The Module

class API(skip_policy_check=False)


API for interacting with the neutron 2.x API.

add_dns_entry(context, address, name, dns_type, domain)

Create specified DNS entry for address.

add_fixed_ip_to_instance(context, *args, **kwargs)

Add a fixed IP to the instance from specified network.

add_network_to_project(context, project_id, network_uuid=None)

Force add a network to the project.

allocate_floating_ip(context, pool=None)

Add a floating IP to a project from a pool.

allocate_for_instance(context, instance, **kwargs)

Allocate network resources for the instance.

  • context – The request context.
  • instance – nova.objects.instance.Instance object.
  • requested_networks – optional value containing network_id, fixed_ip, and port_id
  • security_groups – security groups to allocate for instance
  • macs – None or a set of MAC addresses that the instance should use. macs is supplied by the hypervisor driver (contrast with requested_networks which is user supplied). NB: NeutronV2 currently assigns hypervisor supplied MAC addresses to arbitrary networks, which requires openflow switches to function correctly if more than one network is being used with the bare metal hypervisor (which is the only one known to limit MAC addresses).
  • dhcp_options – None or a set of key/value pairs that should determine the DHCP BOOTP response, eg. for PXE booting an instance configured with the baremetal hypervisor. It is expected that these are already formatted for the neutron v2 api. See nova/virt/ for an example.
  • bind_host_id – the host ID to attach to the ports being created.
allocate_port_for_instance(context, instance, port_id, network_id=None, requested_ip=None, bind_host_id=None)

Allocate a port for the instance.

associate(context, network_uuid, host=<object object at 0x7f32efb13240>, project=<object object at 0x7f32efb13240>)

Associate a network for client.

associate_floating_ip(context, *args, **kwargs)

Associate a floating IP with a fixed IP.

cleanup_instance_network_on_host(context, instance, host)

Cleanup network for specified instance on host.

create_pci_requests_for_sriov_ports(context, pci_requests, requested_networks)

Check requested networks for any SR-IOV port request.

Create a PCI request object for each SR-IOV port, and add it to the pci_requests object that contains a list of PCI request object.

create_private_dns_domain(context, domain, availability_zone)

Create a private DNS domain with nova availability zone.

create_public_dns_domain(context, domain, project=None)

Create a private DNS domain with optional nova project.

deallocate_for_instance(context, instance, **kwargs)

Deallocate all network resources related to the instance.

deallocate_port_for_instance(context, instance, port_id)

Remove a specified port from the instance.

Return network information for the instance

delete(context, network_uuid)

Delete a network for client.

delete_dns_domain(context, domain)

Delete the specified dns domain.

delete_dns_entry(context, name, domain)

Delete the specified dns entry.

disassociate(context, network_uuid)

Disassociate a network for client.

disassociate_and_release_floating_ip(context, instance, floating_ip)

Removes (deallocates) and deletes the floating IP.

This api call was added to allow this to be done in one operation if using neutron.

disassociate_floating_ip(context, *args, **kwargs)

Disassociate a floating IP from the instance.

get(context, network_uuid)

Get specific network for client.


Get all networks for client.


Return a list of available dns domains.

These can be used to create DNS entries for floating IPs.

get_dns_entries_by_address(context, address, domain)

Get entries for address and domain.

get_dns_entries_by_name(context, name, domain)

Get entries for name and domain.

get_fixed_ip(context, id)

Get a fixed IP from the id.

get_fixed_ip_by_address(context, address)

Return instance uuids given an address.

get_floating_ip(context, id)

Return floating IP object given the floating IP id.

get_floating_ip_by_address(context, address)

Return a floating IP given an address.


Return floating IP pool names.

get_instance_id_by_floating_address(context, address)

Return the instance id a floating IP’s fixed IP is allocated to.

get_vif_by_mac_address(context, mac_address)
get_vifs_by_instance(context, instance)
list_ports(context, **search_opts)

List ports for the client based on search options.

migrate_instance_finish(context, instance, migration)

Finish migrating the network of an instance.

migrate_instance_start(context, instance, migration)

Start to migrate the network of an instance.

modify_dns_entry(context, name, address, domain)

Create specified DNS entry for address.

release_floating_ip(context, address, affect_auto_assigned=False)

Remove a floating IP with the given address from a project.

remove_fixed_ip_from_instance(context, *args, **kwargs)

Remove a fixed IP from the instance.

setup_instance_network_on_host(context, instance, host)

Setup network for specified instance on host.

setup_networks_on_host(context, instance, host=None, teardown=False)

Setup or teardown the network structures.

show_port(context, port_id)

Return the port for the client given the port id.

  • context – Request context.
  • port_id – The id of port to be queried.

A dict containing port data keyed by ‘port’, e.g.

{'port': {'port_id': 'abcd',
          'fixed_ip_address': ''}}
update_instance_vnic_index(context, instance, vif, index)

Update instance vnic index.

When the ‘VNIC index’ extension is supported this method will update the vnic index of the instance on the port.

validate_networks(context, requested_networks, num_instances)

Validate that the tenant can use the requested networks.

Return the number of instances than can be successfully allocated with the requested network configuration.

get_client(context, admin=False)

Previous topic

The Module

Next topic

The Module

Project Source

This Page