implement review comments

Signed-off-by: matiAlfaro <mati@marvell.com>
This commit is contained in:
matiAlfaro 2024-03-25 15:32:53 +02:00
parent f5feebab28
commit c2c9a62130
3 changed files with 21 additions and 45 deletions

View File

@ -91,10 +91,6 @@
"desc": "Vlan members without Creating Vlan",
"eStrKey": "LeafRef"
},
"VLAN_CREATE_DEFAULT_VLAN":{
"desc": "Try to create default Vlan (1)",
"eStr": "Vlan1 is default Vlan"
},
"VLAN_CREATE_VLAN_WITH_MISSMATCHING_NAME": {
"desc": "Create Vlan so that name doesn't match id",
"eStr": "The vlanid must correspond to the VLAN name"

View File

@ -744,17 +744,6 @@
}
}
},
"VLAN_CREATE_DEFAULT_VLAN": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan1"
}
]
}
}
},
"VLAN_CREATE_VLAN_WITH_MISSMATCHING_NAME": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {

View File

@ -1,6 +1,6 @@
module sonic-vlan {
yang-version 1.1;
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-vlan";
prefix vlan;
@ -91,7 +91,7 @@ module sonic-vlan {
error-app-tag nat-zone-invalid;
}
}
default "0";
default "0";
}
leaf mpls {
description "Enable/disable MPLS routing for the vlan interface";
@ -120,10 +120,10 @@ module sonic-vlan {
}
leaf loopback_action {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
}
leaf loopback_action {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
}
}
/* end of VLAN_INTERFACE_LIST */
@ -160,9 +160,9 @@ module sonic-vlan {
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.
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
@ -189,24 +189,16 @@ module sonic-vlan {
leaf name {
type string {
pattern 'Vlan(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])';
pattern 'Vlan(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[2-9])';
}
must "not(current() = 'Vlan1')"
{
error-message "Vlan1 is default Vlan";
}
}
}
leaf vlanid {
type uint16 {
range 1..4094;
}
must "not(current() = 1)"
{
error-message "Vlan1 is default Vlan";
range 2..4094;
}
must "substring-after(../name, 'Vlan') = current()"{
error-message "The vlanid must correspond to the VLAN name";
}
error-message "The vlanid must correspond to the VLAN name";
}
}
leaf alias {
@ -272,28 +264,27 @@ module sonic-vlan {
}
must "not(/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST[sms:dst_port=current()])"
{
error-message "Port is used as a destination port in a mirror session.";
error-message "Port is used as a destination port in a mirror session.";
}
must "not(/lag:sonic-portchannel/lag:PORTCHANNEL_MEMBER/lag:PORTCHANNEL_MEMBER_LIST[lag:port=current()]/lag:name)" {
error-message "Port is a member of a port channel.";
error-message "Port is a member of a port channel.";
}
must "not(/intf:sonic-interface/intf:INTERFACE/intf:INTERFACE_LIST[intf:name=current()])" {
error-message "Port is a router interface.";
}
error-message "Port is a router interface.";
}
must "count(../../vlan:VLAN_MEMBER_LIST[vlan:port=current() and vlan:tagging_mode='untagged']) <= 1" {
error-message "Port can be untagged in at most one VLAN.";
}
}
leaf tagging_mode {
mandatory true;
type stypes:vlan_tagging_mode;
}
}
/* end of list VLAN_MEMBER_LIST */
/* end of list VLAN_MEMBER_LIST */
}
/* end of container VLAN_MEMBER */
/* end of container VLAN_MEMBER */
}
/* end of container sonic-vlan */
/* end of container sonic-vlan */
}
/* end of module sonic-vlan */