From 8d06de37aea7b1c3c4206ecf1ff6b136ecf9dcd2 Mon Sep 17 00:00:00 2001 From: SuvarnaMeenakshi <50386592+SuvarnaMeenakshi@users.noreply.github.com> Date: Thu, 25 Aug 2022 12:39:52 -0700 Subject: [PATCH] Add support to get fabric asic namespaces list. (#11793) Why I did it VoQ chassis supervisor will have Fabric asics and the sub_role for fabric asics will be "Fabric". The fabric asics namespaces are not being returned in get_all_namespaces() and is required in caclmgrd to add right cacl to allow internal docker traffic from fabric asic namespaces. test_cacl_application fails on VoQ chassis Supervisor with the error: Failed: Missing expected iptables rules: set(['-A INPUT -s 240.127.1.1/32 -d 240.127.1.1/32 -j ACCEPT', '-A INPUT -s 240.127.1.3/32 -d 240.127.1.1/32 -j ACCEPT', '-A INPUT -s 240.127.1.2/32 -d 240.127.1.1/32 -j ACCEPT']) How I did it Update get_all_namespaces to return fabric namespaces list. How to verify it Verified on VoQ chassis. --- src/sonic-py-common/sonic_py_common/multi_asic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sonic-py-common/sonic_py_common/multi_asic.py b/src/sonic-py-common/sonic_py_common/multi_asic.py index e03dc6447c90..d63c698392e4 100644 --- a/src/sonic-py-common/sonic_py_common/multi_asic.py +++ b/src/sonic-py-common/sonic_py_common/multi_asic.py @@ -13,6 +13,7 @@ ASIC_CONF_FILENAME = 'asic.conf' FRONTEND_ASIC_SUB_ROLE = 'FrontEnd' BACKEND_ASIC_SUB_ROLE = 'BackEnd' +FABRIC_ASIC_SUB_ROLE = 'Fabric' EXTERNAL_PORT = 'Ext' INTERNAL_PORT = 'Int' INBAND_PORT = 'Inb' @@ -210,6 +211,7 @@ def get_all_namespaces(): """ front_ns = [] back_ns = [] + fabric_ns = [] num_asics = get_num_asics() if is_multi_asic(): @@ -224,8 +226,10 @@ def get_all_namespaces(): front_ns.append(namespace) elif metadata['localhost']['sub_role'] == BACKEND_ASIC_SUB_ROLE: back_ns.append(namespace) + elif metadata['localhost']['sub_role'] == FABRIC_ASIC_SUB_ROLE: + fabric_ns.append(namespace) - return {'front_ns': front_ns, 'back_ns': back_ns} + return {'front_ns': front_ns, 'back_ns': back_ns, 'fabric_ns': fabric_ns} def get_namespace_list(namespace=None):