forked from sonoble/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yang-models]: YANG model changes for INTERFACE, VLAN_INTERFACE, LOOP… (
sonic-net#36) * [yang-models]: YANG model changes for INTERFACE, VLAN_INTERFACE, LOOPBACK_INTERFACE. Changes: 1.) YANG model changes to accomodate VRF feature. 2.) Test case addition for new must condition. 3.) Test case changes for old config for INTERFACE and VLAN_INTERFACE. Signed-off-by: Praveen Chaudhary [email protected] * [yangModelTesting.py]: Test cases for VLAN and Loopback must condition.
- Loading branch information
Praveen Chaudhary
authored
Feb 9, 2020
1 parent
1c391b0
commit 537199c
Showing
5 changed files
with
267 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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
85 changes: 85 additions & 0 deletions
85
src/sonic-yang-mgmt/yang-models/sonic-loopback-interface.yang
This file contains 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,85 @@ | ||
module sonic-loopback-interface { | ||
|
||
namespace "http://github.com/Azure/sonic-loopback-interface"; | ||
prefix lointf; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-head { | ||
prefix head; | ||
revision-date 2019-07-01; | ||
} | ||
|
||
organization "Linkedin Corporation"; | ||
|
||
contact "[email protected]"; | ||
|
||
description | ||
"SONIC LOOPBACK INTERFACE"; | ||
|
||
revision 2020-02-05 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-loopback-interface { | ||
|
||
container LOOPBACK_INTERFACE { | ||
|
||
list LOOPBACK_INTERFACE_LIST { | ||
key "loopback_interface_name"; | ||
|
||
leaf loopback_interface_name{ | ||
type string; | ||
} | ||
|
||
leaf vrf_name { | ||
type string { | ||
pattern "Vrf[a-zA-Z0-9_-]+"; | ||
length 3..255; | ||
} | ||
} | ||
} | ||
/* end of LOOPBACK_INTERFACE_LIST */ | ||
|
||
list LOOPBACK_INTERFACE_IPPREFIX_LIST { | ||
key "loopback_interface_name ip-prefix"; | ||
|
||
leaf loopback_interface_name{ | ||
/* This node must be present in LOOPBACK_INTERFACE_LIST */ | ||
must "(current() = ../../LOOPBACK_INTERFACE_LIST[loopback_interface_name=current()]/loopback_interface_name)" | ||
{ | ||
error-message "Must condition not satisfied, Try adding lo<>: {}, Example: 'lo1': {}"; | ||
} | ||
type string; | ||
} | ||
|
||
leaf ip-prefix { | ||
type inet:ip-prefix; | ||
} | ||
|
||
leaf scope { | ||
type enumeration { | ||
enum global; | ||
enum local; | ||
} | ||
} | ||
|
||
leaf family { | ||
|
||
/* family leaf needed for backward compatibility | ||
Both ip4 and ip6 address are string in IETF RFC 6021, | ||
so must statement can check based on : or ., family | ||
should be IPv4 or IPv6 according. | ||
*/ | ||
|
||
must "(contains(../ip-prefix, ':') and current()='IPv6') or | ||
(contains(../ip-prefix, '.') and current()='IPv4')"; | ||
type head:ip-family; | ||
} | ||
} | ||
} | ||
/* end of LOOPBACK_INTERFACE_IPPREFIX_LIST */ | ||
} | ||
} |
This file contains 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