fixeria has uploaded this change for review. ( 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. Change-Id: I1bff371da6337ecd7710219d1c86f0fff82ad17f --- M s1gw/S1GW_ConnHdlr.ttcn M s1gw/S1GW_Tests.ttcn 2 files changed, 91 insertions(+), 50 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/62/38062/1 diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index c0188db..11d064d 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -286,4 +286,87 @@ f_pfcp_handle_assoc_setup_req(); } } + +type record MmeEnbERabId { + integer mme_id, + integer enb_id, + integer erab_id +}; + +type record of ERabParams ERabParamsList; +type record ERabParams { + GTP_TEID teid, + charstring tla +}; + +function f_ConnHdlr_tx_erab_setup_req(MmeEnbERabId id, ERabParams params) +runs on ConnHdlr { + var template (value) E_RABToBeSetupListBearerSUReq items; + var template (value) E_RABToBeSetupItemBearerSUReq item; + var template (value) E_RABLevelQoSParameters qos_params; + var template (value) TransportLayerAddress tla; + + tla := oct2bit(f_inet_addr(params.tla)); + qos_params := ts_E_RABLevelQoSParameters(qci := 5); + item := ts_S1AP_RABToBeSetupItemBearerSUReq(rab_id := id.erab_id, + qos_params := qos_params, + tla := tla, + gtp_teid := params.teid, + nas_pdu := ''O); + items := ts_S1AP_RABToBeSetupListBearerSUReq(item); + + f_ConnHdlr_tx_s1ap_from_mme(ts_S1AP_RABSetupReq(id.mme_id, id.enb_id, items)); +} + +function f_ConnHdlr_rx_erab_setup_req(MmeEnbERabId id, ERabParams params) +runs on ConnHdlr return S1AP_PDU { + var template (present) E_RABToBeSetupListBearerSUReq items; + var template (present) E_RABToBeSetupItemBearerSUReq item; + var template (present) TransportLayerAddress tla; + var S1AP_PDU pdu; + + tla := oct2bit(f_inet_addr(params.tla)); + item := tr_S1AP_RABToBeSetupItemBearerSUReq(rab_id := id.erab_id, + qos_params := ?, + tla := tla, + gtp_teid := params.teid, + nas_pdu := ''O); + items := tr_S1AP_RABToBeSetupListBearerSUReq(item); + + f_ConnHdlr_rx_s1ap_from_mme(pdu, tr_S1AP_RABSetupReq(id.mme_id, id.enb_id, items)); + return pdu; +} + +function f_ConnHdlr_tx_erab_setup_rsp(MmeEnbERabId id, ERabParams params) +runs on ConnHdlr { + var template (value) E_RABSetupListBearerSURes items; + var template (value) E_RABSetupItemBearerSURes item; + var template (value) TransportLayerAddress tla; + + tla := oct2bit(f_inet_addr(params.tla)); + item := ts_S1AP_RABSetupItemBearerSURes(rab_id := id.erab_id, + tla := tla, + gtp_teid := params.teid); + items := ts_S1AP_RABSetupListBearerSURes(item); + + f_ConnHdlr_tx_s1ap_from_enb(ts_S1AP_RABSetupRsp(id.mme_id, id.enb_id, items)); +} + +function f_ConnHdlr_rx_erab_setup_rsp(MmeEnbERabId id, ERabParams params) +runs on ConnHdlr return S1AP_PDU { + var template (present) E_RABSetupListBearerSURes items; + var template (present) E_RABSetupItemBearerSURes item; + var template (present) TransportLayerAddress tla; + var S1AP_PDU pdu; + + tla := oct2bit(f_inet_addr(params.tla)); + item := tr_S1AP_RABSetupItemBearerSURes(rab_id := id.erab_id, + tla := tla, + gtp_teid := params.teid); + items := tr_S1AP_RABSetupListBearerSURes(item); + + f_ConnHdlr_rx_s1ap_from_enb(pdu, tr_S1AP_RABSetupRsp(id.mme_id, id.enb_id, items)); + return pdu; +} + } diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn index 9e1a27e..35aed5f 100644 --- a/s1gw/S1GW_Tests.ttcn +++ b/s1gw/S1GW_Tests.ttcn @@ -247,10 +247,8 @@ } 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 MmeEnbERabId erab_id := {7, 9, 6}; + var GTP_TEID teid; f_ConnHdlr_register_pfcp(); f_ConnHdlr_s1ap_register(g_pars.genb_id); @@ -258,55 +256,15 @@ 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)); + teid := f_rnd_octstring(4); + f_ConnHdlr_tx_erab_setup_req(erab_id, {teid, "1.2.3.4"}); + f_ConnHdlr_rx_erab_setup_req(erab_id, {teid, mp_s1gw_mme_ip}); 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)); + teid := f_rnd_octstring(4); + f_ConnHdlr_tx_erab_setup_rsp(erab_id, {teid, "4.3.2.1"}); + f_ConnHdlr_rx_erab_setup_rsp(erab_id, {teid, mp_s1gw_enb_ip}); 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: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I1bff371da6337ecd7710219d1c86f0fff82ad17f Gerrit-Change-Number: 38062 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanits...@sysmocom.de>