diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 index e2ad59262cdd..5a50185247a0 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 @@ -1,7 +1,7 @@ {# Get sai.profile based on switch_role #} {%- if DEVICE_METADATA is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} -{%- if switch_role.lower() == 'torrouter' %} +{%- if 'torrouter' in switch_role.lower() %} {% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t0.config.bcm' -%} {%- else %} {%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t1.config.bcm' -%} diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/sai.profile.j2 b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/sai.profile.j2 index 21bf6cd6e737..5feba4956931 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/sai.profile.j2 +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/sai.profile.j2 @@ -1,7 +1,7 @@ {# Get sai.profile based on switch_role #} {%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} -{%- if switch_role.lower() == 'torrouter' %} +{%- if 'torrouter' in switch_role.lower() %} {% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-32x100G-t0.config.bcm' -%} {%- else %} {% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-32x100G-t1.config.bcm' -%} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 index d2c794277098..44992f92f45f 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 @@ -1,7 +1,7 @@ {# Get sai.profile based on switch_role #} {%- if DEVICE_METADATA is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} -{%- if switch_role.lower() == 'torrouter' %} +{%- if 'torrouter' in switch_role.lower() %} {% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s6100-64x40G-t0.config.bcm' -%} {%- else %} {%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s6100-64x40G-t1.config.bcm' -%} diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f-Q64/sai.profile.j2 b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f-Q64/sai.profile.j2 index bfb71fa71e3c..7c6d12b4b173 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f-Q64/sai.profile.j2 +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f-Q64/sai.profile.j2 @@ -1,7 +1,7 @@ {# Get sai.profile based on switch_role #} {%- if DEVICE_METADATA is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} -{%- if switch_role.lower() == 'torrouter' %} +{%- if 'torrouter' in switch_role.lower() %} {% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-z9264f-64x40G-t0.config.bcm' -%} {%- else %} {%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-z9264f-64x40G-t1.config.bcm' -%} diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index c359dd805219..4d2a0be1b051 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -3,11 +3,11 @@ {% set hash_seed = 0 %} {% set hash_seed_offset = 0 %} {% if DEVICE_METADATA.localhost.type %} -{% if DEVICE_METADATA.localhost.type == "ToRRouter" %} +{% if "ToRRouter" in DEVICE_METADATA.localhost.type %} {% set hash_seed = 0 %} -{% elif DEVICE_METADATA.localhost.type == "LeafRouter" %} +{% elif "LeafRouter" in DEVICE_METADATA.localhost.type %} {% set hash_seed = 10 %} -{% elif DEVICE_METADATA.localhost.type == "SpineRouter" %} +{% elif "SpineRouter" in DEVICE_METADATA.localhost.type %} {% set hash_seed = 25 %} {% endif %} {% endif %} diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 index 9e7594117092..5a6416b0ffd8 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 @@ -30,7 +30,7 @@ dependent_startup=true {# Router advertiser should only run on ToR (T0) devices which have #} {# at least one VLAN interface which has an IPv6 address asigned #} {%- set vlan_v6 = namespace(count=0) -%} -{%- if DEVICE_METADATA.localhost.type == "ToRRouter" -%} +{%- if "ToRRouter" in DEVICE_METADATA.localhost.type and DEVICE_METADATA.localhost.type != "MgmtToRRouter" -%} {%- if VLAN_INTERFACE -%} {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} {# If this VLAN has an IPv6 address... #} diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index b1f5355fdd36..443d123272e7 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -9,9 +9,9 @@ def {# Determine device topology and filename postfix #} {%- if DEVICE_METADATA is defined %} {%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- if switch_role.lower() == 'torrouter' %} +{%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%} {%- set filename_postfix = 't0' %} -{%- elif switch_role.lower() == 'leafrouter' %} +{%- elif 'leafrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%} {%- set filename_postfix = 't1' %} {%- else %} {%- set filename_postfix = set_default_topology() %} @@ -69,7 +69,7 @@ def {%- if cable_len -%} {{ cable_len.0 }} {%- else %} - {%- if switch_role.lower() == 'torrouter' %} + {%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%} {%- for local_port in VLAN_MEMBER %} {%- if local_port[1] == port_name %} {%- set roles3 = switch_role + '_' + 'server' %} diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 9420be7a0671..a7c361d69fa5 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -73,7 +73,7 @@ "7": "7" } }, -{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types %} +{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %} "DOT1P_TO_TC_MAP": { "AZURE": { "0": "0", @@ -177,7 +177,7 @@ "PORT_QOS_MAP": { {% for port in PORT_ACTIVE %} "{{ port }}": { -{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types %} +{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %} "dot1p_to_tc_map" : "[DOT1P_TO_TC_MAP|AZURE]", {% else %} "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 5a150713e7fe..2dbf1319d4d0 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -89,6 +89,7 @@ def parse_png(png, hname): mgmt_port = '' port_speeds = {} console_ports = {} + is_storage_device = False for child in png: if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for link in child.findall(str(QName(ns, "DeviceLinkBase"))): @@ -144,6 +145,12 @@ def parse_png(png, hname): device_data['deployment_id'] = deployment_id devices[name] = device_data + if name == hname: + cluster = device.find(str(QName(ns, "ClusterName"))) + + if cluster != None and "str" in cluster.text.lower(): + is_storage_device = True + if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for if_link in child.findall(str(QName(ns, 'DeviceLinkBase'))): if str(QName(ns3, "type")) in if_link.attrib: @@ -161,7 +168,7 @@ def parse_png(png, hname): elif node.tag == str(QName(ns, "EndDevice")): mgmt_dev = node.text - return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speeds, console_ports) + return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speeds, console_ports, is_storage_device) def parse_asic_external_link(link, asic_name, hostname): neighbors = {} @@ -860,6 +867,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None): hostname = None linkmetas = {} host_lo_intfs = None + is_storage_device = False local_devices = [] # hostname is the asic_name, get the asic_id from the asic_name @@ -893,7 +901,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None): elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_internal_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): - (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speed_png, console_ports) = parse_png(child, hostname) + (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speed_png, console_ports, is_storage_device) = parse_png(child, hostname) elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): @@ -936,6 +944,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None): 'type': device_type } } + + if is_storage_device: + results['DEVICE_METADATA']['localhost']['storage_device'] = "true" # for this hostname, if sub_role is defined, add sub_role in # device_metadata if sub_role is not None: @@ -1094,7 +1105,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None): results['PORTCHANNEL_INTERFACE'] = pc_intfs - if current_device['type'] in backend_device_types: + if current_device['type'] in backend_device_types and is_storage_device: del results['INTERFACE'] del results['PORTCHANNEL_INTERFACE'] diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index acfcd4a6a74b..0c0799ea7d19 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -214,6 +214,7 @@ switch-t0 Force10-S6000 + AAA00PrdStr00 switch-01t1 diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 5ebbaafd9671..8ce5e3b8ab95 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -259,6 +259,7 @@ switch-t0 Force10-S6000 + AAA00PrdStr00 ARISTA01T1 diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index b77f0859584a..387f58a3a65a 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -140,4 +140,3 @@ def test_minigraph_bgp_mon(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "BGP_MONITORS"' output = self.run_script(argument) self.assertEqual(output.strip(), "{}") -