Now i am trying to modify the openflow example file "openflow-switch.cc" and add a openflow switch as follows. I use n1 to ping n2, but i am suffering a problem that the host n1 are always send arp request, while the destination n2 has send back arp reply. Can some one help to solve this problem. thank you very much.
// n0 n2
// | |
// ---- ----
// S1------S2
// ---- ----
// | |
// n1 n3
the code is as follows.
NS_LOG_INFO ("Create nodes.");
NodeContainer terminal_s1;
terminal_s1.Create (2);
NodeContainer terminal_s2;
terminal_s2.Create (2);
NodeContainer csmaSwitch;
csmaSwitch.Create (2);
NS_LOG_INFO ("Build Topology");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", DataRateValue (5000000));
p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
// Create the csma links
NetDeviceContainer terminalDevice_s1;
NetDeviceContainer terminalDevice_s2;
NetDeviceContainer switchDevice_s1;
NetDeviceContainer switchDevice_s2;
for (int i = 0; i < 2; i++)
{
NetDeviceContainer link1 = csma.Install (NodeContainer (terminal_s1.Get (i), csmaSwitch.Get (0)));
terminalDevice_s1.Add (link1.Get (0));
switchDevice_s1.Add (link1.Get (1));
}
for (int i = 0; i < 2; i++)
{
NetDeviceContainer link2 = csma.Install (NodeContainer (terminal_s2.Get (i), csmaSwitch.Get (1)));
terminalDevice_s2.Add (link2.Get (0));
switchDevice_s2.Add (link2.Get (1));
}
NetDeviceContainer link3 = csma.Install (NodeContainer (csmaSwitch.Get (0), csmaSwitch.Get (1)));
switchDevice_s1.Add (link3.Get (0));
switchDevice_s2.Add (link3.Get (1));
// Create the switch netdevice, which will do the packet switching
Ptr<Node> switchNode1 = csmaSwitch.Get (0);
Ptr<Node> switchNode2 = csmaSwitch.Get (1);
OpenFlowSwitchHelper swtch;
Ptr<ns3::ofi::LearningController> controller = CreateObject<ns3::ofi::LearningController> ();
swtch.Install (switchNode1, switchDevice_s1, controller);
swtch.Install (switchNode2, switchDevice_s2, controller);
Now i am trying to modify the openflow example file "openflow-switch.cc" and add a openflow switch as follows. I use n1 to ping n2, but i am suffering a problem that the host n1 are always send arp request, while the destination n2 has send back arp reply. Can some one help to solve this problem. thank you very much.
Hi,
Hi,