vinfra service compute network create

Create a compute network:

usage: vinfra service compute network create [--dhcp | --no-dhcp]
                                          [--dns-nameserver <dns-nameserver>]
                                          [--allocation-pool <allocation-pool>]
                                          [--gateway <gateway> | --no-gateway]
                                          [--rbac-policies <rbac-policies>]
                                          [--physical-network <physical-network>]
                                          [--vlan-network <vlan-network>]
                                          [--vlan <vlan>] [--cidr <cidr>]
                                          [--ipv6-address-mode <ipv6-address-mode>]
                                          <network-name>
--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.
--rbac-policies <rbac-policies>

Comma-separated list of RBAC policies in the format: <target>:<target_id>:<action> | none. Valid targets: project, domain. Valid actions: direct, full, routed. ‘*’ is valid target_id for all targets. Pass none to clear out all existing policies.

Example: domain:default:routed,project:uuid1:full

--physical-network <physical-network>
An infrastructure network to link to a physical network
--vlan-network <vlan-network>
A VLAN network to link
--vlan <vlan>
Virtual network VLAN ID
--cidr <cidr>
Subnet range in CIDR notation
--ipv6-address-mode <ipv6-address-mode>
IPv6 address mode: dhcpv6-stateful, dhcpv6-stateless, slaac
<network-name>
Network name

Example 1. Creating a virtual network:

# vinfra service compute network create myprivnet
+------------------+--------------------------------------+
| Field            | Value                                |
+------------------+--------------------------------------+
| allocation_pools |                                      |
| cidr             |                                      |
| dns_nameservers  |                                      |
| enable_dhcp      |                                      |
| gateway_ip       |                                      |
| id               | a0019b43-fe64-4b30-8feb-ff772e293769 |
| ip_version       |                                      |
| ipam_enabled     | False                                |
| name             | myprivnet                            |
| physical_network |                                      |
| project_id       | 6b04700556634b60895804e7ef52df3d     |
| rbac_policies    | []                                   |
| router_external  | False                                |
| shared           | False                                |
| tags             | []                                   |
| type             | virtual                              |
| vlan_id          |                                      |
+------------------+--------------------------------------+

This command creates a virtual network myprivnet with disabled IP management.

Example 2. Creating an untagged physical network and sharing it with a particular domain:

# vinfra service compute network create mypubnet --physical-network Public \
--cidr 10.136.16.0/22 --gateway 10.136.16.1 --dns-nameserver 10.35.11.7 \
--allocation-pool 10.136.18.141-10.136.18.148 \
--rbac-policies domain:cd421db9f3e84e3e8cd2c932c1f7a698:full
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| task_id | 00551a29-c240-4273-ad8f-88535c6113ac |
+---------+--------------------------------------+

This command creates a task to create an untagged physical network over the Public infrastructure network, with enabled IP management, the specified network parameters, and full network access between all the projects within the specified domain.

Task outcome:

# vinfra task show 00551a29-c240-4273-ad8f-88535c6113ac
+---------+-----------------------------------------------------------------+
| Field   | Value                                                           |
+---------+-----------------------------------------------------------------+
| details |                                                                 |
| name    | backend.presentation.compute.network.tasks.CreateComputeNetwork |
| result  | id: 22674f9d-1c94-4953-b79b-7f6029ee9bd0                        |
|         | ipam_enabled: true                                              |
|         | name: mypubnet                                                  |
|         | physical_network: Public                                        |
|         | project_id: c22613639b3147e0b22ef057b87698fe                    |
|         | rbac_policies:                                                  |
|         | - actions:                                                      |
|         |   - routed                                                      |
|         |   - shared                                                      |
|         |   target_project: f59a0d9a4cd543daa73160575d48611b              |
|         | router_external: false                                          |
|         | shared: false                                                   |
|         | subnet:                                                         |
|         |   allocation_pools:                                             |
|         |   - end: 10.136.18.148                                          |
|         |     start: 10.136.18.141                                        |
|         |   cidr: 10.136.16.0/22                                          |
|         |   dns_nameservers:                                              |
|         |   - 10.35.11.7                                                  |
|         |   enable_dhcp: true                                             |
|         |   gateway_ip: 10.136.16.1                                       |
|         |   ip_version: 4                                                 |
|         | tags: []                                                        |
|         | type: flat                                                      |
|         | vlan_id: null                                                   |
| state   | success                                                         |
| task_id | 00551a29-c240-4273-ad8f-88535c6113ac                            |
+---------+-----------------------------------------------------------------+

Example 3. Creating a VLAN-based physical network and sharing it between all projects:

# vinfra service compute network create mypubnet_vlan --vlan 10 \
--physical-network Public --cidr 10.136.16.0/22 --gateway 10.136.16.1 \
--dns-nameserver 10.35.11.7 --allocation-pool 10.136.18.131-10.136.18.138 \
--rbac-policies project:*:shared +---------+--------------------------------------+ | Field | Value | +---------+--------------------------------------+ | task_id | 3ec1afee-8fe5-4d0c-89da-84c971bf23cd | +---------+--------------------------------------+

This command creates a task to create a VLAN-based physical network over the Public infrastructure network, with the VLAN ID 10, enabled IP management, the specified network parameters, and direct (shared) network access between all the projects in the infrastructure.

Task outcome:

# vinfra task show 3ec1afee-8fe5-4d0c-89da-84c971bf23cd
+---------+-----------------------------------------------------------------+
| Field   | Value                                                           |
+---------+-----------------------------------------------------------------+
| details |                                                                 |
| name    | backend.presentation.compute.network.tasks.CreateComputeNetwork |
| result  | id: 8f0dc747-4c8f-42ad-9a4b-31d7d81c61fd                        |
|         | ipam_enabled: true                                              |
|         | name: mypubnet_vlan                                             |
|         | physical_network: Public                                        |
|         | project_id: c22613639b3147e0b22ef057b87698fe                    |
|         | rbac_policies:                                                  |
|         | - actions:                                                      |
|         |   - shared                                                      |
|         |   target_project: '*'                                           |
|         | router_external: false                                          |
|         | shared: false                                                   |
|         | subnet:                                                         |
|         |   allocation_pools:                                             |
|         |   - end: 10.136.18.138                                          |
|         |     start: 10.136.18.131                                        |
|         |   cidr: 10.136.16.0/22                                          |
|         |   dns_nameservers:                                              |
|         |   - 10.35.11.7                                                  |
|         |   enable_dhcp: true                                             |
|         |   gateway_ip: 10.136.16.1                                       |
|         |   ip_version: 4                                                 |
|         | tags: []                                                        |
|         | type: vlan                                                      |
|         | vlan_id: 10                                                     |
| state   | success                                                         |
| task_id | 3ec1afee-8fe5-4d0c-89da-84c971bf23cd                            |
+---------+-----------------------------------------------------------------+