Esempio n. 1
0
class NiceModel(Model):
    generate_inputs = True
    generate_stats = False
    invariants = [NoLoopInvariant, StrictDirectRouteInvariant]

    def initTopology(self, topo):
        self.controller = PySwitchController()
        sw1 = OpenflowSwitch(name="s1", port_count=2, of_id=1, expire_entries=config.get("model.flow_entry_expiration"))
        sw2 = OpenflowSwitch(name="s2", port_count=2, of_id=2, expire_entries=config.get("model.flow_entry_expiration"))
        cl1 = SymExecSender(name="h1", mymac=(0x00, 0xBA, 0xAD, 0xF0, 0x0D, 0x01), max_pkts=config.get("nice_model.max_pkts"), max_burst=config.get("nice_model.max_burst"))
        cl2 = Replier(name="h2", mymac=(0x00, 0x01, 0x02, 0x03, 0x04, 0x05))
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        # start callbacks
        self.controller.start_callbacks.append(lambda: self.controller.install())
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw2))
Esempio n. 2
0
class PyswitchBenchmarkModel(Model):
    invariants = []

    def initTopology(self, topo):
        self.controller = PySwitchController(version="pyswitch")
        sw1 = OpenflowSwitch(name="s1", port_count=2, of_id=1, expire_entries=config.get("model.flow_entry_expiration"))
        sw2 = OpenflowSwitch(name="s2", port_count=2, of_id=2, expire_entries=config.get("model.flow_entry_expiration"))
        mac1 = (0x00, 0x01, 0x02, 0x03, 0x04, 0x00)
        mac2 = (0x00, 0x01, 0x02, 0x03, 0x05, 0x05)
        cl1 = Arrival(name="h1", mymac=mac1, dstmac=mac2, \
            pkts=config.get("pyswitch_model.pkts"), sequential=config.get("pyswitch_model.sequential"))
        cl2 = Replier(name="h2", mymac=mac2)
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        # start callbacks
        self.controller.start_callbacks.append(lambda: self.controller.install())
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw2))
class PyswitchModelSmallRealSwitch(Model):
    invariants = [
        NoLoopInvariant, DirectRouteInvariant, StrictDirectRouteInvariant,
        NoDropMobileInvariant, NotMatchingSwitchOutputs
    ]

    def initTopology(self, topo):
        # Define the controller
        self.controller = PySwitchController(version="pyswitch")
        self.of_context.setController(self.controller)
        # Define the switches
        sw1 = OpenflowSwitchReal(
            name="s1",
            port_count=2,
            of_id=1,
            expire_entries=config.get("model.flow_entry_expiration"))
        # Define the clients and thier addresses
        mac1 = (0x00, 0x00, 0x00, 0x00, 0x01, 0x00)
        mac2 = (0x00, 0x00, 0x00, 0x00, 0x01, 0x01)
        cl1 = Arrival(name="h1", mymac=mac1, dstmac=mac2, \
            pkts=config.get("pyswitch_model.pkts"), sequential=config.get("pyswitch_model.sequential"))
        cl2 = Replier(name="h2", mymac=mac2)
        # We want host mobility active on client 2
        cl2.move_host = config.get("pyswitch_model.move_host")
        #cl2.move_host_switch = (sw1, 1, 2)
        # topology connections: sw1 port 0 is connected to port 0 of cl1, port 1 connected to port 0 of sw2
        sw1.initTopology({0: (cl1, 0), 1: (cl2, 0)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw1, 1)})
        # Add clients and switches to the model list
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        # start callbacks
        self.controller.start_callbacks.append(
            lambda: self.controller.install())
        self.controller.start_callbacks.append(
            lambda: self.controller.addSwitch(sw1))

        sw1.setRealSwitch(HpSwitch, "128.178.149.155", "eth0", {
            0: 3,
            1: 4
        }, 0, ["eth1", "eth2"])
        sw1.setRealSwitch(OpenFlowUserSwitch, "127.0.0.1", "lo", {0: 1, 1: 2})
        sw1.setRealSwitch(OVSSwitch, "127.0.0.1", "lo", {0: 1, 1: 2})

    def generate_inputs(self):
        pass

    def generate_stats(self):
        pass
