pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43882?usp=email ) Change subject: PFCP_Templates: Avoid enum2int() conversion in Src/Dst_Iface ...................................................................... PFCP_Templates: Avoid enum2int() conversion in Src/Dst_Iface The type uses a integer, so better use integer too, otherwise the tr_ template cannot be passed wildcards due to the enum2int() call. Change-Id: I6ed23538660be5ca97df47e66c3b6ab60b39074f --- M library/PFCP_Templates.ttcn M s1gw/S1GW_ConnHdlr.ttcn M smf/SMF_Session_CT.ttcn M upf/UPF_Tests.ttcn 4 files changed, 39 insertions(+), 43 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/82/43882/1 diff --git a/library/PFCP_Templates.ttcn b/library/PFCP_Templates.ttcn index a85b075..ee5497e 100644 --- a/library/PFCP_Templates.ttcn +++ b/library/PFCP_Templates.ttcn @@ -805,26 +805,24 @@ ipv6_address := omit } -type enumerated e_PFCP_Src_Iface { - ACCESS (0), - CORE (1), - SGI_LAN_N6_LAN (2), - CP_FUNCTION (3), - x_5G_VN_INTERNAL (4) -}; +const integer PFCP_Src_Iface_ACCESS := 0; +const integer PFCP_Src_Iface_CORE := 1; +const integer PFCP_Src_Iface_SGI_LAN_N6_LAN := 2; +const integer PFCP_Src_Iface_CP_FUNCTION := 3; +const integer PFCP_Src_Iface_x_5G_VN_INTERNAL := 4; template (value) Source_Interface -ts_PFCP_Src_Iface(e_PFCP_Src_Iface iface) := { +ts_PFCP_Src_Iface(template (value) integer iface) := { elementIdentifier := 20, lengthIndicator := 0, - interfacevalue := enum2int(iface), + interfacevalue := iface, spare := '0000'B } template (present) Source_Interface -tr_PFCP_Src_Iface(e_PFCP_Src_Iface iface) := { +tr_PFCP_Src_Iface(template (present) integer iface := ?) := { elementIdentifier := 20, lengthIndicator := ?, - interfacevalue := enum2int(iface), + interfacevalue := iface, spare := ? } @@ -938,12 +936,12 @@ } template (value) PDI_IE -ts_PFCP_PDI(e_PFCP_Src_Iface src_iface, +ts_PFCP_PDI(template (value) integer src_iface, template (omit) F_TEID local_F_TEID := omit, template (omit) UE_IP_Address ue_addr_v4 := omit, template (omit) Network_Instance network_instance := omit) := { - elementIdentifier := 2, - lengthIndicator := 0, + elementIdentifier := 2, + lengthIndicator := 0, grouped_ie := { source_interface := ts_PFCP_Src_Iface(src_iface), local_F_TEID := local_F_TEID, @@ -958,7 +956,7 @@ } } template (present) PDI_IE -tr_PFCP_PDI(e_PFCP_Src_Iface src_iface, +tr_PFCP_PDI(template (present) integer src_iface := ?, template F_TEID local_F_TEID := *, template UE_IP_Address ue_addr_v4 := *, template Network_Instance network_instance := *, @@ -1050,27 +1048,25 @@ template (value) Apply_Action ts_PFCP_Apply_Action_BUFF := ts_PFCP_Apply_Action(buff := '1'B); template (present) Apply_Action tr_PFCP_Apply_Action_BUFF := tr_PFCP_Apply_Action(buff := '1'B); -type enumerated e_PFCP_Dest_Iface { - ACCESS (0), - CORE (1), - SGI_LAN_N6_LAN (2), - CP_FUNCTION (3), - LI_FUNCTION (4), - x_5G_VN_INTERNAL (5) -}; +const integer PFCP_Dest_Iface_ACCESS := 0; +const integer PFCP_Dest_Iface_CORE := 1; +const integer PFCP_Dest_Iface_SGI_LAN_N6_LAN := 2; +const integer PFCP_Dest_Iface_CP_FUNCTION := 3; +const integer PFCP_Dest_Iface_LI_FUNCTION := 4; +const integer PFCP_Dest_Iface_x_5G_VN_INTERNAL := 5; template (value) Destination_Interface -ts_PFCP_Destination_Interface(e_PFCP_Dest_Iface di) := { +ts_PFCP_Destination_Interface(template (value) integer di) := { elementIdentifier := 42, lengthIndicator := 0, - interface_value := enum2int(di), + interface_value := di, spare := '0000'B } template (present) Destination_Interface -tr_PFCP_Destination_Interface(e_PFCP_Dest_Iface di) := { +tr_PFCP_Destination_Interface(template (present) integer di := ?) := { elementIdentifier := 42, lengthIndicator := ?, - interface_value := enum2int(di), + interface_value := di, spare := ? } @@ -1125,7 +1121,7 @@ } template (value) Forwarding_Parameters -ts_PFCP_Forwarding_Parameters(e_PFCP_Dest_Iface dest_iface, +ts_PFCP_Forwarding_Parameters(template (value) integer dest_iface, template (omit) Network_Instance network_instance := omit, template (omit) Redirect_Information redirect_information := omit, template (omit) Outer_Header_Creation ohc := omit, @@ -1149,7 +1145,7 @@ } } template (present) Forwarding_Parameters -tr_PFCP_Forwarding_Parameters(e_PFCP_Dest_Iface dest_iface, +tr_PFCP_Forwarding_Parameters(template (present) integer dest_iface := ?, template Network_Instance network_instance := *, template Redirect_Information redirect_information := *, template Outer_Header_Creation ohc := *, diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index 9c127d8..0cd6e01 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -1094,11 +1094,11 @@ ohr := tr_PFCP_Outer_Header_Removal(GTP_U_UDP_IPV4); pdr1 := tr_PFCP_Create_PDR(pdr_id := 1, /* -- for Core -> Access */ - pdi := tr_PFCP_PDI(CORE), + pdi := tr_PFCP_PDI(PFCP_Src_Iface_CORE), ohr := ohr, far_id := c_PFCP_FAR_ID_C2A); pdr2 := tr_PFCP_Create_PDR(pdr_id := 2, /* -- for Access -> Core */ - pdi := tr_PFCP_PDI(ACCESS), + pdi := tr_PFCP_PDI(PFCP_Src_Iface_ACCESS), ohr := ohr, far_id := c_PFCP_FAR_ID_A2C); diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn index 58ee1c2..162b5f1 100644 --- a/smf/SMF_Session_CT.ttcn +++ b/smf/SMF_Session_CT.ttcn @@ -405,7 +405,7 @@ create_pdr := { *, tr_PFCP_Create_PDR(pdr_id := 4, - pdi := tr_PFCP_PDI(src_iface := ACCESS, + pdi := tr_PFCP_PDI(src_iface := PFCP_Src_Iface_ACCESS, local_F_TEID := tr_PFCP_F_TEID(?, ?, '1'B, '1'B, omit, omit, omit, ?), network_instance := tr_PFCP_Network_Instance(g_pars.apn), sdf_filter_list := { tr_PFCP_SDF_Filter(fd := '1'B, @@ -419,7 +419,7 @@ *, tr_PFCP_Create_FAR(far_id := 3, aa := tr_PFCP_Apply_Action(forw := '1'B), - fp := tr_PFCP_Forwarding_Parameters(dest_iface := CP_FUNCTION, + fp := tr_PFCP_Forwarding_Parameters(dest_iface := PFCP_Dest_Iface_CP_FUNCTION, ohc := tr_PFCP_Outer_Header_Creation_GTP_ipv4(?, f_inet_addr(mp_smf_hostname)))) , * } diff --git a/upf/UPF_Tests.ttcn b/upf/UPF_Tests.ttcn index 159ac83..8212e8a 100644 --- a/upf/UPF_Tests.ttcn +++ b/upf/UPF_Tests.ttcn @@ -601,7 +601,7 @@ ts_PFCP_Create_PDR( pdr_id, ts_PFCP_PDI( - ACCESS, + PFCP_Src_Iface_ACCESS, local_F_TEID := ts_PFCP_F_TEID_choose_v4(), network_instance := ts_PFCP_Network_Instance(src_netinst)), ts_PFCP_Outer_Header_Removal(GTP_U_UDP_IPV4), @@ -632,7 +632,7 @@ ts_PFCP_Create_PDR( pdr_id, ts_PFCP_PDI( - CORE, + PFCP_Src_Iface_CORE, ue_addr_v4 := ts_PFCP_UE_IP_Address_v4(f_inet_addr(ue_addr_v4), is_destination := true) ), far_id := far_id @@ -658,7 +658,7 @@ /* Add to r a rule set that forwards GTP from one tunnel to another, i.e. one direction of a tunmap */ private function f_ruleset_add_GTP_forw(inout PFCP_Ruleset r, integer pdr_id, - e_PFCP_Src_Iface src_iface, + integer src_iface, charstring src_netinst, integer far_id, e_PFCP_Dest_Iface dest_iface, @@ -692,7 +692,7 @@ /* Add to r a DROP rule from src_iface to dest_iface */ private function f_ruleset_add_GTP_drop(inout PFCP_Ruleset r, integer pdr_id, - e_PFCP_Src_Iface src_iface, + integer src_iface, charstring src_netinst, integer far_id, e_PFCP_Dest_Iface dest_iface) { @@ -727,7 +727,7 @@ gtp.core.tunmap.far_id, ts_PFCP_Apply_Action_FORW, valueof(ts_PFCP_Update_Forwarding_Parameters( - ts_PFCP_Destination_Interface(CORE), + ts_PFCP_Destination_Interface(PFCP_Dest_Iface_CORE), ts_PFCP_Outer_Header_Creation_GTP_ipv4(gtp.core.tunmap.teid_r, f_inet_addr(gtp.core.tunmap.gtp_ip_r)) ) @@ -750,7 +750,7 @@ ts_PFCP_Create_PDR( pdr_id, ts_PFCP_PDI( - CP_FUNCTION, + PFCP_Src_Iface_CP_FUNCTION, local_F_TEID := ts_PFCP_F_TEID_choose_v4('17'O)), ts_PFCP_Outer_Header_Removal(GTP_U_UDP_IPV4), far_id @@ -776,7 +776,7 @@ ts_PFCP_Create_PDR( pdr_id, ts_PFCP_PDI( - CP_FUNCTION, + PFCP_Src_Iface_CP_FUNCTION, local_F_TEID := ts_PFCP_F_TEID_choose_v4('2a'O)), far_id := far_id ) @@ -826,7 +826,7 @@ if (core_gtp_known) { f_ruleset_add_GTP_forw(rules, pdr_id := gtp.access.pdr_id, - src_iface := ACCESS, + src_iface := PFCP_Src_Iface_ACCESS, src_netinst := netinst_access, far_id := gtp.core.tunmap.far_id, dest_iface := CORE, @@ -836,7 +836,7 @@ /* The Core remote GTP will follow in a Session Modification, for now set Core->Access to DROP */ f_ruleset_add_GTP_drop(rules, pdr_id := gtp.access.pdr_id, - src_iface := ACCESS, + src_iface := PFCP_Src_Iface_ACCESS, src_netinst := netinst_access, far_id := gtp.core.tunmap.far_id, dest_iface := CORE); @@ -844,7 +844,7 @@ /* Core to Access */ f_ruleset_add_GTP_forw(rules, pdr_id := gtp.core.tunmap.pdr_id, - src_iface := CORE, + src_iface := PFCP_Src_Iface_CORE, src_netinst := netinst_core, far_id := gtp.access.far_id, dest_iface := ACCESS, -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43882?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I6ed23538660be5ca97df47e66c3b6ab60b39074f Gerrit-Change-Number: 43882 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de>