Feature (contd.): Device Emulation - refactored and moved EncapEmulation as a native field of DeviceGroup instead of a extension - now the device_count comment of "per encap" makes more sense with encap at the same level as device_count

This commit is contained in:
Srivats P 2015-12-16 20:48:17 +05:30
parent ad1fb5fc37
commit 71d04b63bc
4 changed files with 15 additions and 12 deletions

View File

@ -38,8 +38,8 @@ message VlanEmulation {
repeated Vlan stack = 1; // outer to inner
}
message EncapEmulation {
optional VlanEmulation vlan = 1;
extend OstProto.EncapEmulation {
optional VlanEmulation vlan = 1000;
}
// ===========
@ -75,9 +75,6 @@ message Ip6Emulation {
}
extend OstProto.DeviceGroup {
// FIXME: add directly to DeviceGroup in protocol.proto
optional EncapEmulation encap = 2000;
optional MacEmulation mac = 2001;
optional Ip4Emulation ip4 = 3000;

View File

@ -297,13 +297,19 @@ message DeviceGroupIdList {
repeated DeviceGroupId device_group_id = 2;
}
message EncapEmulation {
// Encap Protocols implemented as extensions
extensions 1000 to 1999;
}
message DeviceGroup {
required DeviceGroupId device_group_id = 1;
optional DeviceGroupCore core = 2;
// FIXME: add Encap here
optional uint32 device_count = 3 [default = 1]; // per-encap
optional EncapEmulation encap = 3;
optional uint32 device_count = 4 [default = 1]; // per-encap
extensions 2000 to 5999; // For use by Protocol Emulations
// Device Protocols implemented as extensions
extensions 2000 to 5999;
}
message DeviceGroupConfigList {

View File

@ -321,8 +321,8 @@ void DeviceManager::enumerateDevices(
Operation oper)
{
Device dk(this);
OstEmul::VlanEmulation pbVlan = deviceGroup->GetExtension(OstEmul::encap)
.vlan();
OstEmul::VlanEmulation pbVlan = deviceGroup->encap()
.GetExtension(OstEmul::vlan);
int numTags = pbVlan.stack_size();
int n = 1;
QList<int> vlanCount;

View File

@ -573,7 +573,7 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports, stream_id,
dg.device_group_id.id = dgid_list.tx.device_group_id[0].id
dg.core.name = "Host1"
for vcfg in vlan_cfg:
v = dg.Extensions[emul.encap].vlan.stack.add()
v = dg.encap.Extensions[emul.vlan].stack.add()
v.vlan_tag = vcfg['base']
v.count = vcfg['count']
dg.device_count = num_devs_per_vlan
@ -592,7 +592,7 @@ def test_multiEmulDevPerVlan(request, drone, ports, dut, dut_ports, stream_id,
dg.device_group_id.id = dgid_list.rx.device_group_id[0].id
dg.core.name = "Host1"
for vcfg in vlan_cfg:
v = dg.Extensions[emul.encap].vlan.stack.add()
v = dg.encap.Extensions[emul.vlan].stack.add()
v.vlan_tag = vcfg['base']
v.count = vcfg['count']
dg.device_count = num_devs_per_vlan