• 5 Subscribers
  • 114 Views
1

I added a parameter in EtherIIFrame with etherType and Length to be vlanID

strangely when I took the same steps taken for the etherType just with different naming it didn't work the same way.

// Omnetpp.ini
**.Host1.app.etherType = 0x3E8
**.Host1.app.vlanID = 1

// TraffGen.ned
int etherType = default(0); 
int vlanID = default(0);

// Etherframe.msg
enum EtherType;
enum VlanID;

packet EthernetIIFrame extends EtherFrame
{
    byteLength = ETHER_MAC_FRAME_BYTES;
    int etherType @enum(EtherType);
    int vlanID @enum (VlanID);
}

// Ieee802Ctrl.msg
enum EtherType
{
    Ether1 = 0x3E8;
    Ether2 = 0x3E9;
    Ether3 = 0x3EA;
    Ether4 = 0x3EB;
    Ether5 = 0x3EC;
    Ether6 = 0x3ED;
    Ether7 = 0x3EF;
}

enum VlanID
{
    priority1 = 1;
    priority2 = 2;
    priority3 = 3;
    priority4 = 4;
    priority5 = 5;
    priority6 = 6;
    priority7 = 7;   
    priority8 = 8;
}

// FrameTypeclassifer.cc 
    if (pframe->getEtherType() == Ether1)
        send(msg, "queue1in");

// Framevlanvlassifier.cc
    if (pframe->getVlanID() == priority1)
        send(msg, "queue1in");

The difference is happening at the classifier by adding this line before the condition of the classifier in both cases

EV_DETAIL << "THE CLASSIFIER READ THE VLAN = " << pframe->getVlanID() << endl;
EV_DETAIL << "THE CLASSIFIER READ THE VLAN = " << pframe->getEtherType() << endl;

I am getting the below results, in the VlanID case, the value never changes from 0 not detecting the input I am giving from ini file

DETAIL (FrameVIDClassifier)Mysimulation.switch.eth[2].queue.classifier: THE CLASSIFIER READ THE VLAN = 0

while in the ethertype case it is detecting the ethertype in each frame correctly

DETAIL (FrameTypeClassifier)Mysimulation.switch.eth[2].queue.classifier: THE CLASSIFIER READ THE VLAN = 1000

I tried using hex inside the .msg file but still the same so it is not the problem.

Any idea what would be the difference?


1 answers in total

0
Mour_Ka Posted at 2017-01-13 16:07:57Z

I noticed that I wasn't using the set function to set the input value to the frame. So the classifier was reading the value set by the constructor.

void EtherTrafGen::sendBurstPackets()
{
        etherctrl->setEtherType(etherType);
        etherctrl->setVlanID(vlanID);
}

void EtherEncap::processPacketFromHigherLayer(cPacket *msg)
{
        if (etherctrl)
            eth2Frame->setEtherType(etherctrl->getEtherType());
            eth2Frame->setVlanID(etherctrl->getVlanID());
        frame = eth2Frame;
}

void EtherEncap::processFrameFromMAC(EtherFrame *frame)
{
    if (dynamic_cast<EthernetIIFrame *>(frame) != nullptr)
        {
        etherctrl->setEtherType(((EthernetIIFrame *)frame)->getEtherType());
        etherctrl->setVlanID(((EthernetIIFrame *)frame)->getVlanID());
        }
}

// constructor setting the values to zeros if no values are found
EthernetIIFrame::EthernetIIFrame(const char *name, int kind) : ::inet::EtherFrame(name,kind)
{
    this->setByteLength(ETHER_MAC_FRAME_BYTES);

    this->etherType = 0;
    this->vlanID = 0;
}

in order to etherctrl to call the function it should be in IeeeCtrl.msg

class Ieee802Ctrl
{
    int etherType @enum(EtherType);   // used with ~EthernetIIFrame
    int vlanID @enum(VlanID);
}

Answer this questsion