diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 7ef362c008b..eca1ad97ac5 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -47,6 +47,12 @@ './yang-models/sonic-bgp-neighbor.yang', './yang-models/sonic-bgp-peergroup.yang', './yang-models/sonic-breakout_cfg.yang', + './yang-models/sonic-buffer-pg.yang', + './yang-models/sonic-buffer-pool.yang', + './yang-models/sonic-buffer-port-ingress-profile-list.yang', + './yang-models/sonic-buffer-port-egress-profile-list.yang', + './yang-models/sonic-buffer-profile.yang', + './yang-models/sonic-buffer-queue.yang', './yang-models/sonic-copp.yang', './yang-models/sonic-crm.yang', './yang-models/sonic-device_metadata.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 35cb2207410..39bac43a428 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -4,6 +4,75 @@ "Vrf_blue": { } }, + "BUFFER_POOL": { + "ingress_lossy_pool": { + "mode": "static", + "size": "33004032", + "type": "ingress" + }, + "ingress_lossless_pool": { + "mode": "static", + "size": "33004032", + "xoff": "196608", + "type": "ingress" + }, + "egress_lossless_pool": { + "mode": "static", + "size": "33004032", + "xoff": "196608", + "type": "egress" + }, + "egress_lossy_pool": { + "size": "12766208", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "pg_lossless_100000_300m_profile": { + "dynamic_th": "1", + "pool": "ingress_lossless_pool", + "size": "9427", + "xoff": "50176", + "xon": "0", + "xon_offset": "3584" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "Ethernet9|3-4": { + "profile": "pg_lossless_100000_300m_profile" + } + }, + "BUFFER_QUEUE": { + "Ethernet10|4": { + "profile": "egress_lossy_profile" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet9": { + "profile_list": ["ingress_lossy_profile"] + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet9": { + "profile_list": ["egress_lossless_profile", "egress_lossy_profile"] + } + }, "PORTCHANNEL": { "PortChannel0003": { "admin_status": "up", @@ -285,9 +354,9 @@ "global": { "vrf": "mgmt", "src_intf": [ - "eth0", - "Loopback0" - ] + "eth0", + "Loopback0" + ] } }, "NTP_SERVER": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json new file mode 100644 index 00000000000..f92a75365c7 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json @@ -0,0 +1,17 @@ +{ + "BUFFER_PG_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_PG_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_PG_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_PG_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_PG_WRONG_PG_VALUE": { + "desc": "BUFFER_PG_WRONG_PG_VALUE pattern failure", + "eStr": "Invalid Buffer PG number" + }, + "BUFFER_PG_WRONG_PORT_VALUE": { + "desc": "BUFFER_PG_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json new file mode 100644 index 00000000000..907fa9101ab --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json @@ -0,0 +1,40 @@ +{ + "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE": { + "desc": "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE no failure." + }, + "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE": { + "desc": "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE no failure." + }, + "BUFFER_POOL_WRONG_TYPE_VALUE": { + "desc": "BUFFER_POOL_WRONG_TYPE_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_MANDATORY_TYPE_VALUE": { + "desc": "BUFFER_POOL_MANDATORY_TYPE_VALUE no type.", + "eStrKey": "Mandatory" + }, + "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE": { + "desc": "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE no failure." + }, + "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE": { + "desc": "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE no failure." + }, + "BUFFER_POOL_WRONG_MODE_VALUE": { + "desc": "BUFFER_POOL_WRONG_MODE_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_CORRECT_XOFF_VALUE": { + "desc": "BUFFER_POOL_CORRECT_XOFF_VALUE no failure." + }, + "BUFFER_POOL_WRONG_XOFF_VALUE": { + "desc": "BUFFER_POOL_WRONG_XOFF_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_CORRECT_SIZE_VALUE": { + "desc": "BUFFER_POOL_CORRECT_SIZE_VALUE no failure." + }, + "BUFFER_POOL_WRONG_SIZE_VALUE": { + "desc": "BUFFER_POOL_WRONG_SIZE_VALUE pattern failure.", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json new file mode 100644 index 00000000000..a7b766974a7 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json @@ -0,0 +1,13 @@ +{ + "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json new file mode 100644 index 00000000000..5ed19ce3e47 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json @@ -0,0 +1,13 @@ +{ + "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json new file mode 100644 index 00000000000..c5591c42ed4 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json @@ -0,0 +1,68 @@ +{ + "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE pattern failure.", + "eStr": "-1" + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MIN_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MIN_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MAX_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MAX_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1": { + "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1 no failure.", + "eStrKey": "Range" + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2": { + "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2 no failure.", + "eStrKey": "Range" + }, + "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_SIZE_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_SIZE_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_SIZE_VALUE pattern failure.", + "eStr": "-1" + }, + "BUFFER_PROFILE_MANDATORY_SIZE_VALUE": { + "desc": "BUFFER_PROFILE_MANDATORY_SIZE_VALUE pattern failure.", + "eStrKey": "Mandatory" + }, + "BUFFER_PROFILE_CORRECT_POOL_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_POOL_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_POOL_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_POOL_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_PROFILE_MANDATORY_POOL_VALUE": { + "desc": "BUFFER_PROFILE_MANDATORY_POOL_VALUE pattern failure.", + "eStrKey": "Mandatory" + }, + "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_XON_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_XON_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_XOFF_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_XOFF_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_STATIC": { + "desc": "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_STATIC no failure." + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_DYNAMIC": { + "desc": "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_DYNAMIC no failure." + }, + "BUFFER_PROFILE_WRONG_HEADROOM_TYPE": { + "desc": "BUFFER_PROFILE_WRONG_HEADROOM_TYPE no failure.", + "eStr": "Invalid" + }, + "BUFFER_PROFILE_WRONG_XOFF_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_XOFF_VALUE no failure.", + "eStr": "-1" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json new file mode 100644 index 00000000000..d6e05eeafb4 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json @@ -0,0 +1,17 @@ +{ + "BUFFER_QUEUE_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_QUEUE_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_QUEUE_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_QUEUE_WRONG_QUEUE_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_QUEUE_VALUE pattern failure", + "eStr": "Invalid Q-index" + }, + "BUFFER_QUEUE_WRONG_PORT_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json new file mode 100644 index 00000000000..ec3ea73bf76 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json @@ -0,0 +1,208 @@ +{ + "BUFFER_PG_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_PG_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "wrong" + } + ] + } + } + }, + "BUFFER_PG_WRONG_PG_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "9", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_PG_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "wrong", + "pg_num": "4", + "profile": "lossless_buffer_profile" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json new file mode 100644 index 00000000000..8a0005305fa --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json @@ -0,0 +1,157 @@ +{ + "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "egress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_TYPE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "wrong" + } + ] + } + } + }, + "BUFFER_POOL_MANDATORY_TYPE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "dynamic", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_MODE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "wrong", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "xoff": "300", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "xoff": "wrong", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "wrong", + "type": "ingress" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json new file mode 100644 index 00000000000..72e31ef9c34 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json @@ -0,0 +1,160 @@ +{ + "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "egress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + }, + { + "name": "lossless_buffer_profile2", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": { + "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] + } + ] + } + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "egress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": { + "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["wrong"] + } + ] + } + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "egress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": { + "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "wrong", + "profile_list": ["lossless_buffer_profile"] + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json new file mode 100644 index 00000000000..aef66e1b014 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json @@ -0,0 +1,160 @@ +{ + "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + }, + { + "name": "lossless_buffer_profile2", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-ingress-profile-list:sonic-buffer-port-ingress-profile-list": { + "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] + } + ] + } + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-ingress-profile-list:sonic-buffer-port-ingress-profile-list": { + "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["wrong"] + } + ] + } + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-ingress-profile-list:sonic-buffer-port-ingress-profile-list": { + "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "wrong", + "profile_list": ["lossless_buffer_profile"] + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json new file mode 100644 index 00000000000..b6daa30abad --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json @@ -0,0 +1,604 @@ +{ + "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "static_th": "-1" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_THRESHOLD_TYPE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "wrong_th": "1234" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_NO_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MIN_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "-8" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MAX_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "7" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "-9" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "8" + } + ] + } + } + }, + "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518" + } + ] + } + } + }, + "BUFFER_PROFILE_DUAL_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "dynamic_th": "3", + "static_th": "3", + "size": "1518" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "-1", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_MANDATORY_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_POOL_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "size": "0", + "static_th": "33004032", + "pool": "egress_lossless_pool" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_POOL_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "size": "0", + "static_th": "33004032", + "pool": "wrong" + } + ] + } + } + }, + "BUFFER_PROFILE_MANDATORY_POOL_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "size": "0", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xon_offset": "3584" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XON_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xon": "2560" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_STATIC": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "headroom_type": "static" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_DYNAMIC": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "headroom_type": "dynamic" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_HEADROOM_TYPE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "headroom_type": "Invalid" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xoff": "196608" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xoff": "-1" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json new file mode 100644 index 00000000000..e737c129682 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json @@ -0,0 +1,211 @@ +{ + "BUFFER_QUEUE_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": 1518, + "dynamic_th": "2", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "Ethernet4", + "qindex": "15", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "Ethernet4", + "qindex": "3", + "profile": "wrong" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_QUEUE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "Ethernet4", + "qindex": "16", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "wrong", + "qindex": "4", + "profile": "lossless_buffer_profile" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang new file mode 100644 index 00000000000..efe6e34ad0d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang @@ -0,0 +1,66 @@ +module sonic-buffer-pg { + namespace "http://github.com/Azure/sonic-buffer-pg"; + prefix bpg; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PG"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-pg { + + container BUFFER_PG { + + list BUFFER_PG_LIST { + key "port pg_num"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf pg_num { + type string { + pattern "[0-7]((-)[0-7])?" { + error-message "Invalid Buffer PG number"; + error-app-tag pg-num-invalid; + } + } + description "Priority Group number"; + } + + leaf profile { + default 0; + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "Buffer Profile associated with Priority Group number for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang new file mode 100644 index 00000000000..c59d4ec66ab --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang @@ -0,0 +1,62 @@ +module sonic-buffer-pool { + namespace "http://github.com/Azure/sonic-buffer-pool"; + prefix bpl; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER POOL"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + container sonic-buffer-pool { + + container BUFFER_POOL { + + list BUFFER_POOL_LIST { + key "name"; + + leaf name { + type string; + description "Buffer Pool name"; + } + + leaf type { + mandatory true; + type enumeration { + enum ingress; + enum egress; + } + description "Buffer Pool Type"; + } + + leaf mode { + mandatory true; + type enumeration { + enum static; + enum dynamic; + } + description "Buffer Pool Mode"; + } + + leaf size { + type uint64; + description "Buffer Pool Size (in Bytes)"; + } + + leaf xoff { + default 0; + type uint64; + description "Buffer Pool Xoff Threshold (in Bytes)"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang new file mode 100644 index 00000000000..10af27b7745 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang @@ -0,0 +1,55 @@ +module sonic-buffer-port-egress-profile-list { + namespace "http://github.com/Azure/sonic-buffer-port-egress-profile-list"; + prefix bpg; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PORT EGRESS PROFILE LIST"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-port-egress-profile-list { + + container BUFFER_PORT_EGRESS_PROFILE_LIST { + list BUFFER_PORT_EGRESS_PROFILE_LIST_LIST { + + key "port"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf-list profile_list { + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "a list of references to BUFFER_PROFILE_TABLE object for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang new file mode 100644 index 00000000000..603f50bf2ec --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang @@ -0,0 +1,55 @@ +module sonic-buffer-port-ingress-profile-list { + namespace "http://github.com/Azure/sonic-buffer-port-ingress-profile-list"; + prefix bpg; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PORT INGRESS PROFILE LIST"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-port-ingress-profile-list { + + container BUFFER_PORT_INGRESS_PROFILE_LIST { + list BUFFER_PORT_INGRESS_PROFILE_LIST_LIST { + + key "port"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf-list profile_list { + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "a list of references to BUFFER_PROFILE_TABLE object for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang new file mode 100644 index 00000000000..204e8aa796b --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -0,0 +1,91 @@ +module sonic-buffer-profile { + namespace "http://github.com/Azure/sonic-buffer-profile"; + prefix bpf; + + import sonic-buffer-pool { + prefix bpl; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PROFILE"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-profile { + + container BUFFER_PROFILE { + + list BUFFER_PROFILE_LIST { + key "name"; + + leaf name { + type string; + description "Buffer Profile name"; + } + + leaf static_th { + type uint64; + description "The maximum size of the buffer pool the port can occupy"; + } + + leaf dynamic_th { + type int32 { + range "-8..7"; + } + description "The maximum proportion of the free size of the buffer pool the port can occupy (Alpha value)"; + } + + leaf size { + mandatory true; + type uint64; + description "Reserved Size"; + } + + leaf pool { + mandatory true; + type leafref { + path "/bpl:sonic-buffer-pool/bpl:BUFFER_POOL/bpl:BUFFER_POOL_LIST/bpl:name"; + } + description "Buffer Pool name defined in BUFFER_POOL"; + } + + leaf xon_offset { + type uint64; + default 0; + description "Xon Offset Threshold for ingress PG. Triggered if total buffer usage <= max(xon, total buffer limit - xon_offset)"; + } + + leaf xon { + type uint64; + default 0; + description "Xon Threshold for ingress PG"; + } + + leaf xoff { + type uint64; + default 0; + description "Xoff Threshold for ingress PG"; + } + + leaf headroom_type { + default static; + type enumeration { + enum static; + enum dynamic; + } + description "Profile is dynamically calculated or user configured"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang new file mode 100644 index 00000000000..f8c951aa4dd --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang @@ -0,0 +1,66 @@ +module sonic-buffer-queue { + namespace "http://github.com/Azure/sonic-buffer-queue"; + prefix bqueue; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER QUEUE"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-queue { + + container BUFFER_QUEUE { + + list BUFFER_QUEUE_LIST { + key "port qindex"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf qindex { + type string { + pattern "(1[0-5]|[0-9])((-)(1[0-5]|[0-9]))?"{ + error-message "Invalid Q-index"; + error-app-tag qindex-invalid; + } + } + description "Egress Queue Index for a port"; + } + + leaf profile { + default 0; + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "Buffer Profile associated with Priority Queue for a port"; + } + + } + } + } +}