Adds a NIO as new port on this bridge.

        :param nio: NIO instance to add
546190
def add_nio(self, nio):
        

        yield from self._hypervisor.send('nio_bridge add_nio "{name}" {nio}'.format(name=self._name, nio=nio))
        self._nios.append(nio)
138490
def addOutputPort(self, node: LNode, name: str,
                      out: Optional[Union[RtlSignalBase, LPort]],
                      side=PortSide.EAST):
        
        oPort = node.addPort(name, PortType.OUTPUT, side)
        if out is not None:
            if isinstance(out, LPort):
                self.node.addEdge(oPort, out)
            elif out.hidden:
                raise ValueError("Hidden signals should not be connected to outside", name)
            elif self.isVirtual:
                # This node is inlined inside of parent.
                # Mark that this output of subnode should be connected
                # to output of parent node.
                ctx, _ = self.netCtxs.getDefault(out)
                ctx.addDriver(oPort)
            else:
                # connect my signal to my output port
                _out = self.portCtx.getInside(out, PortType.OUTPUT)
                self.node.addEdge(oPort, _out, originObj=out)
                # mark connection of output port to parent net
                ooPort = self.portCtx.getOutside(out, PortType.OUTPUT)
                ctx, _ = self.rootNetCtxs.getDefault(out)
                ctx.addDriver(ooPort)

        return oPort
1013626
public static ntp_server add(nitro_service client, ntp_server resource) throws Exception
	{
		resource.validate("add");
		return ((ntp_server[]) resource.perform_operation(client, "add"))[0];
	}
492152
def addPort(n: LNode, intf: Interface):
    
    d = PortTypeFromDir(intf._direction)
    ext_p = LayoutExternalPort(
        n, name=intf._name, direction=d, node2lnode=n._node2lnode)
    ext_p.originObj = originObjOfPort(intf)
    n.children.append(ext_p)
    addPortToLNode(ext_p, intf, reverseDirection=True)
    return ext_p
361869
def set_access_port(self, port_number, vlan_id):
        

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

        nio = self._nios[port_number]
        yield from self._hypervisor.send('ethsw set_access_port "{name}" {nio} {vlan_id}'.format(name=self._name,
                                                                                                 nio=nio,
                                                                                                 vlan_id=vlan_id))

        log.info('Ethernet switch "{name}" [{id}]: port {port} set as an access port in VLAN {vlan_id}'.format(name=self._name,
                                                                                                               id=self._id,
                                                                                                               port=port_number,
                                                                                                               vlan_id=vlan_id))
        self._mappings[port_number] = ("access", vlan_id)
761663
def add_slot_ports(self, slot):
        
        slot_nb = int(slot[4])
        # slot_adapter = None
        # if slot in self.node['properties']:
        #     slot_adapter = self.node['properties'][slot]
        # elif self.device_info['model'] == 'c7200':
        #     if self.device_info['npe'] == 'npe-g2':
        #         slot_adapter = 'C7200-IO-GE-E'
        #     else:
        #         slot_adapter = 'C7200-IO-2FE'

        slot_adapter = self.node['properties'][slot]

        num_ports = ADAPTER_MATRIX[slot_adapter]['ports']
        port_type = ADAPTER_MATRIX[slot_adapter]['type']
        ports = []

        for i in range(num_ports):
            port_name = PORT_TYPES[port_type] + '%s/%s' % (slot_nb, i)
            port_temp = {'name': port_name,
                         'id': self.port_id,
                         'port_number': i,
                         'slot_number': slot_nb}
            ports.append(port_temp)
            self.port_id += 1
        self.node['ports'].extend(ports)
931809
def port_remove_nio_binding(self, port_number):
        

        if not self._ethernet_adapter.port_exists(port_number):
            raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
                                                                                           port_number=port_number))

        if self.is_running():
            yield from self._ubridge_send("bridge delete {name}".format(name="VPCS-{}".format(self._id)))

        nio = self._ethernet_adapter.get_nio(port_number)
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)
        self._ethernet_adapter.remove_nio(port_number)

        log.info('VPCS "{name}" [{id}]: {nio} removed from port {port_number}'.format(name=self._name,
                                                                                      id=self.id,
                                                                                      nio=nio,
                                                                                      port_number=port_number))
        return nio
