Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AUSF
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-AUSF
Commits
6fa4b341
Commit
6fa4b341
authored
May 17, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update config
parent
9abbc6e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
156 additions
and
40 deletions
+156
-40
etc/ausf.conf
etc/ausf.conf
+19
-14
src/api_server/impl/DefaultApiImpl.cpp
src/api_server/impl/DefaultApiImpl.cpp
+6
-6
src/ausf_app/ausf_config.cpp
src/ausf_app/ausf_config.cpp
+104
-15
src/ausf_app/ausf_config.hpp
src/ausf_app/ausf_config.hpp
+27
-5
No files found.
etc/ausf.conf
View file @
6fa4b341
...
...
@@ -10,24 +10,29 @@ AUSF =
#STATISTICS_TIMER_INTERVAL = 20; #second
INTERFACES
:{
SBI_AUSF
:{
INTERFACE_NAME
=
"wlo1"
;
#interface for providing ausf service
IPV4_ADDRESS
=
"192.168.1.23/24"
;
#"192.168.61.141/24"; #address for intercafe (cidr)
PORT
=
8383
;
#ausf service port
# AUSF binded interface for SBI interface (e.g., communication with AMF, UDM)
SBI_AUSF
:{
INTERFACE_NAME
=
"eth0"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
8383
;
# YOUR NETWORK CONFIG HERE (default: 80)
PPID
=
60
;
};
NUDM
:{
INTERFACE_NAME
=
"wlo1"
;
#interface for providing udm service
IPV4_ADDRESS
=
"192.168.1.23/24"
;
#address for intercafe (cidr)
PORT
=
8181
;
#udm service port
#PPID = 60;
};
# UDM Information
UDM
:{
IPV4_ADDRESS
=
"192.168.1.23/24"
;
# YOUR NETWORK CONFIG HERE
PORT
=
80
;
# YOUR NETWORK CONFIG HERE (default: 80)
API_VERSION
=
"v1"
;
# YOUR AMF API VERSION FOR UDM CONFIG HERE
};
NAMF
:{
INTERFACE_NAME
=
"wlo1"
;
#interface for request for amf service
IPV4_ADDRESS
=
"192.168.1.23/24"
;
#amf address (cidr)
PORT
=
8383
;
#amf port
# AMF Information
AMF
:{
IPV4_ADDRESS
=
"192.168.1.23/24"
;
# YOUR NETWORK CONFIG HERE (default: 80)
PORT
=
80
;
# YOUR NETWORK CONFIG HERE (default: 80)
API_VERSION
=
"v1"
;
# YOUR AMF API VERSION FOR UDM CONFIG HERE
};
};
};
...
...
src/api_server/impl/DefaultApiImpl.cpp
View file @
6fa4b341
...
...
@@ -192,9 +192,9 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
// 6. send authResult to udm
// UDM POST interface ----- send authentication result
// info--------------------
std
::
string
udm_ip
=
std
::
string
(
inet_ntoa
(
*
(
(
struct
in_addr
*
)
&
ausf_cfg
.
nudm
.
addr4
)));
// need to change to nudm
std
::
string
udm_port
=
std
::
to_string
(
ausf_cfg
.
nudm
.
port
);
std
::
string
udm_ip
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
ausf_cfg
.
udm_addr
.
ipv4_addr
)));
std
::
string
udm_port
=
std
::
to_string
(
ausf_cfg
.
udm_addr
.
port
);
std
::
string
udmUri
;
std
::
string
Method
;
std
::
string
Response
;
...
...
@@ -269,9 +269,9 @@ void DefaultApiImpl::ue_authentications_post(
// 5g he av from udm
// UDM GET interface ----- get authentication related info--------------------
std
::
string
udm_ip
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
ausf_cfg
.
nudm
.
addr4
)));
// need to change to nudm
std
::
string
udm_port
=
std
::
to_string
(
ausf_cfg
.
nudm
.
port
);
std
::
string
udm_ip
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
ausf_cfg
.
udm_addr
.
ipv4_addr
)));
std
::
string
udm_port
=
std
::
to_string
(
ausf_cfg
.
udm_addr
.
port
);
std
::
string
udmUri
;
std
::
string
Method
;
std
::
string
Response
;
...
...
src/ausf_app/ausf_config.cpp
View file @
6fa4b341
...
...
@@ -35,13 +35,27 @@
#include "logger.hpp"
#include "if.hpp"
extern
"C"
{
#include "string.hpp"
// C includes
#include <arpa/inet.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
extern
"C"
{
//#include <arpa/inet.h>
//#include <stdbool.h>
//#include <stdlib.h>
//#include <string.h>
//#include <sys/types.h>
//#include <unistd.h>
#include "common_defs.h"
}
...
...
@@ -51,6 +65,9 @@ namespace config {
//------------------------------------------------------------------------------
ausf_config
::
ausf_config
()
{
udm_addr
.
ipv4_addr
.
s_addr
=
INADDR_ANY
;
udm_addr
.
port
=
80
;
udm_addr
.
api_version
=
"v1"
;
// TODO:
}
...
...
@@ -100,7 +117,7 @@ int ausf_config::load(const std::string& config_file) {
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
ausf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_AUSF_NAME
,
AUSF_N
ame
);
ausf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_AUSF_NAME
,
ausf_n
ame
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
config
().
error
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
...
...
@@ -112,17 +129,71 @@ int ausf_config::load(const std::string& config_file) {
new_if_cfg
[
AUSF_CONFIG_STRING_INTERFACE_SBI_AUSF
];
load_interface
(
sbi_ausf_cfg
,
sbi
);
const
Setting
&
nudm_cfg
=
new_if_cfg
[
AUSF_CONFIG_STRING_INTERFACE_NUDM
];
load_interface
(
nudm_cfg
,
nudm
);
//
const Setting& nudm_cfg = new_if_cfg[AUSF_CONFIG_STRING_INTERFACE_NUDM];
//
load_interface(nudm_cfg, nudm);
const
Setting
&
namf_cfg
=
new_if_cfg
[
AUSF_CONFIG_STRING_INTERFACE_NAMF
];
load_interface
(
namf_cfg
,
namf
);
//
const Setting& namf_cfg = new_if_cfg[AUSF_CONFIG_STRING_INTERFACE_NAMF];
//
load_interface(namf_cfg, namf);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
config
().
error
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
return
-
1
;
}
try
{
std
::
string
astring
;
// UDM
const
Setting
&
udm_cfg
=
ausf_cfg
[
AUSF_CONFIG_STRING_UDM
];
struct
in_addr
udm_ipv4_addr
;
unsigned
int
udm_port
=
0
;
std
::
string
udm_api_version
;
udm_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_UDM_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
udm_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR UDM !"
);
udm_addr
.
ipv4_addr
=
udm_ipv4_addr
;
if
(
!
(
udm_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_UDM_PORT
,
udm_port
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_UDM_PORT
"failed"
);
throw
(
AUSF_CONFIG_STRING_UDM_PORT
"failed"
);
}
udm_addr
.
port
=
udm_port
;
if
(
!
(
udm_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_API_VERSION
,
udm_api_version
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
}
udm_addr
.
api_version
=
udm_api_version
;
// AMF
const
Setting
&
amf_cfg
=
ausf_cfg
[
AUSF_CONFIG_STRING_AMF
];
struct
in_addr
amf_ipv4_addr
;
unsigned
int
amf_port
=
0
;
std
::
string
amf_api_version
;
amf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_AMF_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
amf_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR AMF !"
);
amf_addr
.
ipv4_addr
=
amf_ipv4_addr
;
if
(
!
(
amf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_AMF_PORT
,
amf_port
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_AMF_PORT
"failed"
);
throw
(
AUSF_CONFIG_STRING_AMF_PORT
"failed"
);
}
amf_addr
.
port
=
amf_port
;
if
(
!
(
amf_cfg
.
lookupValue
(
AUSF_CONFIG_STRING_API_VERSION
,
amf_api_version
)))
{
Logger
::
ausf_app
().
error
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
AUSF_CONFIG_STRING_API_VERSION
"failed"
);
}
amf_addr
.
api_version
=
amf_api_version
;
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
ausf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
}
}
//------------------------------------------------------------------------------
...
...
@@ -137,24 +208,42 @@ void ausf_config::display() {
pid_dir
.
c_str
());
Logger
::
config
().
info
(
"- AUSF NAME............................................: %s"
,
AUSF_N
ame
.
c_str
());
ausf_n
ame
.
c_str
());
Logger
::
config
().
info
(
"- SBI Networking:"
);
Logger
::
config
().
info
(
" iface ................: %s"
,
sbi
.
if_name
.
c_str
());
Logger
::
config
().
info
(
" ip ...................: %s"
,
inet_ntoa
(
sbi
.
addr4
));
Logger
::
config
().
info
(
" port .................: %d"
,
sbi
.
port
);
Logger
::
config
().
info
(
"- Nudm Networking:"
);
Logger
::
config
().
info
(
" iface ................: %s"
,
nudm
.
if_name
.
c_str
());
// Logger::config().info("- Nudm Networking:");
// Logger::config().info(" iface ................: %s",
// nudm.if_name.c_str());
// Logger::config().info(
// " ip ...................: %s", inet_ntoa(udm_addr.addr4));
// Logger::config().info(" port .................: %d", udm_addr.port);
Logger
::
config
().
info
(
"- UDM:"
);
Logger
::
config
().
info
(
" IPv4 Addr ...........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udm_addr
.
ipv4_addr
)));
Logger
::
config
().
info
(
" Port ................: %lu "
,
udm_addr
.
port
);
Logger
::
config
().
info
(
" ip ...................: %s"
,
inet_ntoa
(
nudm
.
addr4
));
Logger
::
config
().
info
(
" port .................: %d"
,
nudm
.
port
);
" API version .........: %s"
,
udm_addr
.
api_version
.
c_str
());
Logger
::
config
().
info
(
"- Namf Networking:"
);
Logger
::
config
().
info
(
" iface ................: %s"
,
namf
.
if_name
.
c_str
());
/* Logger::config().info("- Namf Networking:");
Logger::config().info(" iface ................: %s",
namf.if_name.c_str()); Logger::config().info( " ip ...................:
%s", inet_ntoa(namf.addr4)); Logger::config().info(" port
.................: %d", namf.port);
*/
Logger
::
config
().
info
(
"- AMF:"
);
Logger
::
config
().
info
(
" IPv4 Addr ...........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_addr
.
ipv4_addr
)));
Logger
::
config
().
info
(
" Port ................: %lu "
,
amf_addr
.
port
);
Logger
::
config
().
info
(
" ip ...................: %s"
,
inet_ntoa
(
namf
.
addr4
));
Logger
::
config
().
info
(
" port .................: %d"
,
namf
.
port
);
" API version .........: %s"
,
amf_addr
.
api_version
.
c_str
());
}
//------------------------------------------------------------------------------
...
...
src/ausf_app/ausf_config.hpp
View file @
6fa4b341
...
...
@@ -50,12 +50,23 @@
#define AUSF_CONFIG_STRING_INTERFACES "INTERFACES"
#define AUSF_CONFIG_STRING_INTERFACE_SBI_AUSF "SBI_AUSF"
#define AUSF_CONFIG_STRING_INTERFACE_NUDM "NUDM"
#define AUSF_CONFIG_STRING_INTERFACE_NAMF "NAMF"
//#define AUSF_CONFIG_STRING_INTERFACE_NUDM "NUDM"
//#define AUSF_CONFIG_STRING_INTERFACE_NAMF "NAMF"
#define AUSF_CONFIG_STRING_INTERFACE_NAME "INTERFACE_NAME"
#define AUSF_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define AUSF_CONFIG_STRING_PORT "PORT"
#define AUSF_CONFIG_STRING_PPID "PPID"
#define AUSF_CONFIG_STRING_API_VERSION "API_VERSION"
#define AUSF_CONFIG_STRING_UDM "UDM"
#define AUSF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define AUSF_CONFIG_STRING_UDM_PORT "PORT"
#define AUSF_CONFIG_STRING_AMF "AMF"
#define AUSF_CONFIG_STRING_AMF_IPV4_ADDRESS "IPV4_ADDRESS"
#define AUSF_CONFIG_STRING_AMF_PORT "PORT"
using
namespace
libconfig
;
...
...
@@ -80,11 +91,22 @@ class ausf_config {
unsigned
int
instance
;
std
::
string
pid_dir
;
std
::
string
AUSF_N
ame
;
std
::
string
ausf_n
ame
;
interface_cfg_t
sbi
;
interface_cfg_t
nudm
;
interface_cfg_t
namf
;
// interface_cfg_t nudm;
// interface_cfg_t namf;
struct
{
struct
in_addr
ipv4_addr
;
unsigned
int
port
;
std
::
string
api_version
;
}
udm_addr
;
struct
{
struct
in_addr
ipv4_addr
;
unsigned
int
port
;
std
::
string
api_version
;
}
amf_addr
;
}
;
}
// namespace config
...
...
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