ves-io-schema-network_interface-API-Create

Examples of creating network_interface

Usecase:

Create network-interface-1

Request using vesctl:

vesctl configuration create network_interface -i network_interface.yaml

where file networkinterface.yaml has following contents (networkinterface.CreateRequest):

metadata:
  name: network-interface-1
  namespace: documentation
spec:
  DHCPServer: NETWORK_INTERFACE_DHCP_SERVER_ENABLE
  DNSServer:
    dnsMode: NETWORK_INTERFACE_DNS_AUTO_ALLOCATE
  defaultGateway:
    defaultGatewayMode: NETWORK_INTERFACE_GATEWAY_AUTO_ALLOCATE
  dhcpAddress: NETWORK_INTERFACE_DHCP_ENABLE
  mtu: 1500
  staticAddresses:
  - plen: 24
    prefix: 1.2.3.0
  virtualNetwork:
  - kind: virtual_network
    name: network1

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: network-interface-1
  namespace: documentation
spec:
  DHCPServer: NETWORK_INTERFACE_DHCP_SERVER_ENABLE
  DNSServer:
    dnsMode: NETWORK_INTERFACE_DNS_AUTO_ALLOCATE
    dnsServer: []
  addressAllocator: []
  defaultGateway:
    defaultGatewayMode: NETWORK_INTERFACE_GATEWAY_AUTO_ALLOCATE
  dhcpAddress: NETWORK_INTERFACE_DHCP_ENABLE
  mtu: 1500
  parentNetworkInterface: []
  staticAddresses:
  - plen: 24
    prefix: 1.2.3.0
  virtualNetwork:
  - kind: virtual_network
    name: network1
    namespace: documentation
    tenant: acmecorp
    uid: ffffffff-ffff-ffff-ffff-ffffffffffff
systemMetadata:
  creationTimestamp: "2020-05-15T10:52:48.367383778Z"
  creatorClass: examplesvc.ves.io
  finalizers: []
  tenant: acmecorp
  uid: ae2fa981-c98e-491e-9d4c-fc3670e23571

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"network-interface-1","namespace":"documentation"},"spec":{"mtu":1500,"virtualNetwork":[{"kind":"virtual_network","name":"network1"}],"dhcpAddress":"NETWORK_INTERFACE_DHCP_ENABLE","staticAddresses":[{"prefix":"1.2.3.0","plen":24}],"defaultGateway":{"defaultGatewayMode":"NETWORK_INTERFACE_GATEWAY_AUTO_ALLOCATE"},"DNSServer":{"dnsMode":"NETWORK_INTERFACE_DNS_AUTO_ALLOCATE"},"DHCPServer":"NETWORK_INTERFACE_DHCP_SERVER_ENABLE"}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build144460626_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/network_interfaces'

curl response:

HTTP/1.1 200 OK
Content-Type: application/json
Date: Fri, 15 May 2020 10:52:48 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "network-interface-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "ae2fa981-c98e-491e-9d4c-fc3670e23571",
    "creation_timestamp": "2020-05-15T10:52:48.367383778Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc.ves.io",
    "creator_id": "",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "type": "NETWORK_INTERFACE_ETHERNET",
    "mtu": 1500,
    "virtual_network": [
      {
        "kind": "virtual_network",
        "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "tenant": "acmecorp",
        "namespace": "documentation",
        "name": "network1"
      }
    ],
    "dhcp_address": "NETWORK_INTERFACE_DHCP_ENABLE",
    "static_addresses": [
      {
        "prefix": "1.2.3.0",
        "plen": 24
      }
    ],
    "default_gateway": {
      "default_gateway_mode": "NETWORK_INTERFACE_GATEWAY_AUTO_ALLOCATE",
      "default_gateway_address": null
    },
    "DNS_server": {
      "dns_mode": "NETWORK_INTERFACE_DNS_AUTO_ALLOCATE",
      "dns_server": [
      ]
    },
    "DHCP_server": "NETWORK_INTERFACE_DHCP_SERVER_ENABLE",
    "vlan_tagging": "NETWORK_INTERFACE_VLAN_TAGGING_DISABLE",
    "device_name": "",
    "parent_network_interface": [
    ],
    "vlan_tag": 0,
    "tunnel": null,
    "address_allocator": [
    ],
    "priority": 0
  }
}