Skip to content

Commit

Permalink
Changes #9 UT fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan committed Jun 30, 2021
1 parent e2fa96c commit cb9a8af
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 1,166 deletions.
26 changes: 26 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ sai_object_id_t gUnderlayIfId;
sai_object_id_t gSwitchId = SAI_NULL_OBJECT_ID;
MacAddress gMacAddress;
MacAddress gVxlanMacAddress;
bool gP2PTunnelSupported;

#define DEFAULT_BATCH_SIZE 128
int gBatchSize = DEFAULT_BATCH_SIZE;
Expand Down Expand Up @@ -601,6 +602,31 @@ int main(int argc, char **argv)

init_gearbox_phys(&appl_db);

uint32_t max_tunnel_modes = 2;
vector<int32_t> tunnel_peer_modes(max_tunnel_modes, 0);
sai_s32_list_t values;
values.count = max_tunnel_modes;
values.list = tunnel_peer_modes.data();

status = sai_query_attribute_enum_values_capability(gSwitchId, SAI_OBJECT_TYPE_TUNNEL,
SAI_TUNNEL_ATTR_PEER_MODE, &values);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_WARN("Unable to get supported tunnel peer modes. Defaulting to P2P");
gP2PTunnelSupported = true;
}
else
{
gP2PTunnelSupported = false;
for (uint32_t idx = 0; idx < values.count; idx++)
{
if (values.list[idx] == SAI_TUNNEL_PEER_MODE_P2P)
{
gP2PTunnelSupported = true;
break;
}
}
}
auto orchDaemon = make_shared<OrchDaemon>(&appl_db, &config_db, &state_db, chassis_app_db.get());

if (!orchDaemon->init())
Expand Down
24 changes: 10 additions & 14 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using namespace swss;
extern sai_switch_api_t* sai_switch_api;
extern sai_object_id_t gSwitchId;
extern bool gSaiRedisLogRotate;
extern bool gP2PTunnelSupported;

extern void syncd_apply_view();
/*
Expand Down Expand Up @@ -160,6 +161,9 @@ bool OrchDaemon::init()
EvpnNvoOrch* evpn_nvo_orch = new EvpnNvoOrch(m_applDb, APP_VXLAN_EVPN_NVO_TABLE_NAME);
gDirectory.set(evpn_nvo_orch);

VxlanTunnelOrch *vxlan_tunnel_orch = new VxlanTunnelOrch(m_stateDb, m_applDb,
APP_VXLAN_TUNNEL_TABLE_NAME, gP2PTunnelSupported);
gDirectory.set(vxlan_tunnel_orch);

vector<string> qos_tables = {
CFG_TC_TO_QUEUE_MAP_TABLE_NAME,
Expand Down Expand Up @@ -315,28 +319,20 @@ bool OrchDaemon::init()
m_orchList.push_back(gAclOrch);
m_orchList.push_back(chassis_frontend_orch);
m_orchList.push_back(vrf_orch);
m_orchList.push_back(vxlan_tunnel_orch);
m_orchList.push_back(evpn_nvo_orch);
m_orchList.push_back(vxlan_tunnel_map_orch);

VxlanTunnelOrch *vxlan_tunnel_orch = NULL;
if (platform == MLNX_PLATFORM_SUBSTRING)
if (gP2PTunnelSupported)
{
EvpnRemoteVnip2mpOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2mpOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
EvpnRemoteVnip2pOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2pOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
gDirectory.set(evpn_remote_vni_orch);
vxlan_tunnel_orch = new VxlanTunnelOrch(m_stateDb, m_applDb, APP_VXLAN_TUNNEL_TABLE_NAME, false);
gDirectory.set(vxlan_tunnel_orch);
m_orchList.push_back(vxlan_tunnel_orch);
m_orchList.push_back(evpn_nvo_orch);
m_orchList.push_back(vxlan_tunnel_map_orch);
m_orchList.push_back(evpn_remote_vni_orch);
}
else
{
EvpnRemoteVnip2pOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2pOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
EvpnRemoteVnip2mpOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2mpOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
gDirectory.set(evpn_remote_vni_orch);
vxlan_tunnel_orch = new VxlanTunnelOrch(m_stateDb, m_applDb, APP_VXLAN_TUNNEL_TABLE_NAME, true);
gDirectory.set(vxlan_tunnel_orch);
m_orchList.push_back(vxlan_tunnel_orch);
m_orchList.push_back(evpn_nvo_orch);
m_orchList.push_back(vxlan_tunnel_map_orch);
m_orchList.push_back(evpn_remote_vni_orch);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/evpn_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ def check_vrf_routes_ecmp(self, dvs, prefix, vrf_name, tunnel, nh_count, no_upda
vr_ids = self.vrf_route_ids(dvs, vrf_name)
count = len(vr_ids)

new_nhg = get_created_entry(asic_db, self.ASIC_NEXT_HOP_GRP, self.nhop_grp)
new_nhg = self.helper.get_created_entry(asic_db, self.ASIC_NEXT_HOP_GRP, self.nhop_grp)
self.nh_grp_id.add(new_nhg)

if no_update:
Expand Down
1 change: 1 addition & 0 deletions tests/mock_tests/mock_orchagent_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bool gSairedisRecord = true;
bool gSwssRecord = true;
bool gLogRotate = false;
bool gSaiRedisLogRotate = false;
bool gP2PTunnelSupported = true;
ofstream gRecordOfs;
string gRecordFile;
string gMySwitchType = "switch";
Expand Down
1 change: 1 addition & 0 deletions tests/mock_tests/mock_orchagent_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extern MacAddress gVxlanMacAddress;
extern sai_object_id_t gSwitchId;
extern sai_object_id_t gVirtualRouterId;
extern sai_object_id_t gUnderlayIfId;
extern bool gP2PTunnelSupported;

extern SwitchOrch *gSwitchOrch;
extern CrmOrch *gCrmOrch;
Expand Down
4 changes: 3 additions & 1 deletion tests/test_evpn_fdb_p2mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import time
from evpn_tunnel import VxlanTunnel,VxlanEvpnHelper

DVS_FAKE_PLATFORM = "mellanox"

def get_vxlan_p2mp_tunnel_bp(db, src_ip):
tnl_id = None
bp = None
Expand Down Expand Up @@ -47,7 +49,7 @@ def get_vxlan_p2mp_tunnel_bp(db, src_ip):
return bp


def test_evpnFdb(dvs, testlog):
def test_evpnFdbP2MP(dvs, testlog):
vxlan_obj = VxlanTunnel()
helper = VxlanEvpnHelper()
dvs.setup_db()
Expand Down
Loading

0 comments on commit cb9a8af

Please sign in to comment.