aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2009-08-10 11:49:36 +0200
committerHarald Welte <laforge@gnumonks.org>2009-08-10 11:49:36 +0200
commit65f68fa9611c87d3bab75d5c69b45e99d6ee3eae (patch)
treefc1dafbb184d25adfbf6236c27a7e6fc85493985
parent99b4ecd78af937edffbf26d667f56d8b2350e918 (diff)
Add {create, delete}-bport1 and bport0-{star, multidrop} to bs11-config
This adds the possibility to bs11-config to add the second bport and change the line config to star or multidrop.
-rw-r--r--openbsc/include/openbsc/abis_nm.h10
-rw-r--r--openbsc/src/abis_nm.c31
-rw-r--r--openbsc/src/bs11_config.c26
3 files changed, 64 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index f75b9ce7f..946d2379d 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -593,6 +593,12 @@ enum abis_bs11_li_pll_mode {
BS11_LI_PLL_STANDALONE = 3,
};
+enum abis_bs11_line_cfg {
+ BS11_LINE_CFG_STAR = 0x00,
+ BS11_LINE_CFG_MULTIDROP = 0x01,
+ BS11_LINE_CFG_LOOP = 0x02,
+};
+
enum abis_bs11_phase {
BS11_STATE_SOFTWARE_RQD = 0x01,
BS11_STATE_LOAD_SMU_INTENDED = 0x11,
@@ -658,7 +664,7 @@ int abis_nm_tlv_parse(struct tlv_parsed *tp, const u_int8_t *buf, int len);
int abis_nm_rx(struct msgb *msg);
int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8_t i1, u_int8_t i2);
int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
- u_int8_t i1, u_int8_t i2, u_int8_t adm_state);
+ u_int8_t i1, u_int8_t i2, enum abis_nm_adm_state adm_state);
int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot,
u_int8_t tei);
@@ -699,6 +705,7 @@ int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx);
int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx);
int abis_nm_bs11_delete_object(struct gsm_bts *bts,
enum abis_bs11_objtype type, u_int8_t idx);
+int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx);
int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, u_int8_t e1_port,
u_int8_t e1_timeslot, u_int8_t e1_subslot, u_int8_t tei);
int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts);
@@ -714,6 +721,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_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);
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index cd551217f..8fcfdba4e 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -1817,7 +1817,7 @@ int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8
/* Chapter 8.8.5 */
int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
- u_int8_t i1, u_int8_t i2, u_int8_t adm_state)
+ u_int8_t i1, u_int8_t i2, enum abis_nm_adm_state adm_state)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -1996,7 +1996,19 @@ int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx)
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 0, NM_MT_BS11_CREATE_OBJ, NM_OC_BS11_BPORT,
- idx, 0, 0);
+ idx, 0xff, 0xff);
+
+ return abis_nm_sendmsg(bts, msg);
+}
+
+int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx)
+{
+ struct abis_om_hdr *oh;
+ struct msgb *msg = nm_msgb_alloc();
+
+ oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+ fill_om_fom_hdr(oh, 0, NM_MT_BS11_DELETE_OBJ, NM_OC_BS11_BPORT,
+ idx, 0xff, 0xff);
return abis_nm_sendmsg(bts, msg);
}
@@ -2384,6 +2396,21 @@ int abis_nm_bs11_set_ext_time(struct gsm_bts *bts)
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;
+ struct msgb *msg = nm_msgb_alloc();
+ struct bs11_date_time aet;
+
+ get_bs11_date_time(&aet);
+ oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+ fill_om_fom_hdr(oh, 2, NM_MT_BS11_SET_ATTR, NM_OC_BS11_BPORT,
+ bport, 0xff, 0x02);
+ msgb_tv_put(msg, NM_ATT_BS11_LINE_CFG, line_cfg);
+
+ return abis_nm_sendmsg(bts, msg);
+}
+
/* ip.access nanoBTS specific commands */
static const char ipaccess_magic[] = "com.ipaccess";
diff --git a/openbsc/src/bs11_config.c b/openbsc/src/bs11_config.c
index 0fb7cd7a6..3e8bf88a3 100644
--- a/openbsc/src/bs11_config.c
+++ b/openbsc/src/bs11_config.c
@@ -541,6 +541,28 @@ static int handle_state_resp(enum abis_bs11_phase state)
command = NULL;
} else if (!strcmp(command, "query")) {
cmd_query();
+ } else if (!strcmp(command, "create-bport1")) {
+ abis_nm_bs11_create_bport(g_bts, 1);
+ sleep(1);
+ abis_nm_bs11_factory_logon(g_bts, 0);
+ command = NULL;
+ } else if (!strcmp(command, "delete-bport1")) {
+ abis_nm_chg_adm_state(g_bts, NM_OC_BS11_BPORT, 1, 0xff, 0xff, NM_STATE_LOCKED);
+ sleep(1);
+ abis_nm_bs11_delete_bport(g_bts, 1);
+ sleep(1);
+ abis_nm_bs11_factory_logon(g_bts, 0);
+ command = NULL;
+ } else if (!strcmp(command, "bport0-star")) {
+ abis_nm_bs11_set_bport_line_cfg(g_bts, 0, BS11_LINE_CFG_STAR);
+ sleep(1);
+ abis_nm_bs11_factory_logon(g_bts, 0);
+ command = NULL;
+ } else if (!strcmp(command, "bport0-multidrop")) {
+ abis_nm_bs11_set_bport_line_cfg(g_bts, 0, BS11_LINE_CFG_MULTIDROP);
+ sleep(1);
+ abis_nm_bs11_factory_logon(g_bts, 0);
+ command = NULL;
}
}
break;
@@ -692,6 +714,10 @@ static void print_help(void)
printf("\tpll-e1-locked\tSet the PLL to be locked to E1 clock\n");
printf("\tpll-standalone\tSet the PLL to be in standalone mode\n");
printf("\toml-tei\tSet OML E1 TS and TEI\n");
+ printf("\tbport0-star\tSet BPORT0 line config to star\n");
+ printf("\tbport0-multiport\tSet BPORT0 line config to multiport\n");
+ printf("\tcreate-bport1\tCreate BPORT1 object\n");
+ printf("\tdelete-bport1\tDelete BPORT1 object\n");
}
static void handle_options(int argc, char **argv)