9.1. 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#list-networks

9.1.1. Request

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 resource.
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 fields parameter, the API returns only the requested set of attributes. fields parameter can be specified multiple times. For example, if you specify fields=id&fields=name in the request URL, only id and name attributes will be returned.

9.1.1.1. Example

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

9.1.2. Response

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 Time at which the resource has been created (in UTC ISO8601 format).
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 resource.
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 Time at which the resource has been updated (in UTC ISO8601 format).
vlan_transparent body boolean Indicates the VLAN transparency mode of the network, which is VLAN transparent (true) or not VLAN transparent (false).
description body string A human-readable description for the resource.
is_default body boolean The network is default pool or not.
tags body array The list of tags on the resource.

9.1.2.1. Status codes

9.1.2.1.1. Success

Code Reason
200 - OK Request was successful.

9.1.2.1.2. Error

Code Reason
401 - Unauthorized User must authenticate before making a request.

9.1.2.2. 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"
    },
    {
      "provider:physical_network": null,
      "ipv6_address_scope": null,
      "revision_number": 3,
      "port_security_enabled": true,
      "mtu": 1450,
      "id": "c4e2f31b-fe3b-402b-ac1b-b182693f72f7",
      "router:external": false,
      "availability_zone_hints": [],
      "availability_zones": [
        "nova"
      ],
      "ipv4_address_scope": null,
      "shared": false,
      "project_id": "f5d834d636c642c7bfe8af86139c6f26",
      "status": "ACTIVE",
      "subnets": [
        "112f9b9c-7be2-41c9-8c31-903b263353e7"
      ],
      "description": "",
      "tags": [],
      "updated_at": "2020-02-14T13:35:19Z",
      "provider:segmentation_id": 94,
      "name": "privnet1",
      "admin_state_up": true,
      "tenant_id": "f5d834d636c642c7bfe8af86139c6f26",
      "created_at": "2020-02-14T13:33:28Z",
      "provider:network_type": "vxlan"
    }
  ]
}