Attaches load balancer to one or more subnets.
        Attaching subnets that are already registered with the 
        Load Balancer has no effect.

        :type subnets: string or List of strings
        :param subnets: The name of the subnet(s) to add.
332413
def attach_subnets(self, subnets):
        
        if isinstance(subnets, str) or isinstance(subnets, unicode):
            subnets = [subnets]
        new_subnets = self.connection.attach_lb_to_subnets(self.name, subnets)
        self.subnets = new_subnets
767176
def add_connections(self, conns):
        
        rets = []
        for addr, kwargs in conns:
            r = self.add_connection(addr, **kwargs)
            rets.append(r)
        return rets
107325
def update_subnet(self, subnet, body=None):
        """"""
        return self.put(self.subnet_path % (subnet), body=body)
1130271
public void setSubnets(java.util.Collection<Subnet> subnets) {
        if (subnets == null) {
            this.subnets = null;
            return;
        }

        this.subnets = new java.util.ArrayList<Subnet>(subnets);
    }
807150
def sync_networks(self):
        
        nets = self.neutronclient.list_networks()
        for net in nets.get("networks"):
            LOG.info("Syncing network %s", net["id"])
            self.network_create_func(net)
        subnets = self.neutronclient.list_subnets()
        for subnet in subnets.get("subnets"):
            LOG.info("Syncing subnet %s", subnet["id"])
            self.create_subnet(subnet)
742109
private void addHeads(List<AttachedGroup> attachedSubstituents) {
        Iterator<AttachedGroup> substituentsIterator = attachedSubstituents.iterator();
        while (substituentsIterator.hasNext()) {
            AttachedGroup attachedSubstituent = substituentsIterator.next();

            Iterator<Token> locationsIterator = attachedSubstituent.getLocations().iterator();
            while (locationsIterator.hasNext()) {
                Token locationToken = locationsIterator.next();

                int joinLocation = Integer.parseInt(locationToken.image) - 1;
                IAtom connectingAtom;

                //If join location wasn't specified we must be dealing with the "hack" which makes
                //mainchains a substituent if a real substituent has already been parsed and interpreted as a main chain
                if (joinLocation < 0) {
                    connectingAtom = endOfChain;
                } else {
                    connectingAtom = currentMolecule.getAtom(joinLocation);
                }

                IAtomContainer subChain = buildChain(attachedSubstituent.getLength(), false);

                IBond linkingBond = currentMolecule.getBuilder().newInstance(IBond.class, subChain.getAtom(0),
                        connectingAtom);
                currentMolecule.addBond(linkingBond);
                currentMolecule.add(subChain);
            }
        }
    }
236902
def update_subnet(self, subnet, name=None):
        '''
        
        '''
        subnet_id = self._find_subnet_id(subnet)
        return self.network_conn.update_subnet(
            subnet=subnet_id, body={'subnet': {'name': name}})
628942
public synchronized boolean addNode(final NodeConfig config, final Balancer.BalancerBuilder balancerConfig, final XnioIoThread ioThread, final ByteBufferPool bufferPool) {

        final String jvmRoute = config.getJvmRoute();
        final Node existing = nodes.get(jvmRoute);
        if (existing != null) {
            if (config.getConnectionURI().equals(existing.getNodeConfig().getConnectionURI())) {
                // TODO better check if they are the same
                existing.resetState();
                return true;
            } else {
                existing.markRemoved();
                removeNode(existing);
                if (!existing.isInErrorState()) {
                    return false; // replies with MNODERM error
                }
            }
        }

        final String balancerRef = config.getBalancer();
        Balancer balancer = balancers.get(balancerRef);
        if (balancer != null) {
            UndertowLogger.ROOT_LOGGER.debugf("Balancer %s already exists, replacing", balancerRef);
        }
        balancer = balancerConfig.build();
        balancers.put(balancerRef, balancer);

        final Node node = new Node(config, balancer, ioThread, bufferPool, this);
        nodes.put(jvmRoute, node);
        // Schedule the health check
        scheduleHealthCheck(node, ioThread);
        // Reset the load factor periodically
        if (updateLoadTask.cancelKey == null) {
            updateLoadTask.cancelKey = ioThread.executeAtInterval(updateLoadTask, modCluster.getHealthCheckInterval(), TimeUnit.MILLISECONDS);
        }
        // Remove from the failover groups
        failoverDomains.remove(node.getJvmRoute());
        UndertowLogger.ROOT_LOGGER.registeringNode(jvmRoute, config.getConnectionURI());
        return true;
    }
