-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SRv6] Add SRv6 control plane test case #16516
Changes from 1 commit
56a38d0
2b021e2
0f9841b
4f828be
23e6308
3dc76a6
ac58914
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import time | ||
import logging | ||
import pytest | ||
|
||
WAIT_TIME = 5 | ||
|
||
def test_uN_config(duthosts, rand_one_dut_hostname): | ||
duthost = duthosts[rand_one_dut_hostname] | ||
|
||
# add a locator configuration entry | ||
duthost.command("sonic-db-cli CONFIG_DB HSET SRV6_MY_LOCATORS\\|loc1 prefix fcbb:bbbb:1::") | ||
# add a uN sid configuration entry | ||
duthost.command("sonic-db-cli CONFIG_DB HSET SRV6_MY_SIDS\\|loc1\\|fcbb:bbbb:1:1:: action uN") | ||
time.sleep(WAIT_TIME) | ||
|
||
frr_config = duthost.command("vtysh -c \"show running-config\"")["stdout"] | ||
|
||
# verify that bgpcfgd generates FRR config correctly | ||
assert "locator loc1" in frr_config | ||
assert "sid fcbb:bbbb:1:1::/64 locator loc1 behavior uN" in frr_config | ||
|
||
appl_db_my_sids = duthost.command("sonic-db-cli APPL_DB keys SRV6_MY_SID_TABLE*")["stdout"] | ||
|
||
# verify that APPL_DB gets programmed by FRR correctly | ||
assert "SRV6_MY_SID_TABLE:32:16:16:0:fcbb:bbbb:1:1::" in appl_db_my_sids | ||
|
||
# delete the configurations | ||
duthost.command("sonic-db-cli CONFIG_DB DEL SRV6_MY_LOCATORS\\|loc1") | ||
duthost.command("sonic-db-cli CONFIG_DB DEL SRV6_MY_SIDS\\|loc1\\|fcbb:bbbb:1:1::") | ||
time.sleep(WAIT_TIME) | ||
|
||
frr_config = duthost.command("vtysh -c \"show running-config\"")["stdout"] | ||
|
||
# verify that bgpcfgd deletes relevant FRR config | ||
assert "locator loc1" not in frr_config | ||
assert "sid fcbb:bbbb:1:1::/64 locator loc1 behavior uN" not in frr_config | ||
|
||
appl_db_my_sids = duthost.command("sonic-db-cli APPL_DB keys SRV6_MY_SID_TABLE*")["stdout"] | ||
|
||
# verify that the APPL_DB entry gets cleaned correctly | ||
assert "SRV6_MY_SID_TABLE:32:16:16:0:fcbb:bbbb:1:1::" not in appl_db_my_sids | ||
|
||
|
||
def test_uDT46_config(duthosts, rand_one_dut_hostname): | ||
duthost = duthosts[rand_one_dut_hostname] | ||
|
||
# add Vrf1 config | ||
duthost.command("config vrf add Vrf1") | ||
duthost.command("sysctl -w net.vrf.strict_mode=1") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for sonic testing do we need this > There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, without this setting. uDT46 SID will not get programmed into kernel and APPL_DB There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is needed. |
||
|
||
# add a locator configuration entry | ||
duthost.command("sonic-db-cli CONFIG_DB HSET SRV6_MY_LOCATORS\\|loc1 prefix fcbb:bbbb:1::") | ||
# add a uDT46 sid configuration entry | ||
duthost.command("sonic-db-cli CONFIG_DB HSET SRV6_MY_SIDS\\|loc1\\|fcbb:bbbb:1:2:: action uDT46 decap_vrf Vrf1") | ||
time.sleep(WAIT_TIME) | ||
|
||
frr_config = duthost.command("vtysh -c \"show running-config\"")["stdout"] | ||
|
||
# verify that bgpcfgd generates FRR config correctly | ||
assert "locator loc1" in frr_config | ||
assert "sid fcbb:bbbb:1:2::/64 locator loc1 behavior uDT46 vrf Vrf1" in frr_config | ||
|
||
appl_db_my_sids = duthost.command("sonic-db-cli APPL_DB keys SRV6_MY_SID_TABLE*")["stdout"] | ||
|
||
# verify that APPL_DB gets programmed by FRR correctly | ||
assert "SRV6_MY_SID_TABLE:32:16:16:0:fcbb:bbbb:1:2::" in appl_db_my_sids | ||
|
||
# delete the configurations | ||
duthost.command("sonic-db-cli CONFIG_DB DEL SRV6_MY_LOCATORS\\|loc1") | ||
duthost.command("sonic-db-cli CONFIG_DB DEL SRV6_MY_SIDS\\|loc1\\|fcbb:bbbb:1:2::") | ||
time.sleep(WAIT_TIME) | ||
|
||
frr_config = duthost.command("vtysh -c \"show running-config\"")["stdout"] | ||
|
||
# verify that bgpcfgd deletes relevant FRR config | ||
assert "locator loc1" not in frr_config | ||
assert "sid fcbb:bbbb:1:2::/64 locator loc1 behavior uDT46 vrf Vrf1" not in frr_config | ||
|
||
appl_db_my_sids = duthost.command("sonic-db-cli APPL_DB keys SRV6_MY_SID_TABLE*")["stdout"] | ||
|
||
# verify that the APPL_DB entry gets cleaned correctly | ||
assert "SRV6_MY_SID_TABLE:32:16:16:0:fcbb:bbbb:1:2::" not in appl_db_my_sids | ||
|
||
# delete the Vrf config | ||
duthost.command("config vrf del Vrf1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this test case multi-asic aware for future proof.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated