diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 6fd6bbd1125c..7674790c1959 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -1882,6 +1882,7 @@ table allow to change properties of a virtual router. Attributes: packets with IP options - 'l3_mc_action' contains packet action. Defines the action for unknown L3 multicast packets +- 'vni' contains L3 VNI value. VNI associated Virtual router instance. The packet action could be: @@ -1903,7 +1904,8 @@ The packet action could be: 'src_mac': '02:04:05:06:07:08', 'ttl_action': 'copy', 'ip_opt_action': 'deny', - 'l3_mc_action': 'drop' + 'l3_mc_action': 'drop', + 'vni': '100' } ``` diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index f9945175cf48..4a7f5b7ba3d4 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -2,6 +2,7 @@ "SAMPLE_CONFIG_DB_JSON": { "VRF": { "Vrf_blue": { + "vni" : "100" } }, "DHCP_SERVER": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vrf.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vrf.json index a9d9bb0f9d9c..73e31ee109cc 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/vrf.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vrf.json @@ -8,5 +8,12 @@ }, "VRF_TEST_WITH_FALLBACK": { "desc": "Configure VRF with fallback in VRF table." + }, + "VRF_TEST_WITH_VNI": { + "desc": "Configure VRF with VNI in VRF table." + }, + "VRF_TEST_WITH_VNI_OOR": { + "desc": "Configure VRF with out of range VNI in VRF table.", + "eStrKey": "Range" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vrf.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vrf.json index f34d3fbdd52d..082ec022f81b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vrf.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vrf.json @@ -28,5 +28,27 @@ }] } } + }, + + "VRF_TEST_WITH_VNI": { + "sonic-vrf:sonic-vrf": { + "sonic-vrf:VRF": { + "VRF_LIST": [{ + "name": "Vrf_blue", + "vni": "100" + }] + } + } + }, + + "VRF_TEST_WITH_VNI_OOR": { + "sonic-vrf:sonic-vrf": { + "sonic-vrf:VRF": { + "VRF_LIST": [{ + "name": "Vrf_blue", + "vni": "16777216" + }] + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-vrf.yang b/src/sonic-yang-models/yang-models/sonic-vrf.yang index ff9fc5b5a4cc..5387aad2cc80 100644 --- a/src/sonic-yang-models/yang-models/sonic-vrf.yang +++ b/src/sonic-yang-models/yang-models/sonic-vrf.yang @@ -43,6 +43,14 @@ module sonic-vrf { "Enable/disable fallback feature which is useful for specified VRF user to access internet through global/main route."; } + leaf vni { + type uint32 { + range "0..16777215"; + } + default 0; + description + "VNI mapped to VRF"; + } } /* end of list VRF_LISt */ } /* end of container VRf */ } /* end of container sonic-vrf */