Skip to content

Commit

Permalink
Completed compilation along with changes to the swss common
Browse files Browse the repository at this point in the history
  • Loading branch information
srj102 committed May 20, 2020
1 parent 2ff49ac commit 098bcdb
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 28 deletions.
4 changes: 2 additions & 2 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ bool OrchDaemon::init()
CoppOrch *copp_orch = new CoppOrch(copp_table_connectors);
TunnelDecapOrch *tunnel_decap_orch = new TunnelDecapOrch(m_applDb, APP_TUNNEL_DECAP_TABLE_NAME);

VxlanTunnelOrch *vxlan_tunnel_orch = new VxlanTunnelOrch(m_applDb, APP_VXLAN_TUNNEL_TABLE_NAME);
VxlanTunnelOrch *vxlan_tunnel_orch = new VxlanTunnelOrch(m_stateDb, m_applDb, APP_VXLAN_TUNNEL_TABLE_NAME);
gDirectory.set(vxlan_tunnel_orch);
VxlanTunnelMapOrch *vxlan_tunnel_map_orch = new VxlanTunnelMapOrch(m_applDb, APP_VXLAN_TUNNEL_MAP_TABLE_NAME);
gDirectory.set(vxlan_tunnel_map_orch);
VxlanVrfMapOrch *vxlan_vrf_orch = new VxlanVrfMapOrch(m_applDb, APP_VXLAN_VRF_TABLE_NAME);
gDirectory.set(vxlan_vrf_orch);

EvpnRemoteVniOrch* evpn_remote_vni_orch = new EvpnRemoteVniOrch(m_applDb, APP_EVPN_REMOTE_VNI_TABLE_NAME);
EvpnRemoteVniOrch* evpn_remote_vni_orch = new EvpnRemoteVniOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
gDirectory.set(evpn_remote_vni_orch);

EvpnNvoOrch* evpn_nvo_orch = new EvpnNvoOrch(m_applDb, APP_EVPN_NVO_TABLE_NAME);
Expand Down
7 changes: 4 additions & 3 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ class Port
std::vector<sai_object_id_t> m_queue_ids;
std::vector<sai_object_id_t> m_priority_group_ids;
sai_port_priority_flow_control_mode_t m_pfc_asym = SAI_PORT_PRIORITY_FLOW_CONTROL_MODE_COMBINED;
uint8_t m_pfc_bitmask = 0;
uint32_t m_nat_zone_id = 0;
uint32_t m_vnid = 0xFFFFFFFF;
uint8_t m_pfc_bitmask = 0;
uint32_t m_nat_zone_id = 0;
uint32_t m_vnid = 0xFFFFFFFF;
uint32_t m_fdb_count = 0;

/*
* Following two bit vectors are used to lock
Expand Down
16 changes: 2 additions & 14 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3461,18 +3461,6 @@ bool PortsOrch::isVlanMember(Port &vlan, Port &port)
return true;
}

uint32_t PortsOrch::getNumVlanMember(Port &port)
{
uint32_t num;

if(m_portVlanMember.find(port.m_alias) == m_portVlanMember.end())
return 0;

num =(uint32_t) (m_portVlanMember[port.m_alias].size());

return num;
}

bool PortsOrch::addLag(string lag_alias)
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -3713,7 +3701,7 @@ bool PortsOrch::addTunnel(string tunnel_alias, sai_object_id_t tunnel_id, bool h
else
tunnel.m_learn_mode = "disable";
m_portList[tunnel_alias] = tunnel;
portOidToName[tunnel_id] = tunnel_alias;
//portOidToName[tunnel_id] = tunnel_alias;

SWSS_LOG_WARN("addTunnel:: 0x%lx",tunnel_id);

Expand All @@ -3724,7 +3712,7 @@ bool PortsOrch::removeTunnel(Port tunnel)
{
SWSS_LOG_ENTER();

portOidToName.erase(tunnel.m_tunnel_id);
//portOidToName.erase(tunnel.m_tunnel_id);
m_portList.erase(tunnel.m_alias);

return true;
Expand Down
1 change: 0 additions & 1 deletion orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ class PortsOrch : public Orch, public Subject
bool addVlanMember(Port &vlan, Port &port, string& tagging_mode);
bool removeVlanMember(Port &vlan, Port &port);
bool isVlanMember(Port &vlan, Port &port);
uint32_t getNumVlanMember(Port &port);

bool addLag(string lag);
bool removeLag(Port lag);
Expand Down
71 changes: 65 additions & 6 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "vxlanorch.h"
#include "directory.h"
#include "swssnet.h"
#include "warm_restart.h"
#include "tokenize.h"

/* Global variables */
extern sai_object_id_t gSwitchId;
Expand Down Expand Up @@ -75,6 +77,31 @@ static inline uint32_t tunnel_map_val (MAP_T map_t)
return vxlanTunnelMapKeyVal.at(map_t).second;
}

