[sonic-portchannel.yang]: YANG models for PORTCHANNEL_MEMBER table. (#7020)

Changes:
-- YANG models for PORTCHANNEL_MEMBER table.
-- Yang Model Test.
-- Yang Mgmt Test with PORTCHANNEL_MEMBER table in config_db.json

Signed-off-by: Praveen Chaudhary <pchaudhary@linkedin.com>
This commit is contained in:
Praveen Chaudhary 2021-03-30 08:26:37 -07:00 committed by GitHub
parent 67c57990f6
commit a1992c054f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 2 deletions

View File

@ -18,6 +18,10 @@
"mtu": "9100"
}
},
"PORTCHANNEL_MEMBER": {
"PortChannel0003|Ethernet1": {},
"PortChannel0004|Ethernet2": {}
},
"VLAN_INTERFACE": {
"Vlan111": {},
"Vlan777": {},

View File

@ -65,6 +65,18 @@ class Test_yang_models:
'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']
@ -74,7 +86,7 @@ class Test_yang_models:
'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': {

View File

@ -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": {
@ -1354,4 +1390,3 @@
}
}
}

View File

@ -32,6 +32,7 @@ module sonic-portchannel {
container sonic-portchannel {
container PORTCHANNEL {
description "PORTCHANNEL part of config_db.json";
@ -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 {