776a446d76
- Why I did it Currently dhcp packets are disabled by the COPP manager for non ToRRouter type switches. Even if the feature is enabled, DHCP packets wont hook to the CPU since the COPP manager will not trap this packets. This change is to disable dhcp_relay by default for non ToRRouter switches from init_cfg.json. With this approach, if the user want to enable the feature for non ToRRouter switches, manual enablement is required by the 'feature' configuration. This is to keep the current approach for MSFT production issue with dhcp relay for non ToRRouter switched and allow the user to decide if to use it or not. - How I did it Configure dhcp_relay 'disabled' by default on init_cfg.json for non ToRRouter switches. Remove the exclusion of dhcp packets on copp_cfg.json - How to verify it Enable dhcp_relay feature on a non ToRRouter switch. Unit-tests modified so the default values on mocked CONFIG DB in 'test_vectors.py' for dhcp_relay will be 'disabled'. This is by the change for 'init_cfg.json.j2'. For ToRRouter the state will change from 'disabled' to 'enabled'. Another test case added for a 'ToR' switch type, this is to test the state is 'enabled' if the user configured it to be so.
58 lines
3.6 KiB
Django/Jinja
58 lines
3.6 KiB
Django/Jinja
{
|
|
"DEVICE_METADATA": {
|
|
"localhost": {
|
|
"buffer_model": {% if default_buffer_model == "dynamic" %}"dynamic"{% else %}"traditional"{% endif %},
|
|
"default_bgp_status": {% if shutdown_bgp_on_start == "y" %}"down"{% else %}"up"{% endif %},
|
|
"default_pfcwd_status": {% if enable_pfcwd_on_start == "y" %}"enable"{% else %}"disable"{% endif %}
|
|
}
|
|
},
|
|
"CRM": {
|
|
"Config": {
|
|
"polling_interval": "300",
|
|
{%- for crm_res in ["ipv4_route", "ipv6_route", "ipv4_nexthop", "ipv6_nexthop", "ipv4_neighbor",
|
|
"ipv6_neighbor", "nexthop_group_member", "nexthop_group", "acl_table",
|
|
"acl_group", "acl_entry", "acl_counter", "fdb_entry", "snat_entry", "dnat_entry",
|
|
"ipmc_entry", "mpls_inseg", "mpls_nexthop"] %}
|
|
"{{crm_res}}_threshold_type": "percentage",
|
|
"{{crm_res}}_low_threshold": "70",
|
|
"{{crm_res}}_high_threshold": "85"{% if not loop.last %},{% endif -%}
|
|
{% endfor %}
|
|
}
|
|
},
|
|
{%- set features = [("bgp", "enabled", false, "enabled"),
|
|
("database", "always_enabled", false, "always_enabled"),
|
|
("lldp", "enabled", false, "enabled"),
|
|
("pmon", "enabled", false, "enabled"),
|
|
("radv", "enabled", false, "enabled"),
|
|
("snmp", "enabled", true, "enabled"),
|
|
("swss", "enabled", false, "enabled"),
|
|
("syncd", "enabled", false, "enabled"),
|
|
("teamd", "enabled", false, "enabled")] %}
|
|
{% do features.append(("dhcp_relay", "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}
|
|
{%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %}
|
|
{%- if include_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %}
|
|
{%- if include_mgmt_framework == "y" %}{% do features.append(("mgmt-framework", "enabled", true, "enabled")) %}{% endif %}
|
|
{%- if include_nat == "y" %}{% do features.append(("nat", "disabled", false, "enabled")) %}{% endif %}
|
|
{%- if include_restapi == "y" %}{% do features.append(("restapi", "enabled", false, "enabled")) %}{% endif %}
|
|
{%- if include_sflow == "y" %}{% do features.append(("sflow", "disabled", false, "enabled")) %}{% endif %}
|
|
{%- if include_macsec == "y" %}{% do features.append(("macsec", "disabled", false, "enabled")) %}{% endif %}
|
|
{%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %}
|
|
"FEATURE": {
|
|
{# has_timer field if set, will start the feature systemd .timer unit instead of .service unit #}
|
|
{%- for feature, state, has_timer, autorestart in features %}
|
|
"{{feature}}": {
|
|
"state": "{{state}}",
|
|
"has_timer" : {{has_timer | lower()}},
|
|
"has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %},
|
|
"has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}true{% else %}false{% endif %},
|
|
"auto_restart": "{{autorestart}}",
|
|
{%- if include_kubernetes == "y" %}
|
|
{%- if feature in ["dhcp_relay", "lldp", "pmon", "radv", "snmp", "telemetry"] %}
|
|
"set_owner": "kube", {% else %}
|
|
"set_owner": "local", {% endif %} {% endif %}
|
|
"high_mem_alert": "disabled"
|
|
}{% if not loop.last %},{% endif -%}
|
|
{% endfor %}
|
|
}
|
|
}
|