static inline MAP_T tunnel_map_type (tunnel_map_type_t type, bool isencap)
{
if(isencap)
{
switch(type)
{
case TUNNEL_MAP_T_VLAN : return MAP_T::VLAN_ID_TO_VNI;
case TUNNEL_MAP_T_VIRTUAL_ROUTER: return MAP_T::VRID_TO_VNI;
case TUNNEL_MAP_T_BRIDGE: return MAP_T::BRIDGE_TO_VNI;
default: return MAP_T::MAP_TO_INVALID;
}
}
else
{
switch(type)
{
case TUNNEL_MAP_T_VLAN : return MAP_T::VNI_TO_VLAN_ID;
case TUNNEL_MAP_T_VIRTUAL_ROUTER: return MAP_T::VNI_TO_VRID;
case TUNNEL_MAP_T_BRIDGE: return MAP_T::VNI_TO_BRIDGE;
default: return MAP_T::MAP_TO_INVALID;
}
}
}


//------------------- SAI Interface functions --------------------------//

static sai_object_id_t
Expand Down Expand Up @@ -428,6 +455,32 @@ remove_tunnel_termination(sai_object_id_t term_table_id)

//------------------- VxlanTunnel Implementation --------------------------//

VxlanTunnel::VxlanTunnel(string name, IpAddress srcIp, IpAddress dstIp, tunnel_creation_src_t src)
:tunnel_name_(name), src_ip_(srcIp), dst_ip_(dstIp), src_creation_(src)
{
VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();

if(dstIp.isZero())
{
//tunnel_orch->addVTEP(std::unique_ptr<VxlanTunnel>this,srcIp);
tunnel_orch->addVTEP(this,srcIp);
vtep_ptr = NULL;
}
else
{
vtep_ptr = tunnel_orch->getVTEP(srcIp);
tunnel_orch->addRemoveStateTableEntry(name,srcIp, dstIp,
src, true);
}
}

VxlanTunnel::~VxlanTunnel()
{
VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();
tunnel_orch->addRemoveStateTableEntry(tunnel_name_,src_ip_, dst_ip_,
src_creation_, false);
}

bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl)
{
try
Expand Down Expand Up @@ -811,7 +864,7 @@ bool VxlanTunnel::deleteTunnelHW(uint8_t mapper_list,
ret = sai_tunnel_api->remove_tunnel(ids_.tunnel_id);
SWSS_LOG_INFO("tunnel table delete reststatus = %d",ret);
deleteMapperHW(mapper_list, map_src);
total_diptunnel_del++;
//total_diptunnel_del++;
}

catch (const std::runtime_error& error)
Expand Down Expand Up @@ -843,7 +896,7 @@ bool VxlanTunnel::createTunnelHW(uint8_t mapper_list,
{
swss::copy(ipd, dst_ip_);
ip = &ipd;
total_diptunnel_add++;
//total_diptunnel_add++;
}

ids_.tunnel_id = create_tunnel(&ids_, &ips, ip, gUnderlayIfId);
Expand Down Expand Up @@ -1038,7 +1091,7 @@ bool VxlanTunnel::createDynamicDIPTunnel(const std::string dip, tunnel_user_type

TUNNELMAP_SET_VLAN(mapper_list);
TUNNELMAP_SET_VRF(mapper_list);
dip_tunnel->createTunnelHW(mapper_list,USE_COMMON_ENCAP_DECAP, FALSE);
dip_tunnel->createTunnelHW(mapper_list,USE_COMMON_ENCAP_DECAP, false);
SWSS_LOG_NOTICE("Created P2P Tunnel remote IP %s ", dip.c_str());
}
else
Expand Down Expand Up @@ -1094,7 +1147,7 @@ bool VxlanTunnel::deleteDynamicDIPTunnel(const std::string dip, tunnel_user_type

TUNNELMAP_SET_VLAN(mapper_list);
TUNNELMAP_SET_VRF(mapper_list);
dip_tunnel->deleteTunnelHW(mapper_list,USE_COMMON_ENCAP_DECAP, FALSE);
dip_tunnel->deleteTunnelHW(mapper_list,USE_COMMON_ENCAP_DECAP, false);

tnl_users_.erase(dip);

Expand Down Expand Up @@ -1341,7 +1394,7 @@ bool VxlanTunnelOrch::addOperation(const Request& request)
return true;
}

vxlan_tunnel_table_[tunnel_name] = std::unique_ptr<VxlanTunnel>(new VxlanTunnel(tunnel_name, src_ip, dst_ip), TNL_CREATION_SRC_CLI);
vxlan_tunnel_table_[tunnel_name] = std::unique_ptr<VxlanTunnel>(new VxlanTunnel(tunnel_name, src_ip, dst_ip, TNL_CREATION_SRC_CLI));

SWSS_LOG_NOTICE("Vxlan tunnel '%s' was added", tunnel_name.c_str());
return true;
Expand Down Expand Up @@ -1701,12 +1754,15 @@ bool VxlanTunnelMapOrch::addOperation(const Request& request)
}

tunnel_orch->addVlanMappedToVni(vni_id, vlan_id);

#ifdef L3PR
VRFOrch* vrf_orch = gDirectory.get<VRFOrch*>();
if (0 == vrf_orch->getL3VniVlan(vni_id))
{
SWSS_LOG_NOTICE("update l3vni %d, vlan %d", vni_id, vlan_id);
vrf_orch->updateL3VniVlan(vni_id, vlan_id);
}
#endif

SWSS_LOG_NOTICE("Vxlan tunnel map entry '%s' for tunnel '%s' was created",
tunnel_map_entry_name.c_str(), tunnel_name.c_str());
Expand Down Expand Up @@ -1739,7 +1795,7 @@ bool VxlanTunnelMapOrch::delOperation(const Request& request)

vlanPort.m_vnid = (uint32_t) 0xFFFFFFFF;

auto tunnel_map_entry_id = vxlan_tunnel_map_table_[full_tunnel_map_entry_name];
auto tunnel_map_entry_id = vxlan_tunnel_map_table_[full_tunnel_map_entry_name].map_entry_id;
try
{
remove_tunnel_map_entry(tunnel_map_entry_id);
Expand Down Expand Up @@ -1933,8 +1989,11 @@ bool VxlanVrfMapOrch::delOperation(const Request& request)
return false;
}

#ifdef L3PR
SWSS_LOG_NOTICE("VxlanVrfMapOrch Vxlan vrf map entry '%s' is removed. VRF Refcnt %d", full_map_entry_name.c_str(),
vrf_orch->getVrfRefCount(vrf_name));
#endif

return true;
}

Expand Down
4 changes: 2 additions & 2 deletions orchagent/vxlanorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ class VxlanTunnel

bool deleteMapperHW(uint8_t mapper_list, tunnel_map_src_t map_src);
bool createMapperHW(uint8_t mapper_list, tunnel_map_src_t map_src);
bool createTunnelHW(uint8_t mapper_list, tunnel_map_src_t map_src, bool with_term = TRUE);
bool deleteTunnelHW(uint8_t mapper_list, tunnel_map_src_t map_src, bool with_term = TRUE);
bool createTunnelHW(uint8_t mapper_list, tunnel_map_src_t map_src, bool with_term = true);
bool deleteTunnelHW(uint8_t mapper_list, tunnel_map_src_t map_src, bool with_term = true);
void deletePendingSIPTunnel();
void increment_spurious_imr_add(const std::string remote_vtep);
void increment_spurious_imr_del(const std::string remote_vtep);
Expand Down

0 comments on commit 098bcdb

Please sign in to comment.