fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41764?usp=email )
Change subject: s1gw: add MME pool related REST definitions ......................................................................
s1gw: add MME pool related REST definitions
Change-Id: I76f1a5cf41331d021c08fbefdf78e34da4ac2121 Related: osmo-s1gw.git Iad249aed99face9e35fd19e0596cf2364ade4c77 Related: SYS#7052, SYS#7066 --- M s1gw/S1GW_REST_Functions.ttcn M s1gw/S1GW_REST_Types.ttcn 2 files changed, 56 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/64/41764/1
diff --git a/s1gw/S1GW_REST_Functions.ttcn b/s1gw/S1GW_REST_Functions.ttcn index fb8731b..454d77e 100644 --- a/s1gw/S1GW_REST_Functions.ttcn +++ b/s1gw/S1GW_REST_Functions.ttcn @@ -53,6 +53,37 @@ return dec_OperationResult(char2oct(rsp.response.body)); }
+/* Get a list of MMEs in the pool */ +function f_REST_MmeList() +runs on http_CT return MmeList { + var HTTPMessage rsp := f_http_transact("/mme-list", method := "GET"); + return dec_MmeList(char2oct(rsp.response.body)); +} + +/* Add an MME to the pool */ +function f_REST_MmeAdd(MmeItem mme_item) +runs on http_CT return boolean { + var HTTPMessage rsp := f_http_transact("/mme-list", method := "POST", + binary_body := enc_MmeItem(mme_item)); + return rsp.response.statuscode == 201; +} + +/* Get information about a specific MME */ +function f_REST_MmeInfo(ParamMmeId mme_id) +runs on http_CT return MmeItem { + var charstring p_mme_id := enc_ParamMmeId(mme_id); + var HTTPMessage rsp := f_http_transact("/mme/" & p_mme_id, method := "GET"); + return dec_MmeItem(char2oct(rsp.response.body)); +} + +/* Delete an MME from the pool */ +function f_REST_MmeDelete(ParamMmeId mme_id) +runs on http_CT return boolean { + var charstring p_mme_id := enc_ParamMmeId(mme_id); + var HTTPMessage rsp := f_http_transact("/mme/" & p_mme_id, method := "DELETE"); + return rsp.response.statuscode == 200; +} + /* Get a list of eNB connections */ function f_REST_EnbList() runs on http_CT return EnbList { diff --git a/s1gw/S1GW_REST_Types.ttcn b/s1gw/S1GW_REST_Types.ttcn index e76f33e..f182ae9 100644 --- a/s1gw/S1GW_REST_Types.ttcn +++ b/s1gw/S1GW_REST_Types.ttcn @@ -21,6 +21,11 @@ type integer TEID (0..4294967295); type integer Port (0..65535);
+type union ParamMmeId { + charstring name (pattern "name:*"), + charstring addr (pattern "addr:[0-9a-f:.]+-[0-9]+") +} with { encode "TEXT" }; + type union ParamEnbId { charstring handle (pattern "handle:[0-9]+"), charstring pid (pattern "pid:[0-9]+.[0-9]+.[0-9]+"), @@ -69,6 +74,17 @@ connected };
+type set of MmeItem MmeList; +type set MmeItem { + charstring name, /* Unique, human-readable identifier */ + charstring laddr optional, /* Local (bind) IP address (default: any) */ + charstring raddr, /* Remote (connect) IP address */ + Port rport optional, /* Remote port (default: 36412) */ + TacList tac_list optional /* List of allowed TACs (empty means allow-all) */ +}; + +type record of integer TacList; + type set of EnbItem EnbList; type set EnbItem { EnbHandle handle, /* Unique number in the eNB registry */ @@ -112,17 +128,26 @@ charstring tla /* GTP-U TLA (Transport Layer Address) */ };
+external function enc_ParamMmeId(in ParamMmeId mme_id) return charstring + with { extension "prototype(convert) encode(TEXT)" } external function enc_ParamEnbId(in ParamEnbId enb_id) return charstring with { extension "prototype(convert) encode(TEXT)" } external function enc_ParamErabId(in ParamErabId erab_id) return charstring with { extension "prototype(convert) encode(TEXT)" }
+external function enc_MmeItem(in MmeItem mme_item) return octetstring + with { extension "prototype(convert) encode(JSON)" } + external function dec_OperationResult(in octetstring data) return OperationResult with { extension "prototype(convert) decode(JSON)" } external function dec_MetricsList(in octetstring data) return MetricsList with { extension "prototype(convert) decode(JSON)" } external function dec_PfcpAssocInfo(in octetstring data) return PfcpAssocInfo with { extension "prototype(convert) decode(JSON)" } +external function dec_MmeList(in octetstring data) return MmeList + with { extension "prototype(convert) decode(JSON)" } +external function dec_MmeItem(in octetstring data) return MmeItem + with { extension "prototype(convert) decode(JSON)" } external function dec_EnbList(in octetstring data) return EnbList with { extension "prototype(convert) decode(JSON)" } external function dec_EnbItem(in octetstring data) return EnbItem