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 4f4cdb841465..3c0e17085e5c 100644 --- a/src/sonic-config-engine/tests/test_cfggen_from_yang.py +++ b/src/sonic-config-engine/tests/test_cfggen_from_yang.py @@ -265,6 +265,17 @@ def test_vlan_crm(self): } }) + 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" + } + }) + def test_fabric_monitor_data_table(self): arg = ["--var-json", "FABRIC_MONITOR"] output = json.loads(self.run_script_with_yang_arg(arg)) diff --git a/src/sonic-config-engine/tests/test_yang_data.json b/src/sonic-config-engine/tests/test_yang_data.json index 51a1c6a94590..bd4bd26b70a6 100644 --- a/src/sonic-config-engine/tests/test_yang_data.json +++ b/src/sonic-config-engine/tests/test_yang_data.json @@ -379,6 +379,20 @@ } } }, + + "sonic-fabric-port:sonic-fabric-port": { + "sonic-fabric-port:FABRIC_PORT": { + "FABRIC_PORT_LIST": [ + { + "name": "Fabric0", + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + } + ] + } + } + "sonic-fabric-monitor:sonic-fabric-monitor": { "sonic-fabric-monitor:FABRIC_MONITOR": { "FABRIC_MONITOR_DATA": { diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index eccf550ecef9..e15a9e1fe8b7 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -30,6 +30,7 @@ Table of Contents * [Device neighbor metada](#device-neighbor-metada) * [DHCP_RELAY](#dhcp_relay) * [DSCP_TO_TC_MAP](#dscp_to_tc_map) + * [FABRIC_PORT](#fabric-port) * [FG_NHG](#fg_nhg) * [FG_NHG_MEMBER](#fg_nhg_member) * [FG_NHG_PREFIX](#fg_nhg_prefix) @@ -1060,6 +1061,26 @@ 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 4369b5b1d335..5b30b3e8d8db 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -116,6 +116,7 @@ def run(self): './yang-models/sonic-events-swss.yang', './yang-models/sonic-events-syncd.yang', './yang-models/sonic-extension.yang', + './yang-models/sonic-fabric-port.yang', './yang-models/sonic-fabric-monitor.yang', './yang-models/sonic-flex_counter.yang', './yang-models/sonic-fine-grained-ecmp.yang', @@ -206,6 +207,7 @@ def run(self): './cvlyang-models/sonic-events-syncd.yang', './cvlyang-models/sonic-device_neighbor_metadata.yang', './cvlyang-models/sonic-extension.yang', + './cvlyang-models/sonic-fabric-port.yang', './cvlyang-models/sonic-fabric-monitor.yang', './cvlyang-models/sonic-flex_counter.yang', './cvlyang-models/sonic-feature.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 c9d3cfec61b8..b51fa11f87f2 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1263,6 +1263,18 @@ "allow_insecure": "false" } }, + "FABRIC_PORT": { + "Fabric0": { + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + }, + "Fabric1": { + "alias": "Fabric1", + "isolateStatus": "False", + "lanes": "1" + } + }, "FABRIC_MONITOR": { "FABRIC_MONITOR_DATA": { "monErrThreshCrcCells": "1", 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 000000000000..8c8db3ca1655 --- /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 000000000000..278834826120 --- /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 000000000000..d9a00ca335d8 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-fabric-port.yang @@ -0,0 +1,59 @@ +module sonic-fabric-port{ + + yang-version 1.1; + + namespace "http://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 { + 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 */