Question: from pox.core import core import pox.openflow.libopenflow _ 0 1 as of log = core.getLogger ( ) class Routing ( object ) : def _ _

from pox.core import core
import pox.openflow.libopenflow_01 as of
log = core.getLogger()
class Routing (object):
def __init__(self, connection):
# Keep track of the connection to the switch so that we can
# send it messages!
self.connection = connection
# This binds our PacketIn event listener
connection.addListeners(self)
def do_routing (self, packet, packet_in, port_on_switch, switch_id):
# port_on_swtich - the port on which this packet was received
# switch_id - the switch which received this packet
# Your code here
pass
def _handle_PacketIn (self, event):
"""
Handles packet in messages from the switch.
"""
packet = event.parsed # This is the parsed packet data.
if not packet.parsed:
log.warning("Ignoring incomplete packet")
return
packet_in = event.ofp # The actual ofp_packet_in message.
self.do_routing(packet, packet_in, event.port, event.dpid)
def launch ():
"""
Starts the component
"""
def start_switch (event):
log.debug("Controlling %s"%(event.connection,))
Routing(event.connection)
core.openflow.addListenerByName("ConnectionUp", start_switch)
#!/usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.node import RemoteController
class MyTopology(Topo):
def __init__(self):
Topo.__init__(self)
# laptop1= self.addHost('Laptop1', ip='200.20.2.8/24',defaultRoute="Laptop1-eth1")
# switch1= self.addSwitch('s1')
# self.addLink(laptop1, switch1, port1=1, port2=2)
if __name__=='__main__':
#This part of the script is run when the script is executed
topo = MyTopology() #Creates a topology
c0= RemoteController(name='c0', controller=RemoteController, ip='127.0.0.1', port=6633) #Creates a remote controller
net = Mininet(topo=topo, controller=c0) #Loads the topology
net.start() #Starts mininet
CLI(net) #Opens a command line to run commands on the simulated topology
net.stop() #Stops mininet
Network Topology and Rules to be implemented:
Rule 1: ICMP traffic is forwarded only between the Student Housing LAN, Faculty LAN
and IT Department subnets or between devices that are on the same subnet.
Rule 2: TCP traffic is forwarded only between the University Data Center, IT
Department, Faculty LAN, Student Housing LAN, trustedPC, or between devices that
are on the same subnet; however, only the Faculty LAN may access the exam
server.
Rule 3: UDP traffic is forwarded only between the University Data Center, IT
Department, Faculty LAN, Student Housing LAN, or between devices that are on the
same subnet
Rule 4: All other traffic should be dropped.
Your goal will be to allow or block traffic between the different devices based on the 4 Network
Topology Rules given below. In this assignment, you cannot use flooding (i.e., you cannot use
flooding: of.OFPP_FLOOD)! Instead, you will need to specify specific ports for all traffic and the
forwarding must be done by subnet, not by enumerating all of the IP addresses. You might
consider a method to determine if an IP Address is valid on a particular subnet. Notice that the
rules are written according to the subnet.
You may implement your router however you choosealthough as a suggestion, you may find it
easiest to determine the correct destination port by using
the source and destination IP addresses
or the source port on the switch from which the packet originated.
These provided files will get you startedyou will need to modify both:
lab5_topo_skel.py / lab5_controller_skel.py
We will use the same topology as Lab4, which is shown in Figure 1. Note the departments are
now organized into subnets. You will need to do the following:
Finish the topology file by adding all the hosts (be sure to manually specify the MAC
address, IP address and subnet for each host), switches and links
Implement the router based on Rule 1, Rule 2, Rule 3 and Rule 4In your code use the naming convention below:
Table 1- Standard Names
 from pox.core import core import pox.openflow.libopenflow_01 as of log = core.getLogger()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!