3.5. Managing Networks

3.5.1. Creating Compute Networks

3.5.1.1. Syntax

usage: vinfra service compute network create [-h] [-f {json,table,value,yaml}]
                                             [-c COLUMN] [--wait]
                                             [--timeout <seconds>]
                                             [--dhcp | --no-dhcp]
                                             [--dns-nameserver <dns-nameserver>]
                                             [--allocation-pool <allocation-pool>]
                                             [--gateway <gateway> | --no-gateway]
                                             [--ip-version <ip-version>]
                                             [--type {vxlan,flat}]
                                             [--physical-network <physical-network>]
                                             [--cidr <cidr>]
                                             <network-name>

Create a compute network.

positional arguments:
  <network-name>        Network name

optional arguments:
  -h, --help            show this help message and exit
  --dhcp                Enable DHCP
  --no-dhcp             Disable DHCP
  --dns-nameserver <dns-nameserver>
                        DNS server IP address. This option can be used
                        multiple times.
  --allocation-pool <allocation-pool>
                        Allocation pool to create inside the network in the
                        format: ip_addr_start-ip_addr_end. This option can be
                        used multiple times.
  --gateway <gateway>   Gateway IP address.
  --no-gateway          Do not configure a gateway for this network
  --ip-version <ip-version>
                        Network IP version
  --type {vxlan,flat}   Virtual network type ('vxlan' is private and 'flat' is
                        public)
  --physical-network <physical-network>
                        A physical network to link to a flat network
  --cidr <cidr>         Subnet range in CIDR notation

output formatters:
  output formatter options

  -f {json,table,value,yaml}, --format {json,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
...

3.5.1.2. Sample Output

This command creates a private network myprivnet with the specific CIDR and gateway.

# vinfra service compute network create myprivnet --type vxlan \
--cidr 192.128.128.0/24 --gateway 192.128.128.1
+------------------+--------------------------------------+
| Field            | Value                                |
+------------------+--------------------------------------+
| id               | 3848fb5d-bc98-4320-acd0-cde2df7c5bdd |
| name             | myprivnet                            |
| physical_network |                                      |
| project_id       | 72a5db3a033c403a86756021e601ef34     |
| subnet           | allocation_pools:                    |
|                  | - end: 192.128.128.254               |
|                  |   start: 192.128.128.2               |
|                  | cidr: 192.128.128.0/24               |
|                  | dns_nameservers: []                  |
|                  | enable_dhcp: true                    |
|                  | gateway_ip: 192.128.128.1            |
|                  | ip_version: 4                        |
| type             | vxlan                                |
+------------------+--------------------------------------+

3.5.2. Listing Compute Networks

3.5.2.1. Syntax

usage: vinfra service compute network list [-h] [-f {json,table,value,yaml}]
                                           [-c COLUMN]

List compute networks.
...

3.5.2.2. Sample Output

This command lists networks used in the compute cluster. (The output is abridged to fit on page.)

# vinfra service compute network list -c id -c name -c cidr -c type -c allocation_pools
+----------------+-----------+-------+------------------+------------------------+
| id             | name      | type  | cidr             | allocation_pools       |
+----------------+-----------+-------+------------------+------------------------+
| 1bf2c9da-<...> | private   | vxlan | 192.168.128.0/24 | - end: 192.168.128.254 |
|                |           |       |                  |   start: 192.168.128.2 |
| 3848fb5d-<...> | myprivnet | vxlan | 192.128.128.0/24 | - end: 192.128.128.254 |
|                |           |       |                  |   start: 192.128.128.2 |
| 417606ac-<...> | public    | flat  | 10.94.0.0/16     | - end: 10.94.129.79    |
|                |           |       |                  |   start: 10.94.129.64  |
+----------------+-----------+-------+------------------+------------------------+

3.5.3. Showing Compute Network Details

3.5.3.1. Syntax

usage: vinfra service compute network show [-h] [-f {json,table,value,yaml}]
                                           [-c COLUMN]
                                           <network>

Display compute network details.

positional arguments:
  <network>             Network ID or name
...

3.5.3.2. Sample Output

This command shows the details of the network with the ID 417606ac-1dbe-426a-844d-e047831ddce9.

# vinfra service compute network show 417606ac-1dbe-426a-844d-e047831ddce9
+------------------+--------------------------------------+
| Field            | Value                                |
+------------------+--------------------------------------+
| allocation_pools |                                      |
| cidr             |                                      |
| dns_nameservers  |                                      |
| enable_dhcp      |                                      |
| gateway_ip       |                                      |
| id               | 417606ac-1dbe-426a-844d-e047831ddce9 |
| ip_version       |                                      |
| name             | public                               |
| physical_network | Public                               |
| project_id       | 72a5db3a033c403a86756021e601ef34     |
| type             | flat                                 |
+------------------+--------------------------------------+

3.5.4. Changing Compute Network Parameters

3.5.4.1. Syntax

usage: vinfra service compute network set [-h] [-f {json,table,value,yaml}]
                                          [-c COLUMN] [--dhcp | --no-dhcp]
                                          [--dns-nameserver <dns-nameserver>]
                                          [--allocation-pool <allocation-pool>]
                                          [--gateway <gateway> | --no-gateway]
                                          [--name <name>]
                                          <network>

Modify compute network parameters.

positional arguments:
  <network>             Network ID or name

optional arguments:
  -h, --help            show this help message and exit
  --dhcp                Enable DHCP
  --no-dhcp             Disable DHCP
  --dns-nameserver <dns-nameserver>
                        DNS server IP address. This option can be used
                        multiple times.
  --allocation-pool <allocation-pool>
                        Allocation pool to create inside the network in the
                        format: ip_addr_start-ip_addr_end. This option can be
                        used multiple times.
  --gateway <gateway>   Gateway IP address.
  --no-gateway          Do not configure a gateway for this network
  --name <name>         A new name for the network
...

3.5.4.2. Sample Output

This command disables DHCP for the private network myprivnet.

# vinfra service compute network set myprivnet --no-dhcp
+------------------+--------------------------------------+
| Field            | Value                                |
+------------------+--------------------------------------+
| id               | 3848fb5d-bc98-4320-acd0-cde2df7c5bdd |
| name             | myprivnet                            |
| physical_network |                                      |
| project_id       | 72a5db3a033c403a86756021e601ef34     |
| subnet           | allocation_pools:                    |
|                  | - end: 192.128.128.254               |
|                  |   start: 192.128.128.2               |
|                  | cidr: 192.128.128.0/24               |
|                  | dns_nameservers: []                  |
|                  | enable_dhcp: false                   |
|                  | gateway_ip: 192.128.128.1            |
|                  | ip_version: 4                        |
| type             | vxlan                                |
+------------------+--------------------------------------+

3.5.5. Deleting Compute Networks

3.5.5.1. Syntax

usage: vinfra service compute network delete [-h] [-f {json,table,value,yaml}]
                                             [-c COLUMN] [--wait]
                                             [--timeout <seconds>]
                                             <network>

Delete a compute network.

positional arguments:
  <network>             Network ID or name

optional arguments:
  -h, --help            show this help message and exit

output formatters:
  output formatter options

  -f {json,table,value,yaml}, --format {json,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
                        specify the column(s) to include, can be repeated

command run options:
  additional command options

...

3.5.5.2. Sample Output

This command deletes the private network myprivnet.

# vinfra service compute network delete myprivnet
Operation successful