Change in osmo-bsc[master]: ipaccess-config: request and print NM_ATT_IPACC_NV_FLAGS

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Nov 27 23:14:29 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26150 )

Change subject: ipaccess-config: request and print NM_ATT_IPACC_NV_FLAGS
......................................................................

ipaccess-config: request and print NM_ATT_IPACC_NV_FLAGS

Below is an example output:

"""
  Received SIGNAL S_NM_GET_ATTR_REP
  {
      "primary_oml_ip": "192.168.100.100",
      "primary_oml_port": "0",
      "unit_id": "6969/0/0",
      "nv_flags": {
          "static-ip": "no",
          "static-gw": "no",
          "no-dhcp-vsi": "no",
          "dhcp-enabled": "yes",
          "led-enabled": "yes",
          "secondary-oml-enabled": "yes",
          "diag-enabled": "yes",
          "cli-enabled": "yes",
          "http-enabled": "no",
          "post-enabled": "yes",
          "snmp-enabled": "yes"
      }
  }
"""

Change-Id: Ic901910878529e6d8b152b3417463bae60644b82
---
M src/ipaccess/ipaccess-config.c
1 file changed, 30 insertions(+), 1 deletion(-)

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



diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index c06a7cc..06fc9eb 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -268,6 +268,8 @@
 	return 0;
 }
 
+static const struct value_string ipa_nvflag_strs[];
+
 static int print_attr_rep(struct msgb *mb)
 {
 	/* Parse using nanoBTS own formatting for Get Attribute Response */
@@ -303,7 +305,33 @@
 
 	print_field("primary_oml_ip", "%s", oml_ip); ENDL(false);
 	print_field("primary_oml_port", "%u", oml_port); ENDL(false);
-	print_field("unit_id", "%s", unit_id); ENDL(true);
+	print_field("unit_id", "%s", unit_id); ENDL(false);
+
+	uint16_t Fx = (TLVP_VAL(&tp, NM_ATT_IPACC_NV_FLAGS)[2] << 8)
+		    | (TLVP_VAL(&tp, NM_ATT_IPACC_NV_FLAGS)[0] << 0);
+	uint16_t Mx = (TLVP_VAL(&tp, NM_ATT_IPACC_NV_FLAGS)[3] << 8)
+		    | (TLVP_VAL(&tp, NM_ATT_IPACC_NV_FLAGS)[1] << 0);
+	const struct value_string *nvflag = ipa_nvflag_strs;
+
+	print_offset("\"nv_flags\": {\n");
+	indent++;
+
+	while (nvflag->value && nvflag->str) {
+		const char *val = (Fx & nvflag->value) ? "yes" : "no";
+		if (~Mx & nvflag->value)
+			val = "unknown";
+		print_field(nvflag->str, "%s", val);
+
+		nvflag++;
+
+		if (nvflag->value && nvflag->str)
+			ENDL(false); /* more fields to print */
+		else
+			ENDL(true); /* this was the last field */
+	}
+
+	indent--;
+	print_offset("}\n");
 
 	indent--;
 	print_offset("}\n");
@@ -559,6 +587,7 @@
 	if (get_attr) {
 		msgb_put_u8(nmsg_get, NM_ATT_IPACC_PRIM_OML_CFG);
 		msgb_put_u8(nmsg_get, NM_ATT_IPACC_UNIT_ID);
+		msgb_put_u8(nmsg_get, NM_ATT_IPACC_NV_FLAGS);
 	}
 	if (unit_id) {
 		len = strlen(unit_id);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26150
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic901910878529e6d8b152b3417463bae60644b82
Gerrit-Change-Number: 26150
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211127/2acf6d8c/attachment.htm>


More information about the gerrit-log mailing list