​
Select Service
ves-io-schema-views-policy_based_routing-API-Create
Published April 5, 2023 | Last modified May 30, 2025
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"
}
]
}
}
Copied!
vesctl yaml response:
ResponseJSON:
{
"metadata": {
"name": "policy-based-routing-1",
"namespace": "documentation",
"labels": {},
"annotations": {},
"description": "",
"disable": false
},
"system_metadata": {
"uid": "5d362484-d0aa-47a6-b45d-29a55c86d3d3",
"creation_timestamp": "2025-05-30T01:23:15.858113Z",
"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"
}
]
}
}
Copied!
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=_var_folders_q2_3kp8z3zs0x5_m7pk1bgb0_ph0000gp_T_go-build1497866850_b001_apidocs.test/host=MTY6VVHQPH/svc=S:examplesvc/site=mytestce01' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/policy_based_routings'
Copied!
curl response:
HTTP/1.1 200 OK
Content-Length: 1320
Content-Type: application/json
Date: Fri, 30 May 2025 01:23:15 GMT
Vary: Accept-Encoding
{
"metadata": {
"name": "policy-based-routing-1",
"namespace": "documentation",
"labels": {
},
"annotations": {
},
"description": "",
"disable": false
},
"system_metadata": {
"uid": "5d362484-d0aa-47a6-b45d-29a55c86d3d3",
"creation_timestamp": "2025-05-30T01:23:15.858113Z",
"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"
}
]
}
}
Copied!