Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
"desc": "Configure vlan sub interface must condition false.",
"eStrKey": "Must"
},
"VLAN_SUB_INTERFACE_NAME_LENGTH_LIMIT_MUST_CONDITION_FALSE_TEST": {
"desc": "Configure vlan sub interface name length must condition false.",
"eStrKey": "Must"
},
"VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": {
"desc": "Configure short name format vlan sub interface must condition false.",
"eStrKey": "Must"
},
"VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": {
"desc": "Configure valid portchannel short name format vlan sub interface must condition true."
},
"VLAN_SUB_INTERFACE_PO_MUST_CONDITION_TRUE_TEST": {
"desc": "Configure portchannel long name format vlan sub interface must condition true."
},
"VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": {
"desc": "Configure portchannel long name format vlan sub interface must condition false.",
"eStrKey": "Must"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,38 @@
}
}
},
"VLAN_SUB_INTERFACE_NAME_LENGTH_LIMIT_MUST_CONDITION_FALSE_TEST": {
"sonic-vlan-sub-interface:sonic-vlan-sub-interface": {
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "Ethernet12000.10"
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet12000.10",
"ip-prefix": "10.0.0.1/30"
}
]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet12000",
"admin_status": "up",
"alias": "Ethernet12000/1",
"description": "Ethernet12000",
"lanes": "49,50,51,52",
"mtu": 9000,
"speed": 100000
}
]
}
}
},
"VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": {
"sonic-vlan-sub-interface:sonic-vlan-sub-interface": {
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
Expand Down Expand Up @@ -177,6 +209,56 @@
}
}
},
"VLAN_SUB_INTERFACE_PO_MUST_CONDITION_TRUE_TEST": {
"sonic-vlan-sub-interface:sonic-vlan-sub-interface": {
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "PortChannel01.8"
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
{
"name": "PortChannel01.8",
"ip-prefix": "10.0.0.1/30"
}
]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"tpid": "0x8100",
"speed": 25000
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"members": [
"Ethernet0"
],
"min_links": "1",
"mtu": "9100",
"tpid": "0x8100",
"lacp_key": "auto",
"name": "PortChannel01"
}
]
}
}
},
"VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": {
"sonic-vlan-sub-interface:sonic-vlan-sub-interface": {
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ module sonic-vlan-sub-interface {
key "name";

leaf name {
must "(substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " +
"(starts-with(substring-before(current(), '.'), 'Eth') and " +
"concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " +
"(starts-with(substring-before(current(), '.'), 'Po') and " +
"concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name)"
must "(string-length(current()) <= 15) and " +
"((substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " +
"(starts-with(substring-before(current(), '.'), 'Eth') and concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " +
"(substring-before(current(), '.') = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name) or " +
"(starts-with(substring-before(current(), '.'), 'Po') and concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name))"
{
error-message "Must condition not satisfied, please follow vlan sub interface naming convention";
}
Expand Down