Update a port NIO binding.

        :param adapter_number: adapter number
        :param nio: NIO instance to add to the adapter
351473
def adapter_update_nio_binding(self, adapter_number, nio):
        

        if self._ubridge_hypervisor:
            try:
                yield from self._update_ubridge_connection(adapter_number, nio)
            except IndexError:
                raise VMwareError('Adapter {adapter_number} does not exist on VMware VM "{name}"'.format(
                    name=self._name,
                    adapter_number=adapter_number
                ))
237677
def update(self, update):
        

        params = shlex.split(update)
        if params[0] in self.addr:
            self.addr[params[0]].update(*params)

        else:
            a = Addr(self)
            # add both name and IP address
            self.addr[params[0]] = a
            self.addr[params[1]] = a
            a.update(*params)
            self.notify("addrmap_added", *[a], **{})
1089657
def add_nexusport_binding(port_id, vlan_id, vni, switch_ip, instance_id,
                          is_native=False, ch_grp=0):
    """"""
    LOG.debug("add_nexusport_binding() called")
    session = bc.get_writer_session()
    binding = nexus_models_v2.NexusPortBinding(port_id=port_id,
                  vlan_id=vlan_id,
                  vni=vni,
                  switch_ip=switch_ip,
                  instance_id=instance_id,
                  is_native=is_native,
                  channel_group=ch_grp)
    session.add(binding)
    session.flush()
    return binding
1183956
def slot_remove_nio_binding(self, slot_number, port_number):
        

        try:
            adapter = self._slots[slot_number]
        except IndexError:
            raise DynamipsError('Slot {slot_number} does not exist on router "{name}"'.format(name=self._name,
                                                                                              slot_number=slot_number))

        if adapter is None:
            raise DynamipsError("Adapter is missing in slot {slot_number}".format(slot_number=slot_number))

        if not adapter.port_exists(port_number):
            raise DynamipsError("Port {port_number} does not exist in adapter {adapter}".format(adapter=adapter,
                                                                                                port_number=port_number))

        yield from self.slot_disable_nio(slot_number, port_number)
        yield from self._hypervisor.send('vm slot_remove_nio_binding "{name}" {slot_number} {port_number}'.format(name=self._name,
                                                                                                                  slot_number=slot_number,
                                                                                                                  port_number=port_number))

        nio = adapter.get_nio(port_number)
        if nio is None:
            return
        yield from nio.close()
        adapter.remove_nio(port_number)

        log.info('Router "{name}" [{id}]: NIO {nio_name} removed from port {slot_number}/{port_number}'.format(name=self._name,
                                                                                                               id=self._id,
                                                                                                               nio_name=nio.name,
                                                                                                               slot_number=slot_number,
                                                                                                               port_number=port_number))

        return nio
583617
def create_nio(self, nio_settings):
        

        nio = None
        if nio_settings["type"] == "nio_udp":
            lport = nio_settings["lport"]
            rhost = nio_settings["rhost"]
            rport = nio_settings["rport"]
            try:
                info = socket.getaddrinfo(rhost, rport, socket.AF_UNSPEC, socket.SOCK_DGRAM, 0, socket.AI_PASSIVE)
                if not info:
                    raise aiohttp.web.HTTPInternalServerError(text="getaddrinfo returns an empty list on {}:{}".format(rhost, rport))
                for res in info:
                    af, socktype, proto, _, sa = res
                    with socket.socket(af, socktype, proto) as sock:
                        sock.connect(sa)
            except OSError as e:
                raise aiohttp.web.HTTPInternalServerError(text="Could not create an UDP connection to {}:{}: {}".format(rhost, rport, e))
            filters = nio_settings.get("filters", {})
            nio = NIOUDP(lport, rhost, rport, filters)
        elif nio_settings["type"] == "nio_tap":
            tap_device = nio_settings["tap_device"]
            # if not is_interface_up(tap_device):
            #    raise aiohttp.web.HTTPConflict(text="TAP interface {} does not exist or is down".format(tap_device))
            # FIXME: check for permissions on tap device
            # if not self.has_privileged_access(executable):
            #    raise aiohttp.web.HTTPForbidden(text="{} has no privileged access to {}.".format(executable, tap_device))
            nio = NIOTAP(tap_device)
        elif nio_settings["type"] in ("nio_generic_ethernet", "nio_ethernet"):
            ethernet_device = nio_settings["ethernet_device"]
            if not is_interface_up(ethernet_device):
                raise aiohttp.web.HTTPConflict(text="Ethernet interface {} does not exist or is down".format(ethernet_device))
            nio = NIOEthernet(ethernet_device)
        assert nio is not None
        return nio
