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

Examples of creating policy_based_routing

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 policy_based_routing.yaml has following contents (policy_based_routing.CreateRequest):

RequestJSON:

{"metadata":{"name":"policy-based-routing-1","namespace":"documentation"},"spec":{"network_pbr":{"any":{},"network_pbr_rules":[{"metadata":{"name":"rule-1"},"forwarding_class_list":[{"namespace":"documentation","name":"forward-class-2"}],"dns_name":"www.abc.com","all_traffic":{}}]},"forwarding_class_list":[{"namespace":"documentation","name":"forward-class-1"}]}} `

vesctl yaml response:

ResponseJSON:

  "metadata": {
    "name": "policy-based-routing-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "26caaa3b-adf8-4863-91cd-d9a9394e70cf",
    "creation_timestamp": "2022-07-28T12:14:45.594784212Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null,
    "labels": {
    }
  },
  "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"
      }
    ]
  }
}```
`

Request using curl:

    


curl -X 'POST' -d '{"metadata":{"name":"policy-based-routing-1","namespace":"documentation"},"spec":{"network_pbr":{"any":{},"network_pbr_rules":[{"metadata":{"name":"rule-1"},"forwarding_class_list":[{"namespace":"documentation","name":"forward-class-2"}],"dns_name":"www.abc.com","all_traffic":{}}]},"forwarding_class_list":[{"namespace":"documentation","name":"forward-class-1"}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build1372770011_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: 1323 Content-Type: application/json Date: Thu, 28 Jul 2022 12:14:45 GMT Vary: Accept-Encoding

{ "metadata": { "name": "policy-based-routing-1", "namespace": "documentation", "labels": { }, "annotations": { }, "description": "", "disable": false }, "system_metadata": { "uid": "26caaa3b-adf8-4863-91cd-d9a9394e70cf", "creation_timestamp": "2022-07-28T12:14:45.594784212Z", "deletion_timestamp": null, "modification_timestamp": null, "initializers": null, "finalizers": [ ], "tenant": "acmecorp", "creator_class": "examplesvc", "creator_id": "examplesvc", "object_index": 0, "owner_view": null, "labels": { } }, "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"
  }
]

} }