Skip to content
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

[orchagent]: srv6orch support for uSID #2335

Merged
merged 3 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion orchagent/srv6orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,39 @@ bool Srv6Orch::sidEntryEndpointBehavior(string action, sai_my_sid_entry_endpoint
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT_RED;
}
else if (action == "udx6")
svshah-intel marked this conversation as resolved.
Show resolved Hide resolved
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX6;
}
else if (action == "udx4")
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX4;
}
else if (action == "udt4")
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4;
}
else if (action == "udt6")
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6;
}
else if (action == "udt46")
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46;
}
else if (action == "un")
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_UN;
end_flavor = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD;
}
else if (action == "ua")
{
end_behavior = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_UA;
end_flavor = SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD;
}
else
{
SWSS_LOG_ERROR("Invalid endpoing behavior function");
SWSS_LOG_ERROR("Invalid endpoint behavior function");
return false;
}
return true;
Expand Down
19 changes: 18 additions & 1 deletion tests/test_srv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_mysid(self, dvs, testlog):
# create MySID entries
mysid1='16:8:8:8:baba:2001:10::'
mysid2='16:8:8:8:baba:2001:20::'
mysid3='16:8:8:8:fcbb:bb01:800::'

# create MySID END
fvs = swsscommon.FieldValuePairs([('action', 'end')])
Expand Down Expand Up @@ -90,14 +91,30 @@ def test_mysid(self, dvs, testlog):
elif fv[0] == "SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR":
assert fv[1] == "SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46"

# create MySID uN
fvs = swsscommon.FieldValuePairs([('action', 'un')])
key = self.create_mysid(mysid3, fvs)

# check ASIC MySID database
mysid = json.loads(key)
assert mysid["sid"] == "fcbb:bb01:800::"
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_ENDPOINT_BEHAVIOR":
assert fv[1] == "SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_UN"
elif fv[0] == "SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR_FLAVOR":
assert fv[1] == "SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD"

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

# remove vrf
self.remove_vrf("VrfDt46")


class TestSrv6(object):
def setup_db(self, dvs):
self.pdb = dvs.get_app_db()
Expand Down