632227
def append(self, network):
        
        arr = network.to_array(self.hg.mappings)
        if len(self.__matrix):
            self.__matrix = np.append(self.__matrix, [arr], axis=0)
            self.__networks = np.append(self.__networks, network.networks)
        else:
            self.__matrix = np.array([arr])
            self.__networks = np.array([network.networks])
424169
public void setSubnetwork(int nodeId, int subnetwork) {
        if (subnetwork > 127)
            throw new IllegalArgumentException("Number of subnetworks is currently limited to 127 but requested " + subnetwork);

        byte[] bytes = new byte[1];
        bytes[0] = (byte) subnetwork;
        da.setBytes(nodeId, bytes, bytes.length);
    }
185389
def show_subnetwork(kwargs=None, call=None):
    '''
    

    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_subnetwork function must be called with -f or --function.'
        )

    if not kwargs or 'name' not in kwargs:
        log.error(
            'Must specify name of subnet.'
        )
        return False

    if 'region' not in kwargs:
        log.error(
            'Must specify region of subnet.'
        )
        return False

    name = kwargs['name']
    region = kwargs['region']
    conn = get_conn()
    return _expand_item(conn.ex_get_subnetwork(name, region))
1132177
public void setSubnets(java.util.Collection<String> subnets) {
        if (subnets == null) {
            this.subnets = null;
            return;
        }

        this.subnets = new java.util.ArrayList<String>(subnets);
    }
385072
public void setLoadBalancerAddresses(java.util.Collection<LoadBalancerAddress> loadBalancerAddresses) {
        if (loadBalancerAddresses == null) {
            this.loadBalancerAddresses = null;
            return;
        }

        this.loadBalancerAddresses = new java.util.ArrayList<LoadBalancerAddress>(loadBalancerAddresses);
    }
755397
def attach_lb(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The attach_lb function must be called with -f or --function.'
        )

    if not kwargs or 'name' not in kwargs:
        log.error(
            'A load-balancer name must be specified.'
        )
        return False
    if 'member' not in kwargs:
        log.error(
            'A node name name must be specified.'
        )
        return False

    conn = get_conn()
    node = conn.ex_get_node(kwargs['member'])

    lb_conn = get_lb_conn(conn)
    lb = lb_conn.get_balancer(kwargs['name'])

    __utils__['cloud.fire_event'](
        'event',
        'attach load_balancer',
        'salt/cloud/loadbalancer/attaching',
        args=kwargs,
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    result = lb_conn.balancer_attach_compute_node(lb, node)

    __utils__['cloud.fire_event'](
        'event',
        'attached load_balancer',
        'salt/cloud/loadbalancer/attached',
        args=kwargs,
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )
    return _expand_item(result)
444047
def add_intf_router(self, rout_id, tenant_id, subnet_lst):
        
        try:
            for subnet_id in subnet_lst:
                body = {'subnet_id': subnet_id}
                intf = self.neutronclient.add_interface_router(rout_id,
                                                               body=body)
                intf.get('port_id')
        except Exception as exc:
            LOG.error("Failed to create router intf ID %(id)s,"
                      " Exc %(exc)s", {'id': rout_id, 'exc': str(exc)})
            return False
        return True
486597
def _subnets(proto='inet', interfaces_=None):
    '''
    
    '''
    if interfaces_ is None:
        ifaces = interfaces()
    elif isinstance(interfaces_, list):
        ifaces = {}
        for key, value in six.iteritems(interfaces()):
            if key in interfaces_:
                ifaces[key] = value
    else:
        ifaces = {interfaces_: interfaces().get(interfaces_, {})}

    ret = set()

    if proto == 'inet':
        subnet = 'netmask'
        dflt_cidr = 32
    elif proto == 'inet6':
        subnet = 'prefixlen'
        dflt_cidr = 128
    else:
        log.error('Invalid proto %s calling subnets()', proto)
        return

    for ip_info in six.itervalues(ifaces):
        addrs = ip_info.get(proto, [])
        addrs.extend([addr for addr in ip_info.get('secondary', []) if addr.get('type') == proto])

        for intf in addrs:
            if subnet in intf:
                intf = ipaddress.ip_interface('{0}/{1}'.format(intf['address'], intf[subnet]))
            else:
                intf = ipaddress.ip_interface('{0}/{1}'.format(intf['address'], dflt_cidr))
            if not intf.is_loopback:
                ret.add(intf.network)
    return [six.text_type(net) for net in sorted(ret)]
280614
def subnets_list(resource_group_name, vnet_name, address_prefix = nil)
      list = network_resource_client.subnets.list(resource_group_name, vnet_name)
      !address_prefix.nil? && !list.empty? ? subnets_list_for_specific_address_space(address_prefix, list) : list
    end