1070969
def adapter_remove_nio_binding(self, adapter_number, port_number):
        

        try:
            adapter = self._adapters[adapter_number]
        except IndexError:
            raise IOUError('Adapter {adapter_number} does not exist on IOU "{name}"'.format(name=self._name,
                                                                                            adapter_number=adapter_number))

        if not adapter.port_exists(port_number):
            raise IOUError("Port {port_number} does not exist in adapter {adapter}".format(adapter=adapter,
                                                                                           port_number=port_number))

        nio = adapter.get_nio(port_number)
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)
        adapter.remove_nio(port_number)
        log.info('IOU "{name}" [{id}]: {nio} removed from {adapter_number}/{port_number}'.format(name=self._name,
                                                                                                 id=self._id,
                                                                                                 nio=nio,
                                                                                                 adapter_number=adapter_number,
                                                                                                 port_number=port_number))

        if self.ubridge:
            bridge_name = "IOL-BRIDGE-{}".format(self.application_id + 512)
            yield from self._ubridge_send("iol_bridge delete_nio_udp {name} {bay} {unit}".format(name=bridge_name,
                                                                                                 bay=adapter_number,
                                                                                                 unit=port_number))

        return nio
465063
def adapter_add_nio_binding(self, adapter_number, nio):
        

        try:
            adapter = self._ethernet_adapters[adapter_number]
        except IndexError:
            raise VMwareError("Adapter {adapter_number} doesn't exist on VMware VM '{name}'".format(name=self.name,
                                                                                                    adapter_number=adapter_number))

        self._read_vmx_file()
        # check if trying to connect to a nat, bridged or host-only adapter
        if self._get_vmx_setting("ethernet{}.present".format(adapter_number), "TRUE"):
            # check for the connection type
            connection_type = "ethernet{}.connectiontype".format(adapter_number)
            if connection_type in self._vmx_pairs and self._vmx_pairs[connection_type] in ("nat", "bridged", "hostonly"):
                if not self._use_any_adapter:
                    raise VMwareError("Attachment '{attachment}' is already configured on network adapter {adapter_number}. "
                                      "Please remove it or allow VMware VM '{name}' to use any adapter.".format(attachment=self._vmx_pairs[connection_type],
                                                                                                                adapter_number=adapter_number,
                                                                                                                name=self.name))
                elif (yield from self.is_running()):
                    raise VMwareError("Attachment '{attachment}' is configured on network adapter {adapter_number}. "
                                      "Please stop VMware VM '{name}' to link to this adapter and allow GNS3 to change the attachment type.".format(attachment=self._vmx_pairs[connection_type],
                                                                                                                                                    adapter_number=adapter_number,
                                                                                                                                                    name=self.name))

        adapter.add_nio(0, nio)
        if self._started and self._ubridge_hypervisor:
            yield from self._add_ubridge_connection(nio, adapter_number)

        log.info("VMware VM '{name}' [{id}]: {nio} added to adapter {adapter_number}".format(name=self.name,
                                                                                             id=self.id,
                                                                                             nio=nio,
                                                                                             adapter_number=adapter_number))
16441
public static base_response update(nitro_service client, snmpengineid resource) throws Exception {
		snmpengineid updateresource = new snmpengineid();
		updateresource.engineid = resource.engineid;
		updateresource.ownernode = resource.ownernode;
		return updateresource.update_resource(client);
	}
