Skip to content

Commit

Permalink
Changes #5 Fixing compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan committed Jun 15, 2021
1 parent 44b7d4a commit 5db32ee
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 65 deletions.
2 changes: 1 addition & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ bool OrchDaemon::init()
gDirectory.set(vxlan_tunnel_map_orch);
VxlanVrfMapOrch *vxlan_vrf_orch = new VxlanVrfMapOrch(m_applDb, APP_VXLAN_VRF_TABLE_NAME);
gDirectory.set(vxlan_vrf_orch);
VxlanTunnelOrch *vxlan_tunnel_orch; = new VxlanTunnelOrch(m_stateDb, m_applDb, APP_VXLAN_TUNNEL_TABLE_NAME);


EvpnNvoOrch* evpn_nvo_orch = new EvpnNvoOrch(m_applDb, APP_VXLAN_EVPN_NVO_TABLE_NAME);
Expand Down Expand Up @@ -317,6 +316,7 @@ bool OrchDaemon::init()
m_orchList.push_back(chassis_frontend_orch);
m_orchList.push_back(vrf_orch);

VxlanTunnelOrch *vxlan_tunnel_orch = NULL;
if (platform == MLNX_PLATFORM_SUBSTRING)
{
EvpnRemoteVnip2mpOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2mpOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
Expand Down
4 changes: 2 additions & 2 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct VlanMemberEntry

typedef std::map<sai_vlan_id_t, VlanMemberEntry> vlan_members_t;

typedef std::map<string, sai_object_id_t> endpoint_ip_l2mc_group_member_map_t;
typedef std::map<std::string, sai_object_id_t> endpoint_ip_l2mc_group_member_map_t;

struct VlanInfo
{
Expand All @@ -42,7 +42,7 @@ struct VlanInfo
sai_vlan_flood_control_type_t uuc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
sai_vlan_flood_control_type_t umc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
sai_vlan_flood_control_type_t bc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
spai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
sai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
endpoint_ip_l2mc_group_member_map_t l2mc_members;
};

Expand Down
70 changes: 35 additions & 35 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,15 @@ PortsOrch::PortsOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,

if (sai_query_attribute_enum_values_capability(gSwitchId, SAI_OBJECT_TYPE_VLAN,
SAI_VLAN_ATTR_UNKNOWN_UNICAST_FLOOD_CONTROL_TYPE,
values) != SAI_STATUS_SUCCESS)
&values) != SAI_STATUS_SUCCESS)
{
SWSS_LOG_NOTICE("This device does not support unknown unicast flood control types");
}
else
{
for (uint32_t idx = 0; idx < values.count; idx++)
{
uuc_sup_flood_control_type.insert(values.list[idx]);
uuc_sup_flood_control_type.insert(static_cast<sai_vlan_flood_control_type_t>(values.list[idx]));
}
}

Expand All @@ -424,15 +424,15 @@ PortsOrch::PortsOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,

if (sai_query_attribute_enum_values_capability(gSwitchId, SAI_OBJECT_TYPE_VLAN,
SAI_VLAN_ATTR_UNKNOWN_MULTICAST_FLOOD_CONTROL_TYPE,
values) != SAI_STATUS_SUCCESS)
&values) != SAI_STATUS_SUCCESS)
{
SWSS_LOG_NOTICE("This device does not support unknown multicast flood control types");
}
else
{
for (uint32_t idx = 0; idx < values.count; idx++)
{
umc_sup_flood_control_type.insert(values.list[idx]);
umc_sup_flood_control_type.insert(static_cast<sai_vlan_flood_control_type_t>(values.list[idx]));
}
}

Expand All @@ -442,15 +442,15 @@ PortsOrch::PortsOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,

if (sai_query_attribute_enum_values_capability(gSwitchId, SAI_OBJECT_TYPE_VLAN,
SAI_VLAN_ATTR_BROADCAST_FLOOD_CONTROL_TYPE,
values) != SAI_STATUS_SUCCESS)
&values) != SAI_STATUS_SUCCESS)
{
SWSS_LOG_NOTICE("This device does not support broadcast flood control types");
}
else
{
for (uint32_t idx = 0; idx < values.count; idx++)
{
bc_sup_flood_control_type.insert(values.list[idx]);
bc_sup_flood_control_type.insert(static_cast<sai_vlan_flood_control_type_t>(values.list[idx]));
}
}

Expand Down Expand Up @@ -4019,7 +4019,7 @@ bool PortsOrch::addVlan(string vlan_alias)
umc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED;
}

