laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38062?usp=email )
Change subject: s1gw: derive functions from f_TC_e_rab_setup() ...................................................................... s1gw: derive functions from f_TC_e_rab_setup() ... to avoid code duplication when adding more E-RAB related TCs. While at it, allow establishing multiple E-RABs. Change-Id: I1bff371da6337ecd7710219d1c86f0fff82ad17f --- M s1gw/S1GW_ConnHdlr.ttcn M s1gw/S1GW_Tests.ttcn 2 files changed, 124 insertions(+), 50 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index d90609d..7737676 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -281,4 +281,117 @@ f_pfcp_handle_assoc_setup_req(); } } + +/* 256 is maxnoofE-RABs (see S1AP_Constants.asn) */ +type record length(1..256) of ERab ERabList; +type record ERab { + E_RAB_ID erab_id, /* ::= INTEGER (0..15, ...) */ + ERabParams u2c, /* UPF -> Core params */ + ERabParams c2u, /* Core -> UPF params */ + ERabParams a2u, /* Access -> UPF params */ + ERabParams u2a /* UPF -> Access params */ +}; + +type record ERabParams { + GTP_TEID teid, /* ::= OCTET STRING (SIZE (4)) */ + charstring tla /* Transport Layer Address */ +}; + +private const MME_UE_S1AP_ID c_MME_UE_ID := 4242; + +function f_ConnHdlr_tx_erab_setup_req(in ERabList erabs, + MME_UE_S1AP_ID mme_ue_id := c_MME_UE_ID) +runs on ConnHdlr { + var template (value) E_RABToBeSetupListBearerSUReq items; + var template (value) E_RABLevelQoSParameters qos_params; + var ENB_UE_S1AP_ID enb_ue_id := g_pars.idx; + + qos_params := valueof(ts_E_RABLevelQoSParameters); + + for (var integer i := 0; i < lengthof(erabs); i := i + 1) { + var template (value) E_RABToBeSetupItemBearerSUReq item; + var template (value) TransportLayerAddress tla; + var ERabParams epars := erabs[i].u2c; + + tla := oct2bit(f_inet_addr(epars.tla)); + item := ts_S1AP_RABToBeSetupItemBearerSUReq(rab_id := erabs[i].erab_id, + qos_params := qos_params, + tla := tla, + gtp_teid := epars.teid, + nas_pdu := ''O); + items[i] := ts_S1AP_RABToBeSetupListBearerSUReq(item)[0]; + } + + f_ConnHdlr_tx_s1ap_from_mme(ts_S1AP_RABSetupReq(mme_ue_id, enb_ue_id, items)); +} + +function f_ConnHdlr_rx_erab_setup_req(in ERabList erabs, + MME_UE_S1AP_ID mme_ue_id := c_MME_UE_ID) +runs on ConnHdlr return S1AP_PDU { + var template (present) E_RABToBeSetupListBearerSUReq items; + var ENB_UE_S1AP_ID enb_ue_id := g_pars.idx; + var S1AP_PDU pdu; + + for (var integer i := 0; i < lengthof(erabs); i := i + 1) { + var template (present) E_RABToBeSetupItemBearerSUReq item; + var template (present) TransportLayerAddress tla; + var ERabParams epars := erabs[i].a2u; + + tla := oct2bit(f_inet_addr(epars.tla)); + item := tr_S1AP_RABToBeSetupItemBearerSUReq(rab_id := erabs[i].erab_id, + qos_params := ?, + tla := tla, + gtp_teid := epars.teid, + nas_pdu := ''O); + items[i] := tr_S1AP_RABToBeSetupListBearerSUReq(item)[0]; + } + + f_ConnHdlr_rx_s1ap_from_mme(pdu, tr_S1AP_RABSetupReq(mme_ue_id, enb_ue_id, items)); + return pdu; +} + +function f_ConnHdlr_tx_erab_setup_rsp(in ERabList erabs, + MME_UE_S1AP_ID mme_ue_id := c_MME_UE_ID) +runs on ConnHdlr { + var template (value) E_RABSetupListBearerSURes items; + var ENB_UE_S1AP_ID enb_ue_id := g_pars.idx; + + for (var integer i := 0; i < lengthof(erabs); i := i + 1) { + var template (value) E_RABSetupItemBearerSURes item; + var template (value) TransportLayerAddress tla; + var ERabParams epars := erabs[i].u2a; + + tla := oct2bit(f_inet_addr(epars.tla)); + item := ts_S1AP_RABSetupItemBearerSURes(rab_id := erabs[i].erab_id, + tla := tla, + gtp_teid := epars.teid); + items[i] := ts_S1AP_RABSetupListBearerSURes(item)[0]; + } + + f_ConnHdlr_tx_s1ap_from_enb(ts_S1AP_RABSetupRsp(mme_ue_id, enb_ue_id, items)); +} + +function f_ConnHdlr_rx_erab_setup_rsp(in ERabList erabs, + MME_UE_S1AP_ID mme_ue_id := c_MME_UE_ID) +runs on ConnHdlr return S1AP_PDU { + var template (present) E_RABSetupListBearerSURes items; + var ENB_UE_S1AP_ID enb_ue_id := g_pars.idx; + var S1AP_PDU pdu; + + for (var integer i := 0; i < lengthof(erabs); i := i + 1) { + var template (present) E_RABSetupItemBearerSURes item; + var template (present) TransportLayerAddress tla; + var ERabParams epars := erabs[i].c2u; + + tla := oct2bit(f_inet_addr(epars.tla)); + item := tr_S1AP_RABSetupItemBearerSURes(rab_id := erabs[i].erab_id, + tla := tla, + gtp_teid := epars.teid); + items[i] := tr_S1AP_RABSetupListBearerSURes(item)[0]; + } + + f_ConnHdlr_rx_s1ap_from_enb(pdu, tr_S1AP_RABSetupRsp(mme_ue_id, enb_ue_id, items)); + return pdu; +} + } diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn index eb65ce5..1896e30 100644 --- a/s1gw/S1GW_Tests.ttcn +++ b/s1gw/S1GW_Tests.ttcn @@ -250,10 +250,13 @@ } function f_TC_e_rab_setup(charstring id) runs on ConnHdlr { - const integer mme_id := 7; - const integer enb_id := 9; - const integer erab_id := 6; - var S1AP_PDU pdu; + const ERab erab := { + erab_id := 0, + u2c := {'42424242'O, "1.2.3.4"}, + c2u := {'42424242'O, mp_s1gw_mme_ip}, + a2u := {'24242424'O, "4.3.2.1"}, + u2a := {'24242424'O, mp_s1gw_enb_ip} + }; f_ConnHdlr_register_pfcp(); f_ConnHdlr_s1ap_register(g_pars.genb_id); @@ -261,55 +264,13 @@ f_ConnHdlr_s1ap_setup(g_pars.genb_id); log("eNB <- [S1GW] <- MME: E-RAB SETUP REQUEST"); - var template (value) E_RABToBeSetupListBearerSUReq items_req; - var E_RABToBeSetupItemBearerSUReq item_req := { - e_RAB_ID := erab_id, - e_RABlevelQoSParameters := { - qCI := 5, - allocationRetentionPriority := { - priorityLevel := 1, - pre_emptionCapability := shall_not_trigger_pre_emption, - pre_emptionVulnerability := not_pre_emptable, - iE_Extensions := omit - }, - gbrQosInformation := omit, - iE_Extensions := omit - }, - transportLayerAddress := -, - gTP_TEID := f_rnd_octstring(4), - nAS_PDU := ''O, - iE_Extensions := omit - }; - - /* MME -> S1GW */ - item_req.transportLayerAddress := oct2bit(f_inet_addr("1.2.3.4")); - items_req := ts_S1AP_RABToBeSetupListBearerSUReq(item_req); - f_ConnHdlr_tx_s1ap_from_mme(ts_S1AP_RABSetupReq(mme_id, enb_id, items_req)); - - /* S1GW -> eNB */ - item_req.transportLayerAddress := oct2bit(f_inet_addr(mp_s1gw_mme_ip)); - items_req := ts_S1AP_RABToBeSetupListBearerSUReq(item_req); - f_ConnHdlr_rx_s1ap_from_mme(pdu, tr_S1AP_RABSetupReq(mme_id, enb_id, items_req)); + f_ConnHdlr_tx_erab_setup_req({erab}); + f_ConnHdlr_rx_erab_setup_req({erab}); log("eNB -> [S1GW] -> MME: E-RAB SETUP RESPONSE"); - var template (value) E_RABSetupListBearerSURes items_res; - var E_RABSetupItemBearerSURes item_res := { - e_RAB_ID := erab_id, - transportLayerAddress := -, - gTP_TEID := f_rnd_octstring(4), - iE_Extensions := omit - }; - - /* eNB -> S1GW */ - item_res.transportLayerAddress := oct2bit(f_inet_addr("4.3.2.1")); - items_res := ts_S1AP_RABSetupListBearerSURes(item_res); - f_ConnHdlr_tx_s1ap_from_enb(ts_S1AP_RABSetupRsp(mme_id, enb_id, items_res)); - - /* S1GW -> MME */ - item_res.transportLayerAddress := oct2bit(f_inet_addr(mp_s1gw_enb_ip)); - items_res := ts_S1AP_RABSetupListBearerSURes(item_res); - f_ConnHdlr_rx_s1ap_from_enb(pdu, tr_S1AP_RABSetupRsp(mme_id, enb_id, items_res)); + f_ConnHdlr_tx_erab_setup_rsp({erab}); + f_ConnHdlr_rx_erab_setup_rsp({erab}); f_ConnHdlr_s1ap_disconnect(); f_ConnHdlr_s1ap_unregister(g_pars.genb_id); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38062?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I1bff371da6337ecd7710219d1c86f0fff82ad17f Gerrit-Change-Number: 38062 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanits...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: osmith <osm...@sysmocom.de> Gerrit-Reviewer: pespin <pes...@sysmocom.de>