ves-io-schema-views-policy_based_routing-API-Create

Examples of creating policybasedrouting

Usecase:

Create policy-based-routing-1 with rule-1 to send to forwarding-class-2

Request using vesctl:

vesctl configuration create policy_based_routing -i policy_based_routing.yaml

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

metadata:
  name: policy-based-routing-1
  namespace: documentation
spec:
  forwardingClassList:
  - name: forward-class-1
    namespace: documentation
  networkPbr:
    any: {}
    networkPbrRules:
    - allTraffic: {}
      dnsName: www.abc.com
      forwardingClassList:
      - name: forward-class-2
        namespace: documentation
      metadata:
        name: rule-1

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: policy-based-routing-1
  namespace: documentation
spec:
  forwardingClassList:
  - name: forward-class-1
    namespace: documentation
    tenant: acmecorp
  networkPbr:
    any: {}
    networkPbrRules:
    - allTraffic: {}
      dnsName: www.abc.com
      forwardingClassList:
      - name: forward-class-2
        namespace: documentation
        tenant: acmecorp
      metadata:
        name: rule-1
systemMetadata:
  creationTimestamp: "2021-08-25T09:04:26.316274511Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 4e816a6f-7791-4792-b08c-0fd74a8de2ea

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"policy-based-routing-1","namespace":"documentation"},"spec":{"networkPbr":{"any":{},"networkPbrRules":[{"metadata":{"name":"rule-1"},"forwardingClassList":[{"namespace":"documentation","name":"forward-class-2"}],"dnsName":"www.abc.com","allTraffic":{}}]},"forwardingClassList":[{"namespace":"documentation","name":"forward-class-1"}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build970361017_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/policy_based_routings'

curl response:

HTTP/1.1 200 OK
Content-Length: 1300
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:04:26 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "policy-based-routing-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "4e816a6f-7791-4792-b08c-0fd74a8de2ea",
    "creation_timestamp": "2021-08-25T09:04:26.316274511Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "network_pbr": {
      "any": {

      },
      "network_pbr_rules": [
        {
          "metadata": {
            "name": "rule-1",
            "description": "",
            "disable": false
          },
          "rule_name": "",
          "forwarding_class_list": [
            {
              "tenant": "acmecorp",
              "namespace": "documentation",
              "name": "forward-class-2"
            }
          ],
          "dns_name": "www.abc.com",
          "all_traffic": {

          }
        }
      ]
    },
    "forwarding_class_list": [
      {
        "tenant": "acmecorp",
        "namespace": "documentation",
        "name": "forward-class-1"
      }
    ]
  }
}