Esempio n. 4
0
class PyswitchModelRealSwitch(Model):
    invariants = [NoLoopInvariant, DirectRouteInvariant, StrictDirectRouteInvariant, NoDropMobileInvariant, NotMatchingSwitchOutputs]

    def initTopology(self, topo):
        # Define the controller
        self.controller = PySwitchController(version="pyswitch")
        # Define the switches
        sw1 = OpenflowSwitchReal(name="s1", port_count=2, of_id=1, expire_entries=config.get("model.flow_entry_expiration"))
        sw2 = OpenflowSwitchReal(name="s2", port_count=3, of_id=2, expire_entries=config.get("model.flow_entry_expiration"))
        # Define the clients and thier addresses
        mac1 = (0x00, 0x00, 0x00, 0x00, 0x01, 0x00)
        mac2 = (0x00, 0x00, 0x00, 0x00, 0x01, 0x01)
        cl1 = Arrival(name="h1", mymac=mac1, dstmac=mac2, \
            pkts=config.get("pyswitch_model.pkts"), sequential=config.get("pyswitch_model.sequential"))
        cl2 = Replier(name="h2", mymac=mac2)
        # We want host mobility active on client 2
        cl2.move_host = config.get("pyswitch_model.move_host")
        cl2.move_host_switch = (sw2, 1, 2)
        # topology connections: sw1 port 0 is connected to port 0 of cl1, port 1 connected to port 0 of sw2
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0), 2: (None, None)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        # Add clients and switches to the model list
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        # start callbacks
        self.controller.start_callbacks.append(lambda: self.controller.install())
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw2))

        sw1.setRealSwitch(HpSwitch, "128.178.149.155", "eth0", {0 : 3, 1 : 4}, 0, ["eth1", "eth2"])
        sw1.setRealSwitch(OpenFlowUserSwitch, "127.0.0.1", "lo", {0 : 1, 1 : 2})
        sw2.setRealSwitch(OpenFlowUserSwitch, "127.0.0.1", "lo", {0 : 1, 1 : 2, 2 : 3})
        sw1.setRealSwitch(OVSSwitch, "127.0.0.1", "lo", {0 : 1, 1 : 2})
        sw2.setRealSwitch(OVSSwitch, "127.0.0.1", "lo", {0 : 1, 1 : 2, 2 : 3})


    def generate_inputs(self):
        pass

    def generate_stats(self):
        pass
Esempio n. 5
0
class PyswitchModel(Model):

    def initTopology(self, topo):
        # Define the controller
        self.controller = PySwitchController(version="pyswitch")
        # Define the switches
        sw1 = OpenflowSwitch(name="s1", port_count=2, of_id=1, expire_entries=config.get("model.flow_entry_expiration"))
        sw2 = OpenflowSwitch(name="s2", port_count=3, of_id=2, expire_entries=config.get("model.flow_entry_expiration"))
        # Define the clients and thier addresses
        mac1 = (0x00, 0x01, 0x02, 0x03, 0x04, 0x00)
        mac2 = (0x00, 0x01, 0x02, 0x03, 0x05, 0x05)
        cl1 = Arrival(name="h1", mymac=mac1, dstmac=mac2, \
            pkts=config.get("pyswitch_model.pkts"), sequential=config.get("pyswitch_model.sequential"))
        cl2 = Replier(name="h2", mymac=mac2)
        # We want host mobility active on client 2
        cl2.move_host = config.get("pyswitch_model.move_host")
        cl2.move_host_switch = (sw2, 1, 2)
        if cl2.move_host:
            self.invariants = [NoDropMobileInvariant]
        else:
            self.invariants = [NoLoopInvariant, StrictDirectRouteInvariant]
        # topology connections: sw1 port 0 is connected to port 0 of cl1, port 1 connected to port 0 of sw2
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0), 2: (None, None)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        # Add clients and switches to the model list
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        # start callbacks
        self.controller.start_callbacks.append(lambda: self.controller.install())
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw2))


    def generate_inputs(self):
        pass

    def generate_stats(self):
        pass
