laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved
SS7: Support secondary point codes

osmo_ss7 so far only supported a single local point code per cs7
instance: The primary point code. Let's add support for a secondary
point code, just like it is the case in Cisco ITP.

Change-Id: I3c4c0d89d2a0ea36aa5df0887225d99a16b810f0
---
M TODO-RELEASE
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
M tests/vty/ss7_asp_test.vty
5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 0ed7189..935cda8 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+libosmo-sigtran API change struct osmo_ss7_instance has new member 'secondary_pc'
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 155e05a..049c7d8 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -96,12 +96,12 @@
char *name;
char *description;
uint32_t primary_pc;
- /* secondary PCs */
/* capability PCs */
uint8_t network_indicator;
struct osmo_ss7_pc_fmt pc_fmt;
bool permit_dyn_rkm_alloc;
struct llist_head sccp_address_book;
+ uint32_t secondary_pc;
} cfg;
};

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 74b0f50..55d3d02 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -332,6 +332,7 @@
return NULL;

inst->cfg.primary_pc = OSMO_SS7_PC_INVALID;
+ inst->cfg.secondary_pc = OSMO_SS7_PC_INVALID;

inst->cfg.id = id;
LOGSS7(inst, LOGL_INFO, "Creating SS7 Instance\n");
@@ -1134,7 +1135,9 @@
OSMO_ASSERT(ss7_initialized);
if (osmo_ss7_pc_is_valid(inst->cfg.primary_pc) && pc == inst->cfg.primary_pc)
return true;
- /* FIXME: Secondary and Capability Point Codes */
+ if (osmo_ss7_pc_is_valid(inst->cfg.secondary_pc) && pc == inst->cfg.secondary_pc)
+ return true;
+ /* FIXME: Capability Point Codes */
return false;
}

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 9d58fb6..f1b0a1c 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -234,7 +234,23 @@
return CMD_SUCCESS;
}

-/* TODO: cs7 secondary-pc */
+DEFUN_ATTR(cs7_secondary_pc, cs7_secondary_pc_cmd,
+ "secondary-pc POINT_CODE",
+ "Configure the local Secondary Point Code\n"
+ "Point Code\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct osmo_ss7_instance *inst = vty->index;
+ int pc = osmo_ss7_pointcode_parse(inst, argv[0]);
+ if (pc < 0 || !osmo_ss7_pc_is_valid((uint32_t)pc)) {
+ vty_out(vty, "Invalid point code (%s)%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ inst->cfg.secondary_pc = pc;
+ return CMD_SUCCESS;
+}
+
/* TODO: cs7 capability-pc */
DEFUN_ATTR(cs7_permit_dyn_rkm, cs7_permit_dyn_rkm_cmd,
"xua rkm routing-key-allocation (static-only|dynamic-permitted)",
@@ -2812,6 +2828,11 @@
osmo_ss7_pointcode_print(inst, inst->cfg.primary_pc),
VTY_NEWLINE);

+ if (osmo_ss7_pc_is_valid(inst->cfg.secondary_pc)) {
+ vty_out(vty, " secondary-pc %s%s",
+ osmo_ss7_pointcode_print(inst, inst->cfg.secondary_pc), VTY_NEWLINE);
+ }
+
if (inst->cfg.permit_dyn_rkm_alloc)
vty_out(vty, " xua rkm routing-key-allocation dynamic-permitted%s", VTY_NEWLINE);

@@ -2972,6 +2993,7 @@
install_lib_element(L_CS7_NODE, &cfg_description_cmd);
install_lib_element(L_CS7_NODE, &cs7_net_ind_cmd);
install_lib_element(L_CS7_NODE, &cs7_point_code_cmd);
+ install_lib_element(L_CS7_NODE, &cs7_secondary_pc_cmd);
install_lib_element(L_CS7_NODE, &cs7_pc_format_cmd);
install_lib_element(L_CS7_NODE, &cs7_pc_format_def_cmd);
install_lib_element(L_CS7_NODE, &cs7_pc_delimiter_cmd);
diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty
index 7168d20..b565557 100644
--- a/tests/vty/ss7_asp_test.vty
+++ b/tests/vty/ss7_asp_test.vty
@@ -104,6 +104,7 @@
description .TEXT
network-indicator (international | national | reserved | spare)
point-code POINT_CODE
+ secondary-pc POINT_CODE
point-code format <1-24> [<1-23>] [<1-22>]
point-code format default
point-code delimiter (default|dash)
@@ -123,6 +124,7 @@
description Save human-readable description of the object
network-indicator Configure the Network Indicator
point-code Configure the local Point Code
+ secondary-pc Configure the local Secondary Point Code
xua SIGTRAN xxxUA related
asp Configure Application Server Process
no Negate a command or set its defaults

To view, visit change 38180. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I3c4c0d89d2a0ea36aa5df0887225d99a16b810f0
Gerrit-Change-Number: 38180
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>