Create a network interface in the resource group.

        Attach NIC to the subnet and public IP provided.
497077
def _create_network_interface(
        self, ip_config_name, nic_name, public_ip, region,
        resource_group_name, subnet, accelerated_networking=False
    ):
        
        nic_config = {
            'location': region,
            'ip_configurations': [{
                'name': ip_config_name,
                'private_ip_allocation_method': 'Dynamic',
                'subnet': {
                    'id': subnet.id
                },
                'public_ip_address': {
                    'id': public_ip.id
                },
            }]
        }

        if accelerated_networking:
            nic_config['enable_accelerated_networking'] = True

        try:
            nic_setup = self.network.network_interfaces.create_or_update(
                resource_group_name, nic_name, nic_config
            )
        except Exception as error:
            raise AzureCloudException(
                'Unable to create network interface: {0}.'.format(
                    error
                )
            )

        return nic_setup.result()
993589
def cli(env, ip_address):
    """"""

    mgr = SoftLayer.NetworkManager(env.client)

    addr_info = mgr.ip_lookup(ip_address)

    if not addr_info:
        raise exceptions.CLIAbort('Not found')

    table = formatting.KeyValueTable(['name', 'value'])
    table.align['name'] = 'r'
    table.align['value'] = 'l'

    table.add_row(['id', addr_info['id']])
    table.add_row(['ip', addr_info['ipAddress']])

    subnet_table = formatting.KeyValueTable(['name', 'value'])
    subnet_table.align['name'] = 'r'
    subnet_table.align['value'] = 'l'
    subnet_table.add_row(['id', addr_info['subnet']['id']])
    subnet_table.add_row(['identifier',
                          '%s/%s' % (addr_info['subnet']['networkIdentifier'],
                                     str(addr_info['subnet']['cidr']))])
    subnet_table.add_row(['netmask', addr_info['subnet']['netmask']])
    if addr_info['subnet'].get('gateway'):
        subnet_table.add_row(['gateway', addr_info['subnet']['gateway']])
    subnet_table.add_row(['type', addr_info['subnet'].get('subnetType')])

    table.add_row(['subnet', subnet_table])

    if addr_info.get('virtualGuest') or addr_info.get('hardware'):
        device_table = formatting.KeyValueTable(['name', 'value'])
        device_table.align['name'] = 'r'
        device_table.align['value'] = 'l'
        if addr_info.get('virtualGuest'):
            device = addr_info['virtualGuest']
            device_type = 'vs'
        else:
            device = addr_info['hardware']
            device_type = 'server'
        device_table.add_row(['id', device['id']])
        device_table.add_row(['name', device['fullyQualifiedDomainName']])
        device_table.add_row(['type', device_type])
        table.add_row(['device', device_table])
    env.fout(table)
688453
def network_create(request, **kwargs):
    
    LOG.debug("network_create(): kwargs = %s", kwargs)
    if 'tenant_id' not in kwargs:
        kwargs['tenant_id'] = request.user.project_id
    body = {'network': kwargs}
    network = neutronclient(request).create_network(body=body).get('network')
    return Network(network)
1017928
def deploy(self, id_networkv4):
        

        data = dict()
        uri = 'api/networkv4/%s/equipments/' % id_networkv4

        return super(ApiNetworkIPv4, self).post(uri, data=data)
487504
def virtual_interface_create(self, name, net_name):
        '''
        
        '''
        nt_ks = self.compute_conn
        serverid = self._server_uuid_from_name(name)
        networkid = self.network_show(net_name).get('id', None)
        if networkid is None:
            return {net_name: False}
        nets = nt_ks.virtual_interfaces.create(networkid, serverid)
        return nets
140921
def deploy(self, id_networkv6):
        

        data = dict()
        uri = 'api/networkv6/%s/equipments/' % id_networkv6

        return super(ApiNetworkIPv6, self).post(uri, data=data)
1367574
def create_network(self, network):
        """"""
        n_res = MechResource(network['id'], a_const.NETWORK_RESOURCE,
                             a_const.CREATE)
        self.provision_queue.put(n_res)
226471
def create(cls, interface_id, address, network_value,
               nodeid=1, **kwargs):
        
        data = {'address': address,
                'network_value': network_value,
                'nicid': str(interface_id),
                'auth_request': False,
                'backup_heartbeat': False,
                'nodeid': nodeid,
                'outgoing': False,
                'primary_mgt': False,
                'primary_heartbeat': False}

        for k, v in kwargs.items():
            data.update({k: v})

        return cls(data)
