Static Route OpenConfig Translation
Create a static route
This XML configuration snippet is used to specify the destination prefix and mask for the network and create a gateway statically.
Release
This configuration was introduced in OcNOS version 4.2.
OpenConfig NetConf Payload
Here is a sample OpenConfig NetConf Payload to specify the destination prefix and mask for the network and create a gateway statically.
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>TEST_A9</name>
<config>
<name>TEST_A9</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</config>
<protocols>
<protocol>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<config>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<enabled>true</enabled>
</config>
</protocol>
<protocol>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</identifier>
<name>static-routes</name>
<config>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</identifier>
<name>static-routes</name>
</config>
<static-routes>
<static>
<prefix>192.168.0.0/24</prefix>
<next-hops>
<next-hop>
<index>172.17.30.2</index>
<interface-ref>
<config>
<interface>xe2</interface>
</config>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</config>
</next-hop>
</next-hops>
<config>
<prefix>192.168.0.0/24</prefix>
</config>
</static>
</static-routes>
</protocol>
</protocols>
<tables>
<table>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
<config>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
</config>
</table>
<table>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</address-family>
<config>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</address-family>
</config>
</table>
<table>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
<config>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
</config>
</table>
</tables>
<interfaces>
<interface>
<id>xe2</id>
<config>
<interface>xe2</interface>
<id>xe2</id>
</config>
</interface>
</interfaces>
</network-instance>
</network-instances>
OcNOS CLI Command
This CLI command is used to specify the destination prefix and mask for the network and create a gateway statically.
interface xe2
ip vrf forwarding TEST_A9
!
ip route vrf TEST_A9 192.168.0.0/24 172.17.30.2 xe2 10
OcNOS NetConf Payload
Here is a sample OcNOS NetConf Payload to specify the destination prefix and mask for the network and create a gateway statically.
<network-instances xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-network-instance">
<network-instance>
<instance-name>TEST_A9</instance-name>
<instance-type>vrf</instance-type>
<config>
<instance-name>TEST_A9</instance-name>
<instance-type>vrf</instance-type>
</config>
<vrf xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-vrf">
<config>
<vrf-name>TEST_A9</vrf-name>
</config>
<static-routes xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-rib-vrf">
<ipv4>
<route>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.30.2</gateway-address>
<gateway-interface-route>
<interface-name>xe2</interface-name>
<config>
<interface-name>xe2</interface-name>
<distance>10</distance>
</config>
</gateway-interface-route>
<config>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.30.2</gateway-address>
</config>
</route>
</ipv4>
</static-routes>
</vrf>
</network-instance>
</network-instances>
<interfaces xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-interface">
<interface>
<name>xe2</name>
<config>
<name>xe2</name>
<vrf-name>TEST_A9</vrf-name>
</config>
</interface>
</interfaces>
Validation with NetConf get
Here is a NetConf validation response that provides detailed information about destination prefix and mask for the network and create a gateway statically.
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>TEST_A9</name>
<config>
<name>TEST_A9</name>
<type
xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</config>
<state>
<name>TEST_A9</name>
<type
xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</state>
<protocols>
<protocol>
<identifier
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<config>
<identifier
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<enabled>true</enabled>
</config>
</protocol>
<protocol>
<identifier
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</identifier>
<name>static-routes</name>
<config>
<identifier
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</identifier>
<name>static-routes</name>
</config>
<static-routes>
<static>
<prefix>192.168.0.0/24</prefix>
<next-hops>
<next-hop>
<index>172.17.30.2</index>
<interface-ref>
<config>
<interface>xe2</interface>
</config>
<state>
<interface>xe2</interface>
</state>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</config>
<state>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</state>
</next-hop>
</next-hops>
<config>
<prefix>192.168.0.0/24</prefix>
</config>
<state>
<prefix>192.168.0.0/24</prefix>
</state>
</static>
</static-routes>
</protocol>
</protocols>
<tables>
<table>
<protocol
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
<config>
<protocol
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
</config>
</table>
<table>
<protocol
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</address-family>
<config>
<protocol
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</address-family>
</config>
</table>
<table>
<protocol
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</protocol>
<address-family
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
<config>
<protocol
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</protocol>
<address-family
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
</config>
</table>
</tables>
<interfaces>
<interface>
<id>lo.TEST_A9</id>
<config>
<interface>lo.TEST_A9</interface>
<id>lo.TEST_A9</id>
</config>
</interface>
<interface>
<id>xe2</id>
<config>
<interface>xe2</interface>
<id>xe2</id>
</config>
</interface>
</interfaces>
</network-instance>
</network-instances>
Restrictions
/network-instances/network-instance/protocols/protocol/static-routes/static/next-hops/next-hop
It is necessary to have at least one entry in this list of next hops
/network-instances/network-instance/protocols/protocol/static-routes/static/next-hops/next-hop/index
Whenever config/next-hop leaf is configured, the index must have the same value as the next-hop. If not, the index must match the interface name built from interface-ref/config/interface and interface-ref/config/subinterface. For example xe1”, “xe2.100” and so on.
Create a Static Route with Load Balancing
This XML configuration snippet is used to create two paths to a specified destination prefix and mask for the network and a gateway working in load balancing scenario. With these two links, it is possible to guarantee the service availability. All traffic should be routed throughout both links at the same time and if any of them has a failure, all traffic must be routed through the available link.
Release
This configuration was introduced in OcNOS version 5.1.
OpenConfig NetConf Payload
Here is a sample OpenConfig NetConf Payload to create a static route with load balancing.
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>TEST_A9</name>
<config>
<name>TEST_A9</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</config>
<protocols>
<protocol>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<config>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<enabled>true</enabled>
</config>
</protocol>
<protocol>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</identifier>
<name>static-routes</name>
<config>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</identifier>
<name>static-routes</name>
</config>
<static-routes>
<static>
<prefix>192.168.0.0/24</prefix>
<next-hops>
<next-hop>
<index>172.17.30.2</index>
<interface-ref>
<config>
<interface>xe2</interface>
</config>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</config>
</next-hop>
<next-hop>
<index>172.17.31.2</index>
<interface-ref>
<config>
<interface>xe1</interface>
</config>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.31.2</index>
<next-hop>172.17.31.2</next-hop>
</config>
</next-hop>
</next-hops>
<config>
<prefix>192.168.0.0/24</prefix>
</config>
</static>
</static-routes>
</protocol>
</protocols>
<tables>
<table>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
<config>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
</config>
</table>
<table>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</address-family>
<config>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</address-family>
</config>
</table>
<table>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
<config>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:STATIC</protocol>
<address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</address-family>
</config>
</table>
</tables>
<interfaces>
<interface>
<id>xe1</id>
<config>
<interface>xe1</interface>
<id>xe1</id>
</config>
</interface>
<interface>
<id>xe2</id>
<config>
<interface>xe2</interface>
<id>xe2</id>
</config>
</interface>
</interfaces>
</network-instance>
</network-instances>
OcNOS CLI Command
This CLI command is used to create a static route with load balancing.
interface xe1
ip vrf forwarding TEST_A9
!
interface xe2
ip vrf forwarding TEST_A9
!
ip route vrf TEST_A9 192.168.0.0/24 172.17.30.2 xe2 10
ip route vrf TEST_A9 192.168.0.0/24 172.17.31.2 xe1 10
OcNOS NetConf Payload
Here is a sample OcNOS NetConf Payload to create a static route with load balancing.
<network-instances xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-network-instance">
<network-instance>
<instance-name>TEST_A9</instance-name>
<instance-type>vrf</instance-type>
<config>
<instance-name>TEST_A9</instance-name>
<instance-type>vrf</instance-type>
</config>
<vrf xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-vrf">
<config>
<vrf-name>TEST_A9</vrf-name>
</config>
<static-routes xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-rib-vrf">
<ipv4>
<route>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.30.2</gateway-address>
<gateway-interface-route>
<interface-name>xe2</interface-name>
<config>
<interface-name>xe2</interface-name>
<distance>10</distance>
</config>
</gateway-interface-route>
<config>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.30.2</gateway-address>
</config>
</route>
<route>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.31.2</gateway-address>
<gateway-interface-route>
<interface-name>xe1</interface-name>
<config>
<interface-name>xe1</interface-name>
<distance>10</distance>
</config>
</gateway-interface-route>
<config>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.31.2</gateway-address>
</config>
</route>
</ipv4>
</static-routes>
</vrf>
</network-instance>
</network-instances>
Validation with NetConf get
Here is a NetConf validation response that provides detailed information about creating a static route with load balancing.
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>TEST_A9</name>
<config>
<name>TEST_A9</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</config>
<state>
<name>TEST_A9</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</state>
<protocols>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<identifier>oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<config>
<identifier>oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<enabled>true</enabled>
</config>
</protocol>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<identifier>oc-pol-types:STATIC</identifier>
<name>static-routes</name>
<config>
<identifier>oc-pol-types:STATIC</identifier>
<name>static-routes</name>
</config>
<static-routes>
<static>
<prefix>192.168.0.0/24</prefix>
<next-hops>
<next-hop>
<index>172.17.30.2</index>
<interface-ref>
<config>
<interface>xe2</interface>
</config>
<state>
<interface>xe2</interface>
</state>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</config>
<state>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</state>
</next-hop>
<next-hop>
<index>172.17.31.2</index>
<interface-ref>
<config>
<interface>xe1</interface>
</config>
<state>
<interface>xe1</interface>
</state>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.31.2</index>
<next-hop>172.17.31.2</next-hop>
</config>
<state>
<metric>10</metric>
<index>172.17.31.2</index>
<next-hop>172.17.31.2</next-hop>
</state>
</next-hop>
</next-hops>
<config>
<prefix>192.168.0.0/24</prefix>
</config>
<state>
<prefix>192.168.0.0/24</prefix>
<prefix>192.168.0.0/24</prefix>
</state>
</static>
</static-routes>
</protocol>
</protocols>
<tables xmlns:oc-types="http://openconfig.net/yang/openconfig-types">
<table xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV4</address-family>
<config>
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV4</address-family>
</config>
</table>
<table xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV6</address-family>
<config>
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV6</address-family>
</config>
</table>
<table xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<protocol>oc-pol-types:STATIC</protocol>
<address-family>oc-types:IPV4</address-family>
<config>
<protocol>oc-pol-types:STATIC</protocol>
<address-family>oc-types:IPV4</address-family>
</config>
</table>
</tables>
<interfaces>
<interface>
<id>lo.TEST_A9</id>
<config>
<interface>lo.TEST_A9</interface>
<id>lo.TEST_A9</id>
</config>
</interface>
<interface>
<id>xe1</id>
<config>
<interface>xe1</interface>
<id>xe1</id>
</config>
</interface>
<interface>
<id>xe2</id>
<config>
<interface>xe2</interface>
<id>xe2</id>
</config>
</interface>
</interfaces>
</network-instance>
</network-instances>
Restrictions
/network-instances/network-instance/protocols/protocol/static-routes/static/next-hops/next-hop
It is necessary to have at least one entry in this list of next hops
/network-instances/network-instance/protocols/protocol/static-routes/static/next-hops/next-hop/index
Whenever config/next-hop leaf is configured, the index must have the same value as the next-hop. If not, the index must match the interface name built from interface-ref/config/interface and interface-ref/config/subinterface. For example, “xe1”, “xe2.100” and so on.
Create a Static Route with Active/Standby
This XML configuration snippet is used to create two paths to a specified destination prefix and mask for the network and a gateway working in active/standby scenario. With these two links, it is possible to guarantee the service availability. All the traffic must be routed throughout the active link while the passive link must be configured to receive the traffic in case of any failure in the active link.
Release
This configuration was introduced in OcNOS version 5.1.
OpenConfig NetConf Payload
Here is a sample OpenConfig NetConf Payload to create a static route with active/standby.
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<!-- double link in a single PE of any L3 VPN -->
<network-instance>
<name>TEST_A8</name>
<config>
<name>TEST_A8</name>
<type>L3VRF</type>
</config>
<interfaces>
<interface>
<id>xe2</id>
<config>
<id>xe2</id>
<interface>xe2</interface>
</config>
</interface>
<interface>
<id>xe4</id>
<config>
<id>xe4</id>
<interface>xe4</interface>
</config>
</interface>
</interfaces>
<protocols>
<protocol>
<identifier>STATIC</identifier>
<name>static-route</name>
<config>
<identifier>STATIC</identifier>
<name>static-route</name>
<enabled>true</enabled>
</config>
<static-routes>
<static>
<prefix>192.168.0.0/24</prefix>
<config>
<prefix>192.168.0.0/24</prefix>
</config>
<next-hops>
<next-hop>
<index>172.17.30.2</index>
<config>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
<metric>10</metric>
</config>
<interface-ref>
<config>
<interface>xe2</interface>
</config>
</interface-ref>
</next-hop>
<next-hop>
<index>172.17.40.2</index>
<config>
<index>172.17.40.2</index>
<next-hop>172.17.40.2</next-hop>
<metric>30</metric>
</config>
<interface-ref>
<config>
<interface>xe4</interface>
</config>
</interface-ref>
</next-hop>
</next-hops>
</static>
</static-routes>
</protocol>
</protocols>
</network-instance>
</network-instances>
OcNOS CLI Command
This CLI command is used to create a static route with active/standby.
interface xe2
ip vrf forwarding TEST_A8
!
interface xe4
ip vrf forwarding TEST_A8
!
ip route vrf TEST_A8 192.168.0.0/24 172.17.30.2 xe2 10
ip route vrf TEST_A8 192.168.0.0/24 172.17.40.2 xe4 30
!
OcNOS NetConf Payload
Here is a sample OcNOS NetConf Payload to create a static route with active/standby.
<network-instances xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-network-instance">
<network-instance>
<instance-name>TEST_A8</instance-name>
<instance-type>vrf</instance-type>
<config>
<instance-name>TEST_A8</instance-name>
<instance-type>vrf</instance-type>
</config>
<vrf xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-vrf">
<config>
<vrf-name>TEST_A8</vrf-name>
</config>
<static-routes xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-rib-vrf">
<ipv4>
<route>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.30.2</gateway-address>
<gateway-interface-route>
<interface-name>xe2</interface-name>
<config>
<distance>10</distance>
<interface-name>xe2</interface-name>
</config>
</gateway-interface-route>
<config>
<gateway-address>172.17.30.2</gateway-address>
<destination-prefix>192.168.0.0/24</destination-prefix>
</config>
</route>
<route>
<destination-prefix>192.168.0.0/24</destination-prefix>
<gateway-address>172.17.40.2</gateway-address>
<gateway-interface-route>
<interface-name>xe4</interface-name>
<config>
<distance>30</distance>
<interface-name>xe4</interface-name>
</config>
</gateway-interface-route>
<config>
<gateway-address>172.17.40.2</gateway-address>
<destination-prefix>192.168.0.0/24</destination-prefix>
</config>
</route>
</ipv4>
</static-routes>
</vrf>
</network-instance>
</network-instances>
<interfaces xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-interface">
<interface>
<name>xe2</name>
<config>
<vrf-name>TEST_A8</vrf-name>
<name>xe2</name>
</config>
</interface>
<interface>
<name>xe4</name>
<config>
<vrf-name>TEST_A8</vrf-name>
<name>xe4</name>
</config>
</interface>
</interfaces>
Validation with NetConf get
Here is a NetConf validation response that provides detailed information about creating a static route with active/standby.
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>TEST_A8</name>
<config>
<name>TEST_A8</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</config>
<state>
<name>TEST_A8</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
</state>
<protocols>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<identifier>oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<config>
<identifier>oc-pol-types:DIRECTLY_CONNECTED</identifier>
<name>DIRECTLY_CONNECTED</name>
<enabled>true</enabled>
</config>
</protocol>
<protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<identifier>oc-pol-types:STATIC</identifier>
<name>static-routes</name>
<config>
<identifier>oc-pol-types:STATIC</identifier>
<name>static-routes</name>
</config>
<static-routes>
<static>
<prefix>192.168.0.0/24</prefix>
<next-hops>
<next-hop>
<index>172.17.30.2</index>
<interface-ref>
<config>
<interface>xe2</interface>
</config>
<state>
<interface>xe2</interface>
</state>
</interface-ref>
<config>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</config>
<state>
<metric>10</metric>
<index>172.17.30.2</index>
<next-hop>172.17.30.2</next-hop>
</state>
</next-hop>
<next-hop>
<index>172.17.40.2</index>
<interface-ref>
<config>
<interface>xe4</interface>
</config>
<state>
<interface>xe4</interface>
</state>
</interface-ref>
<config>
<metric>30</metric>
<index>172.17.40.2</index>
<next-hop>172.17.40.2</next-hop>
</config>
<state>
<metric>30</metric>
<index>172.17.40.2</index>
<next-hop>172.17.40.2</next-hop>
</state>
</next-hop>
</next-hops>
<config>
<prefix>192.168.0.0/24</prefix>
</config>
<state>
<prefix>192.168.0.0/24</prefix>
<prefix>192.168.0.0/24</prefix>
</state>
</static>
</static-routes>
</protocol>
</protocols>
<tables xmlns:oc-types="http://openconfig.net/yang/openconfig-types">
<table xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV4</address-family>
<config>
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV4</address-family>
</config>
</table>
<table xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV6</address-family>
<config>
<protocol>oc-pol-types:DIRECTLY_CONNECTED</protocol>
<address-family>oc-types:IPV6</address-family>
</config>
</table>
<table xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">
<protocol>oc-pol-types:STATIC</protocol>
<address-family>oc-types:IPV4</address-family>
<config>
<protocol>oc-pol-types:STATIC</protocol>
<address-family>oc-types:IPV4</address-family>
</config>
</table>
</tables>
<interfaces>
<interface>
<id>lo.TEST_A8</id>
<config>
<interface>lo.TEST_A8</interface>
<id>lo.TEST_A8</id>
</config>
</interface>
<interface>
<id>xe2</id>
<config>
<interface>xe2</interface>
<id>xe2</id>
</config>
</interface>
<interface>
<id>xe4</id>
<config>
<interface>xe4</interface>
<id>xe4</id>
</config>
</interface>
</interfaces>
</network-instance>
</network-instances>
Restrictions
/network-instances/network-instance/protocols/protocol/static-routes/static/next-hops/next-hop
It is necessary to have at least one entry in this list of next hops.
/network-instances/network-instance/protocols/protocol/static-routes/static/next-hops/next-hop/index
Whenever config/next-hop leaf is configured, the index must have the same value as the next-hop. If not, the index must match the interface name built from interface-ref/config/interface and interface-ref/config/subinterface. For example, “xe1”, “xe2.100” and so on.
Use Cases
In this chapter, there are scenarios that can be accomplished using OpenConfig configuration XML files, showing complex interactions between different objects.