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.
This commit is contained in:
SuvarnaMeenakshi 2022-08-25 12:39:52 -07:00 committed by GitHub
parent 0cdef2ebc6
commit 8d06de37ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ NAMESPACE_PATH_GLOB = '/run/netns/*'
ASIC_CONF_FILENAME = 'asic.conf' ASIC_CONF_FILENAME = 'asic.conf'
FRONTEND_ASIC_SUB_ROLE = 'FrontEnd' FRONTEND_ASIC_SUB_ROLE = 'FrontEnd'
BACKEND_ASIC_SUB_ROLE = 'BackEnd' BACKEND_ASIC_SUB_ROLE = 'BackEnd'
FABRIC_ASIC_SUB_ROLE = 'Fabric'
EXTERNAL_PORT = 'Ext' EXTERNAL_PORT = 'Ext'
INTERNAL_PORT = 'Int' INTERNAL_PORT = 'Int'
INBAND_PORT = 'Inb' INBAND_PORT = 'Inb'
@ -210,6 +211,7 @@ def get_all_namespaces():
""" """
front_ns = [] front_ns = []
back_ns = [] back_ns = []
fabric_ns = []
num_asics = get_num_asics() num_asics = get_num_asics()
if is_multi_asic(): if is_multi_asic():
@ -224,8 +226,10 @@ def get_all_namespaces():
front_ns.append(namespace) front_ns.append(namespace)
elif metadata['localhost']['sub_role'] == BACKEND_ASIC_SUB_ROLE: elif metadata['localhost']['sub_role'] == BACKEND_ASIC_SUB_ROLE:
back_ns.append(namespace) 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): def get_namespace_list(namespace=None):