Skip to content

Commit

Permalink
Set SAI PL attribute based on ROUTING_TYPE
Browse files Browse the repository at this point in the history
Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
  • Loading branch information
theasianpianist committed Feb 16, 2024
1 parent 37e347f commit 134fd99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions orchagent/dash/dashvnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,6 @@ void DashVnetOrch::addOutboundCaToPa(const string& key, VnetMapBulkContext& ctxt

for (auto action: route_type_actions.items())
{
if (action.action_type() == dash::route_type::ACTION_TYPE_4_to_6)
{
outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION;
outbound_ca_to_pa_attr.value.u32 = SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING;
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);
}

if (action.action_type() == dash::route_type::ACTION_TYPE_STATICENCAP)
{
outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_DASH_ENCAPSULATION;
Expand All @@ -328,6 +321,10 @@ void DashVnetOrch::addOutboundCaToPa(const string& key, VnetMapBulkContext& ctxt

if (ctxt.metadata.action_type() == dash::route_type::ROUTING_TYPE_PRIVATELINK)
{
outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION;
outbound_ca_to_pa_attr.value.u32 = SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING;
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);

outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_UNDERLAY_DIP;
to_sai(ctxt.metadata.underlay_ip(), outbound_ca_to_pa_attr.value.ipaddr);
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dash_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@

@pytest.fixture(scope='module', autouse=True)
def common_setup_teardown(dash_db):
routing_type_msg = ParseDict(ROUTING_TYPE, RouteType())
dash_db.create_routing_type("privatelink", {"pb": routing_type_msg.SerializeToString()})
pb = Vnet()
pb.vni = int("45654")
pb.guid.value = bytes.fromhex(uuid.UUID("559c6ce8-26ab-4193-b946-ccc6e8f930b2").hex)
Expand All @@ -112,8 +114,6 @@ def common_setup_teardown(dash_db):
eni_msg = ParseDict(ENI, Eni())
eni = "F4939FEFC47E"
dash_db.create_eni(eni, {"pb": eni_msg.SerializeToString()})
routing_type_msg = ParseDict(ROUTING_TYPE, RouteType())
dash_db.create_routing_type("privatelink", {"pb": routing_type_msg.SerializeToString()})
vnet_mapping_msg = ParseDict(VNET_MAPPING, VnetMapping())
vnet_map_ip = "10.1.1.1"
dash_db.create_vnet_map(vnet, vnet_map_ip, {"pb": vnet_mapping_msg.SerializeToString()})
Expand Down

0 comments on commit 134fd99

Please sign in to comment.