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
      ruleName: 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
      ruleName: rule-1
systemMetadata:
  creationTimestamp: "2020-09-23T09:54:15.328349Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: d3b49845-86a5-470d-a88b-4ea4a20a23f5

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"policy-based-routing-1","namespace":"documentation"},"spec":{"networkPbr":{"any":{},"networkPbrRules":[{"ruleName":"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-build823219857_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: 1176
Content-Type: application/json
Date: Wed, 23 Sep 2020 09:54:15 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "policy-based-routing-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "d3b49845-86a5-470d-a88b-4ea4a20a23f5",
    "creation_timestamp": "2020-09-23T09:54:15.328349Z",
    "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": [
        {
          "rule_name": "rule-1",
          "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"
      }
    ]
  }
}