diff --git a/cfgmgr/intfmgr.cpp b/cfgmgr/intfmgr.cpp index 34b82d3c06..c8cb075574 100644 --- a/cfgmgr/intfmgr.cpp +++ b/cfgmgr/intfmgr.cpp @@ -707,6 +707,8 @@ void IntfMgr::doTask(Consumer &consumer) SWSS_LOG_ENTER(); static bool replayDone = false; + string table_name = consumer.getTableName(); + auto it = consumer.m_toSync.begin(); while (it != consumer.m_toSync.end()) { @@ -718,6 +720,16 @@ void IntfMgr::doTask(Consumer &consumer) if (keys.size() == 1) { + if((table_name == CFG_VOQ_INBAND_INTERFACE_TABLE_NAME) && + (op == SET_COMMAND)) + { + //No further processing needed. Just relay to orchagent + m_appIntfTableProducer.set(keys[0], data); + m_stateIntfTable.hset(keys[0], "vrf", ""); + + it = consumer.m_toSync.erase(it); + continue; + } if (!doIntfGeneralTask(keys, data, op)) { it++; diff --git a/cfgmgr/intfmgrd.cpp b/cfgmgr/intfmgrd.cpp index d92aff9ceb..d6ed18526e 100644 --- a/cfgmgr/intfmgrd.cpp +++ b/cfgmgr/intfmgrd.cpp @@ -47,6 +47,7 @@ int main(int argc, char **argv) CFG_VLAN_INTF_TABLE_NAME, CFG_LOOPBACK_INTERFACE_TABLE_NAME, CFG_VLAN_SUB_INTF_TABLE_NAME, + CFG_VOQ_INBAND_INTERFACE_TABLE_NAME, }; DBConnector cfgDb("CONFIG_DB", 0); diff --git a/cfgmgr/nbrmgr.cpp b/cfgmgr/nbrmgr.cpp index 0b256cc318..fc94e77127 100644 --- a/cfgmgr/nbrmgr.cpp +++ b/cfgmgr/nbrmgr.cpp @@ -11,6 +11,7 @@ #include "nbrmgr.h" #include "exec.h" #include "shellcmd.h" +#include "subscriberstatetable.h" using namespace swss; @@ -64,6 +65,20 @@ NbrMgr::NbrMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, con TableConsumable::DEFAULT_POP_BATCH_SIZE, default_orch_pri); auto consumer = new Consumer(consumerStateTable, this, APP_NEIGH_RESOLVE_TABLE_NAME); Orch::addExecutor(consumer); + + string swtype; + Table cfgDeviceMetaDataTable(cfgDb, CFG_DEVICE_METADATA_TABLE_NAME); + if(cfgDeviceMetaDataTable.hget("localhost", "switch_type", swtype)) + { + //If this is voq system, let the neighbor manager subscribe to state of SYSTEM_NEIGH + //entries. This is used to program static neigh and static route in kernel for remote neighbors. + if(swtype == "voq") + { + string tableName = STATE_SYSTEM_NEIGH_TABLE_NAME; + Orch::addExecutor(new Consumer(new SubscriberStateTable(stateDb, tableName, TableConsumable::DEFAULT_POP_BATCH_SIZE, 0), this, tableName)); + m_cfgVoqInbandInterfaceTable = unique_ptr(new Table(cfgDb, CFG_VOQ_INBAND_INTERFACE_TABLE_NAME)); + } + } } bool NbrMgr::isIntfStateOk(const string &alias) @@ -294,8 +309,253 @@ void NbrMgr::doTask(Consumer &consumer) } else if (table_name == APP_NEIGH_RESOLVE_TABLE_NAME) { doResolveNeighTask(consumer); - } else + } else if(table_name == STATE_SYSTEM_NEIGH_TABLE_NAME) + { + doStateSystemNeighTask(consumer); + } + else { SWSS_LOG_ERROR("Unknown REDIS table %s ", table_name.c_str()); } } + +void NbrMgr::doStateSystemNeighTask(Consumer &consumer) +{ + SWSS_LOG_ENTER(); + + //Get the name of the device on which the neigh and route are + //going to be programmed. + string nbr_odev; + if(!getVoqInbandInterfaceName(nbr_odev)) + { + //The inband interface is not available yet + return; + } + + auto it = consumer.m_toSync.begin(); + while (it != consumer.m_toSync.end()) + { + KeyOpFieldsValuesTuple t = it->second; + string key = kfvKey(t); + string op = kfvOp(t); + + size_t found = key.find_last_of(state_db_key_delimiter); + if (found == string::npos) + { + SWSS_LOG_ERROR("Failed to parse key %s", key.c_str()); + it = consumer.m_toSync.erase(it); + continue; + } + + IpAddress ip_address(key.substr(found+1)); + if (op == SET_COMMAND) + { + MacAddress mac_address; + for (auto i = kfvFieldsValues(t).begin(); + i != kfvFieldsValues(t).end(); i++) + { + if (fvField(*i) == "neigh") + mac_address = MacAddress(fvValue(*i)); + } + + if (!isIntfStateOk(nbr_odev)) + { + SWSS_LOG_DEBUG("Interface %s is not ready, skipping system neigh %s'", nbr_odev.c_str(), kfvKey(t).c_str()); + it++; + continue; + } + + if (!addKernelNeigh(nbr_odev, ip_address, mac_address)) + { + SWSS_LOG_ERROR("Neigh entry add on dev %s failed for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + it++; + continue; + } + else + { + SWSS_LOG_NOTICE("Neigh entry added on dev %s for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + } + + if (!addKernelRoute(nbr_odev, ip_address)) + { + SWSS_LOG_ERROR("Route entry add on dev %s failed for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + delKernelNeigh(nbr_odev, ip_address); + it++; + continue; + } + else + { + SWSS_LOG_NOTICE("Route entry added on dev %s for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + } + SWSS_LOG_NOTICE("Added voq neighbor %s to kernel", kfvKey(t).c_str()); + } + else if (op == DEL_COMMAND) + { + if (!delKernelRoute(ip_address)) + { + SWSS_LOG_ERROR("Route entry on dev %s delete failed for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + } + else + { + SWSS_LOG_NOTICE("Route entry on dev %s deleted for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + } + + if (!delKernelNeigh(nbr_odev, ip_address)) + { + SWSS_LOG_ERROR("Neigh entry on dev %s delete failed for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + } + else + { + SWSS_LOG_NOTICE("Neigh entry on dev %s deleted for '%s'", nbr_odev.c_str(), kfvKey(t).c_str()); + } + SWSS_LOG_DEBUG("Deleted voq neighbor %s from kernel", kfvKey(t).c_str()); + } + + it = consumer.m_toSync.erase(it); + } +} + +bool NbrMgr::getVoqInbandInterfaceName(string &ibif) +{ + + vector keys; + m_cfgVoqInbandInterfaceTable->getKeys(keys); + + if (keys.empty()) + { + SWSS_LOG_NOTICE("Voq Inband interface is not configured!"); + return false; + } + //key:"alias" = inband interface name + vector if_keys = tokenize(keys[0], config_db_key_delimiter); + ibif = if_keys[0]; + return true; +} + +bool NbrMgr::addKernelRoute(string odev, IpAddress ip_addr) +{ + string cmd, res; + + SWSS_LOG_ENTER(); + + string ip_str = ip_addr.to_string(); + + if(ip_addr.isV4()) + { + cmd = string("") + IP_CMD + " route add " + ip_str + "/32 dev " + odev; + SWSS_LOG_NOTICE("IPv4 Route Add cmd: %s",cmd.c_str()); + } + else + { + cmd = string("") + IP_CMD + " -6 route add " + ip_str + "/128 dev " + odev; + SWSS_LOG_NOTICE("IPv6 Route Add cmd: %s",cmd.c_str()); + } + + int32_t ret = swss::exec(cmd, res); + + if(ret) + { + /* Just log error and return */ + SWSS_LOG_ERROR("Failed to add route for %s, error: %d", ip_str.c_str(), ret); + return false; + } + + SWSS_LOG_INFO("Added route for %s on device %s", ip_str.c_str(), odev.c_str()); + return true; +} + +bool NbrMgr::delKernelRoute(IpAddress ip_addr) +{ + string cmd, res; + + SWSS_LOG_ENTER(); + + string ip_str = ip_addr.to_string(); + + if(ip_addr.isV4()) + { + cmd = string("") + IP_CMD + " route del " + ip_str + "/32"; + SWSS_LOG_NOTICE("IPv4 Route Del cmd: %s",cmd.c_str()); + } + else + { + cmd = string("") + IP_CMD + " -6 route del " + ip_str + "/128"; + SWSS_LOG_NOTICE("IPv6 Route Del cmd: %s",cmd.c_str()); + } + + int32_t ret = swss::exec(cmd, res); + + if(ret) + { + /* Just log error and return */ + SWSS_LOG_ERROR("Failed to delete route for %s, error: %d", ip_str.c_str(), ret); + return false; + } + + SWSS_LOG_INFO("Deleted route for %s", ip_str.c_str()); + return true; +} + +bool NbrMgr::addKernelNeigh(string odev, IpAddress ip_addr, MacAddress mac_addr) +{ + SWSS_LOG_ENTER(); + + string cmd, res; + string ip_str = ip_addr.to_string(); + string mac_str = mac_addr.to_string(); + + if(ip_addr.isV4()) + { + cmd = string("") + IP_CMD + " neigh add " + ip_str + " lladdr " + mac_str + " dev " + odev; + SWSS_LOG_NOTICE("IPv4 Nbr Add cmd: %s",cmd.c_str()); + } + else + { + cmd = string("") + IP_CMD + " -6 neigh add " + ip_str + " lladdr " + mac_str + " dev " + odev; + SWSS_LOG_NOTICE("IPv6 Nbr Add cmd: %s",cmd.c_str()); + } + + int32_t ret = swss::exec(cmd, res); + + if(ret) + { + /* Just log error and return */ + SWSS_LOG_ERROR("Failed to add Nbr for %s, error: %d", ip_str.c_str(), ret); + return false; + } + + SWSS_LOG_INFO("Added Nbr for %s on interface %s", ip_str.c_str(), odev.c_str()); + return true; +} + +bool NbrMgr::delKernelNeigh(string odev, IpAddress ip_addr) +{ + string cmd, res; + + SWSS_LOG_ENTER(); + + string ip_str = ip_addr.to_string(); + + if(ip_addr.isV4()) + { + cmd = string("") + IP_CMD + " neigh del " + ip_str + " dev " + odev; + SWSS_LOG_NOTICE("IPv4 Nbr Del cmd: %s",cmd.c_str()); + } + else + { + cmd = string("") + IP_CMD + " -6 neigh del " + ip_str + " dev " + odev; + SWSS_LOG_NOTICE("IPv6 Nbr Del cmd: %s",cmd.c_str()); + } + + int32_t ret = swss::exec(cmd, res); + + if(ret) + { + /* Just log error and return */ + SWSS_LOG_ERROR("Failed to delete Nbr for %s, error: %d", ip_str.c_str(), ret); + return false; + } + + SWSS_LOG_INFO("Deleted Nbr for %s on interface %s", ip_str.c_str(), odev.c_str()); + return true; +} diff --git a/cfgmgr/nbrmgr.h b/cfgmgr/nbrmgr.h index 3a56c4b6cc..d6018c18e9 100644 --- a/cfgmgr/nbrmgr.h +++ b/cfgmgr/nbrmgr.h @@ -29,6 +29,13 @@ class NbrMgr : public Orch void doResolveNeighTask(Consumer &consumer); void doSetNeighTask(Consumer &consumer); void doTask(Consumer &consumer); + void doStateSystemNeighTask(Consumer &consumer); + bool getVoqInbandInterfaceName(string &nbr_odev); + bool addKernelRoute(string odev, IpAddress ip_addr); + bool delKernelRoute(IpAddress ip_addr); + bool addKernelNeigh(string odev, IpAddress ip_addr, MacAddress mac_addr); + bool delKernelNeigh(string odev, IpAddress ip_addr); + unique_ptr
m_cfgVoqInbandInterfaceTable; Table m_statePortTable, m_stateLagTable, m_stateVlanTable, m_stateIntfTable, m_stateNeighRestoreTable; struct nl_sock *m_nl_sock; diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index c5f46d01d3..29c774d9a9 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -16,6 +16,7 @@ #include "bufferorch.h" #include "directory.h" #include "vnetorch.h" +#include "subscriberstatetable.h" extern sai_object_id_t gVirtualRouterId; extern Directory gDirectory; @@ -32,6 +33,8 @@ extern RouteOrch *gRouteOrch; extern CrmOrch *gCrmOrch; extern BufferOrch *gBufferOrch; extern bool gIsNatSupported; +extern NeighOrch *gNeighOrch; +extern string gMySwitchType; const int intfsorch_pri = 35; @@ -51,7 +54,7 @@ static const vector rifStatIds = SAI_ROUTER_INTERFACE_STAT_OUT_ERROR_OCTETS, }; -IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch) : +IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch, DBConnector *chassisAppDb) : Orch(db, tableName, intfsorch_pri), m_vrfOrch(vrf_orch) { SWSS_LOG_ENTER(); @@ -95,6 +98,15 @@ IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch) : { SWSS_LOG_WARN("RIF flex counter group plugins was not set successfully: %s", e.what()); } + + if(gMySwitchType == "voq") + { + //Add subscriber to process VOQ system interface + tableName = CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME; + Orch::addExecutor(new Consumer(new SubscriberStateTable(chassisAppDb, tableName, TableConsumable::DEFAULT_POP_BATCH_SIZE, 0), this, tableName)); + m_tableVoqSystemInterfaceTable = unique_ptr
(new Table(chassisAppDb, CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME)); + } + } sai_object_id_t IntfsOrch::getRouterIntfsId(const string &alias) @@ -452,6 +464,15 @@ bool IntfsOrch::setIntf(const string& alias, sai_object_id_t vrf_id, const IpPre addIp2MeRoute(port.m_vr_id, *ip_prefix); + if(gMySwitchType == "voq") + { + if(gPortsOrch->isInbandPort(alias)) + { + //Need to sync the inband intf neighbor for other asics + gNeighOrch->addInbandNeighbor(alias, ip_prefix->getIp()); + } + } + if (port.m_type == Port::VLAN) { addDirectedBroadcast(port, *ip_prefix); @@ -475,6 +496,14 @@ bool IntfsOrch::removeIntf(const string& alias, sai_object_id_t vrf_id, const Ip { removeIp2MeRoute(port.m_vr_id, *ip_prefix); + if(gMySwitchType == "voq") + { + if(gPortsOrch->isInbandPort(alias)) + { + gNeighOrch->delInbandNeighbor(alias, ip_prefix->getIp()); + } + } + if(port.m_type == Port::VLAN) { removeDirectedBroadcast(port, *ip_prefix); @@ -519,6 +548,8 @@ void IntfsOrch::doTask(Consumer &consumer) return; } + string table_name = consumer.getTableName(); + auto it = consumer.m_toSync.begin(); while (it != consumer.m_toSync.end()) { @@ -543,6 +574,16 @@ void IntfsOrch::doTask(Consumer &consumer) ip_prefix_in_key = true; } + if(table_name == CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME) + { + if(!isRemoteSystemPortIntf(alias)) + { + //Synced local interface. Skip + it = consumer.m_toSync.erase(it); + continue; + } + } + const vector& data = kfvFieldsValues(t); string vrf_name = "", vnet_name = "", nat_zone = ""; MacAddress mac; @@ -551,6 +592,7 @@ void IntfsOrch::doTask(Consumer &consumer) bool adminUp; uint32_t nat_zone_id = 0; string proxy_arp = ""; + string inband_type = ""; for (auto idx : data) { @@ -630,6 +672,10 @@ void IntfsOrch::doTask(Consumer &consumer) { proxy_arp = value; } + else if (field == "inband_type") + { + inband_type = value; + } } if (alias == "eth0" || alias == "docker0") @@ -683,6 +729,16 @@ void IntfsOrch::doTask(Consumer &consumer) continue; } + //Voq Inband interface config processing + if(inband_type.size() && !ip_prefix_in_key) + { + if(!gPortsOrch->setVoqInbandIntf(alias, inband_type)) + { + it++; + continue; + } + } + Port port; if (!gPortsOrch->getPort(alias, port)) { @@ -925,6 +981,7 @@ bool IntfsOrch::addRouterIntfs(sai_object_id_t vrf_id, Port &port) { case Port::PHY: case Port::LAG: + case Port::SYSTEM: attr.value.s32 = SAI_ROUTER_INTERFACE_TYPE_PORT; attrs.push_back(attr); break; @@ -944,6 +1001,7 @@ bool IntfsOrch::addRouterIntfs(sai_object_id_t vrf_id, Port &port) switch(port.m_type) { case Port::PHY: + case Port::SYSTEM: attr.id = SAI_ROUTER_INTERFACE_ATTR_PORT_ID; attr.value.oid = port.m_port_id; attrs.push_back(attr); @@ -1008,6 +1066,12 @@ bool IntfsOrch::addRouterIntfs(sai_object_id_t vrf_id, Port &port) SWSS_LOG_NOTICE("Create router interface %s MTU %u", port.m_alias.c_str(), port.m_mtu); + if(gMySwitchType == "voq") + { + // Sync the interface of local port/LAG to the SYSTEM_INTERFACE table of CHASSIS_APP_DB + voqSyncAddIntf(port.m_alias); + } + return true; } @@ -1038,6 +1102,12 @@ bool IntfsOrch::removeRouterIntfs(Port &port) SWSS_LOG_NOTICE("Remove router interface for port %s", port.m_alias.c_str()); + if(gMySwitchType == "voq") + { + // Sync the removal of interface of local port/LAG to the SYSTEM_INTERFACE table of CHASSIS_APP_DB + voqSyncDelIntf(port.m_alias); + } + return true; } @@ -1260,6 +1330,7 @@ void IntfsOrch::doTask(SelectableTimer &timer) { case Port::PHY: case Port::LAG: + case Port::SYSTEM: type = "SAI_ROUTER_INTERFACE_TYPE_PORT"; break; case Port::VLAN: @@ -1285,3 +1356,63 @@ void IntfsOrch::doTask(SelectableTimer &timer) } } } + +bool IntfsOrch::isRemoteSystemPortIntf(string alias) +{ + Port port; + if(gPortsOrch->getPort(alias, port)) + { + return(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE); + } + //Given alias is system port alias of the local port + return false; +} + +void IntfsOrch::voqSyncAddIntf(string &alias) +{ + //Sync only local interface. Confirm for the local interface and + //get the system port alias for key for syncing to CHASSIS_APP_DB + Port port; + if(gPortsOrch->getPort(alias, port)) + { + if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE) + { + return; + } + alias = port.m_system_port_info.alias; + } + else + { + SWSS_LOG_ERROR("Port does not exist for %s!", alias.c_str()); + return; + } + + FieldValueTuple nullFv ("NULL", "NULL"); + vector attrs; + attrs.push_back(nullFv); + + m_tableVoqSystemInterfaceTable->set(alias, attrs); +} + +void IntfsOrch::voqSyncDelIntf(string &alias) +{ + //Sync only local interface. Confirm for the local interface and + //get the system port alias for key for syncing to CHASSIS_APP_DB + Port port; + if(gPortsOrch->getPort(alias, port)) + { + if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE) + { + return; + } + alias = port.m_system_port_info.alias; + } + else + { + SWSS_LOG_ERROR("Port does not exist for %s!", alias.c_str()); + return; + } + + m_tableVoqSystemInterfaceTable->del(alias); +} + diff --git a/orchagent/intfsorch.h b/orchagent/intfsorch.h index c5b54cc554..11b947ec29 100644 --- a/orchagent/intfsorch.h +++ b/orchagent/intfsorch.h @@ -32,7 +32,7 @@ typedef map IntfsTable; class IntfsOrch : public Orch { public: - IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch); + IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch, DBConnector *chassisAppDb); sai_object_id_t getRouterIntfsId(const string&); bool isPrefixSubnet(const IpPrefix&, const string&); @@ -65,6 +65,8 @@ class IntfsOrch : public Orch bool updateSyncdIntfPfx(const string &alias, const IpPrefix &ip_prefix, bool add = true); + bool isRemoteSystemPortIntf(string alias); + private: SelectableTimer* m_updateMapsTimer = nullptr; @@ -95,6 +97,11 @@ class IntfsOrch : public Orch bool setIntfVlanFloodType(const Port &port, sai_vlan_flood_control_type_t vlan_flood_type); bool setIntfProxyArp(const string &alias, const string &proxy_arp); + + unique_ptr
m_tableVoqSystemInterfaceTable; + void voqSyncAddIntf(string &alias); + void voqSyncDelIntf(string &alias); + }; #endif /* SWSS_INTFSORCH_H */ diff --git a/orchagent/main.cpp b/orchagent/main.cpp index 7d79e0f76f..d60112e94e 100644 --- a/orchagent/main.cpp +++ b/orchagent/main.cpp @@ -63,6 +63,11 @@ extern bool gIsNatSupported; ofstream gRecordOfs; string gRecordFile; +string gMySwitchType = ""; +int32_t gVoqMySwitchId = -1; +int32_t gVoqMaxCores = 0; +uint32_t gCfgSystemPorts = 0; + void usage() { cout << "usage: orchagent [-h] [-r record_type] [-d record_location] [-b batch_size] [-m MAC] [-i INST_ID] [-s] [-z mode]" << endl; @@ -142,6 +147,124 @@ void init_gearbox_phys(DBConnector *applDb) delete tmpGearboxTable; } +void getCfgSwitchType(DBConnector *cfgDb, string &switch_type) +{ + Table cfgDeviceMetaDataTable(cfgDb, CFG_DEVICE_METADATA_TABLE_NAME); + + if (!cfgDeviceMetaDataTable.hget("localhost", "switch_type", switch_type)) + { + //Switch type is not configured. Consider it default = "switch" (regular switch) + switch_type = "switch"; + } + + if (switch_type != "voq" && switch_type != "fabric" && switch_type != "switch") + { + SWSS_LOG_ERROR("Invalid switch type %s configured", switch_type.c_str()); + //If configured switch type is none of the supported, assume regular switch + switch_type = "switch"; + } +} + +bool getSystemPortConfigList(DBConnector *cfgDb, DBConnector *appDb, vector &sysportcfglist) +{ + Table cfgDeviceMetaDataTable(cfgDb, CFG_DEVICE_METADATA_TABLE_NAME); + Table cfgSystemPortTable(cfgDb, CFG_SYSTEM_PORT_TABLE_NAME); + Table appSystemPortTable(appDb, APP_SYSTEM_PORT_TABLE_NAME); + + if (gMySwitchType != "voq") + { + //Non VOQ switch. Nothing to read + return true; + } + + string value; + if (!cfgDeviceMetaDataTable.hget("localhost", "switch_id", value)) + { + //VOQ switch id is not configured. + SWSS_LOG_ERROR("VOQ switch id is not configured"); + return false; + } + + if (value.size()) + gVoqMySwitchId = stoi(value); + + if (gVoqMySwitchId < 0) + { + SWSS_LOG_ERROR("Invalid VOQ switch id %d configured", gVoqMySwitchId); + return false; + } + + if (!cfgDeviceMetaDataTable.hget("localhost", "max_cores", value)) + { + //VOQ max cores is not configured. + SWSS_LOG_ERROR("VOQ max cores is not configured"); + return false; + } + + if (value.size()) + gVoqMaxCores = stoi(value); + + if (gVoqMaxCores == 0) + { + SWSS_LOG_ERROR("Invalid VOQ max cores %d configured", gVoqMaxCores); + return false; + } + + vector spKeys; + cfgSystemPortTable.getKeys(spKeys); + + //Retrieve system port configurations + vector spFv; + sai_system_port_config_t sysport; + for (auto &k : spKeys) + { + cfgSystemPortTable.get(k, spFv); + + for (auto &fv : spFv) + { + if (fv.first == "switch_id") + { + sysport.attached_switch_id = stoi(fv.second); + continue; + } + if (fv.first == "core_index") + { + sysport.attached_core_index = stoi(fv.second); + continue; + } + if (fv.first == "core_port_index") + { + sysport.attached_core_port_index = stoi(fv.second); + continue; + } + if (fv.first == "speed") + { + sysport.speed = stoi(fv.second); + continue; + } + if (fv.first == "system_port_id") + { + sysport.port_id = stoi(fv.second); + continue; + } + if (fv.first == "num_voq") + { + sysport.num_voq = stoi(fv.second); + continue; + } + } + //Add to system port config list + sysportcfglist.push_back(sysport); + + //Also push to APP DB + appSystemPortTable.set(k, spFv); + } + + SWSS_LOG_NOTICE("Created System Port config list for %d system ports", (int32_t) sysportcfglist.size()); + + return true; +} + int main(int argc, char **argv) { swss::Logger::linkToDbNative("orchagent"); @@ -269,6 +392,14 @@ int main(int argc, char **argv) attr.value.ptr = (void *)on_switch_shutdown_request; attrs.push_back(attr); + // Instantiate database connectors + DBConnector appl_db("APPL_DB", 0); + DBConnector config_db("CONFIG_DB", 0); + DBConnector state_db("STATE_DB", 0); + + // Get switch_type + getCfgSwitchType(&config_db, gMySwitchType); + if (gMacAddress) { attr.id = SAI_SWITCH_ATTR_SRC_MAC_ADDRESS; @@ -276,11 +407,6 @@ int main(int argc, char **argv) attrs.push_back(attr); } - /* Must be last Attribute */ - attr.id = SAI_REDIS_SWITCH_ATTR_CONTEXT; - attr.value.u64 = gSwitchId; - attrs.push_back(attr); - // SAI_REDIS_SWITCH_ATTR_SYNC_MODE attribute only setBuffer and g_syncMode to true // since it is not using ASIC_DB, we can execute it before create_switch // when g_syncMode is set to true here, create_switch will wait the response from syncd @@ -305,6 +431,48 @@ int main(int argc, char **argv) attrs.push_back(attr); } + // Get info required for VOQ system and connect to CHASSISS_APP_DB + shared_ptr chassis_app_db; + vector sysportconfiglist; + if ((gMySwitchType == "voq") && + (getSystemPortConfigList(&config_db, &appl_db, sysportconfiglist))) + { + attr.id = SAI_SWITCH_ATTR_TYPE; + attr.value.u32 = SAI_SWITCH_TYPE_VOQ; + attrs.push_back(attr); + + attr.id = SAI_SWITCH_ATTR_SWITCH_ID; + attr.value.u32 = gVoqMySwitchId; + attrs.push_back(attr); + + attr.id = SAI_SWITCH_ATTR_MAX_SYSTEM_CORES; + attr.value.u32 = gVoqMaxCores; + attrs.push_back(attr); + + gCfgSystemPorts = (uint32_t) sysportconfiglist.size(); + if (gCfgSystemPorts) + { + attr.id = SAI_SWITCH_ATTR_SYSTEM_PORT_CONFIG_LIST; + attr.value.sysportconfiglist.count = gCfgSystemPorts; + attr.value.sysportconfiglist.list = sysportconfiglist.data(); + attrs.push_back(attr); + } + else + { + SWSS_LOG_ERROR("Voq switch create with 0 system ports!"); + exit(EXIT_FAILURE); + } + + //Connect to CHASSIS_APP_DB in redis-server in control/supervisor card as per + //connection info in database_config.json + chassis_app_db = make_shared("CHASSIS_APP_DB", 0, true); + } + + /* Must be last Attribute */ + attr.id = SAI_REDIS_SWITCH_ATTR_CONTEXT; + attr.value.u64 = gSwitchId; + attrs.push_back(attr); + status = sai_switch_api->create_switch(&gSwitchId, (uint32_t)attrs.size(), attrs.data()); if (status != SAI_STATUS_SUCCESS) { @@ -384,13 +552,10 @@ int main(int argc, char **argv) SWSS_LOG_NOTICE("Created underlay router interface ID %" PRIx64, gUnderlayIfId); /* Initialize orchestration components */ - DBConnector appl_db("APPL_DB", 0); - DBConnector config_db("CONFIG_DB", 0); - DBConnector state_db("STATE_DB", 0); - + init_gearbox_phys(&appl_db); - auto orchDaemon = make_shared(&appl_db, &config_db, &state_db); + auto orchDaemon = make_shared(&appl_db, &config_db, &state_db, chassis_app_db.get()); if (!orchDaemon->init()) { diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index e2f0b7e006..246d044a8b 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -6,6 +6,7 @@ #include "routeorch.h" #include "directory.h" #include "muxorch.h" +#include "subscriberstatetable.h" extern sai_neighbor_api_t* sai_neighbor_api; extern sai_next_hop_api_t* sai_next_hop_api; @@ -16,10 +17,11 @@ extern CrmOrch *gCrmOrch; extern RouteOrch *gRouteOrch; extern FgNhgOrch *gFgNhgOrch; extern Directory gDirectory; +extern string gMySwitchType; const int neighorch_pri = 30; -NeighOrch::NeighOrch(DBConnector *appDb, string tableName, IntfsOrch *intfsOrch, FdbOrch *fdbOrch, PortsOrch *portsOrch) : +NeighOrch::NeighOrch(DBConnector *appDb, string tableName, IntfsOrch *intfsOrch, FdbOrch *fdbOrch, PortsOrch *portsOrch, DBConnector *chassisAppDb) : Orch(appDb, tableName, neighorch_pri), m_intfsOrch(intfsOrch), m_fdbOrch(fdbOrch), @@ -29,6 +31,19 @@ NeighOrch::NeighOrch(DBConnector *appDb, string tableName, IntfsOrch *intfsOrch, SWSS_LOG_ENTER(); m_fdbOrch->attach(this); + + if(gMySwitchType == "voq") + { + //Add subscriber to process VOQ system neigh + tableName = CHASSIS_APP_SYSTEM_NEIGH_TABLE_NAME; + Orch::addExecutor(new Consumer(new SubscriberStateTable(chassisAppDb, tableName, TableConsumable::DEFAULT_POP_BATCH_SIZE, 0), this, tableName)); + m_tableVoqSystemNeighTable = unique_ptr
(new Table(chassisAppDb, CHASSIS_APP_SYSTEM_NEIGH_TABLE_NAME)); + + //STATE DB connection for setting state of the remote neighbor SAI programming + unique_ptr stateDb; + stateDb = make_unique("STATE_DB", 0); + m_stateSystemNeighTable = unique_ptr
(new Table(stateDb.get(), STATE_SYSTEM_NEIGH_TABLE_NAME)); + } } NeighOrch::~NeighOrch() @@ -147,6 +162,15 @@ bool NeighOrch::addNextHop(const IpAddress &ipAddress, const string &alias) } NextHopKey nexthop = { ipAddress, alias }; + if(m_intfsOrch->isRemoteSystemPortIntf(alias)) + { + //For remote system ports kernel nexthops are always on inband. Change the key + Port inbp; + gPortsOrch->getInbandPort(inbp); + assert(inbp.m_alias.length()); + + nexthop.alias = inbp.m_alias; + } assert(!hasNextHop(nexthop)); sai_object_id_t rif_id = m_intfsOrch->getRouterIntfsId(alias); @@ -324,6 +348,16 @@ bool NeighOrch::removeNextHop(const IpAddress &ipAddress, const string &alias) SWSS_LOG_ENTER(); NextHopKey nexthop = { ipAddress, alias }; + if(m_intfsOrch->isRemoteSystemPortIntf(alias)) + { + //For remote system ports kernel nexthops are always on inband. Change the key + Port inbp; + gPortsOrch->getInbandPort(inbp); + assert(inbp.m_alias.length()); + + nexthop.alias = inbp.m_alias; + } + assert(hasNextHop(nexthop)); gFgNhgOrch->invalidNextHopInNextHopGroup(nexthop); @@ -422,6 +456,13 @@ void NeighOrch::doTask(Consumer &consumer) return; } + string table_name = consumer.getTableName(); + if(table_name == CHASSIS_APP_SYSTEM_NEIGH_TABLE_NAME) + { + doVoqSystemNeighTask(consumer); + return; + } + auto it = consumer.m_toSync.begin(); while (it != consumer.m_toSync.end()) { @@ -446,6 +487,21 @@ void NeighOrch::doTask(Consumer &consumer) continue; } + if(gPortsOrch->isInbandPort(alias)) + { + Port ibport; + gPortsOrch->getInbandPort(ibport); + if(ibport.m_type != Port::VLAN) + { + //For "port" type Inband, the neighbors are only remote neighbors. + //Hence, this is the neigh learned due to the kernel entry added on + //Inband interface for the remote system port neighbors. Skip + it = consumer.m_toSync.erase(it); + continue; + } + //For "vlan" type inband, may identify the remote neighbors and skip + } + IpAddress ip_address(key.substr(found+1)); NeighborEntry neighbor_entry = { ip_address, alias }; @@ -562,6 +618,15 @@ bool NeighOrch::addNeighbor(const NeighborEntry &neighborEntry, const MacAddress if (!hw_config && mux_orch->isNeighborActive(ip_address, alias)) { + + if (gMySwitchType == "voq") + { + if (!addVoqEncapIndex(alias, ip_address, neighbor_attrs)) + { + return false; + } + } + status = sai_neighbor_api->create_neighbor_entry(&neighbor_entry, (uint32_t)neighbor_attrs.size(), neighbor_attrs.data()); if (status != SAI_STATUS_SUCCESS) @@ -634,6 +699,12 @@ bool NeighOrch::addNeighbor(const NeighborEntry &neighborEntry, const MacAddress NeighborUpdate update = { neighborEntry, macAddress, true }; notify(SUBJECT_TYPE_NEIGH_CHANGE, static_cast(&update)); + if(gMySwitchType == "voq") + { + //Sync the neighbor to add to the CHASSIS_APP_DB + voqSyncAddNeigh(alias, ip_address, macAddress, neighbor_entry); + } + return true; } @@ -644,7 +715,17 @@ bool NeighOrch::removeNeighbor(const NeighborEntry &neighborEntry, bool disable) sai_status_t status; IpAddress ip_address = neighborEntry.ip_address; string alias = neighborEntry.alias; + NextHopKey nexthop = { ip_address, alias }; + if(m_intfsOrch->isRemoteSystemPortIntf(alias)) + { + //For remote system ports kernel nexthops are always on inband. Change the key + Port inbp; + gPortsOrch->getInbandPort(inbp); + assert(inbp.m_alias.length()); + + nexthop.alias = inbp.m_alias; + } if (m_syncdNeighbors.find(neighborEntry) == m_syncdNeighbors.end()) { @@ -744,6 +825,12 @@ bool NeighOrch::removeNeighbor(const NeighborEntry &neighborEntry, bool disable) NeighborUpdate update = { neighborEntry, MacAddress(), false }; notify(SUBJECT_TYPE_NEIGH_CHANGE, static_cast(&update)); + + if(gMySwitchType == "voq") + { + //Sync the neighbor to delete from the CHASSIS_APP_DB + voqSyncDelNeigh(alias, ip_address); + } return true; } @@ -865,3 +952,284 @@ bool NeighOrch::removeTunnelNextHop(const NextHopKey& nh) return true; } +void NeighOrch::doVoqSystemNeighTask(Consumer &consumer) +{ + SWSS_LOG_ENTER(); + + //Local inband port as the outgoing interface of the static neighbor and static route + Port ibif; + if(!gPortsOrch->getInbandPort(ibif)) + { + //Inband port is not ready yet. + return; + } + + auto it = consumer.m_toSync.begin(); + while (it != consumer.m_toSync.end()) + { + KeyOpFieldsValuesTuple t = it->second; + string key = kfvKey(t); + string op = kfvOp(t); + + size_t found = key.find_last_of(consumer.getConsumerTable()->getTableNameSeparator().c_str()); + if (found == string::npos) + { + SWSS_LOG_ERROR("Failed to parse key %s", key.c_str()); + it = consumer.m_toSync.erase(it); + continue; + } + + string alias = key.substr(0, found); + + if(!gIntfsOrch->isRemoteSystemPortIntf(alias)) + { + //Synced local neighbor. Skip + it = consumer.m_toSync.erase(it); + continue; + } + + IpAddress ip_address(key.substr(found+1)); + + NeighborEntry neighbor_entry = { ip_address, alias }; + + string state_key = alias + state_db_key_delimiter + ip_address.to_string(); + + if (op == SET_COMMAND) + { + Port p; + if (!gPortsOrch->getPort(alias, p)) + { + SWSS_LOG_INFO("Port %s doesn't exist", alias.c_str()); + it++; + continue; + } + + if (!p.m_rif_id) + { + SWSS_LOG_INFO("Router interface doesn't exist on %s", alias.c_str()); + it++; + continue; + } + + MacAddress mac_address; + uint32_t encap_index = 0; + for (auto i = kfvFieldsValues(t).begin(); + i != kfvFieldsValues(t).end(); i++) + { + if (fvField(*i) == "neigh") + mac_address = MacAddress(fvValue(*i)); + + if(fvField(*i) == "encap_index") + { + encap_index = (uint32_t)stoul(fvValue(*i)); + } + } + + if(!encap_index) + { + //Encap index is not available yet. Since this is remote neighbor, we need to wait till + //Encap index is made available either by dynamic syncing or by static config + it++; + continue; + } + + if (m_syncdNeighbors.find(neighbor_entry) == m_syncdNeighbors.end() || + m_syncdNeighbors[neighbor_entry].mac != mac_address) + { + //Add neigh to SAI + if (addNeighbor(neighbor_entry, mac_address)) + { + //neigh successfully added to SAI. Set STATE DB to signal kernel programming by neighbor manager + + //If the inband interface type is not VLAN, same MAC can be used for the inband interface for + //kernel programming. + if(ibif.m_type != Port::VLAN) + { + mac_address = gMacAddress; + } + vector fvVector; + FieldValueTuple mac("neigh", mac_address.to_string()); + fvVector.push_back(mac); + m_stateSystemNeighTable->set(state_key, fvVector); + + it = consumer.m_toSync.erase(it); + } + else + { + SWSS_LOG_ERROR("Failed to add voq neighbor %s to SAI", kfvKey(t).c_str()); + it++; + } + } + else + { + /* Duplicate entry */ + SWSS_LOG_INFO("System neighbor %s already exists", kfvKey(t).c_str()); + it = consumer.m_toSync.erase(it); + } + } + else if (op == DEL_COMMAND) + { + if (m_syncdNeighbors.find(neighbor_entry) != m_syncdNeighbors.end()) + { + //Remove neigh from SAI + if (removeNeighbor(neighbor_entry)) + { + //neigh successfully deleted from SAI. Set STATE DB to signal to remove entries from kernel + m_stateSystemNeighTable->del(state_key); + + it = consumer.m_toSync.erase(it); + } + else + { + SWSS_LOG_ERROR("Failed to remove voq neighbor %s from SAI", kfvKey(t).c_str()); + it++; + } + } + else + /* Cannot locate the neighbor */ + it = consumer.m_toSync.erase(it); + } + else + { + SWSS_LOG_ERROR("Unknown operation type %s", op.c_str()); + it = consumer.m_toSync.erase(it); + } + } +} + +bool NeighOrch::addInbandNeighbor(string alias, IpAddress ip_address) +{ + //For "port" type inband, the inband reachability info syncing can be done through static + //configureation or CHASSIS_APP_DB sync (this function) + + //For "vlan" type inband, the inband reachability info syncinng can be ARP learning of other + //asics inband or static configuration or through CHASSIS_APP_DB sync (this function) + + //May implement inband rechability info syncing through CHASSIS_APP_DB sync here + + return true; +} + +bool NeighOrch::delInbandNeighbor(string alias, IpAddress ip_address) +{ + //Remove inband rechability info sync + + return true; +} + +bool NeighOrch::getSystemPortNeighEncapIndex(string &alias, IpAddress &ip, uint32_t &encap_index) +{ + string value; + string key = alias + m_tableVoqSystemNeighTable->getTableNameSeparator().c_str() + ip.to_string(); + + if(m_tableVoqSystemNeighTable->hget(key, "encap_index", value)) + { + encap_index = (uint32_t) stoul(value); + return true; + } + return false; +} + +bool NeighOrch::addVoqEncapIndex(string &alias, IpAddress &ip, vector &neighbor_attrs) +{ + sai_attribute_t attr; + uint32_t encap_index = 0; + + if(gIntfsOrch->isRemoteSystemPortIntf(alias)) + { + if(getSystemPortNeighEncapIndex(alias, ip, encap_index)) + { + attr.id = SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX; + attr.value.u32 = encap_index; + neighbor_attrs.push_back(attr); + + attr.id = SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_IMPOSE_INDEX; + attr.value.booldata = true; + neighbor_attrs.push_back(attr); + + attr.id = SAI_NEIGHBOR_ENTRY_ATTR_IS_LOCAL; + attr.value.booldata = false; + neighbor_attrs.push_back(attr); + } + else + { + //Encap index not available and the interface is remote. Return false to re-try + SWSS_LOG_NOTICE("System port neigh encap index not available for %s|%s!", alias.c_str(), ip.to_string().c_str()); + return false; + } + } + + return true; +} + +void NeighOrch::voqSyncAddNeigh(string &alias, IpAddress &ip_address, const MacAddress &mac, sai_neighbor_entry_t &neighbor_entry) +{ + sai_attribute_t attr; + sai_status_t status; + + //Sync only local neigh. Confirm for the local neigh and + //get the system port alias for key for syncing to CHASSIS_APP_DB + Port port; + if(gPortsOrch->getPort(alias, port)) + { + if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE) + { + return; + } + alias = port.m_system_port_info.alias; + } + else + { + SWSS_LOG_ERROR("Port does not exist for %s!", alias.c_str()); + return; + } + + attr.id = SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX; + + status = sai_neighbor_api->get_neighbor_entry_attribute(&neighbor_entry, 1, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get neighbor attribute for %s on %s, rv:%d", ip_address.to_string().c_str(), alias.c_str(), status); + return; + } + + if (!attr.value.u32) + { + SWSS_LOG_ERROR("Invalid neighbor encap_index for %s on %s", ip_address.to_string().c_str(), alias.c_str()); + return; + } + + vector attrs; + + FieldValueTuple eiFv ("encap_index", to_string(attr.value.u32)); + attrs.push_back(eiFv); + + FieldValueTuple macFv ("neigh", mac.to_string()); + attrs.push_back(macFv); + + string key = alias + m_tableVoqSystemNeighTable->getTableNameSeparator().c_str() + ip_address.to_string(); + m_tableVoqSystemNeighTable->set(key, attrs); +} + +void NeighOrch::voqSyncDelNeigh(string &alias, IpAddress &ip_address) +{ + //Sync only local neigh. Confirm for the local neigh and + //get the system port alias for key for syncing to CHASSIS_APP_DB + Port port; + if(gPortsOrch->getPort(alias, port)) + { + if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE) + { + return; + } + alias = port.m_system_port_info.alias; + } + else + { + SWSS_LOG_ERROR("Port does not exist for %s!", alias.c_str()); + return; + } + + string key = alias + m_tableVoqSystemNeighTable->getTableNameSeparator().c_str() + ip_address.to_string(); + m_tableVoqSystemNeighTable->del(key); +} diff --git a/orchagent/neighorch.h b/orchagent/neighorch.h index bd199efde5..20b6f3913c 100644 --- a/orchagent/neighorch.h +++ b/orchagent/neighorch.h @@ -44,7 +44,7 @@ struct NeighborUpdate class NeighOrch : public Orch, public Subject, public Observer { public: - NeighOrch(DBConnector *db, string tableName, IntfsOrch *intfsOrch, FdbOrch *fdbOrch, PortsOrch *portsOrch); + NeighOrch(DBConnector *db, string tableName, IntfsOrch *intfsOrch, FdbOrch *fdbOrch, PortsOrch *portsOrch, DBConnector *chassisAppDb); ~NeighOrch(); bool hasNextHop(const NextHopKey&); @@ -70,6 +70,9 @@ class NeighOrch : public Orch, public Subject, public Observer bool removeOverlayNextHop(const NextHopKey &); void update(SubjectType, void *); + bool addInbandNeighbor(string alias, IpAddress ip_address); + bool delInbandNeighbor(string alias, IpAddress ip_address); + private: PortsOrch *m_portsOrch; IntfsOrch *m_intfsOrch; @@ -92,6 +95,14 @@ class NeighOrch : public Orch, public Subject, public Observer bool resolveNeighborEntry(const NeighborEntry &, const MacAddress &); void doTask(Consumer &consumer); + void doVoqSystemNeighTask(Consumer &consumer); + + unique_ptr
m_tableVoqSystemNeighTable; + unique_ptr
m_stateSystemNeighTable; + bool getSystemPortNeighEncapIndex(string &alias, IpAddress &ip, uint32_t &encap_index); + bool addVoqEncapIndex(string &alias, IpAddress &ip, vector &neighbor_attrs); + void voqSyncAddNeigh(string &alias, IpAddress &ip_address, const MacAddress &mac, sai_neighbor_entry_t &neighbor_entry); + void voqSyncDelNeigh(string &alias, IpAddress &ip_address); }; #endif /* SWSS_NEIGHORCH_H */ diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index b29f95f563..f1b0089ad7 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -651,7 +651,7 @@ bool Orch::parseIndexRange(const string &input, sai_uint32_t &range_low, sai_uin void Orch::addConsumer(DBConnector *db, string tableName, int pri) { - if (db->getDbName() == "CONFIG_DB" || db->getDbName() == "STATE_DB") + if (db->getDbId() == CONFIG_DB || db->getDbId() == STATE_DB || db->getDbId() == CHASSIS_APP_DB) { addExecutor(new Consumer(new SubscriberStateTable(db, tableName, TableConsumable::DEFAULT_POP_BATCH_SIZE, pri), this, tableName)); } diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index 641c304e91..5e55a8c2d5 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -41,10 +41,11 @@ NatOrch *gNatOrch; bool gIsNatSupported = false; -OrchDaemon::OrchDaemon(DBConnector *applDb, DBConnector *configDb, DBConnector *stateDb) : +OrchDaemon::OrchDaemon(DBConnector *applDb, DBConnector *configDb, DBConnector *stateDb, DBConnector *chassisAppDb) : m_applDb(applDb), m_configDb(configDb), - m_stateDb(stateDb) + m_stateDb(stateDb), + m_chassisAppDb(chassisAppDb) { SWSS_LOG_ENTER(); } @@ -131,8 +132,8 @@ bool OrchDaemon::init() ChassisOrch* chassis_frontend_orch = new ChassisOrch(m_configDb, m_applDb, chassis_frontend_tables, vnet_rt_orch); gDirectory.set(chassis_frontend_orch); - gIntfsOrch = new IntfsOrch(m_applDb, APP_INTF_TABLE_NAME, vrf_orch); - gNeighOrch = new NeighOrch(m_applDb, APP_NEIGH_TABLE_NAME, gIntfsOrch, gFdbOrch, gPortsOrch); + gIntfsOrch = new IntfsOrch(m_applDb, APP_INTF_TABLE_NAME, vrf_orch, m_chassisAppDb); + gNeighOrch = new NeighOrch(m_applDb, APP_NEIGH_TABLE_NAME, gIntfsOrch, gFdbOrch, gPortsOrch, m_chassisAppDb); const int fgnhgorch_pri = 15; diff --git a/orchagent/orchdaemon.h b/orchagent/orchdaemon.h index 1215958a90..b48ffc30a6 100644 --- a/orchagent/orchdaemon.h +++ b/orchagent/orchdaemon.h @@ -38,7 +38,7 @@ using namespace swss; class OrchDaemon { public: - OrchDaemon(DBConnector *, DBConnector *, DBConnector *); + OrchDaemon(DBConnector *, DBConnector *, DBConnector *, DBConnector *); ~OrchDaemon(); bool init(); @@ -52,6 +52,7 @@ class OrchDaemon DBConnector *m_applDb; DBConnector *m_configDb; DBConnector *m_stateDb; + DBConnector *m_chassisAppDb; std::vector m_orchList; Select *m_select; diff --git a/orchagent/port.h b/orchagent/port.h index fb0b8b6434..baf8e3046e 100644 --- a/orchagent/port.h +++ b/orchagent/port.h @@ -38,6 +38,19 @@ struct VlanInfo sai_vlan_id_t vlan_id = 0; }; +struct SystemPortInfo +{ + std::string alias = ""; + sai_system_port_type_t type; + sai_object_id_t local_port_oid = 0; + uint32_t port_id = 0; + uint32_t switch_id = 0; + uint32_t core_index = 0; + uint32_t core_port_index = 0; + uint32_t speed = 400000; + uint32_t num_voq = 8; +}; + class Port { public: @@ -50,6 +63,7 @@ class Port LAG, TUNNEL, SUBPORT, + SYSTEM, UNKNOWN } ; @@ -124,6 +138,10 @@ class Port std::unordered_set m_ingress_acl_tables_uset; std::unordered_set m_egress_acl_tables_uset; + + sai_object_id_t m_system_port_oid = 0; + SystemPortInfo m_system_port_info; + }; } diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 5dd76f70b9..104aeb57f4 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -45,6 +45,7 @@ extern CrmOrch *gCrmOrch; extern BufferOrch *gBufferOrch; extern FdbOrch *gFdbOrch; extern Directory gDirectory; +extern sai_system_port_api_t *sai_system_port_api; #define VLAN_PREFIX "Vlan" #define DEFAULT_VLAN_ID 1 @@ -393,6 +394,9 @@ PortsOrch::PortsOrch(DBConnector *db, vector &tableNames) m_default1QBridge = attrs[0].value.oid; m_defaultVlan = attrs[1].value.oid; + /* Get System ports */ + getSystemPorts(); + removeDefaultVlanMembers(); removeDefaultBridgePorts(); @@ -406,7 +410,7 @@ PortsOrch::PortsOrch(DBConnector *db, vector &tableNames) void PortsOrch::removeDefaultVlanMembers() { /* Get VLAN members in default VLAN */ - vector vlan_member_list(m_portCount); + vector vlan_member_list(m_portCount + m_systemPortCount); sai_attribute_t attr; attr.id = SAI_VLAN_ATTR_MEMBER_LIST; @@ -437,10 +441,10 @@ void PortsOrch::removeDefaultVlanMembers() void PortsOrch::removeDefaultBridgePorts() { /* Get bridge ports in default 1Q bridge - * By default, there will be m_portCount number of SAI_BRIDGE_PORT_TYPE_PORT + * By default, there will be (m_portCount + m_systemPortCount) number of SAI_BRIDGE_PORT_TYPE_PORT * ports and one SAI_BRIDGE_PORT_TYPE_1Q_ROUTER port. The former type of * ports will be removed. */ - vector bridge_port_list(m_portCount + 1); + vector bridge_port_list(m_portCount + m_systemPortCount + 1); sai_attribute_t attr; attr.id = SAI_BRIDGE_ATTR_PORT_LIST; @@ -577,6 +581,7 @@ bool PortsOrch::getPort(sai_object_id_t id, Port &port) switch (portIter.second.m_type) { case Port::PHY: + case Port::SYSTEM: if(portIter.second.m_port_id == id) { port = portIter.second; @@ -2084,6 +2089,7 @@ void PortsOrch::doPortTask(Consumer &consumer) */ if (!m_initDone) { + addSystemPorts(); m_initDone = true; SWSS_LOG_INFO("Get PortInitDone notification from portsyncd."); } @@ -4686,3 +4692,258 @@ bool PortsOrch::initGearboxPort(Port &port) return true; } +bool PortsOrch::getSystemPorts() +{ + sai_status_t status; + sai_attribute_t attr; + uint32_t i; + + m_systemPortCount = 0; + + attr.id = SAI_SWITCH_ATTR_NUMBER_OF_SYSTEM_PORTS; + + status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get number of system ports, rv:%d", status); + return false; + } + + m_systemPortCount = attr.value.u32; + SWSS_LOG_NOTICE("Got %d system ports", m_systemPortCount); + + if(m_systemPortCount) + { + /* Make tuple and system port oid map */ + + vector system_port_list; + system_port_list.resize(m_systemPortCount); + + attr.id = SAI_SWITCH_ATTR_SYSTEM_PORT_LIST; + attr.value.objlist.count = (uint32_t)system_port_list.size(); + attr.value.objlist.list = system_port_list.data(); + + status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get system port list, rv:%d", status); + return false; + } + + uint32_t spcnt = attr.value.objlist.count; + for(i = 0; i < spcnt; i++) + { + attr.id = SAI_SYSTEM_PORT_ATTR_CONFIG_INFO; + + status = sai_system_port_api->get_system_port_attribute(system_port_list[i], 1, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get system port config info spid:%" PRIx64, system_port_list[i]); + return false; + } + + SWSS_LOG_NOTICE("SystemPort(0x%" PRIx64 ") - port_id:%u, switch_id:%u, core:%u, core_port:%u, speed:%u, voqs:%u", + system_port_list[i], + attr.value.sysportconfig.port_id, + attr.value.sysportconfig.attached_switch_id, + attr.value.sysportconfig.attached_core_index, + attr.value.sysportconfig.attached_core_port_index, + attr.value.sysportconfig.speed, + attr.value.sysportconfig.num_voq); + + tuple sp_key(attr.value.sysportconfig.attached_switch_id, + attr.value.sysportconfig.attached_core_index, + attr.value.sysportconfig.attached_core_port_index); + + m_systemPortOidMap[sp_key] = system_port_list[i]; + } + } + + return true; +} + +bool PortsOrch::addSystemPorts() +{ + vector keys; + vector spFv; + + DBConnector appDb(APPL_DB, DBConnector::DEFAULT_UNIXSOCKET, 0); + Table appSystemPortTable(&appDb, APP_SYSTEM_PORT_TABLE_NAME); + + //Retrieve system port configurations from APP DB + appSystemPortTable.getKeys(keys); + for ( auto &alias : keys ) + { + appSystemPortTable.get(alias, spFv); + + int32_t system_port_id = -1; + int32_t switch_id = -1; + int32_t core_index = -1; + int32_t core_port_index = -1; + + for ( auto &fv : spFv ) + { + if(fv.first == "switch_id") + { + switch_id = stoi(fv.second); + continue; + } + if(fv.first == "core_index") + { + core_index = stoi(fv.second); + continue; + } + if(fv.first == "core_port_index") + { + core_port_index = stoi(fv.second); + continue; + } + if(fv.first == "system_port_id") + { + system_port_id = stoi(fv.second); + continue; + } + } + + if(system_port_id < 0 || switch_id < 0 || core_index < 0 || core_port_index < 0) + { + SWSS_LOG_ERROR("Invalid or Missing field values for %s! system_port id:%d, switch_id:%d, core_index:%d, core_port_index:%d", + alias.c_str(), system_port_id, switch_id, core_index, core_port_index); + continue; + } + + tuple sp_key(switch_id, core_index, core_port_index); + + if(m_systemPortOidMap.find(sp_key) != m_systemPortOidMap.end()) + { + + sai_attribute_t attr; + vector attrs; + sai_object_id_t system_port_oid; + sai_status_t status; + + //Retrive system port config info and enable + system_port_oid = m_systemPortOidMap[sp_key]; + + attr.id = SAI_SYSTEM_PORT_ATTR_TYPE; + attrs.push_back(attr); + + attr.id = SAI_SYSTEM_PORT_ATTR_CONFIG_INFO; + attrs.push_back(attr); + + status = sai_system_port_api->get_system_port_attribute(system_port_oid, static_cast(attrs.size()), attrs.data()); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get system port config info spid:%" PRIx64, system_port_oid); + continue; + } + + //Create or update system port and add to the port list. + Port port(alias, Port::SYSTEM); + port.m_port_id = system_port_oid; + port.m_admin_state_up = true; + port.m_oper_status = SAI_PORT_OPER_STATUS_UP; + port.m_speed = attrs[1].value.sysportconfig.speed; + if (attrs[0].value.s32 == SAI_SYSTEM_PORT_TYPE_LOCAL) + { + //Get the local port oid + attr.id = SAI_SYSTEM_PORT_ATTR_PORT; + + status = sai_system_port_api->get_system_port_attribute(system_port_oid, 1, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get local port oid of local system port spid:%" PRIx64, system_port_oid); + continue; + } + + //System port for local port. Update the system port info in the existing physical port + if(!getPort(attr.value.oid, port)) + { + //This is system port for non-front panel local port (CPU or OLP or RCY (Inband)). Not an error + SWSS_LOG_NOTICE("Add port for non-front panel local system port 0x%" PRIx64 "; core: %d, core port: %d", + system_port_oid, core_index, core_port_index); + } + port.m_system_port_info.local_port_oid = attr.value.oid; + } + + port.m_system_port_oid = system_port_oid; + + port.m_system_port_info.alias = alias; + port.m_system_port_info.type = (sai_system_port_type_t) attrs[0].value.s32; + port.m_system_port_info.port_id = attrs[1].value.sysportconfig.port_id; + port.m_system_port_info.switch_id = attrs[1].value.sysportconfig.attached_switch_id; + port.m_system_port_info.core_index = attrs[1].value.sysportconfig.attached_core_index; + port.m_system_port_info.core_port_index = attrs[1].value.sysportconfig.attached_core_port_index; + port.m_system_port_info.speed = attrs[1].value.sysportconfig.speed; + port.m_system_port_info.num_voq = attrs[1].value.sysportconfig.num_voq; + + setPort(port.m_alias, port); + if(m_port_ref_count.find(port.m_alias) == m_port_ref_count.end()) + { + m_port_ref_count[port.m_alias] = 0; + } + + SWSS_LOG_NOTICE("Added system port %" PRIx64 " for %s", system_port_oid, alias.c_str()); + } + else + { + //System port does not exist in the switch + //This can not happen since all the system ports are supposed to be created during switch creation itself + + SWSS_LOG_ERROR("System port %s does not exist in switch. Port not added!", alias.c_str()); + continue; + } + } + + return true; +} + +bool PortsOrch::getInbandPort(Port &port) +{ + if (m_portList.find(m_inbandPortName) == m_portList.end()) + { + return false; + } + else + { + port = m_portList[m_inbandPortName]; + return true; + } +} + +bool PortsOrch::isInbandPort(const string &alias) +{ + return (m_inbandPortName == alias); +} + +bool PortsOrch::setVoqInbandIntf(string &alias, string &type) +{ + if(m_inbandPortName == alias) + { + //Inband interface already exists with this name + SWSS_LOG_NOTICE("Interface %s is already configured as inband!", alias.c_str()); + return true; + } + + Port port; + if(type == "port") + { + if (!getPort(alias, port)) + { + SWSS_LOG_NOTICE("Port configured for inband intf %s is not ready!", alias.c_str()); + return false; + } + } + + // Check for existence of host interface. If does not exist, may create + // host if for the inband here + + // May do the processing for other inband type like type=vlan here + + //Store the name of the local inband port + m_inbandPortName = alias; + + return true; +} + + diff --git a/orchagent/portsorch.h b/orchagent/portsorch.h index dfd5ab875d..ecf65c4f8e 100755 --- a/orchagent/portsorch.h +++ b/orchagent/portsorch.h @@ -92,6 +92,7 @@ class PortsOrch : public Orch, public Subject bool getPortByBridgePortId(sai_object_id_t bridge_port_id, Port &port); void setPort(string alias, Port port); void getCpuPort(Port &port); + bool getInbandPort(Port &port); bool getVlanByVlanId(sai_vlan_id_t vlan_id, Port &vlan); bool setHostIntfsOperStatus(const Port& port, bool up) const; @@ -138,6 +139,10 @@ class PortsOrch : public Orch, public Subject bool removeVlanMember(Port &vlan, Port &port); bool isVlanMember(Port &vlan, Port &port); + string m_inbandPortName = ""; + bool isInbandPort(const string &alias); + bool setVoqInbandIntf(string &alias, string &type); + private: unique_ptr
m_counterTable; unique_ptr
m_counterLagTable; @@ -285,6 +290,12 @@ class PortsOrch : public Orch, public Subject void initGearbox(); bool initGearboxPort(Port &port); + //map key is tuple of + map, sai_object_id_t> m_systemPortOidMap; + sai_uint32_t m_systemPortCount; + bool getSystemPorts(); + bool addSystemPorts(); + }; #endif /* SWSS_PORTSORCH_H */ diff --git a/orchagent/saihelper.cpp b/orchagent/saihelper.cpp index d047852488..15c753b2f0 100644 --- a/orchagent/saihelper.cpp +++ b/orchagent/saihelper.cpp @@ -59,6 +59,7 @@ sai_dtel_api_t* sai_dtel_api; sai_samplepacket_api_t* sai_samplepacket_api; sai_debug_counter_api_t* sai_debug_counter_api; sai_nat_api_t* sai_nat_api; +sai_system_port_api_t* sai_system_port_api; extern sai_object_id_t gSwitchId; extern bool gSairedisRecord; @@ -177,6 +178,7 @@ void initSaiApi() sai_api_query(SAI_API_SAMPLEPACKET, (void **)&sai_samplepacket_api); sai_api_query(SAI_API_DEBUG_COUNTER, (void **)&sai_debug_counter_api); sai_api_query(SAI_API_NAT, (void **)&sai_nat_api); + sai_api_query(SAI_API_SYSTEM_PORT, (void **)&sai_system_port_api); sai_log_set(SAI_API_SWITCH, SAI_LOG_LEVEL_NOTICE); sai_log_set(SAI_API_BRIDGE, SAI_LOG_LEVEL_NOTICE); @@ -205,6 +207,7 @@ void initSaiApi() sai_log_set(SAI_API_SAMPLEPACKET, SAI_LOG_LEVEL_NOTICE); sai_log_set(SAI_API_DEBUG_COUNTER, SAI_LOG_LEVEL_NOTICE); sai_log_set((sai_api_t)SAI_API_NAT, SAI_LOG_LEVEL_NOTICE); + sai_log_set(SAI_API_SYSTEM_PORT, SAI_LOG_LEVEL_NOTICE); } void initSaiRedis(const string &record_location) diff --git a/tests/mock_tests/aclorch_ut.cpp b/tests/mock_tests/aclorch_ut.cpp index d1fe4915a0..f3ca17c865 100644 --- a/tests/mock_tests/aclorch_ut.cpp +++ b/tests/mock_tests/aclorch_ut.cpp @@ -21,6 +21,7 @@ extern sai_vlan_api_t *sai_vlan_api; extern sai_bridge_api_t *sai_bridge_api; extern sai_route_api_t *sai_route_api; extern sai_next_hop_group_api_t* sai_next_hop_group_api; +extern string gMySwitchType; namespace aclorch_test { @@ -182,6 +183,7 @@ namespace aclorch_test shared_ptr m_app_db; shared_ptr m_config_db; shared_ptr m_state_db; + shared_ptr m_chassis_app_db; AclOrchTest() { @@ -189,6 +191,8 @@ namespace aclorch_test m_app_db = make_shared("APPL_DB", 0); m_config_db = make_shared("CONFIG_DB", 0); m_state_db = make_shared("STATE_DB", 0); + if(gMySwitchType == "voq") + m_chassis_app_db = make_shared("CHASSIS_APP_DB", 0); } static map gProfileMap; @@ -319,7 +323,7 @@ namespace aclorch_test gVrfOrch = new VRFOrch(m_app_db.get(), APP_VRF_TABLE_NAME, m_state_db.get(), STATE_VRF_OBJECT_TABLE_NAME); ASSERT_EQ(gIntfsOrch, nullptr); - gIntfsOrch = new IntfsOrch(m_app_db.get(), APP_INTF_TABLE_NAME, gVrfOrch); + gIntfsOrch = new IntfsOrch(m_app_db.get(), APP_INTF_TABLE_NAME, gVrfOrch, m_chassis_app_db.get()); TableConnector applDbFdb(m_app_db.get(), APP_FDB_TABLE_NAME); TableConnector stateDbFdb(m_state_db.get(), STATE_FDB_TABLE_NAME); @@ -333,7 +337,7 @@ namespace aclorch_test gFdbOrch = new FdbOrch(m_app_db.get(), app_fdb_tables, stateDbFdb, gPortsOrch); ASSERT_EQ(gNeighOrch, nullptr); - gNeighOrch = new NeighOrch(m_app_db.get(), APP_NEIGH_TABLE_NAME, gIntfsOrch, gFdbOrch, gPortsOrch); + gNeighOrch = new NeighOrch(m_app_db.get(), APP_NEIGH_TABLE_NAME, gIntfsOrch, gFdbOrch, gPortsOrch, m_chassis_app_db.get()); ASSERT_EQ(gFgNhgOrch, nullptr); const int fgnhgorch_pri = 15; diff --git a/tests/mock_tests/database_config.json b/tests/mock_tests/database_config.json index b86ae11bba..1b6343d20e 100644 --- a/tests/mock_tests/database_config.json +++ b/tests/mock_tests/database_config.json @@ -4,6 +4,11 @@ "hostname" : "127.0.0.1", "port" : 6379, "unix_socket_path" : "/var/run/redis/redis.sock" + }, + "redis_chassis":{ + "hostname" : "240.127.1.1", + "port" : 6380, + "unix_socket_path" : "/var/run/redis/redis_chassis.sock" } }, "DATABASES" : { @@ -51,6 +56,11 @@ "id" : 7, "separator": "|", "instance" : "redis" + }, + "CHASSIS_APP_DB" : { + "id" : 12, + "separator": "|", + "instance" : "redis_chassis" } }, "VERSION" : "1.0" diff --git a/tests/mock_tests/mock_orchagent_main.cpp b/tests/mock_tests/mock_orchagent_main.cpp index 15004b756e..fb1ccc082c 100644 --- a/tests/mock_tests/mock_orchagent_main.cpp +++ b/tests/mock_tests/mock_orchagent_main.cpp @@ -21,6 +21,7 @@ bool gLogRotate = false; bool gSaiRedisLogRotate = false; ofstream gRecordOfs; string gRecordFile; +string gMySwitchType = "voq"; VRFOrch *gVrfOrch; diff --git a/tests/test_virtual_chassis.py b/tests/test_virtual_chassis.py index ed27e45f78..4bdbc6d397 100644 --- a/tests/test_virtual_chassis.py +++ b/tests/test_virtual_chassis.py @@ -1,4 +1,7 @@ import pytest +from swsscommon import swsscommon +from dvslib.dvs_database import DVSDatabase +import ast class TestVirtualChassis(object): def test_connectivity(self, vct): @@ -8,7 +11,7 @@ def test_connectivity(self, vct): nbrs = vct.get_topo_neigh() for name in dvss.keys(): dv = dvss[name] - #ping all vs's inband address + # ping all vs's inband address for ctn in vct.inbands.keys(): ip = vct.inbands[ctn]["inband_address"] ip = ip.split("/")[0] @@ -24,3 +27,205 @@ def test_connectivity(self, vct): _, out = dv.runcmd(['sh', "-c", "ping -c 5 -W 0 -q %s" % ip]) print(out) assert '5 received' in out + + def test_voq_switch(self, vct): + """Test VOQ switch objects configuration. + + This test validates configuration of switch creation objects required for + VOQ switches. The switch_type, max_cores and switch_id attributes configuration + are verified. For the System port config list, it is verified that all the + configured system ports are avaiable in the asic db by checking the count. + """ + + dvss = vct.dvss + for name in dvss.keys(): + dvs = dvss[name] + # Get the config info + config_db = dvs.get_config_db() + metatbl = config_db.get_entry("DEVICE_METADATA", "localhost") + + cfg_switch_type = metatbl.get("switch_type") + + # Test only for line cards + if cfg_switch_type == "voq": + print("VOQ Switch test for {}".format(name)) + cfg_switch_id = metatbl.get("switch_id") + assert cfg_switch_id != "", "Got error in getting switch_id from CONFIG_DB DEVICE_METADATA" + + cfg_max_cores = metatbl.get("max_cores") + assert cfg_max_cores != "", "Got error in getting max_cores from CONFIG_DB DEVICE_METADATA" + + cfgspkeys = config_db.get_keys("SYSTEM_PORT") + sp_count = len(cfgspkeys) + + asic_db = dvs.get_asic_db() + keys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_SWITCH") + switch_oid_key = keys[0] + + switch_entry = asic_db.get_entry("ASIC_STATE:SAI_OBJECT_TYPE_SWITCH", switch_oid_key) + + value = switch_entry.get("SAI_SWITCH_ATTR_TYPE") + assert value == "SAI_SWITCH_TYPE_VOQ", "Switch type is not VOQ" + + value = switch_entry.get("SAI_SWITCH_ATTR_SWITCH_ID") + assert value == cfg_switch_id, "VOQ switch id is invalid" + + value = switch_entry.get("SAI_SWITCH_ATTR_MAX_SYSTEM_CORES") + assert value == cfg_max_cores, "Max system cores is invalid" + + value = switch_entry.get("SAI_SWITCH_ATTR_SYSTEM_PORT_CONFIG_LIST") + assert value != "", "Empty system port config list" + # Convert the spcfg string to dictionary + spcfg = ast.literal_eval(value) + assert spcfg['count'] == sp_count, "Number of systems ports configured is invalid" + + def test_chassis_app_db_sync(self, vct): + """Test chassis app db syncing. + + This test is for verifying the database sync mechanism. With the virtual chassis + setup, it is verified that at least one database entry is synced from line card to + supervisor card. An interface entry is used as sample database entry for verification + of syncing mechanism. + """ + + dvss = vct.dvss + for name in dvss.keys(): + if name.startswith("supervisor"): + dvs = dvss[name] + chassis_app_db = DVSDatabase(swsscommon.CHASSIS_APP_DB, dvs.redis_chassis_sock) + keys = chassis_app_db.get_keys("SYSTEM_INTERFACE") + assert len(keys), "No chassis app db syncing is done" + + def test_chassis_system_interface(self, vct): + """Test RIF record creation in ASIC_DB for remote interfaces. + + This test verifies RIF programming in ASIC_DB for remote interface. The orchagent + creates RIF record for system port interfaces from other line cards. It is verified + by retrieving a RIF record from local ASIC_DB that corresponds to a remote system port + and checking that the switch id of that remote system port does not match the local asic + switch id. + """ + + dvss = vct.dvss + for name in dvss.keys(): + dvs = dvss[name] + + config_db = dvs.get_config_db() + metatbl = config_db.get_entry("DEVICE_METADATA", "localhost") + + cfg_switch_type = metatbl.get("switch_type") + + # Test only for line cards + if cfg_switch_type == "voq": + lc_switch_id = metatbl.get("switch_id") + assert lc_switch_id != "", "Got error in getting switch_id from CONFIG_DB DEVICE_METADATA" + if lc_switch_id == "0": + # Testing in Linecard1, In Linecard1 there will be RIF for Ethernet12 from Linecard3 + # Note: Tesing can be done in any linecard for RIF of any system port interface. + # Here testing is done on linecard with switch id 0 + asic_db = dvs.get_asic_db() + keys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE") + assert len(keys), "No router interfaces in ASIC_DB" + + rif_port_oid = "" + for key in keys: + rif_entry = asic_db.get_entry("ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE", key) + value = rif_entry.get("SAI_ROUTER_INTERFACE_ATTR_TYPE") + assert value != "", "Got error in getting RIF type" + if value == "SAI_ROUTER_INTERFACE_TYPE_PORT": + value = rif_entry.get("SAI_ROUTER_INTERFACE_ATTR_PORT_ID") + assert value != "", "Got error in getting RIF port" + if value.startswith("oid:0x5d"): + # System port RIF, this is used as key for system port config info retrieval + rif_port_oid = value + break + + assert rif_port_oid != "", "No RIF records for remote interfaces in ASIC_DB" + # Validate if the system port is from valid switch + sp_entry = asic_db.get_entry("ASIC_STATE:SAI_OBJECT_TYPE_SYSTEM_PORT", rif_port_oid) + value = sp_entry.get("SAI_SYSTEM_PORT_ATTR_CONFIG_INFO") + assert value != "", "Got error in getting system port config info for rif system port" + spcfginfo = ast.literal_eval(value) + # Remote system ports's switch id should not match local switch id + assert spcfginfo["attached_switch_id"] != lc_switch_id, "RIF system port with wrong switch_id" + + def test_chassis_system_neigh(self, vct): + """Test neigh record creation and syncing to chassis app db. + + This test validates that: + (i) Local neighbor entry is created with encap index + (ii) Local neighbor is synced to chassis ap db with assigned encap index + TODO: (iii) Remote neighbor entry is created in ASIC_DB with received encap index + """ + + dvss = vct.dvss + for name in dvss.keys(): + dvs = dvss[name] + + config_db = dvs.get_config_db() + metatbl = config_db.get_entry("DEVICE_METADATA", "localhost") + + cfg_switch_type = metatbl.get("switch_type") + + # Neighbor record verifiation done in line card + if cfg_switch_type == "voq": + lc_switch_id = metatbl.get("switch_id") + assert lc_switch_id != "", "Got error in getting switch_id from CONFIG_DB DEVICE_METADATA" + if lc_switch_id == "0": + + # Add a static neighbor + _, res = dvs.runcmd(['sh', "-c", "ip neigh add 10.8.101.2 lladdr 00:01:02:03:04:05 dev Ethernet0"]) + assert res == "", "Error configuring static neigh" + + asic_db = dvs.get_asic_db() + neighkeys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY") + assert len(neighkeys), "No neigh entries in ASIC_DB" + + # Check for presence of the neighbor in ASIC_DB + test_neigh = "" + for nkey in neighkeys: + ne = ast.literal_eval(nkey) + if ne['ip'] == '10.8.101.2': + test_neigh = nkey + break + + assert test_neigh != "", "Neigh not found in ASIC_DB" + + # Check for presence of encap index, retrieve and store it for sync verification + test_neigh_entry = asic_db.get_entry("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_neigh) + encap_index = test_neigh_entry.get("SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX") + assert encap_index != "", "VOQ encap index is not programmed in ASIC_DB" + + break + + # Verify neighbor record syncing with encap index + dvss = vct.dvss + for name in dvss.keys(): + if name.startswith("supervisor"): + dvs = dvss[name] + chassis_app_db = DVSDatabase(swsscommon.CHASSIS_APP_DB, dvs.redis_chassis_sock) + sysneighkeys = chassis_app_db.get_keys("SYSTEM_NEIGH") + assert len(sysneighkeys), "No system neighbor entries in chassis app db" + + test_sysneigh = "" + for sysnk in sysneighkeys: + sysnk_tok = sysnk.split("|") + assert len(sysnk_tok) == 3, "Invalid system neigh key in chassis app db" + if sysnk_tok[2] == "10.8.101.2": + test_sysneigh = sysnk + break + + assert test_sysneigh != "", "Neigh is not sync-ed to chassis app db" + + test_sysneigh_entry = chassis_app_db.get_entry("SYSTEM_NEIGH", test_sysneigh) + sys_neigh_encap_index = test_sysneigh_entry.get("encap_index") + assert sys_neigh_encap_index != "", "System neigh in chassis app db does not have encap index" + + assert encap_index == sys_neigh_encap_index, "Encap index not sync-ed correctly" + + break + +# Add Dummy always-pass test at end as workaroud +# for issue when Flaky fail on final test it invokes module tear-down before retrying +def test_nonflaky_dummy(): + pass diff --git a/tests/virtual_chassis/0/chassis_db.json b/tests/virtual_chassis/0/chassis_db.json deleted file mode 100644 index a80ff2c7b6..0000000000 --- a/tests/virtual_chassis/0/chassis_db.json +++ /dev/null @@ -1,674 +0,0 @@ -{ - "SYSTEM_PORT|Linecard1|Ethernet0": { - "speed": "40000", - "system_port_id": "1", - "switch_id": "0", - "core_id": "0", - "core_port_id": "1" - }, - "SYSTEM_PORT|Linecard1|Ethernet4": { - "speed": "40000", - "system_port_id": "2", - "switch_id": "0", - "core_id": "0", - "core_port_id": "2" - }, - "SYSTEM_PORT|Linecard1|Ethernet8": { - "speed": "40000", - "system_port_id": "3", - "switch_id": "0", - "core_id": "0", - "core_port_id": "3" - }, - "SYSTEM_PORT|Linecard1|Ethernet12": { - "speed": "40000", - "system_port_id": "4", - "switch_id": "0", - "core_id": "0", - "core_port_id": "4" - }, - "SYSTEM_PORT|Linecard1|Ethernet16": { - "speed": "40000", - "system_port_id": "5", - "switch_id": "0", - "core_id": "0", - "core_port_id": "5" - }, - "SYSTEM_PORT|Linecard1|Ethernet20": { - "speed": "40000", - "system_port_id": "6", - "switch_id": "0", - "core_id": "0", - "core_port_id": "6" - }, - "SYSTEM_PORT|Linecard1|Ethernet24": { - "speed": "40000", - "system_port_id": "7", - "switch_id": "0", - "core_id": "0", - "core_port_id": "7" - }, - "SYSTEM_PORT|Linecard1|Ethernet28": { - "speed": "40000", - "system_port_id": "8", - "switch_id": "0", - "core_id": "0", - "core_port_id": "8" - }, - "SYSTEM_PORT|Linecard1|Ethernet32": { - "speed": "40000", - "system_port_id": "9", - "switch_id": "0", - "core_id": "0", - "core_port_id": "9" - }, - "SYSTEM_PORT|Linecard1|Ethernet36": { - "speed": "40000", - "system_port_id": "10", - "switch_id": "0", - "core_id": "0", - "core_port_id": "10" - }, - "SYSTEM_PORT|Linecard1|Ethernet40": { - "speed": "40000", - "system_port_id": "11", - "switch_id": "0", - "core_id": "0", - "core_port_id": "11" - }, - "SYSTEM_PORT|Linecard1|Ethernet44": { - "speed": "40000", - "system_port_id": "12", - "switch_id": "0", - "core_id": "0", - "core_port_id": "12" - }, - "SYSTEM_PORT|Linecard1|Ethernet48": { - "speed": "40000", - "system_port_id": "13", - "switch_id": "0", - "core_id": "0", - "core_port_id": "13" - }, - "SYSTEM_PORT|Linecard1|Ethernet52": { - "speed": "40000", - "system_port_id": "14", - "switch_id": "0", - "core_id": "0", - "core_port_id": "14" - }, - "SYSTEM_PORT|Linecard1|Ethernet56": { - "speed": "40000", - "system_port_id": "15", - "switch_id": "0", - "core_id": "0", - "core_port_id": "15" - }, - "SYSTEM_PORT|Linecard1|Ethernet60": { - "speed": "40000", - "system_port_id": "16", - "switch_id": "0", - "core_id": "0", - "core_port_id": "16" - }, - "SYSTEM_PORT|Linecard1|Ethernet64": { - "speed": "40000", - "system_port_id": "17", - "switch_id": "0", - "core_id": "1", - "core_port_id": "1" - }, - "SYSTEM_PORT|Linecard1|Ethernet68": { - "speed": "40000", - "system_port_id": "18", - "switch_id": "0", - "core_id": "1", - "core_port_id": "2" - }, - "SYSTEM_PORT|Linecard1|Ethernet72": { - "speed": "40000", - "system_port_id": "19", - "switch_id": "0", - "core_id": "1", - "core_port_id": "3" - }, - "SYSTEM_PORT|Linecard1|Ethernet76": { - "speed": "40000", - "system_port_id": "20", - "switch_id": "0", - "core_id": "1", - "core_port_id": "4" - }, - "SYSTEM_PORT|Linecard1|Ethernet80": { - "speed": "40000", - "system_port_id": "21", - "switch_id": "0", - "core_id": "1", - "core_port_id": "5" - }, - "SYSTEM_PORT|Linecard1|Ethernet84": { - "speed": "40000", - "system_port_id": "22", - "switch_id": "0", - "core_id": "1", - "core_port_id": "6" - }, - "SYSTEM_PORT|Linecard1|Ethernet88": { - "speed": "40000", - "system_port_id": "23", - "switch_id": "0", - "core_id": "1", - "core_port_id": "7" - }, - "SYSTEM_PORT|Linecard1|Ethernet92": { - "speed": "40000", - "system_port_id": "24", - "switch_id": "0", - "core_id": "1", - "core_port_id": "8" - }, - "SYSTEM_PORT|Linecard1|Ethernet96": { - "speed": "40000", - "system_port_id": "25", - "switch_id": "0", - "core_id": "1", - "core_port_id": "9" - }, - "SYSTEM_PORT|Linecard1|Ethernet100": { - "speed": "40000", - "system_port_id": "26", - "switch_id": "0", - "core_id": "1", - "core_port_id": "10" - }, - "SYSTEM_PORT|Linecard1|Ethernet104": { - "speed": "40000", - "system_port_id": "27", - "switch_id": "0", - "core_id": "1", - "core_port_id": "11" - }, - "SYSTEM_PORT|Linecard1|Ethernet108": { - "speed": "40000", - "system_port_id": "28", - "switch_id": "0", - "core_id": "1", - "core_port_id": "12" - }, - "SYSTEM_PORT|Linecard1|Ethernet112": { - "speed": "40000", - "system_port_id": "29", - "switch_id": "0", - "core_id": "1", - "core_port_id": "13" - }, - "SYSTEM_PORT|Linecard1|Ethernet116": { - "speed": "40000", - "system_port_id": "30", - "switch_id": "0", - "core_id": "1", - "core_port_id": "14" - }, - "SYSTEM_PORT|Linecard1|Ethernet120": { - "speed": "40000", - "system_port_id": "31", - "switch_id": "0", - "core_id": "1", - "core_port_id": "15" - }, - "SYSTEM_PORT|Linecard1|Ethernet124": { - "speed": "40000", - "system_port_id": "32", - "switch_id": "0", - "core_id": "1", - "core_port_id": "16" - }, - "SYSTEM_PORT|Linecard2|Ethernet0": { - "speed": "40000", - "system_port_id": "33", - "switch_id": "1", - "core_id": "0", - "core_port_id": "1" - }, - "SYSTEM_PORT|Linecard2|Ethernet4": { - "speed": "40000", - "system_port_id": "34", - "switch_id": "1", - "core_id": "0", - "core_port_id": "2" - }, - "SYSTEM_PORT|Linecard2|Ethernet8": { - "speed": "40000", - "system_port_id": "35", - "switch_id": "1", - "core_id": "0", - "core_port_id": "3" - }, - "SYSTEM_PORT|Linecard2|Ethernet12": { - "speed": "40000", - "system_port_id": "36", - "switch_id": "1", - "core_id": "0", - "core_port_id": "4" - }, - "SYSTEM_PORT|Linecard2|Ethernet16": { - "speed": "40000", - "system_port_id": "37", - "switch_id": "1", - "core_id": "0", - "core_port_id": "5" - }, - "SYSTEM_PORT|Linecard2|Ethernet20": { - "speed": "40000", - "system_port_id": "38", - "switch_id": "1", - "core_id": "0", - "core_port_id": "6" - }, - "SYSTEM_PORT|Linecard2|Ethernet24": { - "speed": "40000", - "system_port_id": "39", - "switch_id": "1", - "core_id": "0", - "core_port_id": "7" - }, - "SYSTEM_PORT|Linecard2|Ethernet28": { - "speed": "40000", - "system_port_id": "40", - "switch_id": "1", - "core_id": "0", - "core_port_id": "8" - }, - "SYSTEM_PORT|Linecard2|Ethernet32": { - "speed": "40000", - "system_port_id": "41", - "switch_id": "1", - "core_id": "0", - "core_port_id": "9" - }, - "SYSTEM_PORT|Linecard2|Ethernet36": { - "speed": "40000", - "system_port_id": "42", - "switch_id": "1", - "core_id": "0", - "core_port_id": "10" - }, - "SYSTEM_PORT|Linecard2|Ethernet40": { - "speed": "40000", - "system_port_id": "43", - "switch_id": "1", - "core_id": "0", - "core_port_id": "11" - }, - "SYSTEM_PORT|Linecard2|Ethernet44": { - "speed": "40000", - "system_port_id": "44", - "switch_id": "1", - "core_id": "0", - "core_port_id": "12" - }, - "SYSTEM_PORT|Linecard2|Ethernet48": { - "speed": "40000", - "system_port_id": "45", - "switch_id": "1", - "core_id": "0", - "core_port_id": "13" - }, - "SYSTEM_PORT|Linecard2|Ethernet52": { - "speed": "40000", - "system_port_id": "46", - "switch_id": "1", - "core_id": "0", - "core_port_id": "14" - }, - "SYSTEM_PORT|Linecard2|Ethernet56": { - "speed": "40000", - "system_port_id": "47", - "switch_id": "1", - "core_id": "0", - "core_port_id": "15" - }, - "SYSTEM_PORT|Linecard2|Ethernet60": { - "speed": "40000", - "system_port_id": "48", - "switch_id": "1", - "core_id": "0", - "core_port_id": "16" - }, - "SYSTEM_PORT|Linecard2|Ethernet64": { - "speed": "40000", - "system_port_id": "49", - "switch_id": "1", - "core_id": "1", - "core_port_id": "1" - }, - "SYSTEM_PORT|Linecard2|Ethernet68": { - "speed": "40000", - "system_port_id": "50", - "switch_id": "1", - "core_id": "1", - "core_port_id": "2" - }, - "SYSTEM_PORT|Linecard2|Ethernet72": { - "speed": "40000", - "system_port_id": "51", - "switch_id": "1", - "core_id": "1", - "core_port_id": "3" - }, - "SYSTEM_PORT|Linecard2|Ethernet76": { - "speed": "40000", - "system_port_id": "52", - "switch_id": "1", - "core_id": "1", - "core_port_id": "4" - }, - "SYSTEM_PORT|Linecard2|Ethernet80": { - "speed": "40000", - "system_port_id": "53", - "switch_id": "1", - "core_id": "1", - "core_port_id": "5" - }, - "SYSTEM_PORT|Linecard2|Ethernet84": { - "speed": "40000", - "system_port_id": "54", - "switch_id": "1", - "core_id": "1", - "core_port_id": "6" - }, - "SYSTEM_PORT|Linecard2|Ethernet88": { - "speed": "40000", - "system_port_id": "55", - "switch_id": "1", - "core_id": "1", - "core_port_id": "7" - }, - "SYSTEM_PORT|Linecard2|Ethernet92": { - "speed": "40000", - "system_port_id": "56", - "switch_id": "1", - "core_id": "1", - "core_port_id": "8" - }, - "SYSTEM_PORT|Linecard2|Ethernet96": { - "speed": "40000", - "system_port_id": "57", - "switch_id": "1", - "core_id": "1", - "core_port_id": "9" - }, - "SYSTEM_PORT|Linecard2|Ethernet100": { - "speed": "40000", - "system_port_id": "58", - "switch_id": "1", - "core_id": "1", - "core_port_id": "10" - }, - "SYSTEM_PORT|Linecard2|Ethernet104": { - "speed": "40000", - "system_port_id": "59", - "switch_id": "1", - "core_id": "1", - "core_port_id": "11" - }, - "SYSTEM_PORT|Linecard2|Ethernet108": { - "speed": "40000", - "system_port_id": "60", - "switch_id": "1", - "core_id": "1", - "core_port_id": "12" - }, - "SYSTEM_PORT|Linecard2|Ethernet112": { - "speed": "40000", - "system_port_id": "61", - "switch_id": "1", - "core_id": "1", - "core_port_id": "13" - }, - "SYSTEM_PORT|Linecard2|Ethernet116": { - "speed": "40000", - "system_port_id": "62", - "switch_id": "1", - "core_id": "1", - "core_port_id": "14" - }, - "SYSTEM_PORT|Linecard2|Ethernet120": { - "speed": "40000", - "system_port_id": "63", - "switch_id": "1", - "core_id": "1", - "core_port_id": "15" - }, - "SYSTEM_PORT|Linecard2|Ethernet124": { - "speed": "40000", - "system_port_id": "64", - "switch_id": "1", - "core_id": "1", - "core_port_id": "16" - }, - "SYSTEM_PORT|Linecard3|Ethernet0": { - "speed": "40000", - "system_port_id": "65", - "switch_id": "2", - "core_id": "0", - "core_port_id": "1" - }, - "SYSTEM_PORT|Linecard3|Ethernet4": { - "speed": "40000", - "system_port_id": "66", - "switch_id": "2", - "core_id": "0", - "core_port_id": "2" - }, - "SYSTEM_PORT|Linecard3|Ethernet8": { - "speed": "40000", - "system_port_id": "67", - "switch_id": "2", - "core_id": "0", - "core_port_id": "3" - }, - "SYSTEM_PORT|Linecard3|Ethernet12": { - "speed": "40000", - "system_port_id": "68", - "switch_id": "2", - "core_id": "0", - "core_port_id": "4" - }, - "SYSTEM_PORT|Linecard3|Ethernet16": { - "speed": "40000", - "system_port_id": "69", - "switch_id": "2", - "core_id": "0", - "core_port_id": "5" - }, - "SYSTEM_PORT|Linecard3|Ethernet20": { - "speed": "40000", - "system_port_id": "70", - "switch_id": "2", - "core_id": "0", - "core_port_id": "6" - }, - "SYSTEM_PORT|Linecard3|Ethernet24": { - "speed": "40000", - "system_port_id": "71", - "switch_id": "2", - "core_id": "0", - "core_port_id": "7" - }, - "SYSTEM_PORT|Linecard3|Ethernet28": { - "speed": "40000", - "system_port_id": "72", - "switch_id": "2", - "core_id": "0", - "core_port_id": "8" - }, - "SYSTEM_PORT|Linecard3|Ethernet32": { - "speed": "40000", - "system_port_id": "73", - "switch_id": "2", - "core_id": "0", - "core_port_id": "9" - }, - "SYSTEM_PORT|Linecard3|Ethernet36": { - "speed": "40000", - "system_port_id": "74", - "switch_id": "2", - "core_id": "0", - "core_port_id": "10" - }, - "SYSTEM_PORT|Linecard3|Ethernet40": { - "speed": "40000", - "system_port_id": "75", - "switch_id": "2", - "core_id": "0", - "core_port_id": "11" - }, - "SYSTEM_PORT|Linecard3|Ethernet44": { - "speed": "40000", - "system_port_id": "76", - "switch_id": "2", - "core_id": "0", - "core_port_id": "12" - }, - "SYSTEM_PORT|Linecard3|Ethernet48": { - "speed": "40000", - "system_port_id": "77", - "switch_id": "2", - "core_id": "0", - "core_port_id": "13" - }, - "SYSTEM_PORT|Linecard3|Ethernet52": { - "speed": "40000", - "system_port_id": "78", - "switch_id": "2", - "core_id": "0", - "core_port_id": "14" - }, - "SYSTEM_PORT|Linecard3|Ethernet56": { - "speed": "40000", - "system_port_id": "79", - "switch_id": "2", - "core_id": "0", - "core_port_id": "15" - }, - "SYSTEM_PORT|Linecard3|Ethernet60": { - "speed": "40000", - "system_port_id": "80", - "switch_id": "2", - "core_id": "0", - "core_port_id": "16" - }, - "SYSTEM_PORT|Linecard3|Ethernet64": { - "speed": "40000", - "system_port_id": "81", - "switch_id": "2", - "core_id": "1", - "core_port_id": "1" - }, - "SYSTEM_PORT|Linecard3|Ethernet68": { - "speed": "40000", - "system_port_id": "82", - "switch_id": "2", - "core_id": "1", - "core_port_id": "2" - }, - "SYSTEM_PORT|Linecard3|Ethernet72": { - "speed": "40000", - "system_port_id": "83", - "switch_id": "2", - "core_id": "1", - "core_port_id": "3" - }, - "SYSTEM_PORT|Linecard3|Ethernet76": { - "speed": "40000", - "system_port_id": "84", - "switch_id": "2", - "core_id": "1", - "core_port_id": "4" - }, - "SYSTEM_PORT|Linecard3|Ethernet80": { - "speed": "40000", - "system_port_id": "85", - "switch_id": "2", - "core_id": "1", - "core_port_id": "5" - }, - "SYSTEM_PORT|Linecard3|Ethernet84": { - "speed": "40000", - "system_port_id": "86", - "switch_id": "2", - "core_id": "1", - "core_port_id": "6" - }, - "SYSTEM_PORT|Linecard3|Ethernet88": { - "speed": "40000", - "system_port_id": "87", - "switch_id": "2", - "core_id": "1", - "core_port_id": "7" - }, - "SYSTEM_PORT|Linecard3|Ethernet92": { - "speed": "40000", - "system_port_id": "88", - "switch_id": "2", - "core_id": "1", - "core_port_id": "8" - }, - "SYSTEM_PORT|Linecard3|Ethernet96": { - "speed": "40000", - "system_port_id": "89", - "switch_id": "2", - "core_id": "1", - "core_port_id": "9" - }, - "SYSTEM_PORT|Linecard3|Ethernet100": { - "speed": "40000", - "system_port_id": "90", - "switch_id": "2", - "core_id": "1", - "core_port_id": "10" - }, - "SYSTEM_PORT|Linecard3|Ethernet104": { - "speed": "40000", - "system_port_id": "91", - "switch_id": "2", - "core_id": "1", - "core_port_id": "11" - }, - "SYSTEM_PORT|Linecard3|Ethernet108": { - "speed": "40000", - "system_port_id": "92", - "switch_id": "2", - "core_id": "1", - "core_port_id": "12" - }, - "SYSTEM_PORT|Linecard3|Ethernet112": { - "speed": "40000", - "system_port_id": "93", - "switch_id": "2", - "core_id": "1", - "core_port_id": "13" - }, - "SYSTEM_PORT|Linecard3|Ethernet116": { - "speed": "40000", - "system_port_id": "94", - "switch_id": "2", - "core_id": "1", - "core_port_id": "14" - }, - "SYSTEM_PORT|Linecard3|Ethernet120": { - "speed": "40000", - "system_port_id": "95", - "switch_id": "2", - "core_id": "1", - "core_port_id": "15" - }, - "SYSTEM_PORT|Linecard3|Ethernet124": { - "speed": "40000", - "system_port_id": "96", - "switch_id": "2", - "core_id": "1", - "core_port_id": "16" - } -} diff --git a/tests/virtual_chassis/1/coreportindexmap.ini b/tests/virtual_chassis/1/coreportindexmap.ini new file mode 100644 index 0000000000..2445e45d00 --- /dev/null +++ b/tests/virtual_chassis/1/coreportindexmap.ini @@ -0,0 +1,32 @@ +eth1:0,1 +eth2:0,2 +eth3:0,3 +eth4:0,4 +eth5:0,5 +eth6:0,6 +eth7:0,7 +eth8:0,8 +eth9:0,9 +eth10:0,10 +eth11:0,11 +eth12:0,12 +eth13:0,13 +eth14:0,14 +eth15:0,15 +eth16:0,16 +eth17:1,1 +eth18:1,2 +eth19:1,3 +eth20:1,4 +eth21:1,5 +eth22:1,6 +eth23:1,7 +eth24:1,8 +eth25:1,9 +eth26:1,10 +eth27:1,11 +eth28:1,12 +eth29:1,13 +eth30:1,14 +eth31:1,15 +eth32:1,16 diff --git a/tests/virtual_chassis/1/default_config.json b/tests/virtual_chassis/1/default_config.json index 638843c5d5..8952380199 100644 --- a/tests/virtual_chassis/1/default_config.json +++ b/tests/virtual_chassis/1/default_config.json @@ -5,7 +5,10 @@ "instance_name": "Linecard1", "connect_to_chassis_db" : 1, "chassis_db_address" : "10.8.1.200", - "inband_address" : "10.8.1.1/24" + "inband_address" : "10.8.1.1/24", + "switch_type": "voq", + "switch_id": "0", + "max_cores": "48" } }, "INTERFACE": { @@ -21,5 +24,679 @@ "Ethernet4": { "admin_status": "up" } + }, + "SYSTEM_PORT": { + "Linecard1|Ethernet0": { + "speed": "40000", + "system_port_id": "1", + "switch_id": "0", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard1|Ethernet4": { + "speed": "40000", + "system_port_id": "2", + "switch_id": "0", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard1|Ethernet8": { + "speed": "40000", + "system_port_id": "3", + "switch_id": "0", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard1|Ethernet12": { + "speed": "40000", + "system_port_id": "4", + "switch_id": "0", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard1|Ethernet16": { + "speed": "40000", + "system_port_id": "5", + "switch_id": "0", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard1|Ethernet20": { + "speed": "40000", + "system_port_id": "6", + "switch_id": "0", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard1|Ethernet24": { + "speed": "40000", + "system_port_id": "7", + "switch_id": "0", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard1|Ethernet28": { + "speed": "40000", + "system_port_id": "8", + "switch_id": "0", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard1|Ethernet32": { + "speed": "40000", + "system_port_id": "9", + "switch_id": "0", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard1|Ethernet36": { + "speed": "40000", + "system_port_id": "10", + "switch_id": "0", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard1|Ethernet40": { + "speed": "40000", + "system_port_id": "11", + "switch_id": "0", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard1|Ethernet44": { + "speed": "40000", + "system_port_id": "12", + "switch_id": "0", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard1|Ethernet48": { + "speed": "40000", + "system_port_id": "13", + "switch_id": "0", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard1|Ethernet52": { + "speed": "40000", + "system_port_id": "14", + "switch_id": "0", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard1|Ethernet56": { + "speed": "40000", + "system_port_id": "15", + "switch_id": "0", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard1|Ethernet60": { + "speed": "40000", + "system_port_id": "16", + "switch_id": "0", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard1|Ethernet64": { + "speed": "40000", + "system_port_id": "17", + "switch_id": "0", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard1|Ethernet68": { + "speed": "40000", + "system_port_id": "18", + "switch_id": "0", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard1|Ethernet72": { + "speed": "40000", + "system_port_id": "19", + "switch_id": "0", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard1|Ethernet76": { + "speed": "40000", + "system_port_id": "20", + "switch_id": "0", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard1|Ethernet80": { + "speed": "40000", + "system_port_id": "21", + "switch_id": "0", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard1|Ethernet84": { + "speed": "40000", + "system_port_id": "22", + "switch_id": "0", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard1|Ethernet88": { + "speed": "40000", + "system_port_id": "23", + "switch_id": "0", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard1|Ethernet92": { + "speed": "40000", + "system_port_id": "24", + "switch_id": "0", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard1|Ethernet96": { + "speed": "40000", + "system_port_id": "25", + "switch_id": "0", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard1|Ethernet100": { + "speed": "40000", + "system_port_id": "26", + "switch_id": "0", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard1|Ethernet104": { + "speed": "40000", + "system_port_id": "27", + "switch_id": "0", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard1|Ethernet108": { + "speed": "40000", + "system_port_id": "28", + "switch_id": "0", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard1|Ethernet112": { + "speed": "40000", + "system_port_id": "29", + "switch_id": "0", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard1|Ethernet116": { + "speed": "40000", + "system_port_id": "30", + "switch_id": "0", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard1|Ethernet120": { + "speed": "40000", + "system_port_id": "31", + "switch_id": "0", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard1|Ethernet124": { + "speed": "40000", + "system_port_id": "32", + "switch_id": "0", + "core_index": "1", + "core_port_index": "16" + }, + "Linecard2|Ethernet0": { + "speed": "40000", + "system_port_id": "33", + "switch_id": "1", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard2|Ethernet4": { + "speed": "40000", + "system_port_id": "34", + "switch_id": "1", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard2|Ethernet8": { + "speed": "40000", + "system_port_id": "35", + "switch_id": "1", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard2|Ethernet12": { + "speed": "40000", + "system_port_id": "36", + "switch_id": "1", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard2|Ethernet16": { + "speed": "40000", + "system_port_id": "37", + "switch_id": "1", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard2|Ethernet20": { + "speed": "40000", + "system_port_id": "38", + "switch_id": "1", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard2|Ethernet24": { + "speed": "40000", + "system_port_id": "39", + "switch_id": "1", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard2|Ethernet28": { + "speed": "40000", + "system_port_id": "40", + "switch_id": "1", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard2|Ethernet32": { + "speed": "40000", + "system_port_id": "41", + "switch_id": "1", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard2|Ethernet36": { + "speed": "40000", + "system_port_id": "42", + "switch_id": "1", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard2|Ethernet40": { + "speed": "40000", + "system_port_id": "43", + "switch_id": "1", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard2|Ethernet44": { + "speed": "40000", + "system_port_id": "44", + "switch_id": "1", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard2|Ethernet48": { + "speed": "40000", + "system_port_id": "45", + "switch_id": "1", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard2|Ethernet52": { + "speed": "40000", + "system_port_id": "46", + "switch_id": "1", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard2|Ethernet56": { + "speed": "40000", + "system_port_id": "47", + "switch_id": "1", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard2|Ethernet60": { + "speed": "40000", + "system_port_id": "48", + "switch_id": "1", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard2|Ethernet64": { + "speed": "40000", + "system_port_id": "49", + "switch_id": "1", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard2|Ethernet68": { + "speed": "40000", + "system_port_id": "50", + "switch_id": "1", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard2|Ethernet72": { + "speed": "40000", + "system_port_id": "51", + "switch_id": "1", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard2|Ethernet76": { + "speed": "40000", + "system_port_id": "52", + "switch_id": "1", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard2|Ethernet80": { + "speed": "40000", + "system_port_id": "53", + "switch_id": "1", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard2|Ethernet84": { + "speed": "40000", + "system_port_id": "54", + "switch_id": "1", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard2|Ethernet88": { + "speed": "40000", + "system_port_id": "55", + "switch_id": "1", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard2|Ethernet92": { + "speed": "40000", + "system_port_id": "56", + "switch_id": "1", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard2|Ethernet96": { + "speed": "40000", + "system_port_id": "57", + "switch_id": "1", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard2|Ethernet100": { + "speed": "40000", + "system_port_id": "58", + "switch_id": "1", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard2|Ethernet104": { + "speed": "40000", + "system_port_id": "59", + "switch_id": "1", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard2|Ethernet108": { + "speed": "40000", + "system_port_id": "60", + "switch_id": "1", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard2|Ethernet112": { + "speed": "40000", + "system_port_id": "61", + "switch_id": "1", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard2|Ethernet116": { + "speed": "40000", + "system_port_id": "62", + "switch_id": "1", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard2|Ethernet120": { + "speed": "40000", + "system_port_id": "63", + "switch_id": "1", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard2|Ethernet124": { + "speed": "40000", + "system_port_id": "64", + "switch_id": "1", + "core_index": "1", + "core_port_index": "16" + }, + "Linecard3|Ethernet0": { + "speed": "40000", + "system_port_id": "65", + "switch_id": "2", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard3|Ethernet4": { + "speed": "40000", + "system_port_id": "66", + "switch_id": "2", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard3|Ethernet8": { + "speed": "40000", + "system_port_id": "67", + "switch_id": "2", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard3|Ethernet12": { + "speed": "40000", + "system_port_id": "68", + "switch_id": "2", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard3|Ethernet16": { + "speed": "40000", + "system_port_id": "69", + "switch_id": "2", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard3|Ethernet20": { + "speed": "40000", + "system_port_id": "70", + "switch_id": "2", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard3|Ethernet24": { + "speed": "40000", + "system_port_id": "71", + "switch_id": "2", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard3|Ethernet28": { + "speed": "40000", + "system_port_id": "72", + "switch_id": "2", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard3|Ethernet32": { + "speed": "40000", + "system_port_id": "73", + "switch_id": "2", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard3|Ethernet36": { + "speed": "40000", + "system_port_id": "74", + "switch_id": "2", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard3|Ethernet40": { + "speed": "40000", + "system_port_id": "75", + "switch_id": "2", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard3|Ethernet44": { + "speed": "40000", + "system_port_id": "76", + "switch_id": "2", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard3|Ethernet48": { + "speed": "40000", + "system_port_id": "77", + "switch_id": "2", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard3|Ethernet52": { + "speed": "40000", + "system_port_id": "78", + "switch_id": "2", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard3|Ethernet56": { + "speed": "40000", + "system_port_id": "79", + "switch_id": "2", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard3|Ethernet60": { + "speed": "40000", + "system_port_id": "80", + "switch_id": "2", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard3|Ethernet64": { + "speed": "40000", + "system_port_id": "81", + "switch_id": "2", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard3|Ethernet68": { + "speed": "40000", + "system_port_id": "82", + "switch_id": "2", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard3|Ethernet72": { + "speed": "40000", + "system_port_id": "83", + "switch_id": "2", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard3|Ethernet76": { + "speed": "40000", + "system_port_id": "84", + "switch_id": "2", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard3|Ethernet80": { + "speed": "40000", + "system_port_id": "85", + "switch_id": "2", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard3|Ethernet84": { + "speed": "40000", + "system_port_id": "86", + "switch_id": "2", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard3|Ethernet88": { + "speed": "40000", + "system_port_id": "87", + "switch_id": "2", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard3|Ethernet92": { + "speed": "40000", + "system_port_id": "88", + "switch_id": "2", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard3|Ethernet96": { + "speed": "40000", + "system_port_id": "89", + "switch_id": "2", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard3|Ethernet100": { + "speed": "40000", + "system_port_id": "90", + "switch_id": "2", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard3|Ethernet104": { + "speed": "40000", + "system_port_id": "91", + "switch_id": "2", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard3|Ethernet108": { + "speed": "40000", + "system_port_id": "92", + "switch_id": "2", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard3|Ethernet112": { + "speed": "40000", + "system_port_id": "93", + "switch_id": "2", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard3|Ethernet116": { + "speed": "40000", + "system_port_id": "94", + "switch_id": "2", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard3|Ethernet120": { + "speed": "40000", + "system_port_id": "95", + "switch_id": "2", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard3|Ethernet124": { + "speed": "40000", + "system_port_id": "96", + "switch_id": "2", + "core_index": "1", + "core_port_index": "16" + } } } diff --git a/tests/virtual_chassis/2/coreportindexmap.ini b/tests/virtual_chassis/2/coreportindexmap.ini new file mode 100644 index 0000000000..2445e45d00 --- /dev/null +++ b/tests/virtual_chassis/2/coreportindexmap.ini @@ -0,0 +1,32 @@ +eth1:0,1 +eth2:0,2 +eth3:0,3 +eth4:0,4 +eth5:0,5 +eth6:0,6 +eth7:0,7 +eth8:0,8 +eth9:0,9 +eth10:0,10 +eth11:0,11 +eth12:0,12 +eth13:0,13 +eth14:0,14 +eth15:0,15 +eth16:0,16 +eth17:1,1 +eth18:1,2 +eth19:1,3 +eth20:1,4 +eth21:1,5 +eth22:1,6 +eth23:1,7 +eth24:1,8 +eth25:1,9 +eth26:1,10 +eth27:1,11 +eth28:1,12 +eth29:1,13 +eth30:1,14 +eth31:1,15 +eth32:1,16 diff --git a/tests/virtual_chassis/2/default_config.json b/tests/virtual_chassis/2/default_config.json index af85811a85..b4dc1a35a0 100644 --- a/tests/virtual_chassis/2/default_config.json +++ b/tests/virtual_chassis/2/default_config.json @@ -5,7 +5,10 @@ "instance_name": "Linecard2", "connect_to_chassis_db" : 1, "chassis_db_address" : "10.8.1.200", - "inband_address" : "10.8.1.2/24" + "inband_address" : "10.8.1.2/24", + "switch_type": "voq", + "switch_id": "2", + "max_cores": "48" } }, "INTERFACE": { @@ -16,5 +19,679 @@ "Ethernet0": { "admin_status": "up" } + }, + "SYSTEM_PORT": { + "Linecard1|Ethernet0": { + "speed": "40000", + "system_port_id": "1", + "switch_id": "0", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard1|Ethernet4": { + "speed": "40000", + "system_port_id": "2", + "switch_id": "0", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard1|Ethernet8": { + "speed": "40000", + "system_port_id": "3", + "switch_id": "0", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard1|Ethernet12": { + "speed": "40000", + "system_port_id": "4", + "switch_id": "0", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard1|Ethernet16": { + "speed": "40000", + "system_port_id": "5", + "switch_id": "0", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard1|Ethernet20": { + "speed": "40000", + "system_port_id": "6", + "switch_id": "0", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard1|Ethernet24": { + "speed": "40000", + "system_port_id": "7", + "switch_id": "0", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard1|Ethernet28": { + "speed": "40000", + "system_port_id": "8", + "switch_id": "0", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard1|Ethernet32": { + "speed": "40000", + "system_port_id": "9", + "switch_id": "0", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard1|Ethernet36": { + "speed": "40000", + "system_port_id": "10", + "switch_id": "0", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard1|Ethernet40": { + "speed": "40000", + "system_port_id": "11", + "switch_id": "0", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard1|Ethernet44": { + "speed": "40000", + "system_port_id": "12", + "switch_id": "0", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard1|Ethernet48": { + "speed": "40000", + "system_port_id": "13", + "switch_id": "0", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard1|Ethernet52": { + "speed": "40000", + "system_port_id": "14", + "switch_id": "0", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard1|Ethernet56": { + "speed": "40000", + "system_port_id": "15", + "switch_id": "0", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard1|Ethernet60": { + "speed": "40000", + "system_port_id": "16", + "switch_id": "0", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard1|Ethernet64": { + "speed": "40000", + "system_port_id": "17", + "switch_id": "0", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard1|Ethernet68": { + "speed": "40000", + "system_port_id": "18", + "switch_id": "0", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard1|Ethernet72": { + "speed": "40000", + "system_port_id": "19", + "switch_id": "0", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard1|Ethernet76": { + "speed": "40000", + "system_port_id": "20", + "switch_id": "0", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard1|Ethernet80": { + "speed": "40000", + "system_port_id": "21", + "switch_id": "0", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard1|Ethernet84": { + "speed": "40000", + "system_port_id": "22", + "switch_id": "0", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard1|Ethernet88": { + "speed": "40000", + "system_port_id": "23", + "switch_id": "0", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard1|Ethernet92": { + "speed": "40000", + "system_port_id": "24", + "switch_id": "0", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard1|Ethernet96": { + "speed": "40000", + "system_port_id": "25", + "switch_id": "0", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard1|Ethernet100": { + "speed": "40000", + "system_port_id": "26", + "switch_id": "0", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard1|Ethernet104": { + "speed": "40000", + "system_port_id": "27", + "switch_id": "0", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard1|Ethernet108": { + "speed": "40000", + "system_port_id": "28", + "switch_id": "0", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard1|Ethernet112": { + "speed": "40000", + "system_port_id": "29", + "switch_id": "0", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard1|Ethernet116": { + "speed": "40000", + "system_port_id": "30", + "switch_id": "0", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard1|Ethernet120": { + "speed": "40000", + "system_port_id": "31", + "switch_id": "0", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard1|Ethernet124": { + "speed": "40000", + "system_port_id": "32", + "switch_id": "0", + "core_index": "1", + "core_port_index": "16" + }, + "Linecard2|Ethernet0": { + "speed": "40000", + "system_port_id": "33", + "switch_id": "1", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard2|Ethernet4": { + "speed": "40000", + "system_port_id": "34", + "switch_id": "1", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard2|Ethernet8": { + "speed": "40000", + "system_port_id": "35", + "switch_id": "1", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard2|Ethernet12": { + "speed": "40000", + "system_port_id": "36", + "switch_id": "1", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard2|Ethernet16": { + "speed": "40000", + "system_port_id": "37", + "switch_id": "1", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard2|Ethernet20": { + "speed": "40000", + "system_port_id": "38", + "switch_id": "1", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard2|Ethernet24": { + "speed": "40000", + "system_port_id": "39", + "switch_id": "1", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard2|Ethernet28": { + "speed": "40000", + "system_port_id": "40", + "switch_id": "1", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard2|Ethernet32": { + "speed": "40000", + "system_port_id": "41", + "switch_id": "1", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard2|Ethernet36": { + "speed": "40000", + "system_port_id": "42", + "switch_id": "1", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard2|Ethernet40": { + "speed": "40000", + "system_port_id": "43", + "switch_id": "1", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard2|Ethernet44": { + "speed": "40000", + "system_port_id": "44", + "switch_id": "1", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard2|Ethernet48": { + "speed": "40000", + "system_port_id": "45", + "switch_id": "1", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard2|Ethernet52": { + "speed": "40000", + "system_port_id": "46", + "switch_id": "1", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard2|Ethernet56": { + "speed": "40000", + "system_port_id": "47", + "switch_id": "1", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard2|Ethernet60": { + "speed": "40000", + "system_port_id": "48", + "switch_id": "1", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard2|Ethernet64": { + "speed": "40000", + "system_port_id": "49", + "switch_id": "1", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard2|Ethernet68": { + "speed": "40000", + "system_port_id": "50", + "switch_id": "1", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard2|Ethernet72": { + "speed": "40000", + "system_port_id": "51", + "switch_id": "1", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard2|Ethernet76": { + "speed": "40000", + "system_port_id": "52", + "switch_id": "1", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard2|Ethernet80": { + "speed": "40000", + "system_port_id": "53", + "switch_id": "1", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard2|Ethernet84": { + "speed": "40000", + "system_port_id": "54", + "switch_id": "1", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard2|Ethernet88": { + "speed": "40000", + "system_port_id": "55", + "switch_id": "1", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard2|Ethernet92": { + "speed": "40000", + "system_port_id": "56", + "switch_id": "1", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard2|Ethernet96": { + "speed": "40000", + "system_port_id": "57", + "switch_id": "1", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard2|Ethernet100": { + "speed": "40000", + "system_port_id": "58", + "switch_id": "1", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard2|Ethernet104": { + "speed": "40000", + "system_port_id": "59", + "switch_id": "1", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard2|Ethernet108": { + "speed": "40000", + "system_port_id": "60", + "switch_id": "1", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard2|Ethernet112": { + "speed": "40000", + "system_port_id": "61", + "switch_id": "1", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard2|Ethernet116": { + "speed": "40000", + "system_port_id": "62", + "switch_id": "1", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard2|Ethernet120": { + "speed": "40000", + "system_port_id": "63", + "switch_id": "1", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard2|Ethernet124": { + "speed": "40000", + "system_port_id": "64", + "switch_id": "1", + "core_index": "1", + "core_port_index": "16" + }, + "Linecard3|Ethernet0": { + "speed": "40000", + "system_port_id": "65", + "switch_id": "2", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard3|Ethernet4": { + "speed": "40000", + "system_port_id": "66", + "switch_id": "2", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard3|Ethernet8": { + "speed": "40000", + "system_port_id": "67", + "switch_id": "2", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard3|Ethernet12": { + "speed": "40000", + "system_port_id": "68", + "switch_id": "2", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard3|Ethernet16": { + "speed": "40000", + "system_port_id": "69", + "switch_id": "2", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard3|Ethernet20": { + "speed": "40000", + "system_port_id": "70", + "switch_id": "2", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard3|Ethernet24": { + "speed": "40000", + "system_port_id": "71", + "switch_id": "2", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard3|Ethernet28": { + "speed": "40000", + "system_port_id": "72", + "switch_id": "2", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard3|Ethernet32": { + "speed": "40000", + "system_port_id": "73", + "switch_id": "2", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard3|Ethernet36": { + "speed": "40000", + "system_port_id": "74", + "switch_id": "2", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard3|Ethernet40": { + "speed": "40000", + "system_port_id": "75", + "switch_id": "2", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard3|Ethernet44": { + "speed": "40000", + "system_port_id": "76", + "switch_id": "2", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard3|Ethernet48": { + "speed": "40000", + "system_port_id": "77", + "switch_id": "2", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard3|Ethernet52": { + "speed": "40000", + "system_port_id": "78", + "switch_id": "2", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard3|Ethernet56": { + "speed": "40000", + "system_port_id": "79", + "switch_id": "2", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard3|Ethernet60": { + "speed": "40000", + "system_port_id": "80", + "switch_id": "2", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard3|Ethernet64": { + "speed": "40000", + "system_port_id": "81", + "switch_id": "2", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard3|Ethernet68": { + "speed": "40000", + "system_port_id": "82", + "switch_id": "2", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard3|Ethernet72": { + "speed": "40000", + "system_port_id": "83", + "switch_id": "2", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard3|Ethernet76": { + "speed": "40000", + "system_port_id": "84", + "switch_id": "2", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard3|Ethernet80": { + "speed": "40000", + "system_port_id": "85", + "switch_id": "2", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard3|Ethernet84": { + "speed": "40000", + "system_port_id": "86", + "switch_id": "2", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard3|Ethernet88": { + "speed": "40000", + "system_port_id": "87", + "switch_id": "2", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard3|Ethernet92": { + "speed": "40000", + "system_port_id": "88", + "switch_id": "2", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard3|Ethernet96": { + "speed": "40000", + "system_port_id": "89", + "switch_id": "2", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard3|Ethernet100": { + "speed": "40000", + "system_port_id": "90", + "switch_id": "2", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard3|Ethernet104": { + "speed": "40000", + "system_port_id": "91", + "switch_id": "2", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard3|Ethernet108": { + "speed": "40000", + "system_port_id": "92", + "switch_id": "2", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard3|Ethernet112": { + "speed": "40000", + "system_port_id": "93", + "switch_id": "2", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard3|Ethernet116": { + "speed": "40000", + "system_port_id": "94", + "switch_id": "2", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard3|Ethernet120": { + "speed": "40000", + "system_port_id": "95", + "switch_id": "2", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard3|Ethernet124": { + "speed": "40000", + "system_port_id": "96", + "switch_id": "2", + "core_index": "1", + "core_port_index": "16" + } } } diff --git a/tests/virtual_chassis/3/coreportindexmap.ini b/tests/virtual_chassis/3/coreportindexmap.ini new file mode 100644 index 0000000000..2445e45d00 --- /dev/null +++ b/tests/virtual_chassis/3/coreportindexmap.ini @@ -0,0 +1,32 @@ +eth1:0,1 +eth2:0,2 +eth3:0,3 +eth4:0,4 +eth5:0,5 +eth6:0,6 +eth7:0,7 +eth8:0,8 +eth9:0,9 +eth10:0,10 +eth11:0,11 +eth12:0,12 +eth13:0,13 +eth14:0,14 +eth15:0,15 +eth16:0,16 +eth17:1,1 +eth18:1,2 +eth19:1,3 +eth20:1,4 +eth21:1,5 +eth22:1,6 +eth23:1,7 +eth24:1,8 +eth25:1,9 +eth26:1,10 +eth27:1,11 +eth28:1,12 +eth29:1,13 +eth30:1,14 +eth31:1,15 +eth32:1,16 diff --git a/tests/virtual_chassis/3/default_config.json b/tests/virtual_chassis/3/default_config.json index acff5b095d..d1b91de7b4 100644 --- a/tests/virtual_chassis/3/default_config.json +++ b/tests/virtual_chassis/3/default_config.json @@ -5,7 +5,10 @@ "instance_name": "Linecard3", "connect_to_chassis_db" : 1, "chassis_db_address" : "10.8.1.200", - "inband_address" : "10.8.1.3/24" + "inband_address" : "10.8.1.3/24", + "switch_type": "voq", + "switch_id": "4", + "max_cores": "48" } }, "INTERFACE": { @@ -16,5 +19,679 @@ "Ethernet0": { "admin_status": "up" } + }, + "SYSTEM_PORT": { + "Linecard1|Ethernet0": { + "speed": "40000", + "system_port_id": "1", + "switch_id": "0", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard1|Ethernet4": { + "speed": "40000", + "system_port_id": "2", + "switch_id": "0", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard1|Ethernet8": { + "speed": "40000", + "system_port_id": "3", + "switch_id": "0", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard1|Ethernet12": { + "speed": "40000", + "system_port_id": "4", + "switch_id": "0", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard1|Ethernet16": { + "speed": "40000", + "system_port_id": "5", + "switch_id": "0", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard1|Ethernet20": { + "speed": "40000", + "system_port_id": "6", + "switch_id": "0", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard1|Ethernet24": { + "speed": "40000", + "system_port_id": "7", + "switch_id": "0", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard1|Ethernet28": { + "speed": "40000", + "system_port_id": "8", + "switch_id": "0", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard1|Ethernet32": { + "speed": "40000", + "system_port_id": "9", + "switch_id": "0", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard1|Ethernet36": { + "speed": "40000", + "system_port_id": "10", + "switch_id": "0", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard1|Ethernet40": { + "speed": "40000", + "system_port_id": "11", + "switch_id": "0", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard1|Ethernet44": { + "speed": "40000", + "system_port_id": "12", + "switch_id": "0", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard1|Ethernet48": { + "speed": "40000", + "system_port_id": "13", + "switch_id": "0", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard1|Ethernet52": { + "speed": "40000", + "system_port_id": "14", + "switch_id": "0", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard1|Ethernet56": { + "speed": "40000", + "system_port_id": "15", + "switch_id": "0", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard1|Ethernet60": { + "speed": "40000", + "system_port_id": "16", + "switch_id": "0", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard1|Ethernet64": { + "speed": "40000", + "system_port_id": "17", + "switch_id": "0", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard1|Ethernet68": { + "speed": "40000", + "system_port_id": "18", + "switch_id": "0", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard1|Ethernet72": { + "speed": "40000", + "system_port_id": "19", + "switch_id": "0", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard1|Ethernet76": { + "speed": "40000", + "system_port_id": "20", + "switch_id": "0", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard1|Ethernet80": { + "speed": "40000", + "system_port_id": "21", + "switch_id": "0", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard1|Ethernet84": { + "speed": "40000", + "system_port_id": "22", + "switch_id": "0", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard1|Ethernet88": { + "speed": "40000", + "system_port_id": "23", + "switch_id": "0", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard1|Ethernet92": { + "speed": "40000", + "system_port_id": "24", + "switch_id": "0", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard1|Ethernet96": { + "speed": "40000", + "system_port_id": "25", + "switch_id": "0", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard1|Ethernet100": { + "speed": "40000", + "system_port_id": "26", + "switch_id": "0", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard1|Ethernet104": { + "speed": "40000", + "system_port_id": "27", + "switch_id": "0", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard1|Ethernet108": { + "speed": "40000", + "system_port_id": "28", + "switch_id": "0", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard1|Ethernet112": { + "speed": "40000", + "system_port_id": "29", + "switch_id": "0", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard1|Ethernet116": { + "speed": "40000", + "system_port_id": "30", + "switch_id": "0", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard1|Ethernet120": { + "speed": "40000", + "system_port_id": "31", + "switch_id": "0", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard1|Ethernet124": { + "speed": "40000", + "system_port_id": "32", + "switch_id": "0", + "core_index": "1", + "core_port_index": "16" + }, + "Linecard2|Ethernet0": { + "speed": "40000", + "system_port_id": "33", + "switch_id": "1", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard2|Ethernet4": { + "speed": "40000", + "system_port_id": "34", + "switch_id": "1", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard2|Ethernet8": { + "speed": "40000", + "system_port_id": "35", + "switch_id": "1", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard2|Ethernet12": { + "speed": "40000", + "system_port_id": "36", + "switch_id": "1", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard2|Ethernet16": { + "speed": "40000", + "system_port_id": "37", + "switch_id": "1", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard2|Ethernet20": { + "speed": "40000", + "system_port_id": "38", + "switch_id": "1", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard2|Ethernet24": { + "speed": "40000", + "system_port_id": "39", + "switch_id": "1", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard2|Ethernet28": { + "speed": "40000", + "system_port_id": "40", + "switch_id": "1", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard2|Ethernet32": { + "speed": "40000", + "system_port_id": "41", + "switch_id": "1", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard2|Ethernet36": { + "speed": "40000", + "system_port_id": "42", + "switch_id": "1", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard2|Ethernet40": { + "speed": "40000", + "system_port_id": "43", + "switch_id": "1", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard2|Ethernet44": { + "speed": "40000", + "system_port_id": "44", + "switch_id": "1", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard2|Ethernet48": { + "speed": "40000", + "system_port_id": "45", + "switch_id": "1", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard2|Ethernet52": { + "speed": "40000", + "system_port_id": "46", + "switch_id": "1", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard2|Ethernet56": { + "speed": "40000", + "system_port_id": "47", + "switch_id": "1", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard2|Ethernet60": { + "speed": "40000", + "system_port_id": "48", + "switch_id": "1", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard2|Ethernet64": { + "speed": "40000", + "system_port_id": "49", + "switch_id": "1", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard2|Ethernet68": { + "speed": "40000", + "system_port_id": "50", + "switch_id": "1", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard2|Ethernet72": { + "speed": "40000", + "system_port_id": "51", + "switch_id": "1", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard2|Ethernet76": { + "speed": "40000", + "system_port_id": "52", + "switch_id": "1", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard2|Ethernet80": { + "speed": "40000", + "system_port_id": "53", + "switch_id": "1", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard2|Ethernet84": { + "speed": "40000", + "system_port_id": "54", + "switch_id": "1", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard2|Ethernet88": { + "speed": "40000", + "system_port_id": "55", + "switch_id": "1", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard2|Ethernet92": { + "speed": "40000", + "system_port_id": "56", + "switch_id": "1", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard2|Ethernet96": { + "speed": "40000", + "system_port_id": "57", + "switch_id": "1", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard2|Ethernet100": { + "speed": "40000", + "system_port_id": "58", + "switch_id": "1", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard2|Ethernet104": { + "speed": "40000", + "system_port_id": "59", + "switch_id": "1", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard2|Ethernet108": { + "speed": "40000", + "system_port_id": "60", + "switch_id": "1", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard2|Ethernet112": { + "speed": "40000", + "system_port_id": "61", + "switch_id": "1", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard2|Ethernet116": { + "speed": "40000", + "system_port_id": "62", + "switch_id": "1", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard2|Ethernet120": { + "speed": "40000", + "system_port_id": "63", + "switch_id": "1", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard2|Ethernet124": { + "speed": "40000", + "system_port_id": "64", + "switch_id": "1", + "core_index": "1", + "core_port_index": "16" + }, + "Linecard3|Ethernet0": { + "speed": "40000", + "system_port_id": "65", + "switch_id": "2", + "core_index": "0", + "core_port_index": "1" + }, + "Linecard3|Ethernet4": { + "speed": "40000", + "system_port_id": "66", + "switch_id": "2", + "core_index": "0", + "core_port_index": "2" + }, + "Linecard3|Ethernet8": { + "speed": "40000", + "system_port_id": "67", + "switch_id": "2", + "core_index": "0", + "core_port_index": "3" + }, + "Linecard3|Ethernet12": { + "speed": "40000", + "system_port_id": "68", + "switch_id": "2", + "core_index": "0", + "core_port_index": "4" + }, + "Linecard3|Ethernet16": { + "speed": "40000", + "system_port_id": "69", + "switch_id": "2", + "core_index": "0", + "core_port_index": "5" + }, + "Linecard3|Ethernet20": { + "speed": "40000", + "system_port_id": "70", + "switch_id": "2", + "core_index": "0", + "core_port_index": "6" + }, + "Linecard3|Ethernet24": { + "speed": "40000", + "system_port_id": "71", + "switch_id": "2", + "core_index": "0", + "core_port_index": "7" + }, + "Linecard3|Ethernet28": { + "speed": "40000", + "system_port_id": "72", + "switch_id": "2", + "core_index": "0", + "core_port_index": "8" + }, + "Linecard3|Ethernet32": { + "speed": "40000", + "system_port_id": "73", + "switch_id": "2", + "core_index": "0", + "core_port_index": "9" + }, + "Linecard3|Ethernet36": { + "speed": "40000", + "system_port_id": "74", + "switch_id": "2", + "core_index": "0", + "core_port_index": "10" + }, + "Linecard3|Ethernet40": { + "speed": "40000", + "system_port_id": "75", + "switch_id": "2", + "core_index": "0", + "core_port_index": "11" + }, + "Linecard3|Ethernet44": { + "speed": "40000", + "system_port_id": "76", + "switch_id": "2", + "core_index": "0", + "core_port_index": "12" + }, + "Linecard3|Ethernet48": { + "speed": "40000", + "system_port_id": "77", + "switch_id": "2", + "core_index": "0", + "core_port_index": "13" + }, + "Linecard3|Ethernet52": { + "speed": "40000", + "system_port_id": "78", + "switch_id": "2", + "core_index": "0", + "core_port_index": "14" + }, + "Linecard3|Ethernet56": { + "speed": "40000", + "system_port_id": "79", + "switch_id": "2", + "core_index": "0", + "core_port_index": "15" + }, + "Linecard3|Ethernet60": { + "speed": "40000", + "system_port_id": "80", + "switch_id": "2", + "core_index": "0", + "core_port_index": "16" + }, + "Linecard3|Ethernet64": { + "speed": "40000", + "system_port_id": "81", + "switch_id": "2", + "core_index": "1", + "core_port_index": "1" + }, + "Linecard3|Ethernet68": { + "speed": "40000", + "system_port_id": "82", + "switch_id": "2", + "core_index": "1", + "core_port_index": "2" + }, + "Linecard3|Ethernet72": { + "speed": "40000", + "system_port_id": "83", + "switch_id": "2", + "core_index": "1", + "core_port_index": "3" + }, + "Linecard3|Ethernet76": { + "speed": "40000", + "system_port_id": "84", + "switch_id": "2", + "core_index": "1", + "core_port_index": "4" + }, + "Linecard3|Ethernet80": { + "speed": "40000", + "system_port_id": "85", + "switch_id": "2", + "core_index": "1", + "core_port_index": "5" + }, + "Linecard3|Ethernet84": { + "speed": "40000", + "system_port_id": "86", + "switch_id": "2", + "core_index": "1", + "core_port_index": "6" + }, + "Linecard3|Ethernet88": { + "speed": "40000", + "system_port_id": "87", + "switch_id": "2", + "core_index": "1", + "core_port_index": "7" + }, + "Linecard3|Ethernet92": { + "speed": "40000", + "system_port_id": "88", + "switch_id": "2", + "core_index": "1", + "core_port_index": "8" + }, + "Linecard3|Ethernet96": { + "speed": "40000", + "system_port_id": "89", + "switch_id": "2", + "core_index": "1", + "core_port_index": "9" + }, + "Linecard3|Ethernet100": { + "speed": "40000", + "system_port_id": "90", + "switch_id": "2", + "core_index": "1", + "core_port_index": "10" + }, + "Linecard3|Ethernet104": { + "speed": "40000", + "system_port_id": "91", + "switch_id": "2", + "core_index": "1", + "core_port_index": "11" + }, + "Linecard3|Ethernet108": { + "speed": "40000", + "system_port_id": "92", + "switch_id": "2", + "core_index": "1", + "core_port_index": "12" + }, + "Linecard3|Ethernet112": { + "speed": "40000", + "system_port_id": "93", + "switch_id": "2", + "core_index": "1", + "core_port_index": "13" + }, + "Linecard3|Ethernet116": { + "speed": "40000", + "system_port_id": "94", + "switch_id": "2", + "core_index": "1", + "core_port_index": "14" + }, + "Linecard3|Ethernet120": { + "speed": "40000", + "system_port_id": "95", + "switch_id": "2", + "core_index": "1", + "core_port_index": "15" + }, + "Linecard3|Ethernet124": { + "speed": "40000", + "system_port_id": "96", + "switch_id": "2", + "core_index": "1", + "core_port_index": "16" + } } }