Commit 663017d6 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'develop' of https://gitlab.eurecom.fr/oai/oai-cn5g-smf into develop

parents ced83268 1eefc2e8
...@@ -94,6 +94,12 @@ SMF = ...@@ -94,6 +94,12 @@ SMF =
#SCHED_PRIORITY = 95; #SCHED_PRIORITY = 95;
#}; #};
}; };
TEST_UPF :
{
# P-GW binded interface for SX communication
IS_TEST = "0"; # 0: no test,1:test
GNB_IPV4_ADDRESS = "192.168.20.136"; # STRING,gnb_ip
};
}; };
...@@ -104,11 +110,12 @@ SMF = ...@@ -104,11 +110,12 @@ SMF =
IP_ADDRESS_POOL : IP_ADDRESS_POOL :
{ {
IPV4_LIST = ( IPV4_LIST = (
{RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. # {RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. # {RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.169.0.2 - 192.169.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. # {RANGE = "192.169.0.2 - 192.169.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.170.0.2 - 192.170.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. # {RANGE = "192.170.0.2 - 192.170.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.171.0.2 - 192.171.255.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. # {RANGE = "192.171.0.2 - 192.171.255.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "10.0.0.3 - 10.0.0.4";}
); );
IPV6_LIST = ( IPV6_LIST = (
{PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. {PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
......
...@@ -209,6 +209,24 @@ int smf_config::load_interface(const Setting& if_cfg, interface_cfg_t & cfg) ...@@ -209,6 +209,24 @@ int smf_config::load_interface(const Setting& if_cfg, interface_cfg_t & cfg)
return RETURNok; return RETURNok;
} }
//------------------------------------------------------------------------------
int smf_config::load_upf_config(const Setting& if_cfg, test_upf_cfg_t & cfg)
{
std::string is_test = {};
if_cfg.lookupValue(SMF_CONFIG_STRING_TEST_UPF_IS_TEST,is_test);
util::trim(is_test);
if (not boost::iequals(is_test, "none")) {
cfg.is_test = atoi(is_test.c_str());
std::string address = {};
if_cfg.lookupValue(SMF_CONFIG_STRING_TEST_UPF_GNB_IPV4_ADDRESS, address);
util::trim(address);
inet_aton(address.c_str(), &cfg.gnb_addr4);
}
return RETURNok;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int smf_config::load(const string& config_file) int smf_config::load(const string& config_file)
{ {
...@@ -580,6 +598,10 @@ void smf_config::display () ...@@ -580,6 +598,10 @@ void smf_config::display ()
Logger::smf_app().info( " UDM ..........: %s", inet_ntoa (*((struct in_addr *)&udm_addr.ipv4_addr))); Logger::smf_app().info( " UDM ..........: %s", inet_ntoa (*((struct in_addr *)&udm_addr.ipv4_addr)));
Logger::smf_app().info( " UDM Port ..........: %lu ", udm_addr.port); Logger::smf_app().info( " UDM Port ..........: %lu ", udm_addr.port);
Logger::smf_app().info( "- UPF support (test upf)");
Logger::smf_app().info( " UPF is test ..........: %lu ", test_upf_cfg.is_test);
Logger::smf_app().info( " Gnb Address ..........: %s", inet_ntoa (*((struct in_addr *)&test_upf_cfg.gnb_addr4)));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -133,6 +133,12 @@ ...@@ -133,6 +133,12 @@
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS" #define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UDM_PORT "PORT" #define SMF_CONFIG_STRING_UDM_PORT "PORT"
//test_upf
#define SMF_CONFIG_STRING_TEST_UPF "TEST_UPF"
#define SMF_CONFIG_STRING_TEST_UPF_IS_TEST "IS_TEST"
#define SMF_CONFIG_STRING_TEST_UPF_GNB_IPV4_ADDRESS "GNB_IPV4_ADDRESS"
#define PGW_MAX_ALLOCATED_PDN_ADDRESSES 1024 #define PGW_MAX_ALLOCATED_PDN_ADDRESSES 1024
namespace smf { namespace smf {
...@@ -147,6 +153,11 @@ typedef struct interface_cfg_s { ...@@ -147,6 +153,11 @@ typedef struct interface_cfg_s {
util::thread_sched_params thread_rd_sched_params; util::thread_sched_params thread_rd_sched_params;
} interface_cfg_t; } interface_cfg_t;
typedef struct test_upf_cfg_s {
uint8_t is_test;
struct in_addr gnb_addr4;
} test_upf_cfg_t;
typedef struct itti_cfg_s { typedef struct itti_cfg_s {
util::thread_sched_params itti_timer_sched_params; util::thread_sched_params itti_timer_sched_params;
util::thread_sched_params sx_sched_params; util::thread_sched_params sx_sched_params;
...@@ -158,6 +169,7 @@ typedef struct itti_cfg_s { ...@@ -158,6 +169,7 @@ typedef struct itti_cfg_s {
class smf_config { class smf_config {
private: private:
int load_itti(const libconfig::Setting& itti_cfg, itti_cfg_t& cfg); int load_itti(const libconfig::Setting& itti_cfg, itti_cfg_t& cfg);
int load_upf_config(const libconfig::Setting& if_cfg, test_upf_cfg_t & cfg);
int load_interface(const libconfig::Setting& if_cfg, interface_cfg_t& cfg); int load_interface(const libconfig::Setting& if_cfg, interface_cfg_t& cfg);
int load_thread_sched_params(const libconfig::Setting& thread_sched_params_cfg, util::thread_sched_params& cfg); int load_thread_sched_params(const libconfig::Setting& thread_sched_params_cfg, util::thread_sched_params& cfg);
...@@ -171,6 +183,7 @@ public: ...@@ -171,6 +183,7 @@ public:
interface_cfg_t n4; interface_cfg_t n4;
interface_cfg_t n11; interface_cfg_t n11;
itti_cfg_t itti; itti_cfg_t itti;
test_upf_cfg_t test_upf_cfg;
struct in_addr default_dnsv4; struct in_addr default_dnsv4;
struct in_addr default_dns_secv4; struct in_addr default_dns_secv4;
......
...@@ -144,8 +144,29 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_ ...@@ -144,8 +144,29 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_
ppc->generate_far_id(far_id); ppc->generate_far_id(far_id);
apply_action.forw = 1; apply_action.forw = 1;
destination_interface.interface_value = pfcp::INTERFACE_VALUE_CORE; // ACCESS is for downlink, CORE for uplink //wys-test-add
forwarding_parameters.set(destination_interface); pfcp::outer_header_creation_t outer_header_creation = {};
if(smf_cfg.test_upf_cfg.is_test)
{
//wys-test-add
destination_interface.interface_value = pfcp::INTERFACE_VALUE_ACCESS; // ACCESS is for downlink, CORE for uplink
outer_header_creation.teid = 1;
//inet_aton("192.168.20.136", &outer_header_creation.ipv4_address);
outer_header_creation.ipv4_address = smf_cfg.test_upf_cfg.gnb_addr4 ;
//uint16_t port = 4;
//outer_header_creation.port_number = port;
outer_header_creation.outer_header_creation_description = pfcp::OUTER_HEADER_CREATION_GTPU_UDP_IPV4;
forwarding_parameters.set(outer_header_creation);
forwarding_parameters.set(destination_interface);
}
else
{
destination_interface.interface_value = pfcp::INTERFACE_VALUE_CORE; // ACCESS is for downlink, CORE for uplink
forwarding_parameters.set(destination_interface);
}
create_far.set(far_id); create_far.set(far_id);
create_far.set(apply_action); create_far.set(apply_action);
...@@ -167,7 +188,17 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_ ...@@ -167,7 +188,17 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_
pfcp::application_id_t application_id = {}; pfcp::application_id_t application_id = {};
pfcp::qfi_t qfi = {}; pfcp::qfi_t qfi = {};
source_interface.interface_value = pfcp::INTERFACE_VALUE_ACCESS;
//wys-test-aadd
if(smf_cfg.test_upf_cfg.is_test)
{
source_interface.interface_value = pfcp::INTERFACE_VALUE_ACCESS;
}
else
{
source_interface.interface_value = pfcp::INTERFACE_VALUE_ACCESS;
}
local_fteid.ch = 1; local_fteid.ch = 1;
//local_fteid.chid = 1; //local_fteid.chid = 1;
...@@ -191,7 +222,12 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_ ...@@ -191,7 +222,12 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_
create_pdr.set(pdr_id); create_pdr.set(pdr_id);
create_pdr.set(precedence); create_pdr.set(precedence);
create_pdr.set(pdi); create_pdr.set(pdi);
create_pdr.set(outer_header_removal);
//wys-add-test
if(smf_cfg.test_upf_cfg.is_test)
create_pdr.set(outer_header_removal);
//create_pdr.set(outer_header_removal);
create_pdr.set(far_id); create_pdr.set(far_id);
//TODO: list of Usage reporting Rule IDs //TODO: list of Usage reporting Rule IDs
//TODO: list of QoS Enforcement Rule IDs //TODO: list of QoS Enforcement Rule IDs
......
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