[PATCH 1/1] Add {create, delete}-bport1 and bport0-{star, multidrop} to bs11-config

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/OpenBSC@lists.osmocom.org/.

Daniel Willmann daniel at totalueberwachung.de
Sun Aug 9 00:24:17 UTC 2009


This adds the possibility to bs11-config to add the second bport and
change the line config to star or multidrop.
---
 openbsc/include/openbsc/abis_nm.h |    4 +++-
 openbsc/src/abis_nm.c             |   31 +++++++++++++++++++++++++++++--
 openbsc/src/bs11_config.c         |   26 ++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index d8cd9fa..9e873e9 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -654,7 +654,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);
@@ -695,6 +695,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);
@@ -710,6 +711,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, u_int8_t 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 31f1df0..4baf6f6 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -1755,7 +1755,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();
@@ -1934,7 +1934,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);
 }
@@ -2322,6 +2334,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, u_int8_t 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 0fb7cd7..bdf797b 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, 0);
+				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, 1);
+				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)
-- 
1.6.3.3





More information about the OpenBSC mailing list