Static Routes
Create a static route
Release
This configuration was introduced in OcNOS version 4.2.
Configuration
Use this xml config to specify the destination prefix and mask for the network and a gateway statically create.
OpenConfig NETCONF Payload
<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>
<enabled>true</enabled>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</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
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
<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
<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>
<enabled>true</enabled>
<enabled-address-families
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</config>
<state>
<name>TEST_A9</name>
<type
xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
<enabled>true</enabled>
<enabled-address-families
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families
xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</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, e.g., “xe1”, “xe2.100”, etc.
Create a static route with load balancing
Release
This configuration was introduced in OcNOS version 5.1.
Configuration
Use this xml config to create two paths to a specified the destination prefix and mask for the network and a gateway working in load balancing scenario, with this 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 should be routed by available link.
OpenConfig NETCONF Payload
<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>
<enabled>true</enabled>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</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
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
<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
<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>
<enabled>true</enabled>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</config>
<state>
<name>TEST_A9</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
<enabled>true</enabled>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</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, e.g., “xe1”, “xe2.100”, etc.
Create a static route with active/standby
Release
This configuration was introduced in OcNOS version 5.1.
Configuration
Use this xml config to create two paths to a specified the 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 traffic should be routed throughout the active link while the passive link should be configured to be ready to receive the traffic in case of any failure in the active link.
OpenConfig NETCONF Payload
<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
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
<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
<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>
<enabled>true</enabled>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</config>
<state>
<name>TEST_A8</name>
<type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
<enabled>true</enabled>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV4</enabled-address-families>
<enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:IPV6</enabled-address-families>
</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, e.g., “xe1”, “xe2.100”, etc.
Last modified date: 07/14/2023