bs11_config: show the BPORT0 / BPORT1 configuration in 'query'

This introduces abis_nm_bs11_get_bport_line_cfg() and a parser for the result.
This commit is contained in:
Harald Welte 2010-12-14 12:52:16 +01:00
parent 7e72fa0250
commit f751a10018
3 changed files with 40 additions and 0 deletions

View File

@ -138,6 +138,7 @@ int abis_nm_bs11_get_state(struct gsm_bts *bts);
int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
u_int8_t win_size, int forced, gsm_cbfn *cbfn);
int abis_nm_bs11_set_ext_time(struct gsm_bts *bts);
int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport);
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg);
int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect);
int abis_nm_bs11_restart(struct gsm_bts *bts);

View File

@ -2681,6 +2681,20 @@ int abis_nm_bs11_set_ext_time(struct gsm_bts *bts)
return abis_nm_sendmsg(bts, msg);
}
int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
u_int8_t attr = NM_ATT_BS11_LINE_CFG;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 2+sizeof(attr), NM_MT_GET_ATTR,
NM_OC_BS11_BPORT, bport, 0xff, 0x02);
msgb_tlv_put(msg, NM_ATT_LIST_REQ_ATTR, sizeof(attr), &attr);
return abis_nm_sendmsg(bts, msg);
}
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg)
{
struct abis_om_hdr *oh;

View File

@ -331,6 +331,18 @@ static const char *cclk_acc_name(u_int8_t acc)
}
}
static const char *bport_lcfg_name(u_int8_t lcfg)
{
switch (lcfg) {
case BS11_LINE_CFG_STAR:
return "Star";
case BS11_LINE_CFG_MULTIDROP:
return "Multi-Drop";
default:
return "unknown";
}
}
static const char *obj_name(struct abis_om_fom_hdr *foh)
{
static char retbuf[256];
@ -356,6 +368,10 @@ static const char *obj_name(struct abis_om_fom_hdr *foh)
case NM_OC_SITE_MANAGER:
strcat(retbuf, "SITE MANAGER ");
break;
case NM_OC_BS11_BPORT:
sprintf(retbuf+strlen(retbuf), "BPORT%u ",
foh->obj_inst.bts_nr);
break;
}
return retbuf;
}
@ -441,6 +457,13 @@ static int print_attr(struct tlv_parsed *tp)
const u_int8_t *acc = TLVP_VAL(tp, NM_ATT_BS11_CCLK_TYPE);
printf("\tCCLK Type=%d\n", *acc);
}
if (TLVP_PRESENT(tp, NM_ATT_BS11_LINE_CFG) &&
TLVP_LEN(tp, NM_ATT_BS11_LINE_CFG) >= 1) {
const u_int8_t *lcfg = TLVP_VAL(tp, NM_ATT_BS11_LINE_CFG);
printf("\tLine Configuration: %s (%d)\n",
bport_lcfg_name(*lcfg), *lcfg);
}
return 0;
@ -459,6 +482,8 @@ static void cmd_query(void)
trx = gsm_bts_trx_num(g_bts, 1);
if (trx)
abis_nm_bs11_get_trx_power(trx);
abis_nm_bs11_get_bport_line_cfg(g_bts, 0);
abis_nm_bs11_get_bport_line_cfg(g_bts, 1);
sleep(1);
abis_nm_bs11_factory_logon(g_bts, 0);
command = NULL;