-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[nvgre] Added YANG model and tests #9136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
liat-grozovik
merged 7 commits into
sonic-net:master
from
vadymhlushko-mlnx:nvgre_yang_model
Feb 17, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
47a787a
[nvgre]: Added YANG model and tests
vadymhlushko-mlnx 6bc054d
Fixed comments
vadymhlushko-mlnx c484396
Changed type of src_ip leaf to ip-address
vadymhlushko-mlnx 7687cb1
Fixed test case
vadymhlushko-mlnx 7cbc965
Fixed tunnel map key
vadymhlushko-mlnx b687e8e
Added NVGRE yang model to setup.py
vadymhlushko-mlnx e89dac2
Minor codestyle improvements
vadymhlushko-mlnx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "NVGRE_TUNNEL_AND_TUNNEL_MAP": { | ||
| "desc": "NVGRE_TUNNEL with NVGRE_TUNNEL_MAP" | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_INVALID_SRC_IP": { | ||
| "desc": "INVALID src_ip value for NVGRE_TUNNEL", | ||
| "eStrKey": "InvalidValue" | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_MAP_UNEXISTING_NVGRE_TUNNEL_NAME": { | ||
| "desc": "Unexisting NVGRE_TUNNEL", | ||
| "eStrKey": "LeafRef" | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_MAP_INVALID_VLAN_ID": { | ||
| "desc": "Invalid VLAN ID", | ||
| "eStrKey": "Pattern" | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_MAP_INVALID_VSID": { | ||
| "desc": "INVALID VSID value for NVGRE_TUNNEL_MAP", | ||
| "eStrKey": "Pattern" | ||
| } | ||
| } |
125 changes: 125 additions & 0 deletions
125
src/sonic-yang-models/tests/yang_model_tests/tests_config/nvgre.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| { | ||
| "NVGRE_TUNNEL_AND_TUNNEL_MAP": { | ||
| "sonic-vlan:sonic-vlan": { | ||
| "sonic-vlan:VLAN": { | ||
| "VLAN_LIST": [ | ||
| { | ||
| "name": "Vlan200" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL": { | ||
| "NVGRE_TUNNEL_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "src_ip": "10.0.0.1" | ||
| } | ||
| ] | ||
| }, | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { | ||
| "NVGRE_TUNNEL_MAP_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "tunnel_map_name": "Vlan200", | ||
| "vlan_id": 200, | ||
| "vsid": 5000 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_INVALID_SRC_IP": { | ||
| "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL": { | ||
| "NVGRE_TUNNEL_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "src_ip": "INVALID" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_MAP_UNEXISTING_NVGRE_TUNNEL_NAME": { | ||
| "sonic-vlan:sonic-vlan": { | ||
| "sonic-vlan:VLAN": { | ||
| "VLAN_LIST": [ | ||
| { | ||
| "name": "Vlan200" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { | ||
| "NVGRE_TUNNEL_MAP_LIST": [ | ||
| { | ||
| "tunnel_name": "INVALID", | ||
| "tunnel_map_name": "Vlan200", | ||
| "vlan_id": 200, | ||
| "vsid": 5000 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_MAP_INVALID_VLAN_ID": { | ||
| "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL": { | ||
| "NVGRE_TUNNEL_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "src_ip": "10.0.0.1" | ||
| } | ||
| ] | ||
| }, | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { | ||
| "NVGRE_TUNNEL_MAP_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "tunnel_map_name": "Vlan200", | ||
| "vlan_id": 5000, | ||
| "vsid": 5000 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| "NVGRE_TUNNEL_MAP_INVALID_VSID": { | ||
| "sonic-vlan:sonic-vlan": { | ||
| "sonic-vlan:VLAN": { | ||
| "VLAN_LIST": [ | ||
| { | ||
| "name": "Vlan200" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL": { | ||
| "NVGRE_TUNNEL_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "src_ip": "10.0.0.1" | ||
| } | ||
| ] | ||
| }, | ||
| "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { | ||
| "NVGRE_TUNNEL_MAP_LIST": [ | ||
| { | ||
| "tunnel_name": "tunnel_1", | ||
| "tunnel_map_name": "Vlan200", | ||
| "vlan_id": 200, | ||
| "vsid": 999999999 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } |
114 changes: 114 additions & 0 deletions
114
src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| module sonic-nvgre-tunnel { | ||
|
|
||
| yang-version 1.1; | ||
|
|
||
| namespace "http://github.com/Azure/sonic-nvgre-tunnel"; | ||
| prefix nvgre; | ||
|
|
||
| import ietf-inet-types { | ||
| prefix inet; | ||
| } | ||
|
|
||
| import sonic-vlan { | ||
| prefix vlan; | ||
| } | ||
|
|
||
|
|
||
| organization | ||
| "SONiC"; | ||
|
|
||
| contact | ||
| "SONiC"; | ||
|
|
||
| description | ||
| "NVGRE Tunnel YANG Module for SONiC OS"; | ||
|
|
||
| revision 2021-10-31 { | ||
| description | ||
| "First Revision"; | ||
| } | ||
|
|
||
| container sonic-nvgre-tunnel { | ||
|
|
||
| container NVGRE_TUNNEL { | ||
|
|
||
| description "NVGRE_TUNNEL part of config_db.json"; | ||
|
|
||
| list NVGRE_TUNNEL_LIST { | ||
|
|
||
| key "tunnel_name"; | ||
|
|
||
| leaf tunnel_name { | ||
| description "NVGRE Tunnel name"; | ||
|
|
||
| type string { | ||
| length 1..255; | ||
| } | ||
| } | ||
|
|
||
| leaf src_ip { | ||
vadymhlushko-mlnx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description "Source IP address"; | ||
|
|
||
| mandatory true; | ||
| type inet:ip-address; | ||
| } | ||
|
|
||
| } | ||
| /* end of NVGRE_TUNNEL_LIST */ | ||
|
|
||
| } | ||
| /* end of container NVGRE_TUNNEL */ | ||
|
|
||
| container NVGRE_TUNNEL_MAP { | ||
|
|
||
| description "NVGRE_TUNNEL_MAP part of config_db.json"; | ||
|
|
||
| list NVGRE_TUNNEL_MAP_LIST { | ||
|
|
||
| key "tunnel_name tunnel_map_name"; | ||
|
|
||
| leaf tunnel_name { | ||
| description "NVGRE Tunnel name"; | ||
|
|
||
| type leafref { | ||
vadymhlushko-mlnx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| path /nvgre:sonic-nvgre-tunnel/nvgre:NVGRE_TUNNEL/nvgre:NVGRE_TUNNEL_LIST/nvgre:tunnel_name; | ||
| } | ||
| } | ||
|
|
||
| leaf tunnel_map_name { | ||
| description "NVGRE Tunnel map name"; | ||
|
|
||
| type string { | ||
| length 1..255; | ||
| } | ||
| } | ||
|
|
||
| leaf vlan_id { | ||
vadymhlushko-mlnx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description "VLAN identifier"; | ||
|
|
||
| mandatory true; | ||
| type uint16 { | ||
vadymhlushko-mlnx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| range 1..4094; | ||
| } | ||
| } | ||
|
|
||
| leaf vsid { | ||
| description "Virtual Subnet Identifier"; | ||
|
|
||
| mandatory true; | ||
| type uint32 { | ||
| range 0..16777214; | ||
vadymhlushko-mlnx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| } | ||
| /* end of NVGRE_TUNNEL_MAP_LIST */ | ||
|
|
||
| } | ||
| /* end of container NVGRE_TUNNEL_MAP */ | ||
|
|
||
| } | ||
| /* end of container sonic-nvgre-tunnel */ | ||
|
|
||
| } | ||
| /* end of module sonic-nvgre-tunnel */ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.