Skip to content

6. Changes

Joe Antony edited this page Jan 15, 2019 · 1 revision

Changes

file name

line-number: change
***
[original]

openflow-switch.cc

161: onoff.SetConstantRate (DataRate ("5kb/s"));
***
[onoff.SetConstantRate (DataRate ("500kb/s"));]

166: app.Stop (Seconds (2.0));
***
[app.Stop (Seconds (10.0));]

181: app.Stop (Seconds (1.2));
***
[app.Stop (Seconds (10.0));]

openflow-interface.cc

838: 
if (!dst_addr.IsBroadcast ())
{
  if(key.flow.in_port==0)
    {
      LearnState_t::iterator st = m_learnState.find(dst_addr);
      if (st != m_learnState.end ())
      {
        out_port = st->second.port;
      }
      else
      {
        NS_LOG_INFO ("Setting to flood; don't know yet what port " << dst_addr << " is connected to");
      }
    }
  else
    {
      LearnState_t::iterator st = m_learnState_UDP.find (dst_addr);
      if (st != m_learnState.end ())
      {
        out_port = st->second.port;
      }
      else
      {
        NS_LOG_INFO ("Setting to flood; don't know yet what port " << dst_addr << " is connected to");
      }

    }
}
***
[
if (!dst_addr.IsBroadcast ())
{
 LearnState_t::iterator st = m_learnState.find (dst_addr);
 if (st != m_learnState.end ())
 {
   out_port = st->second.port;
 }
 else
 {
   NS_LOG_INFO ("Setting to flood; don't know yet what port " << dst_addr << " is connected to");
 }
}
]
850: 
else
{
  Mac48Address src_addr;
  src_addr.CopyFrom (key.flow.dl_src);
  broadcast_flags::iterator bd=broadcast_done.find(src_addr);
  if (bd==broadcast_done.end())
  {
    broadcast_done.insert(std::make_pair(src_addr,1));
          
  }
  else
  {
    return;
  }
  
  NS_LOG_INFO ("Setting to flood; this packet is a broadcast");
}
***
[
else
{
 NS_LOG_INFO ("Setting to flood; this packet is a broadcast");
}
]

Additions

openflow-interface.cc

829: NS_LOG_INFO ("Input Port ________"<<port);

836: NS_LOG_INFO ("UDPSRC_______"<<key.flow.tp_src); 837: NS_LOG_INFO ("Dest_______"<<key.flow.tp_dst);

908: m_learnState_UDP.insert(std::make_pair (src_addr,ls));

925: else // if we have already know the source MAC then update the mac address { // if the type of Packets is TCP take LOnger Path LearnState_t::iterator st = m_learnState_UDP.find (src_addr); if(key.flow.tp_src!=0) {
NS_LOG_INFO ("Updated that " << src_addr << "already found in "<second.port<< " updated to port " << in_port); st->second.port=in_port; // Learn src_addr goes to a certain port. ofp_action_output x2[1]; x2[0].type = htons (OFPAT_OUTPUT); x2[0].len = htons (sizeof(ofp_action_output)); x2[0].port = in_port;

// Switch MAC Addresses and ports to the flow we're modifying
src_addr.CopyTo (key.flow.dl_dst);
dst_addr.CopyTo (key.flow.dl_src);
key.flow.in_port = out_port;
ofp_flow_mod* ofm2 = BuildFlow (key, -1, OFPFC_MODIFY, x2, sizeof(x2), OFP_FLOW_PERMANENT, m_expirationTime.IsZero () ? OFP_FLOW_PERMANENT : m_expirationTime.GetSeconds ());
SendToSwitch (swtch, ofm2, ofm2->header.length);

} }

Clone this wiki locally