Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RISE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RISE
Commits
4c1b7b0d
Commit
4c1b7b0d
authored
Oct 29, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify amf config
parent
092befb5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
24 deletions
+46
-24
etc/plugin.conf
etc/plugin.conf
+6
-5
src/api/PluginApi.cpp
src/api/PluginApi.cpp
+9
-9
src/plugin_app/plugin_app.cpp
src/plugin_app/plugin_app.cpp
+29
-9
src/plugin_app/plugin_config.cpp
src/plugin_app/plugin_config.cpp
+2
-1
No files found.
etc/plugin.conf
View file @
4c1b7b0d
...
@@ -2,27 +2,28 @@
...
@@ -2,27 +2,28 @@
PLUGIN
=
PLUGIN
=
{
{
ALGORITHM
=
"RR"
;
INTERFACES
:
INTERFACES
:
{
{
# PLUGIN binded interface for Nudsf interface
# PLUGIN binded interface for Nudsf interface
NGAP
:
NGAP
:
{
{
INTERFACE_NAME
=
"en
o1
"
;
# YOUR NETWORK CONFIG HERE
INTERFACE_NAME
=
"en
s32
"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
IPV4_ADDRESS
=
"read"
;
PORT
=
38412
;
# YOUR NETWORK CONFIG HERE
PORT
=
38412
;
# YOUR NETWORK CONFIG HERE
PPID
=
60
;
# YOUR NETWORK CONFIG HERE
PPID
=
60
;
# YOUR NETWORK CONFIG HERE
};
};
SBI
:
SBI
:
{
{
INTERFACE_NAME
=
"en
o1
"
;
# YOUR NETWORK CONFIG HERE
INTERFACE_NAME
=
"en
32
"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"
read
"
;
IPV4_ADDRESS
=
"
192.168.2.35
"
;
PORT
=
38414
;
# YOUR NETWORK CONFIG HERE
PORT
=
38414
;
# YOUR NETWORK CONFIG HERE
};
};
NRF
:
NRF
:
{
{
INTERFACE_NAME
=
"NRF"
;
# YOUR NETWORK CONFIG HERE
INTERFACE_NAME
=
"NRF"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"1
0.112.202.24
"
;
#amf地址
IPV4_ADDRESS
=
"1
92.168.2.35
"
;
#amf地址
PORT
=
8282
;
# YOUR NETWORK CONFIG HERE
PORT
=
8282
;
# YOUR NETWORK CONFIG HERE
};
};
};
};
...
...
src/api/PluginApi.cpp
View file @
4c1b7b0d
...
@@ -74,19 +74,19 @@ void PluginApi::algorithm_omf_handler(const Pistache::Rest::Request &request, Pi
...
@@ -74,19 +74,19 @@ void PluginApi::algorithm_omf_handler(const Pistache::Rest::Request &request, Pi
Logger
::
plugin_server
().
debug
(
"ip address : %s"
,
transdata
.
ip_addr
.
c_str
());
Logger
::
plugin_server
().
debug
(
"ip address : %s"
,
transdata
.
ip_addr
.
c_str
());
Logger
::
plugin_server
().
debug
(
"current message queue length : %d"
,
transdata
.
mq_len
);
Logger
::
plugin_server
().
debug
(
"current message queue length : %d"
,
transdata
.
mq_len
);
Logger
::
plugin_server
().
debug
(
"current capbility : %f"
,
transdata
.
cap
);
Logger
::
plugin_server
().
debug
(
"current capbility : %f"
,
transdata
.
cap
);
if
(
!
transdata
.
ip_addr
.
compare
(
"1
0.103.239.116
"
)){
if
(
!
transdata
.
ip_addr
.
compare
(
"1
92.168.2.35
"
)){
msg_len
[
0
]
=
transdata
.
mq_len
;
msg_len
[
0
]
=
transdata
.
mq_len
;
pro_cap
[
0
]
=
(
long
)
transdata
.
cap
;
pro_cap
[
0
]
=
(
long
)
transdata
.
cap
;
isall
[
0
]
=
true
;
isall
[
0
]
=
true
;
Logger
::
plugin_server
().
debug
(
"capability(0) %d"
,
pro_cap
[
0
]);
Logger
::
plugin_server
().
debug
(
"capability(0) %d"
,
pro_cap
[
0
]);
}
}
if
(
!
transdata
.
ip_addr
.
compare
(
"1
0.103.239.114
"
)){
if
(
!
transdata
.
ip_addr
.
compare
(
"1
92.168.2.172
"
)){
msg_len
[
1
]
=
transdata
.
mq_len
;
msg_len
[
1
]
=
transdata
.
mq_len
;
pro_cap
[
1
]
=
(
long
)
transdata
.
cap
;
pro_cap
[
1
]
=
(
long
)
transdata
.
cap
;
isall
[
1
]
=
true
;
isall
[
1
]
=
true
;
Logger
::
plugin_server
().
debug
(
"capability(1) %d"
,
pro_cap
[
1
]);
Logger
::
plugin_server
().
debug
(
"capability(1) %d"
,
pro_cap
[
1
]);
}
}
if
(
!
transdata
.
ip_addr
.
compare
(
"1
0.103.239.112
"
)){
if
(
!
transdata
.
ip_addr
.
compare
(
"1
92.168.2.173
"
)){
msg_len
[
2
]
=
transdata
.
mq_len
;
msg_len
[
2
]
=
transdata
.
mq_len
;
pro_cap
[
2
]
=
(
long
)
transdata
.
cap
;
pro_cap
[
2
]
=
(
long
)
transdata
.
cap
;
isall
[
2
]
=
true
;
isall
[
2
]
=
true
;
...
...
src/plugin_app/plugin_app.cpp
View file @
4c1b7b0d
...
@@ -17,8 +17,8 @@ extern std::string amf_ip;
...
@@ -17,8 +17,8 @@ extern std::string amf_ip;
extern
unsigned
int
amf_port
;
extern
unsigned
int
amf_port
;
extern
std
::
map
<
std
::
string
,
long
>
ip2len
;
extern
std
::
map
<
std
::
string
,
long
>
ip2len
;
ofstream
timestamp_plugin
(
"/home/
xgcore
/plugin_timestamp.txt"
);
ofstream
timestamp_plugin
(
"/home/
share/Unicom-NWDAF/2021-10-28
/plugin_timestamp.txt"
);
string
amf_ip_list
[
15
]
=
{
"1
0.103.239.116"
,
"10.103.239.114"
,
"10.103.239.112"
,
"10.103.238.7
5"
,
"10.103.239.112"
,
"10.103.238.72"
,
"10.103.239.53"
,
"10.103.239.61"
,
"10.103.239.63"
,
"10.103.238.105"
,
"10.103.238.104"
,
"10.103.238.103"
,
"10.103.238.98"
,
"10.103.238.97"
,
"10.103.238.96"
};
string
amf_ip_list
[
15
]
=
{
"1
92.168.2.35"
,
"192.168.2.172"
,
"192.168.2.173"
,
"192.168.2.3
5"
,
"10.103.239.112"
,
"10.103.238.72"
,
"10.103.239.53"
,
"10.103.239.61"
,
"10.103.239.63"
,
"10.103.238.105"
,
"10.103.238.104"
,
"10.103.238.103"
,
"10.103.238.98"
,
"10.103.238.97"
,
"10.103.238.96"
};
int
amf_ports
[
15
]
=
{
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
};
int
amf_ports
[
15
]
=
{
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
,
8282
};
int
weight
[
15
]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
};
int
weight
[
15
]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
};
namespace
amf_application
{
namespace
amf_application
{
...
@@ -47,12 +47,32 @@ static std::size_t callback(
...
@@ -47,12 +47,32 @@ static std::size_t callback(
int
index
=
-
1
;
int
index
=
-
1
;
int
random_index
=
0
;
int
random_index
=
0
;
int
choose
=
0
;
int
choose
=
0
;
int
num_inst
=
4
;
int
num_inst
=
2
;
void
plugin_app
::
handle_receive
(
void
plugin_app
::
handle_receive
(
bstring
payload
,
sctp_assoc_id_t
assoc_id
,
sctp_stream_id_t
stream
,
bstring
payload
,
sctp_assoc_id_t
assoc_id
,
sctp_stream_id_t
stream
,
sctp_stream_id_t
instreams
,
sctp_stream_id_t
outstreams
)
sctp_stream_id_t
instreams
,
sctp_stream_id_t
outstreams
)
{
{
// int num_inst = 1;
//
// auto fp = popen("/home/share/Unicom-NWDAF/2021-10-28/getenv.sh","r");
//
// std::string pathvar = "";
// while (!feof(fp)) {
// pathvar.push_back(std::fgetc(fp));
// }
// pathvar.pop_back();
//
// pclose(fp);
//
// Logger::plugin_sbi().debug("\"AMF_NUMBER\" = %s",pathvar.c_str() );
// int value = atoi(pathvar.c_str());
// if(value)
// {
// num_inst = value;
// }
// Logger::plugin_sbi().debug("\"num_inst\" = %d",num_inst );
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
Logger
::
plugin_sbi
().
debug
(
"Begining at time %ld"
,
start
);
Logger
::
plugin_sbi
().
debug
(
"Begining at time %ld"
,
start
);
timestamp_plugin
<<
"time_stamp "
<<
start
<<
endl
;
timestamp_plugin
<<
"time_stamp "
<<
start
<<
endl
;
...
@@ -102,8 +122,8 @@ void plugin_app::handle_receive(
...
@@ -102,8 +122,8 @@ void plugin_app::handle_receive(
if
(
plugin_cfg
.
is_rr
){
if
(
plugin_cfg
.
is_rr
){
Logger
::
plugin_sbi
().
debug
(
"Algorithm RR "
);
Logger
::
plugin_sbi
().
debug
(
"Algorithm RR "
);
url
=
url
=
"http://"
+
std
::
string
(
amf_ip_list
[
index
%
4
].
c_str
())
+
"http://"
+
std
::
string
(
amf_ip_list
[
index
%
num_inst
].
c_str
())
+
":"
+
std
::
to_string
(
amf_ports
[
index
%
4
])
+
"/namf-comm/v1/plugin_n2/"
+
":"
+
std
::
to_string
(
amf_ports
[
index
%
num_inst
])
+
"/namf-comm/v1/plugin_n2/"
+
to_string
(
assoc_id
)
+
"/"
+
to_string
(
stream
)
;
to_string
(
assoc_id
)
+
"/"
+
to_string
(
stream
)
;
}
}
...
...
src/plugin_app/plugin_config.cpp
View file @
4c1b7b0d
...
@@ -116,10 +116,11 @@ int plugin_config::getip(std::string &ip, std::string &ifname)
...
@@ -116,10 +116,11 @@ int plugin_config::getip(std::string &ip, std::string &ifname)
if
(
ioctl
(
sock
,
SIOCGIFADDR
,
&
ifr
)
<
0
)
if
(
ioctl
(
sock
,
SIOCGIFADDR
,
&
ifr
)
<
0
)
{
{
perror
(
"ioctl"
);
perror
(
"ioctl"
);
return
-
1
;
return
-
1
;
}
}
memcpy
(
&
sin
,
&
ifr
.
ifr_addr
,
sizeof
(
sin
));
memcpy
(
&
sin
,
&
ifr
.
ifr_addr
,
sizeof
(
sin
));
//
printf("ip = %s\n",inet_ntoa(sin.sin_addr));
//
printf("ip = %s\n",inet_ntoa(sin.sin_addr));
//sprintf(ip, "%s", inet_ntoa(sin.sin_addr));
//sprintf(ip, "%s", inet_ntoa(sin.sin_addr));
ip
=
std
::
string
(
inet_ntoa
(
sin
.
sin_addr
));
ip
=
std
::
string
(
inet_ntoa
(
sin
.
sin_addr
));
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment