aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-02-13 22:13:28 +0100
committerHarald Welte <laforge@gnumonks.org>2011-02-13 22:13:28 +0100
commita8e6a652ca50f269a739df2b7e915de5b49f63e0 (patch)
treea683d420281a0aca97e9e2f1754e8f28fdfa5998 /openbsc
parentb7eebf869901033d63350044632f77bef7e9d5a0 (diff)
OM2000: Allow VTY based configuration of IS connection groups
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gsm_data.h5
-rw-r--r--openbsc/src/abis_om2000_vty.c88
-rw-r--r--openbsc/src/gsm_data.c4
3 files changed, 83 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index e3092f91..e3cefe12 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -577,6 +577,11 @@ struct gsm_bts {
} rack;
struct gsm_envabtse envabtse[4];
} bs11;
+ struct {
+ struct {
+ struct llist_head conn_groups;
+ } is;
+ } rbs2000;
};
/* Not entirely sure how ip.access specific this is */
diff --git a/openbsc/src/abis_om2000_vty.c b/openbsc/src/abis_om2000_vty.c
index be843c51..c88e8de0 100644
--- a/openbsc/src/abis_om2000_vty.c
+++ b/openbsc/src/abis_om2000_vty.c
@@ -235,23 +235,82 @@ static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1,
grp->cont_idx = cont_idx;
}
+struct is_conn_group {
+ struct llist_head list;
+ uint16_t icp1;
+ uint16_t icp2;
+ uint8_t ci;
+};
+
+DEFUN(om2k_is_conn_list, om2k_is_conn_list_cmd,
+ "is-connection-list (add|del) <0-2047> <0-2047> <0-255>",
+ "Interface Switch Connnection List\n"
+ "Add to IS list\n" "Delete from IS list\n"
+ "ICP1\n" "ICP2\n" "Contiguity Index\n")
+{
+ struct oml_node_state *oms = vty->index;
+ struct gsm_bts *bts = oms->bts;
+ uint16_t icp1 = atoi(argv[1]);
+ uint16_t icp2 = atoi(argv[2]);
+ uint8_t ci = atoi(argv[3]);
+ struct is_conn_group *grp, *grp2;
+
+ if (!strcmp(argv[0], "add")) {
+ grp = talloc_zero(bts, struct is_conn_group);
+ grp->icp1 = icp1;
+ grp->icp2 = icp2;
+ grp->ci = ci;
+ llist_add(&grp->list, &bts->rbs2000.is.conn_groups);
+ } else {
+ llist_for_each_entry_safe(grp, grp2, &bts->rbs2000.is.conn_groups, list) {
+ if (grp->icp1 == icp1 && grp->icp2 == icp2
+ && grp->ci == ci) {
+ llist_del(&grp->list);
+ talloc_free(grp);
+ return CMD_SUCCESS;
+ }
+ }
+ vty_out(vty, "%% No matching IS Conn Group found!%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
+
DEFUN(om2k_is_conf_req, om2k_is_conf_req_cmd,
"is-conf-req",
- "IS Configuration Request\n")
+ "Send IS Configuration Request\n")
{
struct oml_node_state *oms = vty->index;
- struct om2k_is_conn_grp grps[6];
-
- /* TRX 0 */
- om2k_fill_is_conn_grp(&grps[0], 512, 4, 4);
- om2k_fill_is_conn_grp(&grps[1], 516, 8, 4);
- om2k_fill_is_conn_grp(&grps[2], 520, 12, 4);
- /* TRX 1 */
- om2k_fill_is_conn_grp(&grps[3], 524, 16, 4);
- om2k_fill_is_conn_grp(&grps[4], 528, 20, 4);
- om2k_fill_is_conn_grp(&grps[5], 532, 24, 4);
-
- abis_om2k_tx_is_conf_req(oms->bts, grps, ARRAY_SIZE(grps));
+ struct gsm_bts *bts = oms->bts;
+ struct is_conn_group *grp;
+ unsigned int num_grps = 0, i = 0;
+ struct om2k_is_conn_grp *o2grps;
+
+ /* count number of groups in linked list */
+ llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
+ num_grps++;
+
+ if (!num_grps) {
+ vty_out(vty, "%% No IS connection groups configured!%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ /* allocate buffer for oml group array */
+ o2grps = talloc_zero_array(bts, struct om2k_is_conn_grp, num_grps);
+
+ /* fill array with data from linked list */
+ llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
+ om2k_fill_is_conn_grp(&o2grps[i++], grp->icp1, grp->icp2, grp->ci);
+
+ /* send the actual OML request */
+ abis_om2k_tx_is_conf_req(oms->bts, o2grps, num_grps);
+
+ talloc_free(o2grps);
+
return CMD_SUCCESS;
}
@@ -273,6 +332,9 @@ int abis_om2k_vty_init(void)
install_element(OM2K_NODE, &om2k_op_info_cmd);
install_element(OM2K_NODE, &om2k_test_cmd);
install_element(OM2K_NODE, &om2k_is_conf_req_cmd);
+ install_element(OM2K_NODE, &om2k_is_conn_list_cmd);
+
+ //install_element(BTS_NODE, &om2k_is_conn_list_cmd);
return 0;
}
diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c
index 3a14f7eb..395339e4 100644
--- a/openbsc/src/gsm_data.c
+++ b/openbsc/src/gsm_data.c
@@ -574,9 +574,11 @@ int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
bts->c0->nominal_power = 23;
break;
case GSM_BTS_TYPE_BS11:
- case GSM_BTS_TYPE_RBS2000:
case GSM_BTS_TYPE_UNKNOWN:
break;
+ case GSM_BTS_TYPE_RBS2000:
+ INIT_LLIST_HEAD(&bts->rbs2000.is.conn_groups);
+ break;
}
return 0;