Esempio n. 6
0
class Pyswitch3WayModel(Model):
    invariants = [NoLoopInvariant]

    def initTopology(self, topo):
        """ 3 switch triangle topology """
        self.controller = PySwitchController(version="pyswitch")
        sw1 = OpenflowSwitch(name="s1", port_count=3, of_id=1)
        sw2 = OpenflowSwitch(name="s2", port_count=3, of_id=2)
        sw3 = OpenflowSwitch(name="s3", port_count=2, of_id=3)

        cl1 = Arrival(name="h1",
                      pkts=config.get("pyswitch_model.pkts"),
                      sequential=config.get("pyswitch_model.sequential"))
        cl2 = Replier(name="h2", mymac=(0x00, 0x01, 0x02, 0x03, 0x04, 0x05))
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0), 2: (sw3, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0), 2: (sw3, 1)})
        sw3.initTopology({0: (sw1, 2), 1: (sw2, 2)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches.append(sw3)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        self.switches_idx[sw3.getOpenflowID()] = sw3
        # start callbacks
        self.controller.start_callbacks.append(
            lambda: self.controller.install())
        self.controller.start_callbacks.append(
            lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(
            lambda: self.controller.addSwitch(sw2))
        self.controller.start_callbacks.append(
            lambda: self.controller.addSwitch(sw3))

    def generate_inputs(self):
        pass

    def generate_stats(self):
        pass
Esempio n. 7
0
class NiceModel(Model):
    generate_inputs = True
    generate_stats = False
    invariants = [NoLoopInvariant, StrictDirectRouteInvariant]

    def initTopology(self, topo):
        self.controller = PySwitchController()
        sw1 = OpenflowSwitch(
            name="s1",
            port_count=2,
            of_id=1,
            expire_entries=config.get("model.flow_entry_expiration"))
        sw2 = OpenflowSwitch(
            name="s2",
            port_count=2,
            of_id=2,
            expire_entries=config.get("model.flow_entry_expiration"))
        cl1 = SymExecSender(name="h1",
                            mymac=(0x00, 0xBA, 0xAD, 0xF0, 0x0D, 0x01),
                            max_pkts=config.get("nice_model.max_pkts"),
                            max_burst=config.get("nice_model.max_burst"))
        cl2 = Replier(name="h2", mymac=(0x00, 0x01, 0x02, 0x03, 0x04, 0x05))
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        # start callbacks
        self.controller.start_callbacks.append(
            lambda: self.controller.install())
        self.controller.start_callbacks.append(
            lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(
            lambda: self.controller.addSwitch(sw2))
Esempio n. 8
0
class Pyswitch3WayModel(Model):
    invariants = [NoLoopInvariant]

    def initTopology(self, topo):
        """ 3 switch triangle topology """
        self.controller = PySwitchController(version="pyswitch")
        sw1 = OpenflowSwitch(name="s1", port_count=3, of_id=1)
        sw2 = OpenflowSwitch(name="s2", port_count=3, of_id=2)
        sw3 = OpenflowSwitch(name="s3", port_count=2, of_id=3)

        cl1 = Arrival(name="h1", pkts=config.get("pyswitch_model.pkts"), sequential=config.get("pyswitch_model.sequential"))
        cl2 = Replier(name="h2", mymac=(0x00, 0x01, 0x02, 0x03, 0x04, 0x05))
        sw1.initTopology({0: (cl1, 0), 1: (sw2, 0), 2: (sw3, 0)})
        sw2.initTopology({0: (sw1, 1), 1: (cl2, 0), 2: (sw3, 1)})
        sw3.initTopology({0: (sw1, 2), 1: (sw2, 2)})
        cl1.initTopology({0: (sw1, 0)})
        cl2.initTopology({0: (sw2, 1)})
        self.clients.append(cl1)
        self.clients.append(cl2)
        self.switches.append(sw1)
        self.switches.append(sw2)
        self.switches.append(sw3)
        self.switches_idx[sw1.getOpenflowID()] = sw1
        self.switches_idx[sw2.getOpenflowID()] = sw2
        self.switches_idx[sw3.getOpenflowID()] = sw3
        # start callbacks
        self.controller.start_callbacks.append(lambda: self.controller.install())
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw1))
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw2))
        self.controller.start_callbacks.append(lambda: self.controller.addSwitch(sw3))

    def generate_inputs(self):
        pass

    def generate_stats(self):
        pass