Change in osmo-bsc[master]: om2k: Add VTY command to allow TX of arbitrary message for testing

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Apr 28 08:55:47 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/17962 )

Change subject: om2k: Add VTY command to allow TX of arbitrary message for testing
......................................................................

om2k: Add VTY command to allow TX of arbitrary message for testing

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
Change-Id: I5a385614fc670946f83ea79cc176c2d448675672
---
M include/osmocom/bsc/abis_om2000.h
M src/osmo-bsc/abis_om2000.c
M src/osmo-bsc/abis_om2000_vty.c
3 files changed, 45 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/include/osmocom/bsc/abis_om2000.h b/include/osmocom/bsc/abis_om2000.h
index 163a49c..0d48c0c 100644
--- a/include/osmocom/bsc/abis_om2000.h
+++ b/include/osmocom/bsc/abis_om2000.h
@@ -113,6 +113,7 @@
 int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
 			 uint8_t operational);
 int abis_om2k_tx_cap_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
+int abis_om2k_tx_arb(struct gsm_bts *bts, struct abis_om2k_mo *mo, uint16_t req, uint8_t *buf, int buf_len);
 int abis_om2k_tx_is_conf_req(struct gsm_bts *bts);
 int abis_om2k_tx_con_conf_req(struct gsm_bts *bts);
 int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts);
diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c
index e1a526c..b221441 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -1129,6 +1129,21 @@
 	return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_CAPA_REQ);
 }
 
+int abis_om2k_tx_arb(struct gsm_bts *bts, struct abis_om2k_mo *mo,
+		     uint16_t req, uint8_t *buf, int buf_len)
+{
+	struct msgb *msg = om2k_msgb_alloc();
+	struct abis_om2k_hdr *o2k;
+
+	o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
+	fill_om2k_hdr(o2k, mo, req);
+
+	if (buf_len)
+		memcpy(msgb_put(msg, buf_len), buf, buf_len);
+
+	return abis_om2k_sendmsg(bts, msg);
+}
+
 static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1,
 				  uint16_t icp2, uint8_t cont_idx)
 {
diff --git a/src/osmo-bsc/abis_om2000_vty.c b/src/osmo-bsc/abis_om2000_vty.c
index 5404d62..972fff0 100644
--- a/src/osmo-bsc/abis_om2000_vty.c
+++ b/src/osmo-bsc/abis_om2000_vty.c
@@ -255,6 +255,34 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(om2k_arb, om2k_arb_cmd,
+	"arbitrary <0-65535> [HEXSTRING]",
+	"Send arbitrary OM2k message\n"
+	"Command identifier\n"
+	"Hex Encoded payload\n")
+{
+	struct oml_node_state *oms = vty->index;
+	uint8_t buf[128];
+	int rc;
+	int cmd = atoi(argv[0]);
+
+	if (argc >= 2) {
+		rc = osmo_hexparse(argv[1], buf, sizeof(buf));
+		if (rc < 0 || rc > sizeof(buf)) {
+			vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
+			return CMD_WARNING;
+		}
+	} else {
+		rc = 0;
+	}
+
+	abis_om2k_tx_arb(oms->bts, &oms->mo, cmd, buf, rc);
+
+	return CMD_SUCCESS;
+}
+
+
+
 static struct con_group *con_group_find_or_create(struct gsm_bts *bts, uint8_t cg)
 {
 	struct con_group *ent;
@@ -595,6 +623,7 @@
 	install_element(OM2K_NODE, &om2k_test_cmd);
 	install_element(OM2K_NODE, &om2k_cap_req_cmd);
 	install_element(OM2K_NODE, &om2k_conf_req_cmd);
+	install_element(OM2K_NODE, &om2k_arb_cmd);
 
 	install_node(&om2k_con_group_node, dummy_config_write);
 	install_element(OM2K_CON_GROUP_NODE, &cfg_om2k_con_path_dec_cmd);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/17962
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I5a385614fc670946f83ea79cc176c2d448675672
Gerrit-Change-Number: 17962
Gerrit-PatchSet: 2
Gerrit-Owner: tnt <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200428/a7ab1e66/attachment.htm>


More information about the gerrit-log mailing list