696698
def add_bridge_port(name, port, promisc=False):
    '''  '''
    log('Adding port {} to bridge {}'.format(port, name))
    subprocess.check_call(["ovs-vsctl", "--", "--may-exist", "add-port",
                           name, port])
    subprocess.check_call(["ip", "link", "set", port, "up"])
    if promisc:
        subprocess.check_call(["ip", "link", "set", port, "promisc", "on"])
    else:
        subprocess.check_call(["ip", "link", "set", port, "promisc", "off"])
1204161
def add_bridge(name, datapath_type=None):
    '''  '''
    log('Creating bridge {}'.format(name))
    cmd = ["ovs-vsctl", "--", "--may-exist", "add-br", name]
    if datapath_type is not None:
        cmd += ['--', 'set', 'bridge', name,
                'datapath_type={}'.format(datapath_type)]
    subprocess.check_call(cmd)
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
776331
def create_nio(self, node, 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 DynamipsError("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 DynamipsError("Could not create an UDP connection to {}:{}: {}".format(rhost, rport, e))
            nio = NIOUDP(node, lport, rhost, rport, nio_settings.get("filters", {}))
        elif nio_settings["type"] == "nio_generic_ethernet":
            ethernet_device = nio_settings["ethernet_device"]
            if sys.platform.startswith("win"):
                # replace the interface name by the GUID on Windows
                windows_interfaces = interfaces()
                npf_interface = None
                for interface in windows_interfaces:
                    if interface["name"] == ethernet_device:
                        npf_interface = interface["id"]
                if not npf_interface:
                    raise DynamipsError("Could not find interface {} on this host".format(ethernet_device))
                else:
                    ethernet_device = npf_interface
            if not is_interface_up(ethernet_device):
                raise aiohttp.web.HTTPConflict(text="Ethernet interface {} is down".format(ethernet_device))
            nio = NIOGenericEthernet(node.hypervisor, ethernet_device)
        elif nio_settings["type"] == "nio_linux_ethernet":
            if sys.platform.startswith("win"):
                raise DynamipsError("This NIO type is not supported on Windows")
            ethernet_device = nio_settings["ethernet_device"]
            nio = NIOLinuxEthernet(node.hypervisor, ethernet_device)
        elif nio_settings["type"] == "nio_tap":
            tap_device = nio_settings["tap_device"]
            nio = NIOTAP(node.hypervisor, tap_device)
            if not is_interface_up(tap_device):
                # test after the TAP interface has been created (if it doesn't exist yet)
                raise aiohttp.web.HTTPConflict(text="TAP interface {} is down".format(tap_device))
        elif nio_settings["type"] == "nio_unix":
            local_file = nio_settings["local_file"]
            remote_file = nio_settings["remote_file"]
            nio = NIOUNIX(node.hypervisor, local_file, remote_file)
        elif nio_settings["type"] == "nio_vde":
            control_file = nio_settings["control_file"]
            local_file = nio_settings["local_file"]
            nio = NIOVDE(node.hypervisor, control_file, local_file)
        elif nio_settings["type"] == "nio_null":
            nio = NIONull(node.hypervisor)
        else:
            raise aiohttp.web.HTTPConflict(text="NIO of type {} is not supported".format(nio_settings["type"]))

        yield from nio.create()
        return nio
595623
function addConnect ( base, add ) {

            if ( !add ) {
                return false;
            }

            return addNodeTo(base, options.cssClasses.connect);
        }
1313454
def add_nic(self, instance_id, net_id):
        """"""
        #TODO: upgrade with port_id and fixed_ip in future
        self.client.servers.interface_attach(
            instance_id, None, net_id, None)
        return True
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)
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
                ))
487274
def vserver_add(v_name, v_ip, v_port, v_type, **connection_args):
    '''
    
    '''
    ret = True
    if vserver_exists(v_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    vserver = NSLBVServer()
    vserver.set_name(v_name)
    vserver.set_ipv46(v_ip)
    vserver.set_port(v_port)
    vserver.set_servicetype(v_type.upper())
    try:
        NSLBVServer.add(nitro, vserver)
    except NSNitroError as error:
        log.debug('netscaler module error - NSLBVServer.add() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
563464
def create_n_connect(self,
                         socket_type,
                         address: str,
                         bind=False,
                         on_error='log',
                         socket_name=''):
        
        self.logger.debug('create and connect: %s %s %s',
                          socket_type, socket_name, address)

        socket = self.context.socket(socket_type)
        if self.using_auth:
            self._create_using_auth(socket, address, bind, on_error, socket_name)
        else:
            self._create_no_auth(socket, address, bind, on_error, socket_name)

        return socket