Skip to content

Commit 655fa0d

Browse files
authored
[tests]: Update SRv6 test cases to use static SID configuration CLI (#3956)
Previously, SRv6 test cases relied on a workaround to configure SIDs by creating them directly in the kernel. The kernel would then notify FRR, which in turn would program the SIDs in SONiC. This was the only available method before the introduction of the static SRv6 CLI in FRR. With the introduction of the static SRv6 CLI, we can now configure SIDs directly through FRR, which is the intended and correct approach. This commit updates the test cases to leverage the static SRv6 CLI. This change aligns the test cases with the recommended and expected workflow for configuring SIDs in SONiC, which is also used by `bgpcfgd`. Signed-off-by: Carmine Scarpitta <[email protected]>
1 parent 3a7fd1e commit 655fa0d

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

tests/test_srv6.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,11 +1074,10 @@ def test_AddRemoveSrv6MySidUN(self, dvs, testlog):
10741074
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"locators\" -c \"locator loc1\" -c \"prefix fc00:0:2::/48 block-len 32 node-len 16 func-bits 16\" -c \"behavior usid\"")
10751075

10761076
# create srv6 mysid un behavior
1077-
dvs.runcmd("ip -6 route add fc00:0:2::/48 encap seg6local action End dev sr0")
1078-
# dvs.runcmd("ip -6 route add fc00:0:2::/48 encap seg6local action End flavors next-csid lblen 32 nflen 16 dev sr0")
1077+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"sid fc00:0:2::/48 locator loc1 behavior uN\"")
10791078

10801079
# check application database
1081-
self.pdb.wait_for_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2::")
1080+
self.pdb.wait_for_entry("SRV6_MY_SID_TABLE", "32:16:0:0:fc00:0:2::")
10821081

10831082
# verify that the mysid has been programmed into the ASIC
10841083
self.adb.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_MY_SID_ENTRY", len(self.initial_my_sid_entries) + 1)
@@ -1093,11 +1092,10 @@ def test_AddRemoveSrv6MySidUN(self, dvs, testlog):
10931092
assert fv[1] == "SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_UN"
10941093

10951094
# remove srv6 mysid un behavior
1096-
dvs.runcmd("ip -6 route del fc00:0:2::/48 encap seg6local action End dev sr0".format(self.vrf_table_id))
1097-
# dvs.runcmd("ip -6 route del fc00:0:2::/48 encap seg6local action End flavors next-csid lblen 32 nflen 16 dev sr0".format(self.vrf_table_id))
1095+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"no sid fc00:0:2::/48 locator loc1 behavior uN\"")
10981096

10991097
# check application database
1100-
self.pdb.wait_for_deleted_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2::")
1098+
self.pdb.wait_for_deleted_entry("SRV6_MY_SID_TABLE", "32:16:0:0:fc00:0:2::")
11011099

11021100
# verify that the mysid has been removed from the ASIC
11031101
self.adb.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_MY_SID_ENTRY", len(self.initial_my_sid_entries))
@@ -1121,8 +1119,7 @@ def test_AddRemoveSrv6MySidUA(self, dvs, testlog):
11211119
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"locators\" -c \"locator loc1\" -c \"prefix fc00:0:2::/48 block-len 32 node-len 16 func-bits 16\" -c \"behavior usid\"")
11221120

11231121
# create srv6 mysid ua behavior
1124-
dvs.runcmd("ip -6 route add fc00:0:2:ff00::/64 encap seg6local action End.X nh6 2001::1 dev sr0")
1125-
# dvs.runcmd("ip -6 route add fc00:0:2:ff00::/64 encap seg6local action End.X nh6 2001::1 flavors next-csid lblen 32 nflen 16 dev sr0")
1122+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"sid fc00:0:2:ff00::/64 locator loc1 behavior uA interface Ethernet104 nexthop 2001::1\"")
11261123

11271124
# check application database
11281125
self.pdb.wait_for_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff00::")
@@ -1142,8 +1139,7 @@ def test_AddRemoveSrv6MySidUA(self, dvs, testlog):
11421139
assert fv[1] == self.next_hop_ipv6_id
11431140

11441141
# remove srv6 mysid ua behavior
1145-
dvs.runcmd("ip -6 route del fc00:0:2:ff00::/64 encap seg6local action End.DT6 nh6 2001::1 dev sr0")
1146-
# dvs.runcmd("ip -6 route del fc00:0:2:ff00::/64 encap seg6local action End.DT6 nh6 2001::1 flavors next-csid lblen 32 nflen 16 dev sr0")
1142+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"no sid fc00:0:2:ff00::/64 locator loc1 behavior uA interface Ethernet104 nexthop 2001::1\"")
11471143