968392
public static base_responses add(nitro_service client, nsip resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			nsip addresources[] = new nsip[resources.length];
			for (int i=0;i<resources.length;i++){
				addresources[i] = new nsip();
				addresources[i].ipaddress = resources[i].ipaddress;
				addresources[i].netmask = resources[i].netmask;
				addresources[i].type = resources[i].type;
				addresources[i].arp = resources[i].arp;
				addresources[i].icmp = resources[i].icmp;
				addresources[i].vserver = resources[i].vserver;
				addresources[i].telnet = resources[i].telnet;
				addresources[i].ftp = resources[i].ftp;
				addresources[i].gui = resources[i].gui;
				addresources[i].ssh = resources[i].ssh;
				addresources[i].snmp = resources[i].snmp;
				addresources[i].mgmtaccess = resources[i].mgmtaccess;
				addresources[i].restrictaccess = resources[i].restrictaccess;
				addresources[i].dynamicrouting = resources[i].dynamicrouting;
				addresources[i].ospf = resources[i].ospf;
				addresources[i].bgp = resources[i].bgp;
				addresources[i].rip = resources[i].rip;
				addresources[i].hostroute = resources[i].hostroute;
				addresources[i].hostrtgw = resources[i].hostrtgw;
				addresources[i].metric = resources[i].metric;
				addresources[i].vserverrhilevel = resources[i].vserverrhilevel;
				addresources[i].ospflsatype = resources[i].ospflsatype;
				addresources[i].ospfarea = resources[i].ospfarea;
				addresources[i].state = resources[i].state;
				addresources[i].vrid = resources[i].vrid;
				addresources[i].icmpresponse = resources[i].icmpresponse;
				addresources[i].ownernode = resources[i].ownernode;
				addresources[i].arpresponse = resources[i].arpresponse;
				addresources[i].td = resources[i].td;
			}
			result = add_bulk_request(client, addresources);
		}
		return result;
	}
1232257
def add_resourcegroup(group, network_id,**kwargs):
    
    group_i                   = ResourceGroup()
    group_i.name              = group.name
    group_i.description       = group.description
    group_i.status            = group.status
    group_i.network_id        = network_id
    db.DBSession.add(group_i)
    db.DBSession.flush()
    return group_i
369805
def create(config, group, type):
        """"""
        if type not in ('user', 'service'):
            raise click.BadOptionUsage(  # pragma: no cover
                "--grouptype must be 'user' or 'service'")

        client = Client()
        client.prepare_connection()
        group_api = API(client)
        group_api.create(group, type)
915128
def create_api_network_ipv4(self):
        """"""

        return ApiNetworkIPv4(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1026362
def create(cls, interface_id, logical_interface_ref, **kw):
        
        data = {'inspect_unspecified_vlans': True,
                'logical_interface_ref': logical_interface_ref,
                'nicid': str(interface_id)}
        
        if 'reset_interface_nicid' in kw:
            data.update(reset_interface_nicid=kw.get('reset_interface_nicid'))

        return cls(data)
699281
def create(cls, interface_id, logical_interface_ref,
            second_interface_id=None, zone_ref=None, **kwargs):
        
        data = {'inspect_unspecified_vlans': True,
                'nicid': '{}-{}'.format(str(interface_id), str(second_interface_id)) if 
                    second_interface_id else str(interface_id),
                'logical_interface_ref': logical_interface_ref,
                'zone_ref': zone_ref}

        for k, v in kwargs.items():
            data.update({k: v})

        return cls(data)
937822
def add_ch_grp_to_interface(
        self, nexus_host, if_type, port, ch_grp):
        """"""

        if if_type != "ethernet":
            LOG.error("Unexpected interface type %(iftype)s when "
                      "adding change group", {'iftype': if_type})
            return

        starttime = time.time()

        path_snip = snipp.PATH_ALL
        path_interface = "phys-[eth" + port + "]"

        body_snip = snipp.BODY_ADD_CH_GRP % (ch_grp, ch_grp, path_interface)

        self.send_edit_string(nexus_host, path_snip, body_snip)

        self.capture_and_print_timeshot(
            starttime, "add_ch_group",
            switch=nexus_host)
89816
def _create_public_ip(self, public_ip_name, resource_group_name, region):
        
        public_ip_config = {
            'location': region,
            'public_ip_allocation_method': 'Dynamic'
        }

        try:
            public_ip_setup = \
                self.network.public_ip_addresses.create_or_update(
                    resource_group_name, public_ip_name, public_ip_config
                )
        except Exception as error:
            raise AzureCloudException(
                'Unable to create public IP: {0}.'.format(error)
            )

        return public_ip_setup.result()
49327
def create_secgroup_rule(self, protocol, from_port, to_port,
            source, target):
        
        nova = self.nova

        def get_id(gname):
            sg = nova.security_groups.find(name=gname)
            if not sg:
                raise BangError("Security group not found, %s" % gname)
            return str(sg.id)

        kwargs = {
                'ip_protocol': protocol,
                'from_port': str(from_port),
                'to_port': str(to_port),
                'parent_group_id': get_id(target),
                }
        if '/' in source:
            kwargs['cidr'] = source
        else:
            kwargs['group_id'] = get_id(source)
            # not sure if this is an openstack hack or an hpcloud hack, but
            # this is definitely required to get it working on hpcloud:
            kwargs['cidr'] = 'null'
        nova.security_group_rules.create(**kwargs)