Commit 6bb7a6c6 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add N11 interface

parent b67b2482
......@@ -47,10 +47,13 @@ AMF =
NGAP_AMF:{
INTERFACE_NAME = "ens3";
IPV4_ADDRESS = "read";
SCTP_PORT = 38412;
PORT = 38412;
PPID = 60;
};
N11:{
INTERFACE_NAME = "ens3";
IPV4_ADDRESS = "read";
HTTP_PORT = 80;
SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = 1; IPV4_ADDRESS = "192.168.122.168"; PORT = "80"; VERSION = "v2"; SELECTED = "true"},
{SMF_INSTANCE_ID = 2; IPV4_ADDRESS = "10.103.238.21"; PORT = "8181"; VERSION = "v1"; SELECTED = "false"}
......
......@@ -53,6 +53,7 @@ namespace config {
//------------------------------------------------------------------------------
amf_config::amf_config() {
//TODO:
}
//------------------------------------------------------------------------------
......@@ -160,6 +161,7 @@ int amf_config::load(const std::string &config_file) {
const Setting &n2_amf_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_NGAP_AMF];
load_interface(n2_amf_cfg, n2);
const Setting &n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11];
load_interface(n11_cfg, n11);
const Setting &smf_addr_pool = n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
int count = smf_addr_pool.getLength();
for (int i = 0; i < count; i++) {
......@@ -268,6 +270,19 @@ void amf_config::display() {
Logger::config().info("- MYSQL db ...........................................: %s", auth_para.mysql_db.c_str());
Logger::config().info("- operator key .......................................: %s", auth_para.operator_key.c_str());
Logger::config().info("- random .............................................: %s", auth_para.random.c_str());
Logger::config().info("- N2 Networking:");
Logger::config().info(" iface ................: %s", n2.if_name.c_str());
Logger::config().info(" ip ...................: %s", inet_ntoa(n2.addr4));
Logger::config().info(" port .................: %d", n2.port);
Logger::config().info("- N11 Networking:");
Logger::config().info(" iface ................: %s", n11.if_name.c_str());
Logger::config().info(" ip ...................: %s",
inet_ntoa(n11.addr4));
Logger::config().info(" port .................: %d", n11.port);
// Logger::config().info(" HTTP2 port ............: %d", n11_http2_port);
Logger::config().info("- Remote SMF Pool.....................................: ");
for (int i = 0; i < smf_pool.size(); i++) {
std::string selected;
......@@ -308,7 +323,7 @@ int amf_config::load_interface(const libconfig::Setting &if_cfg, interface_cfg_t
}
cfg.network4.s_addr = htons(ntohs(cfg.addr4.s_addr) & 0xFFFFFFFF << (32 - std::stoi(util::trim(words.at(1)))));
}
if_cfg.lookupValue(AMF_CONFIG_STRING_SCTP_PORT, cfg.port);
if_cfg.lookupValue(AMF_CONFIG_STRING_PORT, cfg.port);
try {
const Setting &sched_params_cfg = if_cfg[AMF_CONFIG_STRING_SCHED_PARAMS];
......
......@@ -53,7 +53,7 @@
#define AMF_CONFIG_STRING_INTERFACE_NGAP_AMF "NGAP_AMF"
#define AMF_CONFIG_STRING_INTERFACE_NAME "INTERFACE_NAME"
#define AMF_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define AMF_CONFIG_STRING_SCTP_PORT "SCTP_PORT"
#define AMF_CONFIG_STRING_PORT "PORT"
#define AMF_CONFIG_STRING_PPID "PPID"
#define AMF_CONFIG_STRING_INTERFACE_N11 "N11"
......@@ -171,6 +171,7 @@ class amf_config {
unsigned int instance;
std::string pid_dir;
interface_cfg_t n2;
interface_cfg_t n11;
itti_cfg_t itti;
unsigned int statistics_interval;
std::string AMF_Name;
......
......@@ -64,7 +64,7 @@ if (!Options::parse(argc, argv)) {
amf_app_inst->allRegistredModulesInit(modules);
Logger::amf_app().debug("Initiating AMF server endpoints");
Pistache::Address addr(std::string(inet_ntoa (*((struct in_addr *)&amf_cfg.n2.addr4))) , Pistache::Port(80));
Pistache::Address addr(std::string(inet_ntoa (*((struct in_addr *)&amf_cfg.n11.addr4))) , Pistache::Port(amf_cfg.n11.port));
AMFApiServer amfApiServer(addr, amf_app_inst);
amfApiServer.init(2);
std::thread amf_api_manager(&AMFApiServer::start, amfApiServer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment