fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42449?usp=email )

Change subject: [REST] Add PLMN/eNB IDs to EnbItem
......................................................................

[REST] Add PLMN/eNB IDs to EnbItem

Change-Id: I79690223a34afea5e6661125ac04f98462dadb03
Related: SYS#7066
---
M contrib/openapi.yaml
M doc/manuals/chapters/rest.adoc
M priv/openapi.json
M src/rest_server.erl
4 files changed, 54 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/contrib/openapi.yaml b/contrib/openapi.yaml
index d1aaba9..9308027 100644
--- a/contrib/openapi.yaml
+++ b/contrib/openapi.yaml
@@ -416,7 +416,24 @@
           type: string
           pattern: '^[0-9]{3}-[0-9]{2,3}-[0-9]+$'
           example: 001-01-1337
-          description: Global-eNB-ID
+          description: Global-eNB-ID (MCC-MNC-eNBId)
+        plmn_id:
+          type: object
+          description: PLMN identifier
+          properties:
+            mcc:
+              type: string
+              pattern: '^[0-9]{3}$'
+              example: '001'
+              description: Mobile Country Code
+            mnc:
+              type: string
+              pattern: '^[0-9]{2,3}$'
+              example: '01'
+              description: Mobile Network Code
+        enb_id:
+          type: integer
+          description: eNB identifier
         enb_saddr:
           type: string
           description: Source (remote) address of the eNB
diff --git a/doc/manuals/chapters/rest.adoc b/doc/manuals/chapters/rest.adoc
index cc74ba1..92b4f7a 100644
--- a/doc/manuals/chapters/rest.adoc
+++ b/doc/manuals/chapters/rest.adoc
@@ -254,6 +254,8 @@
     "handle": 0,
     "pid": "<0.699.0>",
     "genb_id": "001-01-0",
+    "plmn_id": {"mcc": "001", "mnc": "01"},
+    "enb_id": 0,
     "state": "connected",
     "enb_saddr": "192.168.1.10",
     "enb_sport": 56767,
@@ -272,8 +274,10 @@

 `handle`:: Unique integer identifier within the eNB registry.
 `pid`:: Erlang process ID of the `enb_proxy` process.
-`genb_id`:: Global-eNB-ID in MCC-MNC-eNBId format.  Present once the S1
-  Setup procedure has completed.
+`genb_id`:: Global-eNB-ID (MCC-MNC-eNBId) parsed from the S1 Setup Request.
+`plmn_id`:: PLMN identifier as received in the S1 Setup Request, encoded as
+  an object with `mcc` and `mnc` string fields.
+`enb_id`:: eNB identifier (integer) parsed from the S1 Setup Request.
 `state`:: Current proxy state: `wait_s1setup_req`, `connecting`,
   `wait_s1setup_rsp`, or `connected`.
 `enb_saddr` / `enb_sport`:: Source address and port of the eNB's SCTP 
connection.
diff --git a/priv/openapi.json b/priv/openapi.json
index bcec82b..f305739 100644
--- a/priv/openapi.json
+++ b/priv/openapi.json
@@ -616,7 +616,29 @@
                         "type": "string",
                         "pattern": "^[0-9]{3}-[0-9]{2,3}-[0-9]+$",
                         "example": "001-01-1337",
-                        "description": "Global-eNB-ID"
+                        "description": "Global-eNB-ID (MCC-MNC-eNBId)"
+                    },
+                    "plmn_id": {
+                        "type": "object",
+                        "description": "PLMN identifier",
+                        "properties": {
+                            "mcc": {
+                                "type": "string",
+                                "pattern": "^[0-9]{3}$",
+                                "example": "001",
+                                "description": "Mobile Country Code"
+                            },
+                            "mnc": {
+                                "type": "string",
+                                "pattern": "^[0-9]{2,3}$",
+                                "example": "01",
+                                "description": "Mobile Network Code"
+                            }
+                        }
+                    },
+                    "enb_id": {
+                        "type": "integer",
+                        "description": "eNB identifier"
                     },
                     "enb_saddr": {
                         "type": "string",
diff --git a/src/rest_server.erl b/src/rest_server.erl
index 0107427..5913b3b 100644
--- a/src/rest_server.erl
+++ b/src/rest_server.erl
@@ -440,9 +440,13 @@


 -spec enb_item_add_enb_info(map(), enb_registry:enb_info()) -> map().
-enb_item_add_enb_info(M0, #{genb_id_str := GlobalENBId}) ->
-    %% TODO: add enb_id and plmn_id
-    M0#{genb_id => GlobalENBId};
+enb_item_add_enb_info(M0, #{genb_id_str := GlobalENBId,
+                            genb_id := #{plmn_id := {MCC, MNC},
+                                         enb_id := ENBId}}) ->
+    M0#{genb_id => GlobalENBId,
+        plmn_id => #{mcc => MCC, mnc => MNC},
+        enb_id => ENBId
+       };

 enb_item_add_enb_info(M0, _) -> M0.


--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42449?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I79690223a34afea5e6661125ac04f98462dadb03
Gerrit-Change-Number: 42449
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to