Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11681


Change subject: abis_nm: Add support to parse some nanoBTS Attribute Response 
attributes
......................................................................

abis_nm: Add support to parse some nanoBTS Attribute Response attributes

Related: OS#3624
Change-Id: I52e9f177c14fec1ec3f5c4ddb244594409008357
---
M src/osmo-bsc/abis_nm.c
1 file changed, 33 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/81/11681/1

diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index eb4bb3f..61820b8 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -527,6 +527,37 @@
        return data + adjust;
 }

+/* Handle 3GPP TS 52.021 §8.11.3 Get Attribute Response (with nanoBTS 
speecific attribute formatting) */
+static int parse_attr_resp_nanobts(struct gsm_bts *bts, struct abis_om_fom_hdr 
*foh, struct tlv_parsed *tp)
+{
+       const uint8_t* data;
+       uint16_t len;
+       uint16_t port;
+       struct in_addr ia = {0};
+       char unit_id[40];
+
+
+       if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_PRIM_OML_CFG_LIST, 7)) {
+               data = TLVP_VAL(tp, NM_ATT_IPACC_PRIM_OML_CFG_LIST);
+               if (NM_ATT_IPACC_PRIM_OML_CFG == *data) {
+                       ia.s_addr = htonl(osmo_load32be(data+1));
+                       port = osmo_load16be(data+5);
+                       LOGPFOH(DNM, LOGL_INFO, foh, "BTS%u Get Attributes 
Response: Primary OML IP is %s:%u\n", bts->nr, inet_ntoa(ia), port);
+               } else {
+                       LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u Get Attributes 
Response: PRIM_OML_CFG_LIST unexpected format: %s\n",
+                            bts->nr, osmo_hexdump(data, TLVP_LEN(tp, 
NM_ATT_IPACC_PRIM_OML_CFG_LIST)));
+               }
+       }
+
+       if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_UNIT_ID, 1)) {
+               data = TLVP_VAL(tp, NM_ATT_IPACC_UNIT_ID);
+               len = TLVP_LEN(tp, NM_ATT_IPACC_UNIT_ID);
+               osmo_strlcpy(unit_id, (char*)data, OSMO_MIN(len, 
sizeof(unit_id)));
+               LOGPFOH(DNM, LOGL_ERROR, foh, "BTS%u Get Attributes Response: 
Unit ID is %s\n", bts->nr, unit_id);
+       }
+       return 0;
+}
+
 /* Handle 3GPP TS 52.021 §9.4.64 Get Attribute Response Info */
 static int parse_attr_resp_info(struct gsm_bts *bts, const struct gsm_bts_trx 
*trx, struct abis_om_fom_hdr *foh, struct tlv_parsed *tp)
 {
@@ -581,6 +612,8 @@
        /* nanoBTS doesn't send Get Attribute Response Info, uses its own 
format */
        if (bts->type != GSM_BTS_TYPE_NANOBTS)
                parse_attr_resp_info(bts, trx, foh, &tp);
+       else
+               parse_attr_resp_nanobts(bts, foh, &tp);


        return 0;

--
To view, visit https://gerrit.osmocom.org/11681
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52e9f177c14fec1ec3f5c4ddb244594409008357
Gerrit-Change-Number: 11681
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <[email protected]>

Reply via email to