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
4 changes: 4 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"mtu": "9100"
}
},
"PORTCHANNEL_MEMBER": {
"PortChannel0003|Ethernet1": {},
"PortChannel0004|Ethernet2": {}
},
"VLAN_INTERFACE": {
"Vlan111": {},
"Vlan777": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ def initTest(self):
'desc': 'Configure a member port in PORT_CHANNEL table.',
'eStr': self.defaultYANGFailure['None']
},
'PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORTCHANNEL': {
'desc': 'Configure PortChannel in PORTCHANNEL_MEMEBER table \
which does not exist in PORTCHANNEL table.',
'eStr': self.defaultYANGFailure['LeafRef'] + \
['portchannel', 'name']
},
'PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORT': {
'desc': 'Configure Port in PORTCHANNEL_MEMEBER table \
which does not exist in PORT table.',
'eStr': self.defaultYANGFailure['LeafRef'] + \
['port', 'name']
},
'PORTCHANNEL_INTERFACE_IP_ADDR_TEST': {
'desc': 'Configure IP address on PORTCHANNEL_INTERFACE table.',
'eStr': self.defaultYANGFailure['None']
Expand All @@ -74,7 +86,7 @@ def initTest(self):
'eStr': self.defaultYANGFailure['LeafRef']
},
'VLAN_MEMEBER_WITH_NON_EXIST_VLAN': {
'desc': 'Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.',
'desc': 'Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.',
'eStr': self.defaultYANGFailure['LeafRef']
},
'TAGGING_MODE_WRONG_VALUE': {
Expand Down
37 changes: 36 additions & 1 deletion src/sonic-yang-models/tests/yang_model_tests/yangTest.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,42 @@
}
},

"PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORTCHANNEL": {
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL_MEMBER": {
"PORTCHANNEL_MEMBER_LIST": [{
"name": "PortChannel0002",
"port": "Ethernet0"
}]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [{
"name": "Ethernet0",
"speed": 25000,
"lanes": "65"
}]
}
}
},
"PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORT": {
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL_MEMBER": {
"PORTCHANNEL_MEMBER_LIST": [{
"name": "PortChannel0002",
"port": "Ethernet0"
}]
},
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [{
"name": "PortChannel0002",
"admin_status": "up"
}]
}
}
},

"PORT_CHANNEL_TEST": {
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
Expand Down Expand Up @@ -1354,4 +1390,3 @@
}
}
}

24 changes: 24 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-portchannel.yang
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module sonic-portchannel {


container sonic-portchannel {

container PORTCHANNEL {

description "PORTCHANNEL part of config_db.json";
Expand Down Expand Up @@ -90,6 +91,29 @@ module sonic-portchannel {

} /* end of container PORTCHANNEL */

container PORTCHANNEL_MEMBER {

description "PORTCHANNEL_MEMBER part of config_db.json";

list PORTCHANNEL_MEMBER_LIST {

key "name port";

leaf name {
type leafref {
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
}
}

leaf port {
/* key elements are mandatory by default */
type leafref {
path /port:sonic-port/port:PORT/port:PORT_LIST/port:name;
}
}
} /* end of list PORTCHANNEL_MEMBER_LIST */

} /* end of container PORTCHANNEL_MEMBER */

container PORTCHANNEL_INTERFACE {

Expand Down