Device Emulation (contd.): Renamed Device List and Device Neighbor List fields so that the names are better reflective of what they contain

This commit is contained in:
Srivats P 2016-03-22 20:18:53 +05:30
parent ce7aee54e5
commit fbb56720ba
4 changed files with 26 additions and 25 deletions

View File

@ -594,9 +594,9 @@ void PortGroup::processDeviceList(int portIndex, PbRpcController *controller)
} }
mPorts[portIndex]->clearDeviceList(); mPorts[portIndex]->clearDeviceList();
for(int i = 0; i < deviceList->ExtensionSize(OstEmul::port_device); i++) { for(int i = 0; i < deviceList->ExtensionSize(OstEmul::device); i++) {
mPorts[portIndex]->insertDevice( mPorts[portIndex]->insertDevice(
deviceList->GetExtension(OstEmul::port_device, i)); deviceList->GetExtension(OstEmul::device, i));
} }
_exit: _exit:
@ -628,9 +628,9 @@ void PortGroup::processDeviceNeighbors(
} }
mPorts[portIndex]->clearDeviceNeighbors(); mPorts[portIndex]->clearDeviceNeighbors();
for(int i = 0; i < neighList->ExtensionSize(OstEmul::devices); i++) { for(int i=0; i < neighList->ExtensionSize(OstEmul::device_neighbor); i++) {
mPorts[portIndex]->insertDeviceNeighbors( mPorts[portIndex]->insertDeviceNeighbors(
neighList->GetExtension(OstEmul::devices, i)); // FIXME: change extn id neighList->GetExtension(OstEmul::device_neighbor, i));
} }
mPorts[portIndex]->deviceInfoRefreshed(); mPorts[portIndex]->deviceInfoRefreshed();

View File

@ -95,7 +95,7 @@ message Device {
} }
extend OstProto.PortDeviceList { extend OstProto.PortDeviceList {
repeated Device port_device = 100; repeated Device device = 100;
} }
message ArpEntry { message ArpEntry {
@ -115,6 +115,5 @@ message DeviceNeighborList {
} }
extend OstProto.PortNeighborList { extend OstProto.PortNeighborList {
// FIXME: rename to device (singular) to be consistent with naming convention for other repeated fields repeated DeviceNeighborList device_neighbor = 100;
repeated DeviceNeighborList devices = 100;
} }

View File

@ -163,7 +163,7 @@ void DeviceManager::getDeviceList(
{ {
foreach(Device *device, sortedDeviceList_) { foreach(Device *device, sortedDeviceList_) {
OstEmul::Device *dev = OstEmul::Device *dev =
deviceList->AddExtension(OstEmul::port_device); deviceList->AddExtension(OstEmul::device);
device->getConfig(dev); device->getConfig(dev);
} }
} }
@ -271,7 +271,7 @@ void DeviceManager::getDeviceNeighbors(
foreach(Device *device, sortedDeviceList_) { foreach(Device *device, sortedDeviceList_) {
OstEmul::DeviceNeighborList *neighList = OstEmul::DeviceNeighborList *neighList =
neighborList->AddExtension(OstEmul::devices); neighborList->AddExtension(OstEmul::device_neighbor);
neighList->set_device_index(count++); neighList->set_device_index(count++);
device->getNeighbors(neighList); device->getNeighbors(neighList);
} }

View File

@ -563,9 +563,9 @@ def test_multiEmulDevNoVlan(drone, ports, dut, dut_ports, dut_ip,
log.info('retrieving ARP/NDP entries on tx port to verify clear') log.info('retrieving ARP/NDP entries on tx port to verify clear')
device_list = drone.getDeviceList(emul_ports.port_id[0]) device_list = drone.getDeviceList(emul_ports.port_id[0])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on tx port') log.info('ARP/NDP Table on tx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
if has_ip4: if has_ip4:
@ -583,9 +583,9 @@ def test_multiEmulDevNoVlan(drone, ports, dut, dut_ports, dut_ip,
log.info('retrieving ARP/NDP entries on rx port to verify clear') log.info('retrieving ARP/NDP entries on rx port to verify clear')
device_list = drone.getDeviceList(emul_ports.port_id[1]) device_list = drone.getDeviceList(emul_ports.port_id[1])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on rx port') log.info('ARP/NDP Table on rx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
if has_ip4: if has_ip4:
@ -669,9 +669,9 @@ def test_multiEmulDevNoVlan(drone, ports, dut, dut_ports, dut_ip,
# retrieve and verify ARP/NDP Table on tx/rx ports # retrieve and verify ARP/NDP Table on tx/rx ports
log.info('retrieving ARP/NDP entries on tx port') log.info('retrieving ARP/NDP entries on tx port')
device_list = drone.getDeviceList(emul_ports.port_id[0]) device_list = drone.getDeviceList(emul_ports.port_id[0])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on tx port') log.info('ARP/NDP Table on tx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
if has_ip4: if has_ip4:
@ -695,9 +695,9 @@ def test_multiEmulDevNoVlan(drone, ports, dut, dut_ports, dut_ip,
log.info('retrieving ARP/NDP entries on rx port') log.info('retrieving ARP/NDP entries on rx port')
device_list = drone.getDeviceList(emul_ports.port_id[1]) device_list = drone.getDeviceList(emul_ports.port_id[1])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on rx port') log.info('ARP/NDP Table on rx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
if has_ip4: if has_ip4:
@ -1008,9 +1008,9 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports,
log.info('retrieving ARP/NDP entries on tx port to verify clear') log.info('retrieving ARP/NDP entries on tx port to verify clear')
device_list = drone.getDeviceList(emul_ports.port_id[0]) device_list = drone.getDeviceList(emul_ports.port_id[0])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on tx port') log.info('ARP/NDP Table on tx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
if has_ip4: if has_ip4:
@ -1028,9 +1028,9 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports,
log.info('retrieving ARP/NDP entries on rx port to verify clear') log.info('retrieving ARP/NDP entries on rx port to verify clear')
device_list = drone.getDeviceList(emul_ports.port_id[1]) device_list = drone.getDeviceList(emul_ports.port_id[1])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on rx port') log.info('ARP/NDP Table on rx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
if has_ip4: if has_ip4:
@ -1124,9 +1124,9 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports,
# retrieve and verify ARP/NDP Table on tx/rx ports # retrieve and verify ARP/NDP Table on tx/rx ports
log.info('retrieving ARP/NDP entries on tx port') log.info('retrieving ARP/NDP entries on tx port')
device_list = drone.getDeviceList(emul_ports.port_id[0]) device_list = drone.getDeviceList(emul_ports.port_id[0])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[0])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on tx port') log.info('ARP/NDP Table on tx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
vlans = '' vlans = ''
@ -1153,9 +1153,9 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports,
log.info('retrieving ARP entries on rx port') log.info('retrieving ARP entries on rx port')
device_list = drone.getDeviceList(emul_ports.port_id[1]) device_list = drone.getDeviceList(emul_ports.port_id[1])
device_config = device_list.Extensions[emul.port_device] device_config = device_list.Extensions[emul.device]
neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1]) neigh_list = drone.getDeviceNeighbors(emul_ports.port_id[1])
devices = neigh_list.Extensions[emul.devices] devices = neigh_list.Extensions[emul.device_neighbor]
log.info('ARP/NDP Table on rx port') log.info('ARP/NDP Table on rx port')
for devcfg, device in zip(device_config, devices): for devcfg, device in zip(device_config, devices):
vlans = '' vlans = ''
@ -1257,6 +1257,8 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports,
# * Verify that device_index in OstEmul.DeviceNeighborList matches the # * Verify that device_index in OstEmul.DeviceNeighborList matches the
# correct device in OstEmul.PortDeviceList # correct device in OstEmul.PortDeviceList
# * Verify ARP/NDP resolution in a bridging topology # * Verify ARP/NDP resolution in a bridging topology
# * Verify non-default IP prefix-length
# * Verify bi-directional streams
# #
import pytest import pytest
pytest.main(__file__) pytest.main(__file__)