Commit 1eefc2e8 authored by wangys20205g's avatar wangys20205g

support test upf pfcp

parent ab5bbfb8
......@@ -93,6 +93,12 @@ SMF =
#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
};
};
......@@ -103,11 +109,12 @@ SMF =
IP_ADDRESS_POOL :
{
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.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.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 = "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 = "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.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 = (
{PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
......
......@@ -208,6 +208,24 @@ int smf_config::load_interface(const Setting& if_cfg, interface_cfg_t & cfg)
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)
{
......@@ -579,6 +597,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 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)));
}
//------------------------------------------------------------------------------
......
......@@ -132,6 +132,12 @@
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#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
namespace smf {
......@@ -146,6 +152,11 @@ typedef struct interface_cfg_s {
util::thread_sched_params thread_rd_sched_params;
} 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 {
util::thread_sched_params itti_timer_sched_params;
util::thread_sched_params sx_sched_params;
......@@ -157,6 +168,7 @@ typedef struct itti_cfg_s {
class smf_config {
private:
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_thread_sched_params(const libconfig::Setting& thread_sched_params_cfg, util::thread_sched_params& cfg);
......@@ -170,6 +182,7 @@ public:
interface_cfg_t n4;
interface_cfg_t n11;
itti_cfg_t itti;
test_upf_cfg_t test_upf_cfg;
struct in_addr default_dnsv4;
struct in_addr default_dns_secv4;
......
......@@ -135,8 +135,29 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_
ppc->generate_far_id(far_id);
apply_action.forw = 1;
destination_interface.interface_value = pfcp::INTERFACE_VALUE_CORE; // ACCESS is for downlink, CORE for uplink
forwarding_parameters.set(destination_interface);
//wys-test-add
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(apply_action);
......@@ -158,7 +179,17 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_
pfcp::application_id_t application_id = {};
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.chid = 1;
......@@ -182,7 +213,12 @@ int session_create_sm_context_procedure::run(std::shared_ptr<itti_n11_create_sm_
create_pdr.set(pdr_id);
create_pdr.set(precedence);
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);
//TODO: list of Usage reporting 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