Listing virtual networks

GET /v2.0/networks

List networks to which the project has access.

Default policy settings return only networks that the project who submits the request owns, unless an administrative user submits the request. In addition, networks shared with the project who submits the request are also returned.

Source: https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-networks-detail#list-networks

Request

Parameters

Name In Type Description
admin_state_up (Optional) query boolean Filter the list result by the administrative state of the resource, which is up (true) or down (false).
id (Optional) query string Filter the list result by the ID of the resource.
mtu (Optional) query integer Filter the network list result by the maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
name (Optional) query string Filter the list result by the human-readable name of the resource.
project_id (Optional) query string Filter the list result by the ID of the project that owns the resource.
provider:network_type (Optional) query string Filter the list result by the type of physical network that this network/segment is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.
provider:physical_network (Optional) query string Filter the list result by the physical network where this network/segment is implemented.
provider:segmentation_id (Optional) query integer Filter the list result by the ID of the isolated segment on the physical network.
revision_number (Optional) query integer Filter the list result by the revision number of the network.
router:external (Optional) query boolean Filter the network list result based on whether the network has an external routing facility that’s not managed by the networking service.
shared (Optional) query boolean Filter the network list result based on if the network is shared across all tenants.
status (Optional) query string Filter the network list result by network status. Values are ACTIVE, DOWN, BUILD or ERROR.
tenant_id (Optional) query string Filter the list result by the ID of the project that owns the resource.
vlan_transparent (Optional) query boolean Filter the network list by the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).
description (Optional) query string Filter the list result by the human-readable description of the resource.
is_default (Optional) query boolean Filter the network list result based on if the network is default pool or not.
tags (Optional) query string A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma.
tags-any (Optional) query string A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma.
not-tags (Optional) query string A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma.
not-tags-any (Optional) query string A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma.
sort_dir (Optional) query string Sort direction. A valid value is asc (ascending) or desc (descending). You can specify multiple pairs of sort key and sort direction query parameters.
sort_key (Optional) query string

Sorts by a network attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to:

  • admin_state_up
  • availability_zone_hints
  • id
  • mtu
  • name
  • status
  • tenant_id
  • project_id
fields (Optional) query string The fields that you want the server to return. If no fields query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using the fields parameter, the API returns only the requested set of attributes. The fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only the id and name attributes will be returned.

Example

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
https://<node_IP_addr>:9696/v2.0/networks

Response

Parameters

Name In Type Description
networks body array A list of network objects.
admin_state_up body boolean The administrative state of the network, which is up (true) or down (false).
availability_zone_hints body array The availability zone candidate for the network.
availability_zones body array The availability zone for the network.
created_at body string

The date and time when the resource was created.

The date and time stamp format is ISO 8601:

CCYY-MM-DDThh:mm:ss±hh:mm

For example, 2015-08-27T09:49:58-05:00.

The ±hh:mm value, if included, is the time zone as an offset from UTC. In this example, the offset value is -05:00.

dns_domain body string A valid DNS domain.
id body string The ID of the network.
ipv4_address_scope body string The ID of the IPv4 address scope that the network is associated with.
ipv6_address_scope body string The ID of the IPv6 address scope that the network is associated with.
l2_adjacency body boolean Indicates whether L2 connectivity is available throughout the network.
mtu body integer The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
name body string Human-readable name of the network.
port_security_enabled body boolean The port security status of the network. Valid values are enabled (true) and disabled (false). This value is used as the default value of port_security_enabled field of a newly created port.
project_id body string The ID of the project.
provider:network_type body string The type of physical network that this network is mapped to. For example, flat, vlan, vxlan, or gre. Valid values depend on a networking back-end.
provider:physical_network body string The physical network where this network/segment is implemented.
provider:segmentation_id body integer The ID of the isolated segment on the physical network. The network_type attribute defines the segmentation model. For example, if the network_type value is vlan, this ID is a vlan identifier. If the network_type value is gre, this ID is a gre key.
qos_policy_id body string The ID of the QoS policy associated with the network.
revision_number body integer The revision number of the network.
router:external body boolean Indicates whether the network has an external routing facility that’s not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension floatingip-autodelete-internal is present.
segments body array A list of provider segment objects.
shared body boolean Indicates whether this network is shared across all tenants. By default, only administrative users can change this value.
status body string The network status. Values are ACTIVE, DOWN, BUILD or ERROR.
subnets body array The associated subnets.
tenant_id body string The ID of the project.
updated_at body string

The date and time when the resource was updated. If the resource has not been updated, this field will be null.

The date and time stamp format is ISO 8601:

CCYY-MM-DDThh:mm:ss±hh:mm

For example, 2015-08-27T09:49:58-05:00.

The ±hh:mm value, if included, is the time zone as an offset from UTC. In this example, the offset value is -05:00.

vlan_transparent body boolean Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).
default_vnic_type body string The default value of the vnic_type parameter for each virtual port created in this network.
description body string A human-readable description for the network.
is_default body boolean The network is default pool or not.
tags body array The list of tags on the network.

Status codes

Success

Code Reason
200 - OK Request was successful.

Error

Code Reason
401 - Unauthorized

User must authenticate before making a request.

Example

{
  "networks": [
    {
      "provider:physical_network": "Public",
      "ipv6_address_scope": null,
      "revision_number": 2,
      "port_security_enabled": true,
      "mtu": 1500,
      "id": "b4907761-8c0f-447e-9cfe-c688ca6e44a0",
      "router:external": true,
      "availability_zone_hints": [],
      "availability_zones": [
        "nova"
      ],
      "ipv4_address_scope": null,
      "shared": true,
      "project_id": "f5d834d636c642c7bfe8af86139c6f26",
      "status": "ACTIVE",
      "subnets": [
        "351884c7-ee37-4a7d-9dcb-4cff4a1bba27"
      ],
      "description": "",
      "tags": [],
      "updated_at": "2020-02-17T11:58:16Z",
      "is_default": false,
      "provider:segmentation_id": null,
      "name": "pubnet1",
      "admin_state_up": true,
      "tenant_id": "f5d834d636c642c7bfe8af86139c6f26",
      "created_at": "2020-02-17T11:58:15Z",
      "provider:network_type": "flat"
    }
  ]
}