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

[dashorch] minor fix #3302

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
14 changes: 14 additions & 0 deletions orchagent/dash/dashorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,20 @@ bool DashOrch::addEniObject(const string& eni, EniEntry& entry)
sai_attribute_t eni_attr;
vector<sai_attribute_t> eni_attrs;

eni_attr.id = SAI_ENI_ATTR_OUTBOUND_ROUTING_GROUP_ID;
DashRouteOrch *dash_route_orch = gDirectory.get<DashRouteOrch*>();
sai_object_id_t route_group_oid =
dash_route_orch->getRouteGroupOid(entry.metadata.group_id());
if (route_group_oid != SAI_NULL_OBJECT_ID)
{
eni_attr.value.oid = route_group_oid;
eni_attrs.push_back(eni_attr);
}
else {
SWSS_LOG_WARN("Failed to find route group %s for ENI %s",
entry.metadata.group_id().c_str(), eni.c_str());
}

eni_attr.id = SAI_ENI_ATTR_VNET_ID;
eni_attr.value.oid = gVnetNameToId[entry.metadata.vnet()];
eni_attrs.push_back(eni_attr);
Expand Down
74 changes: 41 additions & 33 deletions orchagent/dash/dashvnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,47 +285,44 @@ void DashVnetOrch::addOutboundCaToPa(const string& key, VnetMapBulkContext& ctxt
auto& object_statuses = ctxt.outbound_ca_to_pa_object_statuses;
sai_attribute_t outbound_ca_to_pa_attr;
vector<sai_attribute_t> outbound_ca_to_pa_attrs;

DashOrch* dash_orch = gDirectory.get<DashOrch*>();
dash::route_type::RouteType route_type_actions;
if (!dash_orch->getRouteTypeActions(ctxt.metadata.routing_type(), route_type_actions))
{
SWSS_LOG_INFO("Failed to get route type actions for %s", key.c_str());
}

for (auto action: route_type_actions.items())
if (ctxt.metadata.routing_type() == dash::route_type::ROUTING_TYPE_PRIVATELINK)
{
if (action.action_type() == dash::route_type::ACTION_TYPE_STATICENCAP)
DashOrch* dash_orch = gDirectory.get<DashOrch*>();
dash::route_type::RouteType route_type_actions;
if (!dash_orch->getRouteTypeActions(ctxt.metadata.routing_type(), route_type_actions))
{
outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_DASH_ENCAPSULATION;
if (action.encap_type() == dash::route_type::ENCAP_TYPE_VXLAN)
{
outbound_ca_to_pa_attr.value.u32 = SAI_DASH_ENCAPSULATION_VXLAN;
}
else if (action.encap_type() == dash::route_type::ENCAP_TYPE_NVGRE)
{
outbound_ca_to_pa_attr.value.u32 = SAI_DASH_ENCAPSULATION_NVGRE;
}
else
{
SWSS_LOG_ERROR("Invalid encap type %d for %s", action.encap_type(), key.c_str());
return;
}
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);
SWSS_LOG_INFO("Failed to get route type actions for %s", key.c_str());
}

outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_TUNNEL_KEY;
outbound_ca_to_pa_attr.value.u32 = action.vni();
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);
for (auto action: route_type_actions.items())
{
if (action.action_type() == dash::route_type::ACTION_TYPE_STATICENCAP)
{
// Attrs DASH_ENCAPSULATION and TUNNEL_KEY are only for PRIVATE_LINK_MAPPING
outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_DASH_ENCAPSULATION;
if (action.encap_type() == dash::route_type::ENCAP_TYPE_VXLAN)
{
outbound_ca_to_pa_attr.value.u32 = SAI_DASH_ENCAPSULATION_VXLAN;
}
else if (action.encap_type() == dash::route_type::ENCAP_TYPE_NVGRE)
{
outbound_ca_to_pa_attr.value.u32 = SAI_DASH_ENCAPSULATION_NVGRE;
}
else
{
SWSS_LOG_ERROR("Invalid encap type %d for %s", action.encap_type(), key.c_str());
return;
}
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);
outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_TUNNEL_KEY;
outbound_ca_to_pa_attr.value.u32 = action.vni();
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);

}
}
}

if (ctxt.metadata.routing_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);
Expand All @@ -348,6 +345,17 @@ void DashVnetOrch::addOutboundCaToPa(const string& key, VnetMapBulkContext& ctxt
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);
}

else if (ctxt.metadata.routing_type() == dash::route_type::ROUTING_TYPE_VNET_ENCAP)
{
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_TUNNEL_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);

outbound_ca_to_pa_attr.id = SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_OVERLAY_DMAC;
memcpy(outbound_ca_to_pa_attr.value.mac, ctxt.metadata.mac_address().c_str(), sizeof(sai_mac_t));
outbound_ca_to_pa_attrs.push_back(outbound_ca_to_pa_attr);
Expand Down
Loading