From f757effebc66dac23788479b704509e4d1ab26f6 Mon Sep 17 00:00:00 2001 From: Amit Kaushik Date: Wed, 23 Mar 2022 10:45:22 -0700 Subject: [PATCH] Rectify buffer_port_profile(ing/egr) yang files & related tests --- src/sonic-yang-models/tests/files/sample_config_db.json | 4 ++-- .../tests/buffer_port_egress_profile_list.json | 6 +++--- .../tests/buffer_port_ingress_profile_list.json | 6 +++--- .../tests_config/buffer_port_egress_profile_list.json | 9 ++++----- .../tests_config/buffer_port_ingress_profile_list.json | 9 ++++----- .../sonic-buffer-port-egress-profile-list.yang | 7 +++---- .../sonic-buffer-port-ingress-profile-list.yang | 7 +++---- 7 files changed, 22 insertions(+), 26 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 ae0cc60da64..efc34f59a30 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -65,12 +65,12 @@ }, "BUFFER_PORT_INGRESS_PROFILE_LIST": { "Ethernet9": { - "profile_list": ["ingress_lossy_profile"] + "profile_list": "ingress_lossy_profile" } }, "BUFFER_PORT_EGRESS_PROFILE_LIST": { "Ethernet9": { - "profile_list": ["egress_lossless_profile", "egress_lossy_profile"] + "profile_list": "egress_lossless_profile, egress_lossy_profile" } }, "PORTCHANNEL": { 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 index a7b766974a7..afb1baf6207 100644 --- 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 @@ -2,9 +2,9 @@ "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_MANDATORY_PROFILE_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_MANDATORY_PROFILE_VALUE no profile", + "eStrKey": "Mandatory" }, "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", 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 index 5ed19ce3e47..e1bfa8741b8 100644 --- 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 @@ -2,9 +2,9 @@ "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_MANDATORY_PROFILE_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_MANDATORY_PROFILE_VALUE no profile", + "eStrKey": "Mandatory" }, "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json index 72e31ef9c34..43db8a9b10b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json @@ -51,13 +51,13 @@ "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ { "port": "Ethernet4", - "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] + "profile_list": "lossless_buffer_profile, lossless_buffer_profile2" } ] } } }, - "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_MANDATORY_PROFILE_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -100,8 +100,7 @@ "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ { - "port": "Ethernet4", - "profile_list": ["wrong"] + "port": "Ethernet4" } ] } @@ -151,7 +150,7 @@ "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ { "port": "wrong", - "profile_list": ["lossless_buffer_profile"] + "profile_list": "lossless_buffer_profile" } ] } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json index aef66e1b014..120eaee8ae3 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json @@ -51,13 +51,13 @@ "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ { "port": "Ethernet4", - "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] + "profile_list": "lossless_buffer_profile, lossless_buffer_profile2" } ] } } }, - "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_MANDATORY_PROFILE_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -100,8 +100,7 @@ "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ { - "port": "Ethernet4", - "profile_list": ["wrong"] + "port": "Ethernet4" } ] } @@ -151,7 +150,7 @@ "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ { "port": "wrong", - "profile_list": ["lossless_buffer_profile"] + "profile_list": "lossless_buffer_profile" } ] } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang index 10af27b7745..637ef097702 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang @@ -42,10 +42,9 @@ module sonic-buffer-port-egress-profile-list { } } - leaf-list profile_list { - type leafref { - path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; - } + leaf profile_list { + type string; + mandatory true; description "a list of references to BUFFER_PROFILE_TABLE object for a port"; } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang index 603f50bf2ec..92bf6e66dbe 100644 --- a/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang @@ -42,10 +42,9 @@ module sonic-buffer-port-ingress-profile-list { } } - leaf-list profile_list { - type leafref { - path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; - } + leaf profile_list { + type string; + mandatory true; description "a list of references to BUFFER_PROFILE_TABLE object for a port"; }