diff --git a/src/sonic-config-engine/tests/test_cfggen_from_yang.py b/src/sonic-config-engine/tests/test_cfggen_from_yang.py index 4f4cdb8414..5886b2cc88 100644 --- a/src/sonic-config-engine/tests/test_cfggen_from_yang.py +++ b/src/sonic-config-engine/tests/test_cfggen_from_yang.py @@ -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" + } + }) diff --git a/src/sonic-config-engine/tests/test_yang_data.json b/src/sonic-config-engine/tests/test_yang_data.json index 51a1c6a945..41aab043d4 100644 --- a/src/sonic-config-engine/tests/test_yang_data.json +++ b/src/sonic-config-engine/tests/test_yang_data.json @@ -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" + } + ] + } } } diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 046c38e9d9..8e192748c9 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -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 ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 8ba2951a7a..d94b7a33d3 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -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', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 1bccc1792b..e758450e20 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -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" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_port.json new file mode 100644 index 0000000000..8c8db3ca16 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_port.json @@ -0,0 +1,5 @@ +{ + "FABRIC_PORT_POSITIVE_CONFIG": { + "desc": "Configure FABRIC_PORT no failure." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_port.json new file mode 100644 index 0000000000..2788348261 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_port.json @@ -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" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-fabric-port.yang b/src/sonic-yang-models/yang-models/sonic-fabric-port.yang new file mode 100644 index 0000000000..f2266507de --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-fabric-port.yang @@ -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 */