示例#1
0
    def port_desc_stats_reply_handler(self, ev):
        recieved_datapath = ev.msg.datapath
        # Check if the response is from the device we asked it to
        if self.ofdpa_instance.datapath == recieved_datapath:
            port_ids = []
            # Print available ports
            for p in ev.msg.body:
                port_ids.append(p.port_no)
            self.logger.debug('OFPPortDescStatsReply received: %s', port_ids)

            # Configure topology. In this case, two servers with two NICs each,
            # and one OFDPA switch.
            switch, nyx, ananke = topo.create_basic_tue_lab()

            # And send our use case
            usecase.ping(self.ofdpa_instance, 10,
                         (nyx.nics[0].mac,
                          nyx.nics[0].connected_to.ofdpa_id),
                         (ananke.nics[0].mac,
                          ananke.nics[0].connected_to.ofdpa_id))
示例#2
0
logging.basicConfig(level=logging.WARN)
logger = logging.getLogger(__name__)
logging.getLogger("dicttoxml").setLevel(logging.WARN)

# But like some debug information from the messy ofdpy.odlparse
ch = logging.StreamHandler()
ch.setLevel(logging.WARN)
formatter = logging.Formatter('%(message)s')
ch.setFormatter(formatter)
logging.getLogger("ofdpy.odlparse").setLevel(logging.WARN)
logging.getLogger("ofdpy.odlparse").propagate = False
logging.getLogger("ofdpy.odlparse").addHandler(ch)

ofdpa_instance = ofdpa.OFDPA(mode="ODL", controller_ip="131.155.34.9")

# Configure topology. In this case, two servers with two NICs each, and one
# OFDPA switch
switch, nyx, ananke = topo.create_basic_tue_lab()

# Start up the dscp ping use case. After sending sending this to the ODL controller
# with .ODL/send.py, the clients should be able to send DHCP packets with tag
# 60 to the target output port.
usecase.dscp_vlan(ofdpa_instance, 10, 60,
              nyx.nics[0].connected_to.ofdpa_id,
             ananke.nics[0].connected_to.ofdpa_id)
ofdpa_instance.ODL_instance.write_to_file()

# Remove the fake datapath that got created earlier to be sure. If you keep
# opening a new python console to run, you shouldn't need this.
ofdpa._remove_fake_datapath()