Add YANG model for FABRIC_PORT (#15629)

#### Why I did it

Introduce YANG model for FABRIC in CONFIG_DB, which was added in https://github.com/sonic-net/sonic-buildimage/pull/14170.

#### How I did it

This is a clone of @jfeng-arista's PR https://github.com/sonic-net/sonic-buildimage/pull/14282 to resolve conflicts with upstream changes. 

#### How to verify it

Passing pipeline build is sufficient.
This commit is contained in:
kenneth-arista 2023-07-03 13:57:26 -07:00 committed by mssonicbld
parent 8253fd5c07
commit 9a5c188b3c
8 changed files with 138 additions and 0 deletions

View File

@ -276,3 +276,14 @@ class TestCfgGen(object):
"monPollThreshRecovery": "8"
}
})
def test_fabric_port_table(self):
arg = ["--var-json", "FABRIC_PORT"]
output = json.loads(self.run_script_with_yang_arg(arg))
assert(output == {\
"Fabric0": {
"alias": "Fabric0",
"isolateStatus": "False",
"lanes": "0"
}
})

View File

@ -388,5 +388,17 @@
"monPollThreshRecovery": "8"
}
}
},
"sonic-fabric-port:sonic-fabric-port": {
"sonic-fabric-port:FABRIC_PORT": {
"FABRIC_PORT_LIST": [
{
"name": "Fabric0",
"alias": "Fabric0",
"isolateStatus": "False",
"lanes": "0"
}
]
}
}
}

View File

@ -34,6 +34,7 @@ Table of Contents
* [FG_NHG_MEMBER](#fg_nhg_member)
* [FG_NHG_PREFIX](#fg_nhg_prefix)
* [FABRIC_MONITOR](#fabric-monitor)
* [FABRIC_PORT](#fabric-port)
* [FLEX_COUNTER_TABLE](#flex_counter_table)
* [Hash](#hash)
* [IPv6 Link-local] (#ipv6-link-local)
@ -1063,6 +1064,24 @@ The FG_NHG_PREFIX table provides the FG_NHG_PREFIX for which FG behavior is desi
```
### FABRIC_PORT
```
{
"FABRIC_PORT": {
"Fabric0": {
"alias": "Fabric0",
"isolateStatus": "False",
"lanes": "0"
},
"Fabric1": {
"alias": "Fabric1",
"isolateStatus": "False",
"lanes": "1"
}
}
}
```
### MPLS_TC_TO_TC_MAP
```

View File

@ -117,6 +117,7 @@ setup(
'./yang-models/sonic-events-syncd.yang',
'./yang-models/sonic-extension.yang',
'./yang-models/sonic-fabric-monitor.yang',
'./yang-models/sonic-fabric-port.yang',
'./yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-fine-grained-ecmp.yang',
'./yang-models/sonic-feature.yang',
@ -210,6 +211,7 @@ setup(
'./cvlyang-models/sonic-device_neighbor_metadata.yang',
'./cvlyang-models/sonic-extension.yang',
'./cvlyang-models/sonic-fabric-monitor.yang',
'./cvlyang-models/sonic-fabric-port.yang',
'./cvlyang-models/sonic-flex_counter.yang',
'./cvlyang-models/sonic-feature.yang',
'./cvlyang-models/sonic-fine-grained-ecmp.yang',

View File

@ -1275,6 +1275,18 @@
"monPollThreshRecovery": "8"
}
},
"FABRIC_PORT": {
"Fabric0": {
"alias": "Fabric0",
"isolateStatus": "False",
"lanes": "0"
},
"Fabric1": {
"alias": "Fabric1",
"isolateStatus": "False",
"lanes": "1"
}
},
"FLEX_COUNTER_TABLE": {
"PFCWD": {
"FLEX_COUNTER_STATUS": "enable"

View File

@ -0,0 +1,5 @@
{
"FABRIC_PORT_POSITIVE_CONFIG": {
"desc": "Configure FABRIC_PORT no failure."
}
}

View File

@ -0,0 +1,16 @@
{
"FABRIC_PORT_POSITIVE_CONFIG": {
"sonic-fabric-port:sonic-fabric-port": {
"sonic-fabric-port:FABRIC_PORT": {
"FABRIC_PORT_LIST": [
{
"name": "Fabric0",
"alias": "Fabric0",
"isolateStatus": "False",
"lanes": "0"
}
]
}
}
}
}

View File

@ -0,0 +1,61 @@
module sonic-fabric-port{
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-fabric-port";
prefix fabric-port;
import sonic-types {
prefix stypes;
}
description "FABRIC_PORT yang Module for SONiC OS";
revision 2023-03-14 {
description "First Revision";
}
container sonic-fabric-port {
container FABRIC_PORT {
description "FABRIC_PORT part of config_db.json";
list FABRIC_PORT_LIST {
key "name";
leaf name {
type string {
length 1..128;
}
}
leaf isolateStatus {
description "Isolation status of a fabric port";
type stypes:boolean_type;
default "False";
}
leaf alias {
description "Alias of a fabric port";
type string {
length 1..128;
}
}
leaf lanes {
description "Lanes of a fabric port";
mandatory true;
type string {
length 1..128;
}
}
} /* end of list FABRIC_PORT_LIST */
} /* end of container FABRIC_PORT */
} /* end of container sonic-fabric-port */
} /* end of module sonic-fabric-port */