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
This commit is contained in:
Vadim Yanitskiy 2021-11-07 22:29:11 +03:00
parent d260020aa6
commit cc7bdbe62e
1 changed files with 30 additions and 1 deletions

View File

@ -268,6 +268,8 @@ static int nwl_sig_cb(unsigned int subsys, unsigned int signal,
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 @@ static int print_attr_rep(struct msgb *mb)
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 @@ static void bootstrap_om(struct gsm_bts_trx *trx)
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);