From b87a2c4da7434506804ec64680178c36101dc8eb Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Tue, 8 Jun 2021 22:37:16 +0530 Subject: [PATCH 01/20] Adding mmu buffer yang files --- .../yang-models/sonic-buffer-pg.yang | 66 ++++++++++++++++++ .../yang-models/sonic-buffer-pool.yang | 51 ++++++++++++++ .../yang-models/sonic-buffer-profile.yang | 67 +++++++++++++++++++ .../yang-models/sonic-buffer-queue.yang | 65 ++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 src/sonic-yang-models/yang-models/sonic-buffer-pg.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-buffer-pool.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-buffer-profile.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-buffer-queue.yang 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 000000000000..74cf19e5d6a1 --- /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 2019-05-15 { + description + "Initial revision."; + } + + + container sonic-buffer-pg { + + container BUFFER_PG { + + list BUFFER_PG_LIST { + key "ifname pg_num"; + sonic-ext:key-pattern "BUFFER_PG|{ifname}|{pg_num}"; //special pattern used for extracting keys from + //redis-key and fill populate the yang instance + // Total list instance = number(key1) * number(key2) * number(key3) + + leaf ifname { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:ifname"; + } + } + + leaf pg_num { + type string { + pattern "[0-7]((-)[0-7])?" { + error-message "Invalid Buffer PG number"; + error-app-tag pg-num-invalid; + } + } + } + + leaf profile { //Hash reference key + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + } + + } + } + } +} 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 000000000000..5f935b3f94a6 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang @@ -0,0 +1,51 @@ +module sonic-buffer-pool { + namespace "http://github.com/Azure/sonic-buffer-pool"; + prefix bpl; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER POOL"; + + revision 2019-05-15 { + description + "Initial revision."; + } + + container sonic-buffer-pool { + + container BUFFER_POOL { + + list BUFFER_POOL_LIST { + key "name"; + + leaf name { + type string; + } + + leaf type { + type enumeration { + enum ingress; + enum egress; + } + } + + leaf mode { + type enumeration { + enum static; + enum dynamic; + } + } + + leaf size { + type uint64; + } + + } + } + } +} 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 000000000000..71f077654dd4 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -0,0 +1,67 @@ +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 2019-05-15 { + description + "Initial revision."; + } + + + container sonic-buffer-profile { + + container BUFFER_PROFILE { + + list BUFFER_PROFILE_LIST { + key "name"; + + leaf name { + type string; + } + + leaf static_th { + type uint64; + } + + leaf dynamic_th { + type int64; + } + + leaf size { + type uint64; + } + + leaf pool { + type leafref { + path "/bpl:sonic-buffer-pool/bpl:BUFFER_POOL/bpl:BUFFER_POOL_LIST/bpl:name"; + } + } + + leaf xon_offset { + type uint64; + } + + leaf xon { + type uint64; + } + + leaf xoff { + type uint64; + } + } + } + } +} 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 000000000000..ea9ecce5e792 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang @@ -0,0 +1,65 @@ +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 2019-05-15 { + description + "Initial revision."; + } + + + container sonic-buffer-queue { + + container BUFFER_QUEUE { + + list BUFFER_QUEUE_LIST { + key "ifname qindex"; + sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance + // Total list instances = number(key1) * number(key2) * number(key3) + + leaf ifname { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:ifname"; + } + } + + leaf qindex { + type string { + pattern "[0-7]((-)[0-7])?"{ + error-message "Invalid Q-index"; + error-app-tag qindex-invalid; + } + } + } + + leaf profile { //Hash reference key + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + } + + } + } + } +} From 46a13206a724cde56a5500f90028e1448dd3fa85 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 21 Jun 2021 09:29:00 +0530 Subject: [PATCH 02/20] Test files for mmu buffer yang files --- src/sonic-yang-models/setup.py | 4 + .../tests/files/sample_config_db.json | 19 ++ .../yang_model_tests/tests/buffer_pg.json | 17 ++ .../yang_model_tests/tests/buffer_pool.json | 29 +++ .../tests/buffer_profile.json | 39 ++++ .../yang_model_tests/tests/buffer_queue.json | 17 ++ .../tests_config/buffer_pg.json | 206 ++++++++++++++++++ .../tests_config/buffer_pool.json | 114 ++++++++++ .../tests_config/buffer_profile.json | 162 ++++++++++++++ .../tests_config/buffer_queue.json | 206 ++++++++++++++++++ 10 files changed, 813 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index d511b9898a5a..affb543ca441 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -43,6 +43,10 @@ data_files=[ ('yang-models', ['./yang-models/sonic-acl.yang', './yang-models/sonic-breakout_cfg.yang', + './yang-models/sonic-buffer-pool.yang', + './yang-models/sonic-buffer-profile.yang', + './yang-models/sonic-buffer-pg.yang', + './yang-models/sonic-buffer-queue.yang', './yang-models/sonic-crm.yang', './yang-models/sonic-device_metadata.yang', './yang-models/sonic-device_neighbor.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 ce18c538fee5..243b98417c9a 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,25 @@ "Vrf_blue": { } }, + "BUFFER_POOL|egress_lossless_pool": { + "mode": "static", + "size": "33004032", + "type": "egress" + }, + "BUFFER_PFOFILE|pg_lossless_100000_300m_profile": { + "dynamic_th": "1", + "pool": "[BUFFER_POOL|egress_lossless_pool]", + "size": "9427", + "xoff": "50176", + "xon": "0", + "xon_offset": "3584" + }, + "BUFFER_PG|Ethernet9|3-4": { + "profile": "[BUFFER_PROFILE|pg_lossless_25000_300m_profile]" + }, + "BUFFER_QUEUE|Ethernet46|4": { + "profile": "[BUFFER_PROFILE|egress_lossy_profile]" + }, "PORTCHANNEL": { "PortChannel0003": { "admin_status": "up", 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 000000000000..b5235ba86b02 --- /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_INTERFACE_VALUE": { + "desc": "BUFFER_PG_WRONG_INTERFACE_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 000000000000..899631437484 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json @@ -0,0 +1,29 @@ +{ + "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_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_SIZE_VALUE": { + "desc": "BUFFER_POOL_CORRECT_SIZE_VALUE no failure." + }, + "BUFFER_POOL_WRONG_SIZE_VALUE": { + "desc": "BUFFER_POOL_WRONG_SIZE_VALUE no 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 000000000000..c70991cb54be --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json @@ -0,0 +1,39 @@ +{ + "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_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_VALUE no failure." + }, + "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_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_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_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 000000000000..5fc4a99a0381 --- /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_INTERFACE_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_INTERFACE_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 000000000000..4653f9b0aff9 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json @@ -0,0 +1,206 @@ +{ + "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", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "ifname": "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": [ + { + "ifname": "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": [ + { + "ifname": "Ethernet4", + "pg_num": "9", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_PG_WRONG_INTERFACE_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": [ + { + "ifname": "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 000000000000..056e19f538e7 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json @@ -0,0 +1,114 @@ +{ + "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": 300, + "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": "dynamic", + "size": 300, + "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": 300, + "type": "wrong" + } + ] + } + } + }, + "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": 300, + "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": 300, + "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": 300, + "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": 300, + "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_profile.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json new file mode 100644 index 000000000000..1efc9e576cb8 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json @@ -0,0 +1,162 @@ +{ + "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "size": 300, + "static_th": "1121212" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "size": 300, + "static_th": "-1" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "dynamic_th": "232323" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "size": 300, + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_SIZE_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "size": -1, + "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": 300, + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "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": 300, + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "pool": "wrong" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "xon_offset": "3584" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XON_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "xon": "2560" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XOFF_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "xoff": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_XOFF_VALUE": { + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "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 000000000000..9525102187fc --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json @@ -0,0 +1,206 @@ +{ + "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": 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-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "ifname": "Ethernet4", + "qindex": "3", + "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": 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-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "ifname": "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": 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-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "ifname": "Ethernet4", + "qindex": "9", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_INTERFACE_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-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "ifname": "wrong", + "qindex": "4", + "profile": "lossless_buffer_profile" + } + ] + } + } + } +} From 145a6cbba21f9a217a28608f9b4eff64953dc062 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 21 Jun 2021 09:59:36 +0530 Subject: [PATCH 03/20] Updated yang files(commented sonic-ext and updated Port path --- src/sonic-yang-models/yang-models/sonic-buffer-pg.yang | 4 ++-- src/sonic-yang-models/yang-models/sonic-buffer-queue.yang | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang index 74cf19e5d6a1..b28528063132 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang @@ -35,13 +35,13 @@ module sonic-buffer-pg { list BUFFER_PG_LIST { key "ifname pg_num"; - sonic-ext:key-pattern "BUFFER_PG|{ifname}|{pg_num}"; //special pattern used for extracting keys from + //sonic-ext:key-pattern "BUFFER_PG|{ifname}|{pg_num}"; //special pattern used for extracting keys from //redis-key and fill populate the yang instance // Total list instance = number(key1) * number(key2) * number(key3) leaf ifname { type leafref { - path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:ifname"; + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; } } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang index ea9ecce5e792..d5f886a869a5 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang @@ -35,12 +35,12 @@ module sonic-buffer-queue { list BUFFER_QUEUE_LIST { key "ifname qindex"; - sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance + //sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance // Total list instances = number(key1) * number(key2) * number(key3) leaf ifname { type leafref { - path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:ifname"; + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; } } From 766a097219da2775d055d423aea8dd743d76a323 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 21 Jun 2021 11:23:45 +0530 Subject: [PATCH 04/20] Updated yang files(Splitted the BUFFER table's name) --- .../tests/files/sample_config_db.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 243b98417c9a..564696bdec3b 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -4,24 +4,32 @@ "Vrf_blue": { } }, - "BUFFER_POOL|egress_lossless_pool": { + "BUFFER_POOL": { + "egress_lossless_pool": { "mode": "static", "size": "33004032", "type": "egress" + } }, - "BUFFER_PFOFILE|pg_lossless_100000_300m_profile": { + "BUFFER_PFOFILE": { + "pg_lossless_100000_300m_profile": { "dynamic_th": "1", "pool": "[BUFFER_POOL|egress_lossless_pool]", "size": "9427", "xoff": "50176", "xon": "0", "xon_offset": "3584" + } }, - "BUFFER_PG|Ethernet9|3-4": { + "BUFFER_PG": { + "Ethernet9|3-4": { "profile": "[BUFFER_PROFILE|pg_lossless_25000_300m_profile]" + } }, - "BUFFER_QUEUE|Ethernet46|4": { + "BUFFER_QUEUE": { + "Ethernet46|4": { "profile": "[BUFFER_PROFILE|egress_lossy_profile]" + } }, "PORTCHANNEL": { "PortChannel0003": { From c9e6c4d6e2a0e6a055c5dd343f726c0630196043 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 21 Jun 2021 11:58:14 +0530 Subject: [PATCH 05/20] Updated sonic_config_db.json for BUFFER pool/profile/pg/queue --- .../tests/files/sample_config_db.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 564696bdec3b..85d94d50a46d 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -9,9 +9,14 @@ "mode": "static", "size": "33004032", "type": "egress" + }, + "egress_lossy_pool": { + "size": "12766208", + "type": "egress", + "mode": "dynamic" } }, - "BUFFER_PFOFILE": { + "BUFFER_PROFILE": { "pg_lossless_100000_300m_profile": { "dynamic_th": "1", "pool": "[BUFFER_POOL|egress_lossless_pool]", @@ -19,11 +24,16 @@ "xoff": "50176", "xon": "0", "xon_offset": "3584" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" } }, "BUFFER_PG": { "Ethernet9|3-4": { - "profile": "[BUFFER_PROFILE|pg_lossless_25000_300m_profile]" + "profile": "[BUFFER_PROFILE|pg_lossless_100000_300m_profile]" } }, "BUFFER_QUEUE": { From 9bf4c6113447c589c4b5934c1615f72e62506b86 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 21 Jun 2021 12:13:06 +0530 Subject: [PATCH 06/20] Rectified sample_config_db.json --- src/sonic-yang-models/tests/files/sample_config_db.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 85d94d50a46d..e10cb4483d36 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -19,26 +19,26 @@ "BUFFER_PROFILE": { "pg_lossless_100000_300m_profile": { "dynamic_th": "1", - "pool": "[BUFFER_POOL|egress_lossless_pool]", + "pool": "egress_lossless_pool", "size": "9427", "xoff": "50176", "xon": "0", "xon_offset": "3584" }, "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", + "pool":"egress_lossy_pool", "size":"1518", "dynamic_th":"3" } }, "BUFFER_PG": { "Ethernet9|3-4": { - "profile": "[BUFFER_PROFILE|pg_lossless_100000_300m_profile]" + "profile": "pg_lossless_100000_300m_profile" } }, "BUFFER_QUEUE": { "Ethernet46|4": { - "profile": "[BUFFER_PROFILE|egress_lossy_profile]" + "profile": "egress_lossy_profile" } }, "PORTCHANNEL": { From e62fa56690b6285e191a4f4958e001eb59143d11 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 21 Jun 2021 12:28:25 +0530 Subject: [PATCH 07/20] Rectified sample_config_db.json --- src/sonic-yang-models/tests/files/sample_config_db.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e10cb4483d36..d7491ed9d2c9 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -37,7 +37,7 @@ } }, "BUFFER_QUEUE": { - "Ethernet46|4": { + "Ethernet10|4": { "profile": "egress_lossy_profile" } }, From 218178e59552ea3f8109f05b4bfeac0d3cf03de6 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Sun, 11 Jul 2021 12:10:00 -0700 Subject: [PATCH 08/20] Addressed Review comments, added more test cases and ing/egr profile list --- src/sonic-yang-models/setup.py | 2 + .../yang_model_tests/tests/buffer_pg.json | 10 +- .../yang_model_tests/tests/buffer_pool.json | 37 +- .../tests/buffer_profile.json | 45 +- .../yang_model_tests/tests/buffer_queue.json | 10 +- .../tests/port_egress_profile_list.json | 13 + .../tests/port_ingress_profile_list.json | 13 + .../tests_config/buffer_pg.json | 204 +++--- .../tests_config/buffer_pool.json | 280 ++++---- .../tests_config/buffer_profile.json | 630 +++++++++++++----- .../tests_config/buffer_queue.json | 207 +++--- .../port_egress_profile_list.json | 160 +++++ .../port_ingress_profile_list.json | 160 +++++ .../yang-models/sonic-buffer-pg.yang | 98 +-- .../yang-models/sonic-buffer-pool.yang | 110 +-- .../yang-models/sonic-buffer-profile.yang | 155 +++-- .../yang-models/sonic-buffer-queue.yang | 97 +-- .../sonic-port-egress-profile-list.yang | 55 ++ .../sonic-port-ingress-profile-list.yang | 55 ++ 19 files changed, 1626 insertions(+), 715 deletions(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/port_egress_profile_list.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json create mode 100644 src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index d85e938676d1..2ed0f5f8679e 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -66,6 +66,8 @@ './yang-models/sonic-nat.yang', './yang-models/sonic-port.yang', './yang-models/sonic-portchannel.yang', + './yang-models/sonic-port-ingress-profile-list.yang', + './yang-models/sonic-port-egress-profile-list.yang', './yang-models/sonic-route-common.yang', './yang-models/sonic-route-map.yang', './yang-models/sonic-routing-policy-sets.yang', 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 index b5235ba86b02..f92a75365c78 100644 --- 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 @@ -4,14 +4,14 @@ }, "BUFFER_PG_WRONG_PROFILE_VALUE": { "desc": "BUFFER_PG_WRONG_PROFILE_VALUE pattern failure", - "eStr": ["wrong" ] + "eStr": "wrong" }, "BUFFER_PG_WRONG_PG_VALUE": { "desc": "BUFFER_PG_WRONG_PG_VALUE pattern failure", - "eStr": ["Invalid Buffer PG number" ] + "eStr": "Invalid Buffer PG number" }, - "BUFFER_PG_WRONG_INTERFACE_VALUE": { - "desc": "BUFFER_PG_WRONG_INTERFACE_VALUE pattern failure", - "eStr": ["wrong"] + "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 index 899631437484..12b05a053207 100644 --- 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 @@ -1,29 +1,44 @@ { "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE": { - "desc": "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE no failure." + "desc": "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE no failure." }, "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE": { - "desc": "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE no failure." + "desc": "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE no failure." }, "BUFFER_POOL_WRONG_TYPE_VALUE": { - "desc": "BUFFER_POOL_WRONG_TYPE_VALUE pattern failure.", - "eStr": ["wrong" ] + "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." + "desc": "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE no failure." }, "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE": { - "desc": "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE no failure." + "desc": "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE no failure." }, "BUFFER_POOL_WRONG_MODE_VALUE": { - "desc": "BUFFER_POOL_WRONG_MODE_VALUE pattern failure.", - "eStr": ["wrong" ] + "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." + "desc": "BUFFER_POOL_CORRECT_SIZE_VALUE no failure." }, "BUFFER_POOL_WRONG_SIZE_VALUE": { - "desc": "BUFFER_POOL_WRONG_SIZE_VALUE no failure.", - "eStr": ["wrong" ] + "desc": "BUFFER_POOL_WRONG_SIZE_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_MANDATORY_SIZE_VALUE": { + "desc": "BUFFER_POOL_MANDATORY_SIZE_VALUE no size.", + "eStrKey": "Mandatory" } } 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 index c70991cb54be..bbcad1d11791 100644 --- 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 @@ -1,27 +1,54 @@ { "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { - "desc": "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE no failure." + "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" ] + "eStr": "-1" }, - "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_VALUE": { - "desc": "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_VALUE no failure." + "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.", + "eStr": "Invalid" + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2": { + "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2 no failure.", + "eStr": "Invalid" + }, + "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE": { + "desc": "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE pattern failure.", + "eStr": "Missing" + }, + "BUFFER_PROFILE_DUAL_THRESHOLD_VALUE": { + "desc": "BUFFER_PROFILE_DUAL_THRESHOLD_VALUE pattern failure.", + "eStr": "Data for more than one case branch of \"threshold\" choice present." }, "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { - "desc": "BUFFER_PROFILE_CORRECT_SIZE_VALUE no failure." + "desc": "BUFFER_PROFILE_CORRECT_SIZE_VALUE no failure." }, "BUFFER_PROFILE_WRONG_SIZE_VALUE": { - "desc": "BUFFER_PROFILE_WRONG_SIZE_VALUE pattern failure.", - "eStr": ["-1" ] + "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" ] + "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." @@ -34,6 +61,6 @@ }, "BUFFER_PROFILE_WRONG_XOFF_VALUE": { "desc": "BUFFER_PROFILE_WRONG_XOFF_VALUE no failure.", - "eStr": ["-1" ] + "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 index 5fc4a99a0381..d6e05eeafb4b 100644 --- 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 @@ -4,14 +4,14 @@ }, "BUFFER_QUEUE_WRONG_PROFILE_VALUE": { "desc": "BUFFER_QUEUE_WRONG_PROFILE_VALUE pattern failure", - "eStr": ["wrong" ] + "eStr": "wrong" }, "BUFFER_QUEUE_WRONG_QUEUE_VALUE": { "desc": "BUFFER_QUEUE_WRONG_QUEUE_VALUE pattern failure", - "eStr": ["Invalid Q-index" ] + "eStr": "Invalid Q-index" }, - "BUFFER_QUEUE_WRONG_INTERFACE_VALUE": { - "desc": "BUFFER_QUEUE_WRONG_INTERFACE_VALUE pattern failure", - "eStr": ["wrong"] + "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/port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port_egress_profile_list.json new file mode 100644 index 000000000000..309a36ef8dcb --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port_egress_profile_list.json @@ -0,0 +1,13 @@ +{ + "PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "desc": "PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" + }, + "PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "desc": "PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "desc": "PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json new file mode 100644 index 000000000000..25428adebe44 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json @@ -0,0 +1,13 @@ +{ + "PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "desc": "PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" + }, + "PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "desc": "PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "desc": "PORT_INGRESS_PROFILE_LIST_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 index 4653f9b0aff9..ec3ea73bf76d 100644 --- 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 @@ -3,49 +3,51 @@ "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 - } + { + "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" - } + { + "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" - } + { + "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": [ - { - "ifname": "Ethernet4", - "pg_num": "3", - "profile": "lossless_buffer_profile" - } + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "lossless_buffer_profile" + } ] } } @@ -54,49 +56,49 @@ "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 - } + { + "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" - } + { + "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" - } + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } ] } }, "sonic-buffer-pg:sonic-buffer-pg": { "sonic-buffer-pg:BUFFER_PG": { "BUFFER_PG_LIST": [ - { - "ifname": "Ethernet4", - "pg_num": "3", - "profile": "wrong" - } + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "wrong" + } ] } } @@ -105,100 +107,100 @@ "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 - } + { + "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" - } + { + "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" - } + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } ] } }, "sonic-buffer-pg:sonic-buffer-pg": { "sonic-buffer-pg:BUFFER_PG": { "BUFFER_PG_LIST": [ - { - "ifname": "Ethernet4", - "pg_num": "9", - "profile": "lossless_buffer_profile" - } + { + "port": "Ethernet4", + "pg_num": "9", + "profile": "lossless_buffer_profile" + } ] } } }, - "BUFFER_PG_WRONG_INTERFACE_VALUE": { + "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 - } + { + "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" - } + { + "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" - } + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } ] } }, "sonic-buffer-pg:sonic-buffer-pg": { "sonic-buffer-pg:BUFFER_PG": { "BUFFER_PG_LIST": [ - { - "ifname": "wrong", - "pg_num": "4", - "profile": "lossless_buffer_profile" - } + { + "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 index 056e19f538e7..04c721654fa5 100644 --- 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 @@ -1,114 +1,170 @@ { - "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": 300, - "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": "dynamic", - "size": 300, - "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": 300, - "type": "wrong" - } - ] - } - } - }, - "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": 300, - "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": 300, - "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": 300, - "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": 300, - "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" - } - ] - } - } - } + "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" + } + ] + } + } + }, + "BUFFER_POOL_MANDATORY_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "type": "ingress" + } + ] + } + } + } } 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 index 1efc9e576cb8..41e84f289b94 100644 --- 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 @@ -1,162 +1,472 @@ { - "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "size": 300, - "static_th": "1121212" - } - ] - } - } - }, - "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "size": 300, - "static_th": "-1" - } - ] - } - } - }, - "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "dynamic_th": "232323" - } - ] - } - } - }, - "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "size": 300, - "static_th": "33004032" - } - ] - } - } - }, - "BUFFER_PROFILE_WRONG_SIZE_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "size": -1, - "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": 300, - "type": "ingress" - } - ] - } - }, - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "testing", - "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": 300, - "type": "ingress" - } - ] - } - }, - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "testing", - "pool": "wrong" - } - ] - } - } - }, - "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "xon_offset": "3584" - } - ] - } - } - }, - "BUFFER_PROFILE_CORRECT_XON_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "xon": "2560" - } - ] - } - } - }, - "BUFFER_PROFILE_CORRECT_XOFF_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "xoff": "33004032" - } - ] - } - } - }, - "BUFFER_PROFILE_WRONG_XOFF_VALUE": { - "sonic-buffer-profile:sonic-buffer-profile": { - "sonic-buffer-profile:BUFFER_PROFILE": { - "BUFFER_PROFILE_LIST": [ - { - "name": "Ethernet4", - "xoff": "-1" - } - ] - } - } - } + "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_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": "-7" + } + ] + } + } + }, + "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": "3" + } + ] + } + } + }, + "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": "-8" + } + ] + } + } + }, + "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": "4" + } + ] + } + } + }, + "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_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 index 9525102187fc..e737c129682e 100644 --- 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 @@ -3,49 +3,51 @@ "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 - } + { + "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" - } + { + "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", - "pool": "egress_lossless_pool" - } + { + "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": [ - { - "ifname": "Ethernet4", - "qindex": "3", - "profile": "lossless_buffer_profile" - } + { + "port": "Ethernet4", + "qindex": "15", + "profile": "lossless_buffer_profile" + } ] } } @@ -54,49 +56,50 @@ "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 - } + { + "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" - } + { + "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", - "pool": "egress_lossless_pool" - } + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } ] } }, "sonic-buffer-queue:sonic-buffer-queue": { "sonic-buffer-queue:BUFFER_QUEUE": { "BUFFER_QUEUE_LIST": [ - { - "ifname": "Ethernet4", - "qindex": "3", - "profile": "wrong" - } + { + "port": "Ethernet4", + "qindex": "3", + "profile": "wrong" + } ] } } @@ -105,100 +108,102 @@ "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 - } + { + "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" - } + { + "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", - "pool": "egress_lossless_pool" - } + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } ] } }, "sonic-buffer-queue:sonic-buffer-queue": { "sonic-buffer-queue:BUFFER_QUEUE": { "BUFFER_QUEUE_LIST": [ - { - "ifname": "Ethernet4", - "qindex": "9", - "profile": "lossless_buffer_profile" - } + { + "port": "Ethernet4", + "qindex": "16", + "profile": "lossless_buffer_profile" + } ] } } }, - "BUFFER_QUEUE_WRONG_INTERFACE_VALUE": { + "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 - } + { + "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" - } + { + "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", - "pool": "egress_lossless_pool" - } + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } ] } }, "sonic-buffer-queue:sonic-buffer-queue": { "sonic-buffer-queue:BUFFER_QUEUE": { "BUFFER_QUEUE_LIST": [ - { - "ifname": "wrong", - "qindex": "4", - "profile": "lossless_buffer_profile" - } + { + "port": "wrong", + "qindex": "4", + "profile": "lossless_buffer_profile" + } ] } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json new file mode 100644 index 000000000000..3e3ddff7f19c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json @@ -0,0 +1,160 @@ +{ + "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-port-egress-profile-list:sonic-port-egress-profile-list": { + "sonic-port-egress-profile-list:PORT_EGRESS_PROFILE_LIST": { + "PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile": ["lossless_buffer_profile", "lossless_buffer_profile2"] + } + ] + } + } + }, + "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-port-egress-profile-list:sonic-port-egress-profile-list": { + "sonic-port-egress-profile-list:PORT_EGRESS_PROFILE_LIST": { + "PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile": ["wrong"] + } + ] + } + } + }, + "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-port-egress-profile-list:sonic-port-egress-profile-list": { + "sonic-port-egress-profile-list:PORT_EGRESS_PROFILE_LIST": { + "PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "wrong", + "profile": ["lossless_buffer_profile"] + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json new file mode 100644 index 000000000000..44bdfa6c47ad --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json @@ -0,0 +1,160 @@ +{ + "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-port-ingress-profile-list:sonic-port-ingress-profile-list": { + "sonic-port-ingress-profile-list:PORT_INGRESS_PROFILE_LIST": { + "PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile": ["lossless_buffer_profile", "lossless_buffer_profile2"] + } + ] + } + } + }, + "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-port-ingress-profile-list:sonic-port-ingress-profile-list": { + "sonic-port-ingress-profile-list:PORT_INGRESS_PROFILE_LIST": { + "PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile": ["wrong"] + } + ] + } + } + }, + "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-port-ingress-profile-list:sonic-port-ingress-profile-list": { + "sonic-port-ingress-profile-list:PORT_INGRESS_PROFILE_LIST": { + "PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "wrong", + "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 index b28528063132..efe6e34ad0d6 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang @@ -1,66 +1,66 @@ module sonic-buffer-pg { - namespace "http://github.com/Azure/sonic-buffer-pg"; - prefix bpg; + namespace "http://github.com/Azure/sonic-buffer-pg"; + prefix bpg; - import sonic-extension { - prefix sonic-ext; - } + import sonic-extension { + prefix sonic-ext; + } - import sonic-port { - prefix prt; - } + import sonic-port { + prefix prt; + } - import sonic-buffer-profile { - prefix bpf; - } + import sonic-buffer-profile { + prefix bpf; + } - organization - "SONiC"; + organization + "SONiC"; - contact - "SONiC"; + contact + "SONiC"; - description - "SONIC BUFFER PG"; + description + "SONIC BUFFER PG"; - revision 2019-05-15 { - description - "Initial revision."; - } + revision 2021-07-01 { + description + "Initial revision."; + } - container sonic-buffer-pg { + container sonic-buffer-pg { - container BUFFER_PG { + container BUFFER_PG { - list BUFFER_PG_LIST { - key "ifname pg_num"; - //sonic-ext:key-pattern "BUFFER_PG|{ifname}|{pg_num}"; //special pattern used for extracting keys from - //redis-key and fill populate the yang instance - // Total list instance = number(key1) * number(key2) * number(key3) + list BUFFER_PG_LIST { + key "port pg_num"; - leaf ifname { - type leafref { - path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; - } - } + 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; - } - } - } + 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 { //Hash reference key - type leafref { - path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; - } - } + 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 index 5f935b3f94a6..e99330a9de78 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang @@ -1,51 +1,63 @@ module sonic-buffer-pool { - namespace "http://github.com/Azure/sonic-buffer-pool"; - prefix bpl; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "SONIC BUFFER POOL"; - - revision 2019-05-15 { - description - "Initial revision."; - } - - container sonic-buffer-pool { - - container BUFFER_POOL { - - list BUFFER_POOL_LIST { - key "name"; - - leaf name { - type string; - } - - leaf type { - type enumeration { - enum ingress; - enum egress; - } - } - - leaf mode { - type enumeration { - enum static; - enum dynamic; - } - } - - leaf size { - type uint64; - } - - } - } - } + 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 { + default dynamic; + type enumeration { + enum static; + enum dynamic; + } + description "Buffer Pool Mode"; + } + + leaf size { + mandatory true; + 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-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 71f077654dd4..0c1f784ea518 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -1,67 +1,92 @@ 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 2019-05-15 { - description - "Initial revision."; - } - - - container sonic-buffer-profile { - - container BUFFER_PROFILE { - - list BUFFER_PROFILE_LIST { - key "name"; - - leaf name { - type string; - } - - leaf static_th { - type uint64; - } - - leaf dynamic_th { - type int64; - } - - leaf size { - type uint64; - } - - leaf pool { - type leafref { - path "/bpl:sonic-buffer-pool/bpl:BUFFER_POOL/bpl:BUFFER_POOL_LIST/bpl:name"; - } - } - - leaf xon_offset { - type uint64; - } - - leaf xon { - type uint64; - } - - leaf xoff { - type uint64; - } - } - } - } + 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"; + } + + choice threshold { + mandatory true; + case static { + leaf static_th { + type uint64; + description "The maximum size of the buffer pool the port can occupy"; + } + } + + case dynamic { + leaf dynamic_th { + type string { + pattern "(-[1-7]|([0-3]))" { + error-message "Invalid Dynamic Threshold"; + error-app-tag dynamic_threshold-invalid; + } + } + 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 "Headroom 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"; + } + } + } + } } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang index d5f886a869a5..f8c951aa4dd1 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang @@ -1,65 +1,66 @@ module sonic-buffer-queue { - namespace "http://github.com/Azure/sonic-buffer-queue"; - prefix bqueue; + namespace "http://github.com/Azure/sonic-buffer-queue"; + prefix bqueue; - import sonic-extension { - prefix sonic-ext; - } + import sonic-extension { + prefix sonic-ext; + } - import sonic-port { - prefix prt; - } + import sonic-port { + prefix prt; + } - import sonic-buffer-profile { - prefix bpf; - } + import sonic-buffer-profile { + prefix bpf; + } - organization - "SONiC"; + organization + "SONiC"; - contact - "SONiC"; + contact + "SONiC"; - description - "SONIC BUFFER QUEUE"; + description + "SONIC BUFFER QUEUE"; - revision 2019-05-15 { - description - "Initial revision."; - } + revision 2021-07-01 { + description + "Initial revision."; + } - container sonic-buffer-queue { + container sonic-buffer-queue { - container BUFFER_QUEUE { + container BUFFER_QUEUE { - list BUFFER_QUEUE_LIST { - key "ifname qindex"; - //sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance - // Total list instances = number(key1) * number(key2) * number(key3) + list BUFFER_QUEUE_LIST { + key "port qindex"; - leaf ifname { - type leafref { - path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; - } - } + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } - leaf qindex { - type string { - pattern "[0-7]((-)[0-7])?"{ - error-message "Invalid Q-index"; - error-app-tag qindex-invalid; - } - } - } + 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 { //Hash reference key - type leafref { - path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; - } - } + 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"; + } - } - } - } + } + } + } } diff --git a/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang new file mode 100644 index 000000000000..d8c1a1497d12 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang @@ -0,0 +1,55 @@ +module sonic-port-egress-profile-list { + namespace "http://github.com/Azure/sonic-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 PORT EGRESS PROFILE LIST"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-port-egress-profile-list { + + container PORT_EGRESS_PROFILE_LIST { + list 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 { + 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-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang new file mode 100644 index 000000000000..f0e4ec4cad38 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang @@ -0,0 +1,55 @@ +module sonic-port-ingress-profile-list { + namespace "http://github.com/Azure/sonic-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 PORT INGRESS PROFILE LIST"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-port-ingress-profile-list { + + container PORT_INGRESS_PROFILE_LIST { + list 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 { + 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"; + } + + } + } + } +} From dd479ad7daa2572498e054c76fd0bfe69891b462 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 12 Jul 2021 01:57:25 -0700 Subject: [PATCH 09/20] Updated sample_config_db.json and buffer profile yang/test files --- .../tests/files/sample_config_db.json | 18 ++++++++++++++++++ .../yang_model_tests/tests/buffer_profile.json | 4 ++-- .../yang-models/sonic-buffer-profile.yang | 7 ++----- 3 files changed, 22 insertions(+), 7 deletions(-) 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 c5de8578e502..7d156694b6be 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -5,9 +5,16 @@ } }, "BUFFER_POOL": { + "ingress_lossy_pool": { + "mode": "static", + "size": "33004032", + "xoff": "196608", + "type": "ingress" + }, "egress_lossless_pool": { "mode": "static", "size": "33004032", + "xoff": "196608", "type": "egress" }, "egress_lossy_pool": { @@ -25,6 +32,11 @@ "xon": "0", "xon_offset": "3584" }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + }, "egress_lossy_profile": { "pool":"egress_lossy_pool", "size":"1518", @@ -41,6 +53,12 @@ "profile": "egress_lossy_profile" } }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet4": { + "profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_TABLE:Ethernet4": { + "profile_list": "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:pg_lossless_100000_300m_profile]" + }, "PORTCHANNEL": { "PortChannel0003": { "admin_status": "up", 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 index bbcad1d11791..092b8034db11 100644 --- 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 @@ -14,11 +14,11 @@ }, "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1": { "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1 no failure.", - "eStr": "Invalid" + "eStrKey": "Range" }, "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2": { "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2 no failure.", - "eStr": "Invalid" + "eStrKey": "Range" }, "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE": { "desc": "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE pattern failure.", diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 0c1f784ea518..6ebd8a8306f2 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -44,11 +44,8 @@ module sonic-buffer-profile { case dynamic { leaf dynamic_th { - type string { - pattern "(-[1-7]|([0-3]))" { - error-message "Invalid Dynamic Threshold"; - error-app-tag dynamic_threshold-invalid; - } + type int32 { + range "-7..3"; } description "The maximum proportion of the free size of the buffer pool the port can occupy (Alpha value)"; } From 8736d4a832d2e06db10af08e6e79ef618be95bbb Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 12 Jul 2021 05:08:39 -0700 Subject: [PATCH 10/20] Updated sample_config_d.json for ing/egr profile list --- src/sonic-yang-models/tests/files/sample_config_db.json | 8 ++++---- .../tests_config/port_egress_profile_list.json | 6 +++--- .../tests_config/port_ingress_profile_list.json | 6 +++--- .../yang-models/sonic-port-egress-profile-list.yang | 4 ++-- .../yang-models/sonic-port-ingress-profile-list.yang | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) 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 7d156694b6be..80389bc9fbe1 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -54,11 +54,11 @@ } }, "BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet4": { - "profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, + "profile_list": ["ingress_lossy_profile"] + }, "BUFFER_PORT_EGRESS_PROFILE_LIST_TABLE:Ethernet4": { - "profile_list": "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:pg_lossless_100000_300m_profile]" - }, + "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] + }, "PORTCHANNEL": { "PortChannel0003": { "admin_status": "up", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json index 3e3ddff7f19c..551d60b11699 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json @@ -51,7 +51,7 @@ "PORT_EGRESS_PROFILE_LIST_LIST": [ { "port": "Ethernet4", - "profile": ["lossless_buffer_profile", "lossless_buffer_profile2"] + "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] } ] } @@ -101,7 +101,7 @@ "PORT_EGRESS_PROFILE_LIST_LIST": [ { "port": "Ethernet4", - "profile": ["wrong"] + "profile_list": ["wrong"] } ] } @@ -151,7 +151,7 @@ "PORT_EGRESS_PROFILE_LIST_LIST": [ { "port": "wrong", - "profile": ["lossless_buffer_profile"] + "profile_list": ["lossless_buffer_profile"] } ] } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json index 44bdfa6c47ad..dd2760d2c8d4 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json @@ -51,7 +51,7 @@ "PORT_INGRESS_PROFILE_LIST_LIST": [ { "port": "Ethernet4", - "profile": ["lossless_buffer_profile", "lossless_buffer_profile2"] + "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] } ] } @@ -101,7 +101,7 @@ "PORT_INGRESS_PROFILE_LIST_LIST": [ { "port": "Ethernet4", - "profile": ["wrong"] + "profile_list": ["wrong"] } ] } @@ -151,7 +151,7 @@ "PORT_INGRESS_PROFILE_LIST_LIST": [ { "port": "wrong", - "profile": ["lossless_buffer_profile"] + "profile_list": ["lossless_buffer_profile"] } ] } diff --git a/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang index d8c1a1497d12..3fd915967c4f 100644 --- a/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang @@ -42,11 +42,11 @@ module sonic-port-egress-profile-list { } } - leaf-list profile { + leaf-list profile_list { 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"; + description "a list of references to BUFFER_PROFILE_TABLE object for a port"; } } diff --git a/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang index f0e4ec4cad38..bea685c7a764 100644 --- a/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang @@ -42,11 +42,11 @@ module sonic-port-ingress-profile-list { } } - leaf-list profile { + leaf-list profile_list { 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"; + description "a list of references to BUFFER_PROFILE_TABLE object for a port"; } } From 006097c5bd4689b4203f5d228a09297949b97783 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 12 Jul 2021 07:57:10 -0700 Subject: [PATCH 11/20] Updated sample_config_db.json --- src/sonic-yang-models/tests/files/sample_config_db.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 80389bc9fbe1..3827e5e3bd13 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -53,10 +53,10 @@ "profile": "egress_lossy_profile" } }, - "BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet4": { + "PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet4": { "profile_list": ["ingress_lossy_profile"] }, - "BUFFER_PORT_EGRESS_PROFILE_LIST_TABLE:Ethernet4": { + "PORT_EGRESS_PROFILE_LIST_TABLE:Ethernet4": { "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] }, "PORTCHANNEL": { From 1a065758766b669b3727f5ee8b74a2e651b545c1 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 12 Jul 2021 08:26:51 -0700 Subject: [PATCH 12/20] Updated sample_config_db.json --- src/sonic-yang-models/tests/files/sample_config_db.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3827e5e3bd13..3c66b82fc281 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -53,10 +53,10 @@ "profile": "egress_lossy_profile" } }, - "PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet4": { + "PORT_INGRESS_PROFILE_LIST:Ethernet4": { "profile_list": ["ingress_lossy_profile"] }, - "PORT_EGRESS_PROFILE_LIST_TABLE:Ethernet4": { + "PORT_EGRESS_PROFILE_LIST:Ethernet4": { "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] }, "PORTCHANNEL": { From a9f1c631e47de32763826bf95cc4adeb09084cae Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Mon, 12 Jul 2021 09:20:41 -0700 Subject: [PATCH 13/20] Updated sample_config_db.json --- .../tests/files/sample_config_db.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 3c66b82fc281..d5b43ede4c8f 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -53,11 +53,15 @@ "profile": "egress_lossy_profile" } }, - "PORT_INGRESS_PROFILE_LIST:Ethernet4": { - "profile_list": ["ingress_lossy_profile"] + "PORT_INGRESS_PROFILE_LIST": { + "Ethernet9": { + "profile_list": ["ingress_lossy_profile"] + } }, - "PORT_EGRESS_PROFILE_LIST:Ethernet4": { - "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] + "PORT_EGRESS_PROFILE_LIST": { + "Ethernet9": { + "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] + } }, "PORTCHANNEL": { "PortChannel0003": { From db9183b349559e231640e1492bf961d457c585a6 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Tue, 13 Jul 2021 10:26:29 -0700 Subject: [PATCH 14/20] Reverting the choice/case for sonic-buffer-profile.yang --- .../tests/files/sample_config_db.json | 15 ++++++++---- .../yang-models/sonic-buffer-profile.yang | 23 +++++++------------ 2 files changed, 18 insertions(+), 20 deletions(-) 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 d5b43ede4c8f..88f9ec34557a 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -8,13 +8,13 @@ "ingress_lossy_pool": { "mode": "static", "size": "33004032", - "xoff": "196608", + "xoff": "196608", "type": "ingress" }, "egress_lossless_pool": { "mode": "static", "size": "33004032", - "xoff": "196608", + "xoff": "196608", "type": "egress" }, "egress_lossy_pool": { @@ -37,6 +37,11 @@ "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", @@ -344,9 +349,9 @@ "global": { "vrf": "mgmt", "src_intf": [ - "eth0", - "Loopback0" - ] + "eth0", + "Loopback0" + ] } }, "NTP_SERVER": { diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 6ebd8a8306f2..8a4bd9856929 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -33,23 +33,16 @@ module sonic-buffer-profile { description "Buffer Profile name"; } - choice threshold { - mandatory true; - case static { - leaf static_th { - type uint64; - description "The maximum size of the buffer pool the port can occupy"; - } - } + leaf static_th { + type uint64; + description "The maximum size of the buffer pool the port can occupy"; + } - case dynamic { - leaf dynamic_th { - type int32 { - range "-7..3"; - } - description "The maximum proportion of the free size of the buffer pool the port can occupy (Alpha value)"; - } + leaf dynamic_th { + type int32 { + range "-7..3"; } + description "The maximum proportion of the free size of the buffer pool the port can occupy (Alpha value)"; } leaf size { From 47656a93d91b3212e9d58e460c63edef61d00106 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Tue, 13 Jul 2021 10:51:12 -0700 Subject: [PATCH 15/20] Masked Test case for static_th/dyanmic_th --- .../tests/yang_model_tests/tests/buffer_profile.json | 8 -------- 1 file changed, 8 deletions(-) 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 index 092b8034db11..33cd9db96dd8 100644 --- 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 @@ -20,14 +20,6 @@ "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2 no failure.", "eStrKey": "Range" }, - "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE": { - "desc": "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE pattern failure.", - "eStr": "Missing" - }, - "BUFFER_PROFILE_DUAL_THRESHOLD_VALUE": { - "desc": "BUFFER_PROFILE_DUAL_THRESHOLD_VALUE pattern failure.", - "eStr": "Data for more than one case branch of \"threshold\" choice present." - }, "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { "desc": "BUFFER_PROFILE_CORRECT_SIZE_VALUE no failure." }, From 4e8ac0d8e666dd444197bc6e7cd7856fd18a2439 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Wed, 14 Jul 2021 10:04:42 -0700 Subject: [PATCH 16/20] Prefix PORT_INGRESS/EGRESS table with BUFFER_ --- .../tests/files/sample_config_db.json | 4 ++-- .../buffer_port_egress_profile_list.json | 13 ++++++++++ .../buffer_port_ingress_profile_list.json | 13 ++++++++++ .../tests/port_egress_profile_list.json | 13 ---------- .../tests/port_ingress_profile_list.json | 13 ---------- ...n => buffer_port_egress_profile_list.json} | 24 +++++++++---------- ... => buffer_port_ingress_profile_list.json} | 24 +++++++++---------- ...onic-buffer-port-egress-profile-list.yang} | 12 +++++----- ...nic-buffer-port-ingress-profile-list.yang} | 12 +++++----- 9 files changed, 64 insertions(+), 64 deletions(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/port_egress_profile_list.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json rename src/sonic-yang-models/tests/yang_model_tests/tests_config/{port_egress_profile_list.json => buffer_port_egress_profile_list.json} (83%) rename src/sonic-yang-models/tests/yang_model_tests/tests_config/{port_ingress_profile_list.json => buffer_port_ingress_profile_list.json} (83%) rename src/sonic-yang-models/yang-models/{sonic-port-egress-profile-list.yang => sonic-buffer-port-egress-profile-list.yang} (73%) rename src/sonic-yang-models/yang-models/{sonic-port-ingress-profile-list.yang => sonic-buffer-port-ingress-profile-list.yang} (73%) 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 88f9ec34557a..11057a55d163 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -58,12 +58,12 @@ "profile": "egress_lossy_profile" } }, - "PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST": { "Ethernet9": { "profile_list": ["ingress_lossy_profile"] } }, - "PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST": { "Ethernet9": { "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] } 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 000000000000..a7b766974a76 --- /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 000000000000..5ed19ce3e478 --- /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/port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port_egress_profile_list.json deleted file mode 100644 index 309a36ef8dcb..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port_egress_profile_list.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { - "desc": "PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" - }, - "PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { - "desc": "PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", - "eStr": "wrong" - }, - "PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { - "desc": "PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", - "eStr": "wrong" - } -} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json deleted file mode 100644 index 25428adebe44..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port_ingress_profile_list.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { - "desc": "PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" - }, - "PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { - "desc": "PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", - "eStr": "wrong" - }, - "PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { - "desc": "PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", - "eStr": "wrong" - } -} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json similarity index 83% rename from src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json rename to src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json index 551d60b11699..72e31ef9c340 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_egress_profile_list.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json @@ -1,5 +1,5 @@ { - "PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -46,9 +46,9 @@ ] } }, - "sonic-port-egress-profile-list:sonic-port-egress-profile-list": { - "sonic-port-egress-profile-list:PORT_EGRESS_PROFILE_LIST": { - "PORT_EGRESS_PROFILE_LIST_LIST": [ + "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"] @@ -57,7 +57,7 @@ } } }, - "PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -96,9 +96,9 @@ ] } }, - "sonic-port-egress-profile-list:sonic-port-egress-profile-list": { - "sonic-port-egress-profile-list:PORT_EGRESS_PROFILE_LIST": { - "PORT_EGRESS_PROFILE_LIST_LIST": [ + "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"] @@ -107,7 +107,7 @@ } } }, - "PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -146,9 +146,9 @@ ] } }, - "sonic-port-egress-profile-list:sonic-port-egress-profile-list": { - "sonic-port-egress-profile-list:PORT_EGRESS_PROFILE_LIST": { - "PORT_EGRESS_PROFILE_LIST_LIST": [ + "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/port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json similarity index 83% rename from src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json rename to src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json index dd2760d2c8d4..aef66e1b014b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port_ingress_profile_list.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json @@ -1,5 +1,5 @@ { - "PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -46,9 +46,9 @@ ] } }, - "sonic-port-ingress-profile-list:sonic-port-ingress-profile-list": { - "sonic-port-ingress-profile-list:PORT_INGRESS_PROFILE_LIST": { - "PORT_INGRESS_PROFILE_LIST_LIST": [ + "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"] @@ -57,7 +57,7 @@ } } }, - "PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -96,9 +96,9 @@ ] } }, - "sonic-port-ingress-profile-list:sonic-port-ingress-profile-list": { - "sonic-port-ingress-profile-list:PORT_INGRESS_PROFILE_LIST": { - "PORT_INGRESS_PROFILE_LIST_LIST": [ + "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"] @@ -107,7 +107,7 @@ } } }, - "PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -146,9 +146,9 @@ ] } }, - "sonic-port-ingress-profile-list:sonic-port-ingress-profile-list": { - "sonic-port-ingress-profile-list:PORT_INGRESS_PROFILE_LIST": { - "PORT_INGRESS_PROFILE_LIST_LIST": [ + "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/yang-models/sonic-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang similarity index 73% rename from src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang rename to src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang index 3fd915967c4f..10af27b77458 100644 --- a/src/sonic-yang-models/yang-models/sonic-port-egress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang @@ -1,5 +1,5 @@ -module sonic-port-egress-profile-list { - namespace "http://github.com/Azure/sonic-port-egress-profile-list"; +module sonic-buffer-port-egress-profile-list { + namespace "http://github.com/Azure/sonic-buffer-port-egress-profile-list"; prefix bpg; import sonic-extension { @@ -21,7 +21,7 @@ module sonic-port-egress-profile-list { "SONiC"; description - "SONIC PORT EGRESS PROFILE LIST"; + "SONIC BUFFER PORT EGRESS PROFILE LIST"; revision 2021-07-01 { description @@ -29,10 +29,10 @@ module sonic-port-egress-profile-list { } - container sonic-port-egress-profile-list { + container sonic-buffer-port-egress-profile-list { - container PORT_EGRESS_PROFILE_LIST { - list PORT_EGRESS_PROFILE_LIST_LIST { + container BUFFER_PORT_EGRESS_PROFILE_LIST { + list BUFFER_PORT_EGRESS_PROFILE_LIST_LIST { key "port"; diff --git a/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang similarity index 73% rename from src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang rename to src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang index bea685c7a764..603f50bf2ec2 100644 --- a/src/sonic-yang-models/yang-models/sonic-port-ingress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang @@ -1,5 +1,5 @@ -module sonic-port-ingress-profile-list { - namespace "http://github.com/Azure/sonic-port-ingress-profile-list"; +module sonic-buffer-port-ingress-profile-list { + namespace "http://github.com/Azure/sonic-buffer-port-ingress-profile-list"; prefix bpg; import sonic-extension { @@ -21,7 +21,7 @@ module sonic-port-ingress-profile-list { "SONiC"; description - "SONIC PORT INGRESS PROFILE LIST"; + "SONIC BUFFER PORT INGRESS PROFILE LIST"; revision 2021-07-01 { description @@ -29,10 +29,10 @@ module sonic-port-ingress-profile-list { } - container sonic-port-ingress-profile-list { + container sonic-buffer-port-ingress-profile-list { - container PORT_INGRESS_PROFILE_LIST { - list PORT_INGRESS_PROFILE_LIST_LIST { + container BUFFER_PORT_INGRESS_PROFILE_LIST { + list BUFFER_PORT_INGRESS_PROFILE_LIST_LIST { key "port"; From a517b05142f11a80bbd480c47573eb4fd2ae1d23 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Wed, 14 Jul 2021 10:51:29 -0700 Subject: [PATCH 17/20] rearranged buffer related yang files in setup file --- src/sonic-yang-models/setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 2ed0f5f8679e..1f93a4c85938 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -47,9 +47,11 @@ './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-pg.yang', './yang-models/sonic-buffer-queue.yang', './yang-models/sonic-copp.yang', './yang-models/sonic-crm.yang', @@ -66,8 +68,6 @@ './yang-models/sonic-nat.yang', './yang-models/sonic-port.yang', './yang-models/sonic-portchannel.yang', - './yang-models/sonic-port-ingress-profile-list.yang', - './yang-models/sonic-port-egress-profile-list.yang', './yang-models/sonic-route-common.yang', './yang-models/sonic-route-map.yang', './yang-models/sonic-routing-policy-sets.yang', From e78c803b94a16bf9309515467bc6d2f93ff06b05 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Thu, 21 Oct 2021 02:12:25 -0700 Subject: [PATCH 18/20] Addressed review concerns --- .../tests/files/sample_config_db.json | 9 +- .../yang_model_tests/tests/buffer_pool.json | 4 - .../tests/buffer_profile.json | 10 +++ .../tests_config/buffer_pool.json | 13 --- .../tests_config/buffer_profile.json | 85 ++++++++++++++++++- .../yang-models/sonic-buffer-pool.yang | 3 +- .../yang-models/sonic-buffer-profile.yang | 13 ++- 7 files changed, 112 insertions(+), 25 deletions(-) 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 16610974edea..39bac43a4281 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -6,6 +6,11 @@ }, "BUFFER_POOL": { "ingress_lossy_pool": { + "mode": "static", + "size": "33004032", + "type": "ingress" + }, + "ingress_lossless_pool": { "mode": "static", "size": "33004032", "xoff": "196608", @@ -26,7 +31,7 @@ "BUFFER_PROFILE": { "pg_lossless_100000_300m_profile": { "dynamic_th": "1", - "pool": "egress_lossless_pool", + "pool": "ingress_lossless_pool", "size": "9427", "xoff": "50176", "xon": "0", @@ -65,7 +70,7 @@ }, "BUFFER_PORT_EGRESS_PROFILE_LIST": { "Ethernet9": { - "profile_list": ["egress_lossless_profile", "pg_lossless_100000_300m_profile"] + "profile_list": ["egress_lossless_profile", "egress_lossy_profile"] } }, "PORTCHANNEL": { 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 index 12b05a053207..907fa9101ab3 100644 --- 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 @@ -36,9 +36,5 @@ "BUFFER_POOL_WRONG_SIZE_VALUE": { "desc": "BUFFER_POOL_WRONG_SIZE_VALUE pattern failure.", "eStr": "wrong" - }, - "BUFFER_POOL_MANDATORY_SIZE_VALUE": { - "desc": "BUFFER_POOL_MANDATORY_SIZE_VALUE no size.", - "eStrKey": "Mandatory" } } 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 index 33cd9db96dd8..c5591c42ed42 100644 --- 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 @@ -51,6 +51,16 @@ "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_config/buffer_pool.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json index 04c721654fa5..8a0005305faa 100644 --- 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 @@ -153,18 +153,5 @@ ] } } - }, - "BUFFER_POOL_MANDATORY_SIZE_VALUE": { - "sonic-buffer-pool:sonic-buffer-pool": { - "sonic-buffer-pool:BUFFER_POOL": { - "BUFFER_POOL_LIST": [ - { - "name": "Ethernet4", - "mode": "static", - "type": "ingress" - } - ] - } - } } } 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 index 41e84f289b94..acd1efb1a0ec 100644 --- 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 @@ -123,7 +123,7 @@ "name": "Ethernet4", "pool": "egress_lossless_pool", "size": "1518", - "dynamic_th": "-8" + "dynamic_th": "-9" } ] } @@ -149,7 +149,7 @@ "name": "Ethernet4", "pool": "egress_lossless_pool", "size": "1518", - "dynamic_th": "4" + "dynamic_th": "8" } ] } @@ -415,6 +415,87 @@ } } }, + "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": { diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang index e99330a9de78..c59d4ec66ab5 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang @@ -38,7 +38,7 @@ module sonic-buffer-pool { } leaf mode { - default dynamic; + mandatory true; type enumeration { enum static; enum dynamic; @@ -47,7 +47,6 @@ module sonic-buffer-pool { } leaf size { - mandatory true; type uint64; description "Buffer Pool Size (in Bytes)"; } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 8a4bd9856929..204e8aa796be 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -40,7 +40,7 @@ module sonic-buffer-profile { leaf dynamic_th { type int32 { - range "-7..3"; + range "-8..7"; } description "The maximum proportion of the free size of the buffer pool the port can occupy (Alpha value)"; } @@ -48,7 +48,7 @@ module sonic-buffer-profile { leaf size { mandatory true; type uint64; - description "Headroom Size"; + description "Reserved Size"; } leaf pool { @@ -76,6 +76,15 @@ module sonic-buffer-profile { 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"; + } } } } From 0611e95ffbb24ab9cb119ad1ede16f65a4e79c0b Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Thu, 21 Oct 2021 06:59:29 -0700 Subject: [PATCH 19/20] Restricted the threshold to static/dynamic using choice --- .../tests_config/buffer_profile.json | 55 ++++++++++++++++++- .../yang-models/sonic-buffer-profile.yang | 29 ++++++---- 2 files changed, 70 insertions(+), 14 deletions(-) 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 index acd1efb1a0ec..b6daa30abad9 100644 --- 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 @@ -51,6 +51,57 @@ } } }, + "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": { @@ -71,7 +122,7 @@ "name": "Ethernet4", "pool": "egress_lossless_pool", "size": "1518", - "dynamic_th": "-7" + "dynamic_th": "-8" } ] } @@ -97,7 +148,7 @@ "name": "Ethernet4", "pool": "egress_lossless_pool", "size": "1518", - "dynamic_th": "3" + "dynamic_th": "7" } ] } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 204e8aa796be..9ae523b5b723 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -32,18 +32,23 @@ module sonic-buffer-profile { 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)"; - } + choice threshold_type { + mandatory true; + case static { + leaf static_th { + type uint64; + description "The maximum size of the buffer pool the port can occupy"; + } + } + case dynamic { + 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; From 89e145a4313786138d3638ee86805af709ef394f Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Thu, 21 Oct 2021 23:54:17 -0700 Subject: [PATCH 20/20] Reverting back static/threshold choice change --- .../yang-models/sonic-buffer-profile.yang | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang index 9ae523b5b723..204e8aa796be 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -32,23 +32,18 @@ module sonic-buffer-profile { type string; description "Buffer Profile name"; } - choice threshold_type { - mandatory true; - case static { - leaf static_th { - type uint64; - description "The maximum size of the buffer pool the port can occupy"; - } - } - case dynamic { - 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 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;