summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dugeon <olivier.dugeon@orange.com>2022-06-07 17:39:52 +0200
committerGitHub <noreply@github.com>2022-06-07 17:39:52 +0200
commitda152ceea0ce047d60288ea47759da37184fbe15 (patch)
treee0814d1b870a89816b6ee13c63ca548c988536b7
parent96b706b72a8452007efad17ccc161b672a9bab5e (diff)
Revert "ospfd: Remove local-block deprecated command"revert-11334-fix/deprecation_warning
-rw-r--r--doc/developer/ospf-sr.rst3
-rw-r--r--doc/user/ospfd.rst6
-rw-r--r--ospfd/ospf_sr.c80
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf1
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf1
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf1
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf1
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf1
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf1
-rw-r--r--tests/topotests/ospf_te_topo1/r4/ospfd.conf3
-rw-r--r--tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py2
11 files changed, 97 insertions, 3 deletions
diff --git a/doc/developer/ospf-sr.rst b/doc/developer/ospf-sr.rst
index 1c164433dc..263db9dfb9 100644
--- a/doc/developer/ospf-sr.rst
+++ b/doc/developer/ospf-sr.rst
@@ -310,7 +310,8 @@ Routing.
ospf router-id 192.168.1.11
capability opaque
segment-routing on
- segment-routing global-block 10000 19999 local-block 5000 5999
+ segment-routing global-block 10000 19999
+ segment-routing local-block 5000 5999
segment-routing node-msd 8
segment-routing prefix 192.168.1.11/32 index 1100
diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst
index e438d04e93..068bb8ba31 100644
--- a/doc/user/ospfd.rst
+++ b/doc/user/ospfd.rst
@@ -991,6 +991,12 @@ dataplane.
Block, i.e. the label range used for Adjacency SID. The negative version
of the command always unsets both ranges.
+.. clicmd:: segment-routing local-block (16-1048575) (16-1048575)
+
+ Set the Segment Routing Local Block i.e. the label range used by MPLS to
+ store label in the MPLS FIB for Adjacency SID. This command is deprecated
+ in favor of the combined command above.
+
.. clicmd:: segment-routing node-msd (1-16)
Fix the Maximum Stack Depth supported by the router. The value depend of the
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index 2c7c80686c..8fa5ce77bb 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -2302,6 +2302,84 @@ DEFUN(no_sr_global_label_range, no_sr_global_label_range_cmd,
return CMD_SUCCESS;
}
+#if CONFDATE > 20220528
+CPP_NOTICE(
+ "Use of the segment-routing local-block command is deprecated, use the combined global-block command instead")
+#endif
+
+DEFUN_HIDDEN(sr_local_label_range, sr_local_label_range_cmd,
+ "segment-routing local-block (16-1048575) (16-1048575)",
+ SR_STR
+ "Segment Routing Local Block label range\n"
+ "Lower-bound range in decimal (16-1048575)\n"
+ "Upper-bound range in decimal (16-1048575)\n")
+{
+ uint32_t upper;
+ uint32_t lower;
+ uint32_t srgb_upper;
+ int idx_low = 2;
+ int idx_up = 3;
+
+ /* Get lower and upper bound */
+ lower = strtoul(argv[idx_low]->arg, NULL, 10);
+ upper = strtoul(argv[idx_up]->arg, NULL, 10);
+
+ /* check correctness of SRLB */
+ if (!sr_range_is_valid(lower, upper, MIN_SRLB_SIZE)) {
+ vty_out(vty, "Invalid SRLB range\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ /* Check if values have changed */
+ if ((OspfSR.srlb.start == lower)
+ && (OspfSR.srlb.end == upper))
+ return CMD_SUCCESS;
+
+ /* Validate SRLB against SRGB */
+ srgb_upper = OspfSR.srgb.start + OspfSR.srgb.size - 1;
+
+ if (ranges_overlap(OspfSR.srgb.start, srgb_upper, lower, upper)) {
+ vty_out(vty,
+ "New SR Local Block (%u/%u) conflicts with Global Block (%u/%u)\n",
+ lower, upper, OspfSR.srgb.start, srgb_upper);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ if (update_sr_blocks(OspfSR.srgb.start, srgb_upper, lower, upper) < 0)
+ return CMD_WARNING_CONFIG_FAILED;
+ else
+ return CMD_SUCCESS;
+}
+
+DEFUN_HIDDEN(no_sr_local_label_range, no_sr_local_label_range_cmd,
+ "no segment-routing local-block [(16-1048575) (16-1048575)]",
+ NO_STR SR_STR
+ "Segment Routing Local Block label range\n"
+ "Lower-bound range in decimal (16-1048575)\n"
+ "Upper-bound range in decimal (16-1048575)\n")
+{
+
+ uint32_t srgb_end;
+
+ /* Validate SRLB against SRGB */
+ srgb_end = OspfSR.srgb.start + OspfSR.srgb.size - 1;
+ if (ranges_overlap(OspfSR.srgb.start, srgb_end, DEFAULT_SRLB_LABEL,
+ DEFAULT_SRLB_END)) {
+ vty_out(vty,
+ "New SR Local Block (%u/%u) conflicts with Global Block (%u/%u)\n",
+ DEFAULT_SRLB_LABEL, DEFAULT_SRLB_END, OspfSR.srgb.start,
+ srgb_end);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ if (update_sr_blocks(OspfSR.srgb.start, srgb_end, DEFAULT_SRLB_LABEL,
+ DEFAULT_SRLB_END)
+ < 0)
+ return CMD_WARNING_CONFIG_FAILED;
+ else
+ return CMD_SUCCESS;
+}
+
DEFUN (sr_node_msd,
sr_node_msd_cmd,
"segment-routing node-msd (1-16)",
@@ -2969,6 +3047,8 @@ void ospf_sr_register_vty(void)
install_element(OSPF_NODE, &no_ospf_sr_enable_cmd);
install_element(OSPF_NODE, &sr_global_label_range_cmd);
install_element(OSPF_NODE, &no_sr_global_label_range_cmd);
+ install_element(OSPF_NODE, &sr_local_label_range_cmd);
+ install_element(OSPF_NODE, &no_sr_local_label_range_cmd);
install_element(OSPF_NODE, &sr_node_msd_cmd);
install_element(OSPF_NODE, &no_sr_node_msd_cmd);
install_element(OSPF_NODE, &sr_prefix_sid_cmd);
diff --git a/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf
index 064a4bf286..a440fa6fdf 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf
@@ -30,6 +30,7 @@ router ospf
passive-interface lo
segment-routing on
segment-routing global-block 16000 23999
+ !segment-routing local-block 15000 15999
segment-routing node-msd 8
segment-routing prefix 1.1.1.1/32 index 10
!
diff --git a/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf
index 65b20f0e63..7bec98cd76 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf
@@ -41,6 +41,7 @@ router ospf
passive-interface lo
segment-routing on
segment-routing global-block 16000 23999
+ !segment-routing local-block 15000 15999
segment-routing node-msd 8
segment-routing prefix 2.2.2.2/32 index 20
!
diff --git a/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf
index 5be0c49a85..40b85c4601 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf
@@ -40,6 +40,7 @@ router ospf
router-info area 0.0.0.0
segment-routing on
segment-routing global-block 16000 23999
+ !segment-routing local-block 15000 15999
segment-routing node-msd 8
segment-routing prefix 3.3.3.3/32 index 30
!
diff --git a/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf
index 7cdf032eaa..4d3380d107 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf
@@ -47,6 +47,7 @@ router ospf
passive-interface lo
segment-routing on
segment-routing global-block 16000 23999
+ !segment-routing local-block 15000 15999
segment-routing node-msd 8
segment-routing prefix 4.4.4.4/32 index 40
!
diff --git a/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf
index 8f71cda443..b111ce588a 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf
@@ -47,6 +47,7 @@ router ospf
passive-interface lo
segment-routing on
segment-routing global-block 16000 23999
+! segment-routing local-block 15000 15999
segment-routing node-msd 8
segment-routing prefix 5.5.5.5/32 index 50
!
diff --git a/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf
index 20c89757a8..f0c5a9c0ba 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf
@@ -35,6 +35,7 @@ router ospf
passive-interface lo
segment-routing on
segment-routing global-block 16000 23999
+! segment-routing local-block 15000 15999
segment-routing node-msd 8
segment-routing prefix 6.6.6.6/32 index 60
!
diff --git a/tests/topotests/ospf_te_topo1/r4/ospfd.conf b/tests/topotests/ospf_te_topo1/r4/ospfd.conf
index cd508017d3..e454673153 100644
--- a/tests/topotests/ospf_te_topo1/r4/ospfd.conf
+++ b/tests/topotests/ospf_te_topo1/r4/ospfd.conf
@@ -15,7 +15,8 @@ router ospf
mpls-te on
mpls-te router-address 10.0.255.4
segment-routing on
- segment-routing global-block 10000 19999 local-block 5000 5999
+ segment-routing local-block 5000 5999
+ segment-routing global-block 10000 19999
segment-routing node-msd 12
segment-routing prefix 10.0.255.4/32 index 400 no-php-flag
!
diff --git a/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py b/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py
index 699cdc9054..7de23dc34e 100644
--- a/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py
+++ b/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py
@@ -224,7 +224,7 @@ def test_step4():
'vtysh -c "conf t" -c "router ospf" -c "segment-routing node-msd 16"'
)
tgen.net["r2"].cmd(
- 'vtysh -c "conf t" -c "router ospf" -c "segment-routing global-block 16000 23999 local-block 5000 6999"'
+ 'vtysh -c "conf t" -c "router ospf" -c "segment-routing local-block 5000 6999"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing prefix 10.0.255.2/32 index 20 explicit-null"'