Skip to content

Commit

Permalink
[orchagent, SRv6]: mysid support to set default vrf (sonic-net#2405)
Browse files Browse the repository at this point in the history
* [orchagent, SRv6]: mysid support to set default vrf
  • Loading branch information
link19430 authored Apr 12, 2023
1 parent 71b781f commit f139f12
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion orchagent/srv6orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,11 @@ bool Srv6Orch::createUpdateMysidEntry(string my_sid_string, const string dt_vrf,
{
sai_object_id_t dt_vrf_id;
SWSS_LOG_INFO("DT VRF name %s", dt_vrf.c_str());
if (m_vrfOrch->isVRFexists(dt_vrf))
if (dt_vrf == "default")
{
dt_vrf_id = gVirtualRouterId;
}
else if (m_vrfOrch->isVRFexists(dt_vrf))
{
SWSS_LOG_INFO("VRF %s exists in DB", dt_vrf.c_str());
dt_vrf_id = m_vrfOrch->getVRFid(dt_vrf);
Expand Down
18 changes: 18 additions & 0 deletions tests/test_srv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def test_mysid(self, dvs, testlog):
mysid1='16:8:8:8:baba:2001:10::'
mysid2='16:8:8:8:baba:2001:20::'
mysid3='16:8:8:8:fcbb:bb01:800::'
mysid4='16:8:8:8:baba:2001:40::'

# create MySID END
fvs = swsscommon.FieldValuePairs([('action', 'end')])
Expand Down Expand Up @@ -107,10 +108,27 @@ def test_mysid(self, dvs, testlog):
elif fv[0] == "SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR_FLAVOR":
assert fv[1] == "SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD"

# create MySID END.DT4 with default vrf
fvs = swsscommon.FieldValuePairs([('action', 'end.dt4'), ('vrf', 'default')])
key = self.create_mysid(mysid4, fvs)

# check ASIC MySID database
mysid = json.loads(key)
assert mysid["sid"] == "baba:2001:40::"
tbl = swsscommon.Table(self.adb.db_connection, "ASIC_STATE:SAI_OBJECT_TYPE_MY_SID_ENTRY")
(status, fvs) = tbl.get(key)
assert status == True
for fv in fvs:
if fv[0] == "SAI_MY_SID_ENTRY_ATTR_VRF":
assert True
elif fv[0] == "SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR":
assert fv[1] == "SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4"

# delete MySID
self.remove_mysid(mysid1)
self.remove_mysid(mysid2)
self.remove_mysid(mysid3)
self.remove_mysid(mysid4)

# remove vrf
self.remove_vrf("VrfDt46")
Expand Down

0 comments on commit f139f12

Please sign in to comment.