if(bc_sup_flood_control_type.find(SAI_VLAN_ATTR_BROADCAST_FLOOD_CONTROL_TYPE)
if(bc_sup_flood_control_type.find(SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED)
!= umc_sup_flood_control_type.end())
{
attr.id = SAI_VLAN_ATTR_BROADCAST_FLOOD_CONTROL_TYPE;
Expand Down Expand Up @@ -4128,13 +4128,13 @@ bool PortsOrch::getVlanByVlanId(sai_vlan_id_t vlan_id, Port &vlan)
return false;
}

bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string &tagging_mode, string end_point_ip)
bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
{
SWSS_LOG_ENTER();

sai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
sai_status_t status;

sai_attribute_t attr;

if (vlan.m_vlan_info.l2mc_group_id == SAI_NULL_OBJECT_ID)
{
Expand All @@ -4144,7 +4144,6 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string &tagging_mode,
SWSS_LOG_ERROR("Failed to create l2mc flood group");
return false;
}
sai_attribute_t attr;

if (vlan.m_vlan_info.uuc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED)
{
Expand Down Expand Up @@ -4218,19 +4217,20 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string &tagging_mode,

sai_object_id_t l2mc_group_member = SAI_NULL_OBJECT_ID;
status = sai_l2mc_group_api->create_l2mc_group_member(&l2mc_group_member, gSwitchId,
static_cast<uint32>attrs.size(),
static_cast<uint32_t>(attrs.size()),
attrs.data());
if (status != SAI_STATUS_FAILURE)
{
SWSS_LOG_ERROR("Failed to create l2mc group member for adding tunnel %s to vlan %hu",
end_point_ip.c_str(), vlan.m_vlan_info.vlan_id);
return false;
}
vlan.m_vlan_info[end_point_ip] = l2mc_group_member;
vlan.m_vlan_info.l2mc_members[end_point_ip] = l2mc_group_member;
return true;
}

bool PortsOrch::createVlanMember(Port &vlan, Port &port, string &tagging_mode)
bool PortsOrch::createVlanMember(Port &vlan, Port &port, sai_vlan_tagging_mode_t &sai_tagging_mode,
sai_object_id_t &vlan_member_id)
{
SWSS_LOG_ENTER();

Expand All @@ -4245,19 +4245,10 @@ bool PortsOrch::createVlanMember(Port &vlan, Port &port, string &tagging_mode)
attr.value.oid = port.m_bridge_port_id;
attrs.push_back(attr);

sai_vlan_tagging_mode_t sai_tagging_mode = SAI_VLAN_TAGGING_MODE_TAGGED;
attr.id = SAI_VLAN_MEMBER_ATTR_VLAN_TAGGING_MODE;
if (tagging_mode == "untagged")
sai_tagging_mode = SAI_VLAN_TAGGING_MODE_UNTAGGED;
else if (tagging_mode == "tagged")
sai_tagging_mode = SAI_VLAN_TAGGING_MODE_TAGGED;
else if (tagging_mode == "priority_tagged")
sai_tagging_mode = SAI_VLAN_TAGGING_MODE_PRIORITY_TAGGED;
else assert(false);
attr.value.s32 = sai_tagging_mode;
attrs.push_back(attr);

sai_object_id_t vlan_member_id;
sai_status_t status = sai_vlan_api->create_vlan_member(&vlan_member_id, gSwitchId, (uint32_t)attrs.size(), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
Expand All @@ -4275,24 +4266,32 @@ bool PortsOrch::createVlanMember(Port &vlan, Port &port, string &tagging_mode)

}

bool PortsOrch::addVlanMember(Port &vlan, Port &port, string &tagging_mode, string end_point_ip = "")
bool PortsOrch::addVlanMember(Port &vlan, Port &port, string &tagging_mode, string end_point_ip)
{
SWSS_LOG_ENTER();

sai_object_id_t vlan_member_id;
if (!end_point_ip.empty())
{
if (!((vlan.m_vlan_info.uuc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED) ||
(vlan.m_vlan_info.umc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED) ||
(vlan.m_vlan_info.bc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED))
(vlan.m_vlan_info.bc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED)))
{
SWSS_LOG_ERROR("Flood group with end point ip is not supported");
return false;
}
// TODO Check if P2MP bridgeport needs to be added as vlan member
return addVlanFloodGroups(vlan, port, end_point_ip);
}

if(!createVlanMember(vlan, port, tagging_mode))
sai_vlan_tagging_mode_t sai_tagging_mode = SAI_VLAN_TAGGING_MODE_TAGGED;
if (tagging_mode == "untagged")
sai_tagging_mode = SAI_VLAN_TAGGING_MODE_UNTAGGED;
else if (tagging_mode == "tagged")
sai_tagging_mode = SAI_VLAN_TAGGING_MODE_TAGGED;
else if (tagging_mode == "priority_tagged")
sai_tagging_mode = SAI_VLAN_TAGGING_MODE_PRIORITY_TAGGED;
else assert(false);
if(!createVlanMember(vlan, port, sai_tagging_mode, vlan_member_id))
{
return false;
}
Expand All @@ -4319,7 +4318,7 @@ bool PortsOrch::addVlanMember(Port &vlan, Port &port, string &tagging_mode, stri
return true;
}

bool PortsOrch::removeVlanEndPointIP(Port &vlan, Port &port, string end_point_ip)
bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip)
{
SWSS_LOG_ENTER();

Expand All @@ -4328,19 +4327,20 @@ bool PortsOrch::removeVlanEndPointIP(Port &vlan, Port &port, string end_point_ip
if(vlan.m_vlan_info.l2mc_members.find(end_point_ip) == vlan.m_vlan_info.l2mc_members.end())
{
SWSS_LOG_NOTICE("End point ip %s is not part of vlan %hu",
end_point_ip, vlan.m_vlan_info.vlan_id);
end_point_ip.c_str(), vlan.m_vlan_info.vlan_id);
return true;
}

status = sai_l2mc_group_api->remove_l2mc_group_member(vlan.m_vlan_info.l2mc_members[end_point_ip]);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to remove end point ip %s from vlan %hu",
end_point_ip, vlan.m_vlan_info.vlan_id);
end_point_ip.c_str(), vlan.m_vlan_info.vlan_id);
return false;
}
vlan.m_vlan_info.l2mc_members.erase(end_point_ip);
sai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
sai_attribute_t attr;

