Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YANG model for FABRIC_PORT #15629

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 11 additions & 0 deletions src/sonic-config-engine/tests/test_cfggen_from_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,14 @@ def test_fabric_monitor_data_table(self):
"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"
}
})
12 changes: 12 additions & 0 deletions src/sonic-config-engine/tests/test_yang_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}
}
19 changes: 19 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
```
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def run(self):
'./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',
Expand Down Expand Up @@ -209,6 +210,7 @@ def run(self):
'./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',
Expand Down
12 changes: 12 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 @@ -1273,6 +1273,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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"FABRIC_PORT_POSITIVE_CONFIG": {
"desc": "Configure FABRIC_PORT no failure."
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
}
}
59 changes: 59 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-fabric-port.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module sonic-fabric-port{

yang-version 1.1;

namespace "https://github.com/sonic-net/sonic-fabric-port";
prefix fabric-port;

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 string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use Boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. I will revise it to use type stypes:boolean_type where stypes is sonic-types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. See latest commit. I'm waiting for the pipeline build to complete to check if any further revisions are needed.

pattern "False|True";
}
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 */