Feature (contd.): Device Emulation - Removed 'mode' from both vlan and device; will reintroduce or replace with something else when needed

This commit is contained in:
Srivats P 2015-10-03 20:15:20 +05:30
parent 0c98e30a93
commit fcfcfe6887
3 changed files with 4 additions and 34 deletions

View File

@ -25,10 +25,6 @@ package OstEmul;
// VLAN
// ======
message VlanEmulation {
enum Mode {
kNoRepeat = 0;
kRepeat = 1;
}
message Vlan {
optional uint32 tpid = 1 [default = 0x8100];
@ -37,7 +33,6 @@ message VlanEmulation {
optional uint32 count = 10 [default = 1];
optional uint32 step = 11 [default = 1];
optional Mode mode = 12 [default = kRepeat];
}
repeated Vlan stack = 1; // outer to inner
@ -74,19 +69,15 @@ message Ip6Emulation {
optional uint64 step_hi = 10 [default = 0];
optional uint64 step_lo = 11 [default = 1];
// FIXME: step for gateway?
}
message Device {
enum Mode {
kNoRepeat = 0;
kRepeat = 1;
}
optional MacEmulation mac = 1;
optional Ip4Emulation ip4 = 2;
optional Ip6Emulation ip6 = 3;
optional uint32 count = 10 [default = 1];
optional Mode mode = 11 [default = kRepeat]; // FIXME: per proto mode?
}
extend OstProto.DeviceGroup {

View File

@ -227,34 +227,13 @@ void DeviceManager::enumerateDevices(
OstEmul::VlanEmulation::Vlan vlan = pbVlan.stack(j);
quint16 vlanAdd = i*vlan.step();
switch (vlan.mode()) {
case OstEmul::VlanEmulation::kNoRepeat:
/* Do nothing */
break;
case OstEmul::VlanEmulation::kRepeat:
default:
vlanAdd %= vlan.step() * vlan.count();
break;
}
dk.setVlan(j, vlan.vlan_tag() + vlanAdd);
}
for (uint k = 0; k < pbDevice.count(); k++) {
Device *device;
quint64 macAdd = (i*pbDevice.count()+k)*pbDevice.mac().step();
quint32 ip4Add = (i*pbDevice.count()+k)*pbDevice.ip4().step();
switch (pbDevice.mode()) {
case OstEmul::Device::kNoRepeat:
/* Do Nothing*/
break;
case OstEmul::Device::kRepeat:
default:
macAdd %= pbDevice.mac().step() * pbDevice.count();
ip4Add %= pbDevice.ip4().step() * pbDevice.count();
break;
}
quint64 macAdd = k * pbDevice.mac().step();
quint32 ip4Add = k * pbDevice.ip4().step();
dk.setMac(pbDevice.mac().address() + macAdd);
dk.setIp4(pbDevice.ip4().address() + ip4Add,

View File

@ -201,7 +201,7 @@ try:
# ----------------------------------------------------------------- #
passed = False
suite.test_begin('multiEmulDev')
suite.test_begin('multiEmulDevNoVlan')
num_devs = 5
try: