laforge submitted this change.
ss7 vty: Set default route priority to 5
Use a priority != 0 (best prio) as default priority. This allows adding
manual routes with higher prio (lower value) more easily.
Value 5 is chosen to resemble other systems users may be already used to.
Changing the default priority value in routes now shouldn't be much of a
problem, since the only way to set up a specific priority (VTY) was
broken until now and would return an error, so we know for sure nobody
has been setting priorities other than the default value.
Hence, with this change even older implementations reading a backward
compatible file would still work the same by using all-prio-0 instead of
all-prio-5.
The "update route" VTY cmd gets a new "default" param value for the
"priority" param, hence getting some syntatic sugar which also helps
users understand what's the default value through the CMD help string.
Change-Id: I4e283cc07b8e9ea2124ec9da18cbce77c3d866ee
---
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
M src/ss7_internal.h
M tests/vty/osmo_stp_route_prio.vty
M tests/vty/osmo_stp_test.vty
5 files changed, 49 insertions(+), 20 deletions(-)
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index cc40fe1..bcbe76c 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -696,6 +696,7 @@
* masks to ensure we don't fail duplicate detection with longer mask lengths */
rt->cfg.mask = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, mask);
rt->cfg.pc = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, pc);
+ rt->cfg.priority = OSMO_SS7_ROUTE_PRIO_DEFAULT;
return rt;
}
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 35a940f..356090c 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -74,6 +74,12 @@
QOS_CLASS_RANGE_HELP_STR \
"Default QoS Class (0)\n"
+#define ROUTE_PRIO_RANGE_STR "<0-4294967295>"
+#define ROUTE_PRIO_RANGE_HELP_STR "Priority\n"
+#define ROUTE_PRIO_VAR_STR "(" ROUTE_PRIO_RANGE_STR "|default)"
+#define ROUTE_PRIO_VAR_HELP_STR \
+ ROUTE_PRIO_RANGE_HELP_STR \
+ "Default Priority (5)\n"
/* netinet/tcp.h */
static const struct value_string tcp_info_state_values[] = {
@@ -349,7 +355,7 @@
}
DEFUN_ATTR(cs7_rt_upd, cs7_rt_upd_cmd,
- "update route POINT_CODE MASK linkset LS_NAME [priority] [PRIO] [qos-class] [" QOS_CLASS_VAR_STR "]",
+ "update route POINT_CODE MASK linkset LS_NAME [priority] [" ROUTE_PRIO_VAR_STR "] [qos-class] [" QOS_CLASS_VAR_STR "]",
"Update the Route\n"
"Update the Route\n"
"Destination Point Code\n"
@@ -357,7 +363,7 @@
"Specify Destination Linkset\n"
"Linkset Name\n"
"Specify Priority\n"
- "Priority\n"
+ ROUTE_PRIO_VAR_HELP_STR
"Specify QoS Class\n"
QOS_CLASS_VAR_HELP_STR,
CMD_ATTR_IMMEDIATE)
@@ -412,7 +418,9 @@
argind = 3;
if (argc > argind && !strcmp(argv[argind], "priority")) {
argind++;
- rt->cfg.priority = atoi(argv[argind++]);
+ if (strcmp(argv[argind], "default") != 0)
+ rt->cfg.priority = atoi(argv[argind]);
+ argind++;
}
if (argc > argind && !strcmp(argv[argind], "qos-class")) {
@@ -484,7 +492,7 @@
osmo_ss7_pointcode_print(rtable->inst, rt->cfg.pc),
osmo_ss7_pointcode_print2(rtable->inst, rt->cfg.mask),
rt->cfg.linkset_name);
- if (rt->cfg.priority)
+ if (rt->cfg.priority != OSMO_SS7_ROUTE_PRIO_DEFAULT)
vty_out(vty, " priority %u", rt->cfg.priority);
if (rt->cfg.qos_class)
vty_out(vty, " qos-class %u", rt->cfg.qos_class);
diff --git a/src/ss7_internal.h b/src/ss7_internal.h
index 623c607..61fe20e 100644
--- a/src/ss7_internal.h
+++ b/src/ss7_internal.h
@@ -54,6 +54,8 @@
/***********************************************************************
* SS7 Routes
***********************************************************************/
+#define OSMO_SS7_ROUTE_PRIO_DEFAULT 5
+
struct osmo_ss7_route *
ss7_route_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask);
int ss7_route_set_linkset(struct osmo_ss7_route *rt, const char *linkset_name);
diff --git a/tests/vty/osmo_stp_route_prio.vty b/tests/vty/osmo_stp_route_prio.vty
index 6cc862a..10833ea 100644
--- a/tests/vty/osmo_stp_route_prio.vty
+++ b/tests/vty/osmo_stp_route_prio.vty
@@ -65,17 +65,17 @@
OsmoSTP(config-cs7)# ! ADD 2 ROUTES WITH DECREASING PRIORITIES. THEY SHOULD END UP REORDERED BY PRIORITY:
OsmoSTP(config-cs7)# route-table system
-OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset as1 priority 5
-OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset as3
-OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset as2 priority 2
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset as1 priority 6
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset as2
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset as3 priority 2
OsmoSTP(config-cs7-rt)# show running-config
...
cs7 instance 0
...
route-table system
- update route 3.2.1 7.255.7 linkset as3
- update route 3.2.1 7.255.7 linkset as2 priority 2
- update route 3.2.1 7.255.7 linkset as1 priority 5
+ update route 3.2.1 7.255.7 linkset as3 priority 2
+ update route 3.2.1 7.255.7 linkset as2
+ update route 3.2.1 7.255.7 linkset as1 priority 6
...
OsmoSTP(config-cs7-rt)# do show cs7 instance 0 route
Routing table = system
@@ -83,6 +83,6 @@
Destination C Q P Linkset Name Linkset Non-adj Route
---------------------- - - - ------------------- ------- ------- -------
-3.2.1/14 0 as3 ? ? ?
-3.2.1/14 2 as2 ? ? ?
-3.2.1/14 5 as1 ? ? ?
+3.2.1/14 2 as3 ? ? ?
+3.2.1/14 5 as2 ? ? ?
+3.2.1/14 6 as1 ? ? ?
diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty
index 5253b9a..7967216 100644
--- a/tests/vty/osmo_stp_test.vty
+++ b/tests/vty/osmo_stp_test.vty
@@ -570,7 +570,7 @@
OsmoSTP(config-cs7)# route-table system
OsmoSTP(config-cs7-rt)# list
...
- update route POINT_CODE MASK linkset LS_NAME [priority] [PRIO] [qos-class] [(<0-7>|default)]
+ update route POINT_CODE MASK linkset LS_NAME [priority] [(<0-4294967295>|default)] [qos-class] [(<0-7>|default)]
remove route POINT_CODE MASK
OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass
OsmoSTP(config-cs7-rt)# show running-config
@@ -587,13 +587,31 @@
...
route-table system
... !update route 3.2.1 7.255.7 linkset my-ass
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority default
+OsmoSTP(config-cs7-rt)# show running-config
+...
+cs7 instance 0
+...
+ route-table system
+ update route 3.2.1 7.255.7 linkset my-ass
+...
+OsmoSTP(config-cs7-rt)# remove route 3.2.1 7.255.7
OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority 5
OsmoSTP(config-cs7-rt)# show running-config
...
cs7 instance 0
...
route-table system
- update route 3.2.1 7.255.7 linkset my-ass priority 5
+ update route 3.2.1 7.255.7 linkset my-ass
+...
+OsmoSTP(config-cs7-rt)# remove route 3.2.1 7.255.7
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority 6
+OsmoSTP(config-cs7-rt)# show running-config
+...
+cs7 instance 0
+...
+ route-table system
+ update route 3.2.1 7.255.7 linkset my-ass priority 6
...
OsmoSTP(config-cs7-rt)# remove route 3.2.1 7.255.7
OsmoSTP(config-cs7-rt)# show running-config
@@ -601,25 +619,25 @@
cs7 instance 0
...
route-table system
-... !update route 3.2.1 7.255.7 linkset my-ass priority 5
-OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority 5 qos-class 1
+... !update route 3.2.1 7.255.7 linkset my-ass priority 6
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority 6 qos-class 1
OsmoSTP(config-cs7-rt)# show running-config
...
cs7 instance 0
...
route-table system
- update route 3.2.1 7.255.7 linkset my-ass priority 5 qos-class 1
+ update route 3.2.1 7.255.7 linkset my-ass priority 6 qos-class 1
...
cs7 instance 1
...
route-table system
-... !update route 3.2.1 7.255.7 linkset my-ass priority 5 qos-class 1
+... !update route 3.2.1 7.255.7 linkset my-ass priority 6 qos-class 1
OsmoSTP(config-cs7-rt)# remove route 3.2.1 7.255.7
OsmoSTP(config-cs7-rt)# show running-config
...
cs7 instance 0
...
route-table system
-... !update route 3.2.1 7.255.7 linkset my-ass priority 5 qos-class 1
+... !update route 3.2.1 7.255.7 linkset my-ass priority 6 qos-class 1
OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority
% Incomplete command (missing an argument?)
To view, visit change 38390. To unsubscribe, or for help writing mail filters, visit settings.