예제 #1
0
 def remove(self, network_id, dpid, port_no):
     try:
         self.remove_raw(network_id, dpid, port_no)
     except KeyError:
         raise NetworkNotFound(network_id=network_id)
     except ValueError:
         raise PortNotFound(network_id=network_id, dpid=dpid, port=port_no)
예제 #2
0
파일: network.py 프로젝트: rolaya/os-ken
 def remove(self, network_id, dpid, port_no):
     self.logger.info('processing: %s()', sys._getframe(0).f_code.co_name)
     try:
         self.remove_raw(network_id, dpid, port_no)
     except KeyError:
         raise NetworkNotFound(network_id=network_id)
     except ValueError:
         raise PortNotFound(network_id=network_id, dpid=dpid, port=port_no)
예제 #3
0
파일: network.py 프로젝트: rolaya/os-ken
    def _set_mac(self, network_id, dpid, port_no, port, mac_address):
        self.logger.info('processing: %s()', sys._getframe(0).f_code.co_name)
        if not (port.network_id is None or port.network_id == network_id
                or port.network_id == self.nw_id_unknown):
            raise PortNotFound(network_id=network_id, dpid=dpid, port=port_no)

        port.network_id = network_id
        port.mac_address = mac_address
        if port.network_id and port.mac_address:
            self.send_event(
                EventMacAddress(dpid, port_no, port.network_id,
                                port.mac_address, True))
예제 #4
0
파일: network.py 프로젝트: rolaya/os-ken
 def remove_port(self, dpid, port_no):
     self.logger.info('processing: %s()', sys._getframe(0).f_code.co_name)
     try:
         # self.dpids[dpid][port_no] can be already deleted by
         # port_deleted()
         port = self[dpid].pop(port_no, None)
         if port and port.network_id and port.mac_address:
             self.send_event(
                 EventMacAddress(dpid, port_no, port.network_id,
                                 port.mac_address, False))
     except KeyError:
         raise PortNotFound(dpid=dpid, port=port_no, network_id=None)
예제 #5
0
    def _set_mac(self, network_id, dpid, port_no, port, mac_address):
        if not (port.network_id is None or
                port.network_id == network_id or
                port.network_id == self.nw_id_unknown):
            raise PortNotFound(network_id=network_id, dpid=dpid, port=port_no)

        port.network_id = network_id
        port.mac_address = mac_address
        if port.network_id and port.mac_address:
            self.send_event(EventMacAddress(
                            dpid, port_no, port.network_id, port.mac_address,
                            True))
예제 #6
0
 def remove_port(self, dpid, port_no):
     try:
         # self.dpids[dpid][port_no] can be already deleted by
         # port_deleted()
         port = self[dpid].pop(port_no, None)
         if port and port.network_id and port.mac_address:
             self.send_event(EventMacAddress(dpid, port_no,
                                             port.network_id,
                                             port.mac_address,
                                             False))
     except KeyError:
         raise PortNotFound(dpid=dpid, port=port_no, network_id=None)
예제 #7
0
파일: network.py 프로젝트: rolaya/os-ken
 def get_port(self, dpid, port_no):
     self.logger.info('processing: %s()', sys._getframe(0).f_code.co_name)
     try:
         return self[dpid][port_no]
     except KeyError:
         raise PortNotFound(dpid=dpid, port=port_no, network_id=None)
예제 #8
0
 def get_port(self, dpid, port_no):
     try:
         return self[dpid][port_no]
     except KeyError:
         raise PortNotFound(dpid=dpid, port=port_no, network_id=None)