11481144
# check application database
11491145
self.pdb.wait_for_deleted_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff00::")
@@ -1173,7 +1169,7 @@ def test_AddRemoveSrv6MySidUDT4(self, dvs, testlog):
11731169
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"locators\" -c \"locator loc1\" -c \"prefix fc00:0:2::/48 block-len 32 node-len 16 func-bits 16\" -c \"behavior usid\"")
11741170

11751171
# create srv6 mysid udt4 behavior
1176-
dvs.runcmd("ip -6 route add fc00:0:2:ff05::/128 encap seg6local action End.DT4 vrftable {} dev sr0".format(self.vrf_table_id))
1172+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"sid fc00:0:2:ff05::/64 locator loc1 behavior uDT4 vrf Vrf10\"")
11771173

11781174
# check application database
11791175
self.pdb.wait_for_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff05::")
@@ -1193,7 +1189,7 @@ def test_AddRemoveSrv6MySidUDT4(self, dvs, testlog):
11931189
assert fv[1] == self.vrf_id
11941190

11951191
# remove srv6 mysid udt4 behavior
1196-
dvs.runcmd("ip -6 route del fc00:0:2:ff05::/128 encap seg6local action End.DT4 vrftable {} dev sr0".format(self.vrf_table_id))
1192+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"no sid fc00:0:2:ff05::/64 locator loc1 behavior uDT4 vrf Vrf10\"")
11971193

11981194
# check application database
11991195
self.pdb.wait_for_deleted_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff05::")
@@ -1218,7 +1214,7 @@ def test_AddRemoveSrv6MySidUDT6(self, dvs, testlog):
12181214
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"locators\" -c \"locator loc1\" -c \"prefix fc00:0:2::/48 block-len 32 node-len 16 func-bits 16\" -c \"behavior usid\"")
12191215

12201216
# create srv6 mysid udt6 behavior
1221-
dvs.runcmd("ip -6 route add fc00:0:2:ff05::/128 encap seg6local action End.DT6 vrftable {} dev sr0".format(self.vrf_table_id))
1217+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"sid fc00:0:2:ff05::/64 locator loc1 behavior uDT6 vrf Vrf10\"")
12221218

12231219
# check application database
12241220
self.pdb.wait_for_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff05::")
@@ -1240,7 +1236,7 @@ def test_AddRemoveSrv6MySidUDT6(self, dvs, testlog):
12401236
assert fv[1] == self.vrf_id
12411237

12421238
# remove srv6 mysid udt6 behavior
1243-
dvs.runcmd("ip -6 route del fc00:0:2:ff05::/128 encap seg6local action End.DT6 vrftable {} dev sr0".format(self.vrf_table_id))
1239+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"no sid fc00:0:2:ff05::/64 locator loc1 behavior uDT6 vrf Vrf10\"")
12441240

12451241
# check application database
12461242
self.pdb.wait_for_deleted_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff05::")
@@ -1270,7 +1266,7 @@ def test_AddRemoveSrv6MySidUDT46(self, dvs, testlog):
12701266
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"locators\" -c \"locator loc1\" -c \"prefix fc00:0:2::/48 block-len 32 node-len 16 func-bits 16\" -c \"behavior usid\"")
12711267

12721268
# create srv6 mysid udt46 behavior
1273-
dvs.runcmd("ip -6 route add fc00:0:2:ff05::/128 encap seg6local action End.DT46 vrftable {} dev sr0".format(self.vrf_table_id))
1269+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"sid fc00:0:2:ff05::/64 locator loc1 behavior uDT46 vrf Vrf10\"")
12741270

12751271
# check application database
12761272
self.pdb.wait_for_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff05::")
@@ -1290,7 +1286,7 @@ def test_AddRemoveSrv6MySidUDT46(self, dvs, testlog):
12901286
assert fv[1] == self.vrf_id
12911287

12921288
# remove srv6 mysid udt46 behavior
1293-
dvs.runcmd("ip -6 route del fc00:0:2:ff05::/128 encap seg6local action End.DT46 vrftable {} dev sr0".format(self.vrf_table_id))
1289+
dvs.runcmd("vtysh -c \"configure terminal\" -c \"segment-routing\" -c \"srv6\" -c \"static-sids\" -c \"no sid fc00:0:2:ff05::/64 locator loc1 behavior uDT46 vrf Vrf10\"")
12941290

12951291
# check application database
12961292
self.pdb.wait_for_deleted_entry("SRV6_MY_SID_TABLE", "32:16:16:0:fc00:0:2:ff05::")

0 commit comments

Comments
 (0)