Commit d5b39aa1 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent a952bfac
...@@ -39,7 +39,7 @@ Based on document **3GPP TS 23.501 v16.0.0 §6.2.2**. ...@@ -39,7 +39,7 @@ Based on document **3GPP TS 23.501 v16.0.0 §6.2.2**.
| **ID** | **Classification** | **Status** | **Comments** | | **ID** | **Classification** | **Status** | **Comments** |
| ------ | ------------------------------------------------------------------- | ------------------ | ------------------------------------------- | | ------ | ------------------------------------------------------------------- | ------------------ | ------------------------------------------- |
| 1 | Session Management (Session Establishment/Modification/Release) | :heavy_check_mark: | | | 1 | Session Management (Session Establishment/Modification/Release) | :heavy_check_mark: | |
| 2 | UE IP address allocation & management​ | :heavy_check_mark: | Only support static ipv4 address allocation | | 2 | UE IP address allocation & management​ | :heavy_check_mark: | IP Address pool is controlled by SMF |
| 3 | DHCPv4 (server and client) and DHCPv6 (server and client) function | :x: | | | 3 | DHCPv4 (server and client) and DHCPv6 (server and client) function | :x: | |
| 4 | Respond to ARP requests and/or IPv6 Neighbour Solicitation requests | :x: | | | 4 | Respond to ARP requests and/or IPv6 Neighbour Solicitation requests | :x: | |
| 5 | Selection of UPF function​ | :heavy_check_mark: | Local configuration in SMF | | 5 | Selection of UPF function​ | :heavy_check_mark: | Local configuration in SMF |
......
...@@ -74,194 +74,6 @@ ...@@ -74,194 +74,6 @@
#define APPEND_3GPPNETWORK append("3gppnetwork.org") #define APPEND_3GPPNETWORK append("3gppnetwork.org")
namespace EPC { namespace EPC {
enum AppServiceEnum {
x_3gpp_unknown,
x_3gpp_pgw,
x_3gpp_sgw,
x_3gpp_ggsn,
x_3gpp_sgsn,
x_3gpp_mme,
x_3gpp_msc
};
enum AppProtocolEnum {
x_unknown,
x_gn,
x_gp,
x_nq,
x_nqprime,
x_s10,
x_s11,
x_s12,
x_s1_mme,
x_s1_u,
x_s16,
x_s2a_gtp,
x_s2a_mipv4,
x_s2a_pmip,
x_s2b_gtp,
x_s2b_pmip,
x_s2c_dsmip,
x_s3,
x_s4,
x_s5_gtp,
x_s5_pmip,
x_s6a,
x_s8_gtp,
x_s8_pmip,
x_sv
};
enum PGWAppProtocolEnum {
pgw_x_gn,
pgw_x_gp,
pgw_x_s2a_gtp,
pgw_x_s2a_mipv4,
pgw_x_s2a_pmip,
pgw_x_s2b_gtp,
pgw_x_s2b_pmip,
pgw_x_s2c_dsmip,
pgw_x_s5_gtp,
pgw_x_s5_pmip,
pgw_x_s8_gtp,
pgw_x_s8_pmip
};
enum SGWAppProtocolEnum {
sgw_x_s11,
sgw_x_s12,
sgw_x_s1_u,
sgw_x_s2a_pmip,
sgw_x_s2b_pmip,
sgw_x_s4,
sgw_x_s5_gtp,
sgw_x_s5_pmip,
sgw_x_s8_gtp,
sgw_x_s8_pmip
};
enum GGSNAppProtocolEnum {
ggsn_x_gn,
ggsn_x_gp
};
enum SGSNAppProtocolEnum {
sgsn_x_gn,
sgsn_x_gp,
sgsn_x_nqprime,
sgsn_x_s16,
sgsn_x_s3,
sgsn_x_s4,
sgsn_x_sv
};
enum MMEAppProtocolEnum {
mme_x_gn,
mme_x_gp,
mme_x_nq,
mme_x_s10,
mme_x_s11,
mme_x_s1_mme,
mme_x_s3,
mme_x_s6a,
mme_x_sv
};
enum MSCAppProtocolEnum {
msc_x_sv
};
enum DiameterApplicationEnum {
dia_app_unknown,
/*
+------------------+----------------------------+
| Tag | Diameter Application |
+------------------+----------------------------+
| aaa+ap1 | NASREQ [RFC3588] |
| aaa+ap2 | Mobile IPv4 [RFC4004] |
| aaa+ap3 | Base Accounting [RFC3588] |
| aaa+ap4 | Credit Control [RFC4006] |
| aaa+ap5 | EAP [RFC4072] |
| aaa+ap6 | SIP [RFC4740] |
| aaa+ap7 | Mobile IPv6 IKE [RFC5778] |
| aaa+ap8 | Mobile IPv6 Auth [RFC5778] |
| aaa+ap9 | QoS [RFC5866] |
| aaa+ap4294967295 | Relay [RFC3588] |
+------------------+----------------------------+
*/
dia_app_nasreq,
dia_app_mobile_ipv4,
dia_app_base_accounting,
dia_app_credit_control,
dia_app_eap,
dia_app_sip6,
dia_app_mobile_ipv6_ike,
dia_app_mobile_ipv6_auth,
dia_app_qos,
dia_app_relay,
/*
+----------------+----------------------+
| Tag | Diameter Application |
+----------------+----------------------+
| aaa+ap16777250 | 3GPP STa [TS29.273] |
| aaa+ap16777251 | 3GPP S6a [TS29.272] |
| aaa+ap16777264 | 3GPP SWm [TS29.273] |
| aaa+ap16777267 | 3GPP S9 [TS29.215] |
+----------------+----------------------+
*/
dia_app_3gpp_sta,
dia_app_3gpp_s6a,
dia_app_3gpp_swm,
dia_app_3gpp_s9,
/*
+----------------+--------------------------------------------------+
| Tag | Diameter Application |
+----------------+--------------------------------------------------+
| aaa+ap16777281 | WiMAX Network Access Authentication and |
| | Authorization Diameter Application (WNAAADA) |
| | [WiMAX-BASE] |
| aaa+ap16777282 | WiMAX Network Accounting Diameter Application |
| | (WNADA) [WiMAX-BASE] |
| aaa+ap16777283 | WiMAX MIP4 Diameter Application (WM4DA) |
| | [WiMAX-BASE] |
| aaa+ap16777284 | WiMAX MIP6 Diameter Application (WM6DA) |
| | [WiMAX-BASE] |
| aaa+ap16777285 | WiMAX DHCP Diameter Application (WDDA) |
| | [WiMAX-BASE] |
| aaa+ap16777286 | WiMAX Location Authentication Authorization |
| | Diameter Application (WLAADA) [WiMAX-LBS] |
| aaa+ap16777287 | WiMAX Policy and Charging Control R3 Policies |
| | Diameter Application (WiMAX PCC-R3-P) |
| | [WiMAX-PCC] |
| aaa+ap16777288 | WiMAX Policy and Charging Control R3 Offline |
| | Charging Diameter Application (WiMAX PCC-R3-OFC) |
| | [WiMAX-PCC] |
| aaa+ap16777289 | WiMAX Policy and Charging Control R3 Offline |
| | Charging Prime Diameter Application (WiMAX |
| | PCC-R3-OFC-PRIME) [WiMAX-PCC] |
| aaa+ap16777290 | WiMAX Policy and Charging Control R3 Online |
| | Charging Diameter Application (WiMAX PCC-R3-OC) |
| | [WiMAX-PCC] |
+----------------+--------------------------------------------------+
*/
dia_app_wimax_wnaaada,
dia_app_wimax_wnada,
dia_app_wimax_wm4da,
dia_app_wimax_wm6da,
dia_app_wimax_wdda,
dia_app_wimax_wlaada,
dia_app_wimax_pcc_r3_p,
dia_app_wimax_pcc_r3_ofc,
dia_app_wimax_pcc_r3_ofc_prime,
dia_app_wimax_pcc_r3_oc
};
enum DiameterProtocolEnum {
dia_protocol_unknown,
dia_protocol_tcp,
dia_protocol_sctp,
dia_protocol_tls_tcp
};
class Utility { class Utility {
public: public:
...@@ -343,27 +155,7 @@ class Utility { ...@@ -343,27 +155,7 @@ class Utility {
static std::string dnn(const char *apnoi, const unsigned char *plmnid); static std::string dnn(const char *apnoi, const unsigned char *plmnid);
static std::string dnn_label(const std::string &dnn); static std::string dnn_label(const std::string &dnn);
static AppServiceEnum getAppService(const std::string &s);
static AppProtocolEnum getAppProtocol(const std::string &p);
static const char* getAppService(AppServiceEnum s);
static const char* getAppProtocol(AppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(PGWAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(SGWAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(GGSNAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(SGSNAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(MMEAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(MSCAppProtocolEnum proto);
static std::string diameter_fqdn(const char *mnc, const char *mcc);
static std::string diameter_fqdn(const unsigned char *plmnid);
static uint32_t getDiameterApplication(DiameterApplicationEnum app);
static const char* getDiameterProtocol(DiameterProtocolEnum protocol);
static std::string getDiameterService(DiameterApplicationEnum app,
DiameterProtocolEnum protocol);
private: private:
Utility() { Utility() {
......
...@@ -65,7 +65,6 @@ extern "C" { ...@@ -65,7 +65,6 @@ extern "C" {
using namespace smf; using namespace smf;
#define SYSTEM_CMD_MAX_STR_SIZE 512
extern util::async_shell_cmd *async_shell_cmd_inst; extern util::async_shell_cmd *async_shell_cmd_inst;
extern smf_app *smf_app_inst; extern smf_app *smf_app_inst;
extern smf_config smf_cfg; extern smf_config smf_cfg;
...@@ -559,8 +558,9 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -559,8 +558,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
int decoder_rc = smf_n1_inst.decode_n1_sm_container(decoded_nas_msg, int decoder_rc = smf_n1_inst.decode_n1_sm_container(decoded_nas_msg,
n1_sm_msg); n1_sm_msg);
//Failed to decode, send reply to AMF with PDU Session Establishment Reject
if (decoder_rc != RETURNok) { if (decoder_rc != RETURNok) {
//error, send reply to AMF with PDU Session Establishment Reject
Logger::smf_app().warn("N1 SM container cannot be decoded correctly!"); Logger::smf_app().warn("N1 SM container cannot be decoded correctly!");
problem_details.setCause( problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]); pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]);
...@@ -599,7 +599,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -599,7 +599,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//PDU session type (Optional) //PDU session type (Optional)
if (decoded_nas_msg.plain.sm.header.message_type if (decoded_nas_msg.plain.sm.header.message_type
== PDU_SESSION_ESTABLISHMENT_REQUEST) { == PDU_SESSION_ESTABLISHMENT_REQUEST) {
//TODO: Disable this command temporarily since can't get this info from tester
Logger::smf_app().debug( Logger::smf_app().debug(
"PDU Session Type %d", "PDU Session Type %d",
decoded_nas_msg.plain.sm.pdu_session_establishment_request decoded_nas_msg.plain.sm.pdu_session_establishment_request
...@@ -608,7 +607,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -608,7 +607,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
.pdu_session_establishment_request._pdusessiontype .pdu_session_establishment_request._pdusessiontype
.pdu_session_type_value; .pdu_session_type_value;
} }
smreq->req.set_pdu_session_type(pdu_session_type.pdu_session_type); smreq->req.set_pdu_session_type(pdu_session_type.pdu_session_type);
//TODO: Support IPv4 only for now //TODO: Support IPv4 only for now
......
...@@ -77,7 +77,6 @@ typedef enum { ...@@ -77,7 +77,6 @@ typedef enum {
} pdu_session_procedure_t; } pdu_session_procedure_t;
class smf_config; class smf_config;
// same namespace
class smf_context_ref { class smf_context_ref {
public: public:
......
...@@ -1182,7 +1182,6 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1182,7 +1182,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
std::shared_ptr<itti_n11_create_sm_context_response>(sm_context_resp); std::shared_ptr<itti_n11_create_sm_context_response>(sm_context_resp);
sm_context_resp->http_version = smreq->http_version; sm_context_resp->http_version = smreq->http_version;
sm_context_resp->res.set_http_code( sm_context_resp->res.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_200_OK); //default status code http_status_code_e::HTTP_STATUS_CODE_200_OK); //default status code
sm_context_resp->res.set_supi(supi); sm_context_resp->res.set_supi(supi);
...@@ -1246,6 +1245,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1246,6 +1245,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
//For the moment, SMF uses the local policy (e.g., default QoS rule) //For the moment, SMF uses the local policy (e.g., default QoS rule)
//address allocation based on PDN type //address allocation based on PDN type
//IP Address pool is controlled by SMF
//Step 6. paa //Step 6. paa
bool set_paa = false; bool set_paa = false;
paa_t paa = { }; paa_t paa = { };
...@@ -1267,7 +1267,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1267,7 +1267,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
//smf_app_inst->process_pco_request(extended_protocol_options, pco_resp, pco_ids); //smf_app_inst->process_pco_request(extended_protocol_options, pco_resp, pco_ids);
//Step 7. Address allocation based on PDN type //Step 7. Address allocation based on PDN type
Logger::smf_app().debug("UE address allocation"); Logger::smf_app().debug("UE Address Allocation");
switch (sp->pdn_type.pdn_type) { switch (sp->pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4: { case PDN_TYPE_E_IPV4: {
if (!pco_ids.ci_ipv4_address_allocation_via_dhcpv4) { //use SM NAS signalling if (!pco_ids.ci_ipv4_address_allocation_via_dhcpv4) { //use SM NAS signalling
...@@ -1294,6 +1294,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1294,6 +1294,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if (success) { if (success) {
set_paa = true; set_paa = true;
} else { } else {
//TODO:
//cause: ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED; //check for 5G? //cause: ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED; //check for 5G?
} }
// Static IP address allocation // Static IP address allocation
...@@ -1354,11 +1355,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1354,11 +1355,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
sm_context_resp_pending->res.set_paa(paa); //will be used when procedure is running sm_context_resp_pending->res.set_paa(paa); //will be used when procedure is running
sp->set(paa); sp->set(paa);
} else { } else {
// Valid PAA sent in CSR ? //TODO:
//bool paa_res = csreq->gtp_ies.get(paa);
//if ((paa_res) && ( paa.is_ip_assigned())) {
// sp->set(paa);
//}
} }
//Step 5 (4.3.2.2.1 TS 23.502): Trigger SMF APP to send response to SMF-HTTP-API-SERVER //Step 5 (4.3.2.2.1 TS 23.502): Trigger SMF APP to send response to SMF-HTTP-API-SERVER
......
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