783388
def remove_nio(self, 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():
            source_port, source_dlci = source
            destination_port, destination_dlci = destination
            if port_number == source_port:
                log.info('Frame Relay switch "{name}" [{id}]: unmapping VC between port {source_port} DLCI {source_dlci} and port {destination_port} DLCI {destination_dlci}'.format(name=self._name,
                                                                                                                                                                                     id=self._id,
                                                                                                                                                                                     source_port=source_port,
                                                                                                                                                                                     source_dlci=source_dlci,
                                                                                                                                                                                     destination_port=destination_port,
                                                                                                                                                                                     destination_dlci=destination_dlci))
                yield from self.unmap_vc(source_port, source_dlci, destination_port, destination_dlci)
                yield from self.unmap_vc(destination_port, destination_dlci, source_port, source_dlci)

        nio = self._nios[port_number]
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)

        log.info('Frame Relay 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
716378
def adapter_update_nio_binding(self, adapter_number, nio):
        

        if self.is_running():
            try:
                yield from self.update_ubridge_udp_connection(
                    "VBOX-{}-{}".format(self._id, adapter_number),
                    self._local_udp_tunnels[adapter_number][1],
                    nio)
            except IndexError:
                raise VirtualBoxError('Adapter {adapter_number} does not exist on VirtualBox VM "{name}"'.format(
                    name=self._name,
                    adapter_number=adapter_number
                ))
456425
def _update_field(self, natvalue):
        
        updated = False
        if natvalue.element and natvalue.element != self.element:
            self.update(element=natvalue.element)
            self.pop('ip_descriptor', None)
            updated = True
        elif natvalue.ip_descriptor and self.ip_descriptor and \
            natvalue.ip_descriptor != self.ip_descriptor:
            self.update(ip_descriptor=natvalue.ip_descriptor)
            self.pop('element', None)
            updated = True

        for port in ('min_port', 'max_port'):
            _port = getattr(natvalue, port, None)
            if _port is not None and getattr(self, port, None) != _port:
                self[port] = _port
                updated = True
    
        return updated
773180
def update_subports(self, port):
        
        trunk_details = port.get('trunk_details')
        subports = trunk_details['sub_ports']

        host_id = port.get(bc.dns.DNSNAME)
        context = bc.get_context()
        el_context = context.elevated()

        for subport in subports:
            bc.get_plugin().update_port(el_context, subport['port_id'],
                {'port':
                 {bc.portbindings.HOST_ID: host_id,
                  'device_owner': bc.trunk_consts.TRUNK_SUBPORT_OWNER}})

        # Set trunk to ACTIVE status.
        trunk_obj = bc.trunk_objects.Trunk.get_object(
            el_context, id=trunk_details['trunk_id'])
        trunk_obj.update(status=bc.trunk_consts.ACTIVE_STATUS)
526872
def _add_ubridge_connection(self, nio, port_number):
        

        port_info = None
        for port in self._ports_mapping:
            if port["port_number"] == port_number:
                port_info = port
                break

        if not port_info:
            raise NodeError("Port {port_number} doesn't exist on cloud '{name}'".format(name=self.name,
                                                                                        port_number=port_number))

        bridge_name = "{}-{}".format(self._id, port_number)
        yield from self._ubridge_send("bridge create {name}".format(name=bridge_name))
        if not isinstance(nio, NIOUDP):
            raise NodeError("Source NIO is not UDP")
        yield from self._ubridge_send('bridge add_nio_udp {name} {lport} {rhost} {rport}'.format(name=bridge_name,
                                                                                                 lport=nio.lport,
                                                                                                 rhost=nio.rhost,
                                                                                                 rport=nio.rport))

        yield from self._ubridge_apply_filters(bridge_name, nio.filters)
        if port_info["type"] in ("ethernet", "tap"):

            if sys.platform.startswith("win"):
                yield from self._add_ubridge_ethernet_connection(bridge_name, port_info["interface"])

            else:

                if port_info["type"] == "ethernet":
                    network_interfaces = [interface["name"] for interface in self._interfaces()]
                    if not port_info["interface"] in network_interfaces:
                        raise NodeError("Interface '{}' could not be found on this system".format(port_info["interface"]))

                    if sys.platform.startswith("linux"):
                        yield from self._add_linux_ethernet(port_info, bridge_name)
                    elif sys.platform.startswith("darwin"):
                        yield from self._add_osx_ethernet(port_info, bridge_name)
                    else:
                        yield from self._add_windows_ethernet(port_info, bridge_name)

                elif port_info["type"] == "tap":
                    yield from self._ubridge_send('bridge add_nio_tap {name} "{interface}"'.format(name=bridge_name, interface=port_info["interface"]))

        elif port_info["type"] == "udp":
            yield from self._ubridge_send('bridge add_nio_udp {name} {lport} {rhost} {rport}'.format(name=bridge_name,
                                                                                                     lport=port_info["lport"],
                                                                                                     rhost=port_info["rhost"],
                                                                                                     rport=port_info["rport"]))

        if nio.capturing:
            yield from self._ubridge_send('bridge start_capture {name} "{pcap_file}"'.format(name=bridge_name,
                                                                                             pcap_file=nio.pcap_output_file))

        yield from self._ubridge_send('bridge start {name}'.format(name=bridge_name))
725278
def adapter_update_nio_binding(self, adapter_number, nio):
        

        if self.ubridge:
            bridge_name = 'bridge{}'.format(adapter_number)
            if bridge_name in self._bridges:
                yield from self._ubridge_apply_filters(bridge_name, nio.filters)
510190
def update(self, **kwargs):
        
        if 'useProxyServer' in kwargs and kwargs['useProxyServer'] == 'enabled':
            if 'proxyServerPool' not in kwargs:
                error = 'Missing proxyServerPool parameter value.'
                raise MissingUpdateParameter(error)
        if hasattr(self, 'useProxyServer'):
            if getattr(self, 'useProxyServer') == 'enabled' and 'proxyServerPool' not in self.__dict__:
                error = 'Missing proxyServerPool parameter value.'
                raise MissingUpdateParameter(error)

        self._update(**kwargs)

        return self
1298869
def slot_add_nio_binding(self, slot_number, port_number, nio):
        

        try:
            adapter = self._slots[slot_number]
        except IndexError:
            raise DynamipsError('Slot {slot_number} does not exist on router "{name}"'.format(name=self._name,
                                                                                              slot_number=slot_number))

        if adapter is None:
            raise DynamipsError("Adapter is missing in slot {slot_number}".format(slot_number=slot_number))

        if not adapter.port_exists(port_number):
            raise DynamipsError("Port {port_number} does not exist in adapter {adapter}".format(adapter=adapter,
                                                                                                port_number=port_number))

        try:
            yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name,
                                                                                                                         slot_number=slot_number,
                                                                                                                         port_number=port_number,
                                                                                                                         nio=nio))
        except DynamipsError:
            # in case of error try to remove and add the nio binding
            yield from self._hypervisor.send('vm slot_remove_nio_binding "{name}" {slot_number} {port_number}'.format(name=self._name,
                                                                                                                      slot_number=slot_number,
                                                                                                                      port_number=port_number))
            yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name,
                                                                                                                         slot_number=slot_number,
                                                                                                                         port_number=port_number,
                                                                                                                         nio=nio))

        log.info('Router "{name}" [{id}]: NIO {nio_name} bound to port {slot_number}/{port_number}'.format(name=self._name,
                                                                                                           id=self._id,
                                                                                                           nio_name=nio.name,
                                                                                                           slot_number=slot_number,
                                                                                                           port_number=port_number))

        yield from self.slot_enable_nio(slot_number, port_number)
        adapter.add_nio(port_number, nio)
63415
def Tethering_bind(self, port):
		
		assert isinstance(port, (int,)
		    ), "Argument 'port' must be of type '['int']'. Received type: '%s'" % type(
		    port)
		subdom_funcs = self.synchronous_command('Tethering.bind', port=port)
		return subdom_funcs