def remove_nio(self, port_number):
        """
        Removes the specified NIO as member of this ATM switch.

        :param port_number: allocated port number
        """

        if port_number not in self._nios:
            raise DynamipsError("Port {} is not allocated".format(port_number))

        # remove VCs mapped with the port
        for source, destination in self._active_mappings.copy().items():
            if len(source) == 3 and len(destination) == 3:
                # remove the virtual channels mapped with this port/nio
                source_port, source_vpi, source_vci = source
                destination_port, destination_vpi, destination_vci = destination
                if port_number == source_port:
                    log.info('ATM switch "{name}" [{id}]: unmapping VCC between port {source_port} VPI {source_vpi} VCI {source_vci} and port {destination_port} VPI {destination_vpi} VCI {destination_vci}'.format(name=self._name,
                                                                                                                                                                                                                     id=self._id,
                                                                                                                                                                                                                     source_port=source_port,
                                                                                                                                                                                                                     source_vpi=source_vpi,
                                                                                                                                                                                                                     source_vci=source_vci,
                                                                                                                                                                                                                     destination_port=destination_port,
                                                                                                                                                                                                                     destination_vpi=destination_vpi,
                                                                                                                                                                                                                     destination_vci=destination_vci))
                    yield from self.unmap_pvc(source_port, source_vpi, source_vci, destination_port, destination_vpi, destination_vci)
                    yield from self.unmap_pvc(destination_port, destination_vpi, destination_vci, source_port, source_vpi, source_vci)
            else:
                # remove the virtual paths mapped with this port/nio
                source_port, source_vpi = source
                destination_port, destination_vpi = destination
                if port_number == source_port:
                    log.info('ATM switch "{name}" [{id}]: unmapping VPC between port {source_port} VPI {source_vpi} and port {destination_port} VPI {destination_vpi}'.format(name=self._name,
                                                                                                                                                                              id=self._id,
                                                                                                                                                                              source_port=source_port,
                                                                                                                                                                              source_vpi=source_vpi,
                                                                                                                                                                              destination_port=destination_port,
                                                                                                                                                                              destination_vpi=destination_vpi))
                    yield from self.unmap_vp(source_port, source_vpi, destination_port, destination_vpi)
                    yield from self.unmap_vp(destination_port, destination_vpi, source_port, source_vpi)

        nio = self._nios[port_number]
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)
        log.info('ATM switch "{name}" [{id}]: NIO {nio} removed from port {port}'.format(name=self._name,
                                                                                         id=self._id,
                                                                                         nio=nio,
                                                                                         port=port_number))

        del self._nios[port_number]
        return nio
def remove_nio ( self , port_number ) : if port_number not in self . _nios : raise DynamipsError ( "Port {} is not allocated" . format ( port_number ) ) for source , destination in self . _active_mappings . copy ( ) . items ( ) : if len ( source ) == 3 and len ( destination ) == 3 : source_port , source_vpi , source_vci = source destination_port , destination_vpi , destination_vci = destination if port_number == source_port : log . info ( 'ATM switch "{name}" [{id}]: unmapping VCC between port {source_port} VPI {source_vpi} VCI {source_vci} and port {destination_port} VPI {destination_vpi} VCI {destination_vci}' . format ( name = self . _name , id = self . _id , source_port = source_port , source_vpi = source_vpi , source_vci = source_vci , destination_port = destination_port , destination_vpi = destination_vpi , destination_vci = destination_vci ) ) yield from self . unmap_pvc ( source_port , source_vpi , source_vci , destination_port , destination_vpi , destination_vci ) yield from self . unmap_pvc ( destination_port , destination_vpi , destination_vci , source_port , source_vpi , source_vci ) else : source_port , source_vpi = source destination_port , destination_vpi = destination if port_number == source_port : log . info ( 'ATM switch "{name}" [{id}]: unmapping VPC between port {source_port} VPI {source_vpi} and port {destination_port} VPI {destination_vpi}' . format ( name = self . _name , id = self . _id , source_port = source_port , source_vpi = source_vpi , destination_port = destination_port , destination_vpi = destination_vpi ) ) yield from self . unmap_vp ( source_port , source_vpi , destination_port , destination_vpi ) yield from self . unmap_vp ( destination_port , destination_vpi , source_port , source_vpi ) nio = self . _nios [ port_number ] if isinstance ( nio , NIOUDP ) : self . manager . port_manager . release_udp_port ( nio . lport , self . _project ) log . info ( 'ATM switch "{name}" [{id}]: NIO {nio} removed from port {port}' . format ( name = self . _name , id = self . _id , nio = nio , port = port_number ) ) del self . _nios [ port_number ] return nio
Removes the specified NIO as member of this ATM switch.

        :param port_number: allocated port number