if (vlan.m_vlan_info.l2mc_members.empty())
{
Expand All @@ -4352,7 +4352,7 @@ bool PortsOrch::removeVlanEndPointIP(Port &vlan, Port &port, string end_point_ip
status = sai_vlan_api->set_vlan_attribute(vlan.m_vlan_info.vlan_oid, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set null l2mc group %"
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for unknown unicast flooding",
vlan.m_vlan_info.vlan_id);
return false;
Expand All @@ -4366,7 +4366,7 @@ bool PortsOrch::removeVlanEndPointIP(Port &vlan, Port &port, string end_point_ip
status = sai_vlan_api->set_vlan_attribute(vlan.m_vlan_info.vlan_oid, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set null l2mc group %"
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for unknown multicast flooding",
vlan.m_vlan_info.vlan_id);
return false;
Expand All @@ -4380,7 +4380,7 @@ bool PortsOrch::removeVlanEndPointIP(Port &vlan, Port &port, string end_point_ip
status = sai_vlan_api->set_vlan_attribute(vlan.m_vlan_info.vlan_oid, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set null l2mc group %"
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for broadcast flooding",
vlan.m_vlan_info.vlan_id);
return false;
Expand All @@ -4397,13 +4397,13 @@ bool PortsOrch::removeVlanEndPointIP(Port &vlan, Port &port, string end_point_ip
return true;
}

bool PortsOrch::removeVlanMember(Port &vlan, Port &port, string end_point_ip="")
bool PortsOrch::removeVlanMember(Port &vlan, Port &port, string end_point_ip)
{
SWSS_LOG_ENTER();

if (!end_point_ip.empty())
{
return removeVlanEndPointIP(vlan, port, end_point_ip);
return removeVlanEndPointIp(vlan, port, end_point_ip);
}
sai_object_id_t vlan_member_id;
sai_vlan_tagging_mode_t sai_tagging_mode;
Expand Down Expand Up @@ -4448,7 +4448,7 @@ bool PortsOrch::removeVlanMember(Port &vlan, Port &port, string end_point_ip="")
return true;
}

bool PortsOrch::isVlanMember(Port &vlan, Port &port, string end_point_ip = "")
bool PortsOrch::isVlanMember(Port &vlan, Port &port, string end_point_ip)
{
if (!end_point_ip.empty())
{
Expand Down
7 changes: 5 additions & 2 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ class PortsOrch : public Orch, public Subject
bool removeTunnel(Port tunnel);
bool addBridgePort(Port &port);
bool removeBridgePort(Port &port);
bool addVlanMember(Port &vlan, Port &port, string& tagging_mode);
bool removeVlanMember(Port &vlan, Port &port);
bool addVlanMember(Port &vlan, Port &port, string& tagging_mode, string end_point_ip = "");
bool removeVlanMember(Port &vlan, Port &port, string end_point_ip = "");
bool isVlanMember(Port &vlan, Port &port, string end_point_ip = "");
bool addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip);
bool createVlanMember(Port &vlan, Port &port, sai_vlan_tagging_mode_t &sai_tagging_mode, sai_object_id_t &vlan_member_id);
bool removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip);

string m_inbandPortName = "";
bool isInbandPort(const string &alias);
Expand Down
2 changes: 1 addition & 1 deletion orchagent/saihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void initSaiApi()
sai_api_query(SAI_API_NAT, (void **)&sai_nat_api);
sai_api_query(SAI_API_SYSTEM_PORT, (void **)&sai_system_port_api);
sai_api_query(SAI_API_MACSEC, (void **)&sai_macsec_api);
sai_api_query(SAI_API_L2MC_GROUP, (void **)&sai_l2mc_group_api_t);
sai_api_query(SAI_API_L2MC_GROUP, (void **)&sai_l2mc_group_api);

sai_log_set(SAI_API_SWITCH, SAI_LOG_LEVEL_NOTICE);
sai_log_set(SAI_API_BRIDGE, SAI_LOG_LEVEL_NOTICE);
Expand Down
Loading

0 comments on commit 5db32ee

Please sign in to comment.