Added Support to runtime render bgp and teamd feature state and lldp has_asic_scope flag (#11796) (#12856)

Added Support to runtime render bgp and teamd feature state and lldp has_asic_scope flag
This commit is contained in:
abdosi 2022-11-29 13:47:37 -08:00 committed by GitHub
parent 80837d4cb8
commit 81fe1d9c1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 14 deletions

View File

@ -32,7 +32,7 @@
"tsa_enabled": "false" "tsa_enabled": "false"
} }
}, },
{%- set features = [("bgp", "enabled", false, "enabled"), {%- set features = [("bgp", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}disabled{% else %}enabled{% endif %}", false, "enabled"),
("database", "always_enabled", false, "always_enabled"), ("database", "always_enabled", false, "always_enabled"),
("lldp", "enabled", true, "enabled"), ("lldp", "enabled", true, "enabled"),
("pmon", "enabled", true, "enabled"), ("pmon", "enabled", true, "enabled"),
@ -41,7 +41,7 @@
("snmp", "enabled", true, "enabled"), ("snmp", "enabled", true, "enabled"),
("swss", "enabled", false, "enabled"), ("swss", "enabled", false, "enabled"),
("syncd", "enabled", false, "enabled"), ("syncd", "enabled", false, "enabled"),
("teamd", "enabled", false, "enabled")] %} ("teamd", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}disabled{% else %}enabled{% endif %}", 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'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}enabled{% else %}disabled{% endif %}", 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'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}
{%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %} {%- 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_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %}
@ -60,7 +60,11 @@
"state": "{{state}}", "state": "{{state}}",
"has_timer" : {{has_timer | lower()}}, "has_timer" : {{has_timer | lower()}},
"has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, "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 %}, {%- if feature in ["lldp"] %}
"has_per_asic_scope": {% raw %}"{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}"{% endraw %},
{%- else %}
"has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}"True"{% else %}"False"{% endif %},
{%- endif %}
"auto_restart": "{{autorestart}}", "auto_restart": "{{autorestart}}",
{# Set check_up_status to true here when app readiness will be marked in state db #} {# Set check_up_status to true here when app readiness will be marked in state db #}
{# For now, to support the infrastrucure, setting the check_up_status to false for bgp,swss,pmon #} {# For now, to support the infrastrucure, setting the check_up_status to false for bgp,swss,pmon #}

View File

@ -9,10 +9,6 @@ LOCKFILE="/tmp/swss-syncd-lock$DEV"
NAMESPACE_PREFIX="asic" NAMESPACE_PREFIX="asic"
ETC_SONIC_PATH="/etc/sonic/" ETC_SONIC_PATH="/etc/sonic/"
# DEPENDENT initially contains namespace independent services
# namespace specific services are added later in this script.
DEPENDENT="radv"
MULTI_INST_DEPENDENT="teamd"
. /usr/local/bin/asic_status.sh . /usr/local/bin/asic_status.sh
@ -299,8 +295,6 @@ stop() {
function check_peer_gbsyncd() function check_peer_gbsyncd()
{ {
PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform`
HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku`
GEARBOX_CONFIG=/usr/share/sonic/device/$PLATFORM/$HWSKU/$DEV/gearbox_config.json GEARBOX_CONFIG=/usr/share/sonic/device/$PLATFORM/$HWSKU/$DEV/gearbox_config.json
if [ -f $GEARBOX_CONFIG ]; then if [ -f $GEARBOX_CONFIG ]; then
@ -321,6 +315,22 @@ function check_macsec()
fi fi
} }
function check_ports_present()
{
PORT_CONFIG_INI=/usr/share/sonic/device/$PLATFORM/$HWSKU/$DEV/port_config.ini
HWSKU_JSON=/usr/share/sonic/device/$PLATFORM/$HWSKU/$DEV/hwsku.json
if [[ -f $PORT_CONFIG_INI ]] || [[ -f $HWSKU_JSON ]]; then
return 0
fi
return 1
}
# DEPENDENT initially contains namespace independent services
# namespace specific services are added later in this script.
DEPENDENT="radv"
MULTI_INST_DEPENDENT=""
if [ "$DEV" ]; then if [ "$DEV" ]; then
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
SONIC_DB_CLI="sonic-db-cli -n $NET_NS" SONIC_DB_CLI="sonic-db-cli -n $NET_NS"
@ -331,8 +341,19 @@ else
DEPENDENT+=" bgp" DEPENDENT+=" bgp"
fi fi
PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform`
HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku`
check_peer_gbsyncd check_peer_gbsyncd
check_macsec check_macsec
check_ports_present
PORTS_PRESENT=$?
if [[ $PORTS_PRESENT == 0 ]]; then
MULTI_INST_DEPENDENT="teamd"
fi
read_dependent_services read_dependent_services
case "$1" in case "$1" in

View File

@ -1498,7 +1498,7 @@
"lldp": { "lldp": {
"auto_restart": "enabled", "auto_restart": "enabled",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true", "has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"has_timer": "false", "has_timer": "false",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled", "state": "enabled",

View File

@ -45,7 +45,7 @@
"auto_restart": "disabled", "auto_restart": "disabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true", "has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"set_owner": "kube" "set_owner": "kube"
}, },
{ {
@ -71,7 +71,7 @@
"auto_restart": "disabled", "auto_restart": "disabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true", "has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"set_owner": "invalid" "set_owner": "invalid"
} }
] ]
@ -88,7 +88,7 @@
"auto_restart": "disabled", "auto_restart": "disabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true" "has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}"
} }
] ]
} }

View File

@ -24,6 +24,11 @@ module sonic-feature{
} }
} }
typedef feature-scope-status {
description "configuration to set the feature has asic scope as true/false";
type string;
}
container sonic-feature { container sonic-feature {
container FEATURE { container FEATURE {
@ -69,7 +74,7 @@ module sonic-feature{
leaf has_per_asic_scope { leaf has_per_asic_scope {
description "This configuration identicates there will only one service description "This configuration identicates there will only one service
spawned per asic"; spawned per asic";
type stypes:boolean_type; type feature-scope-status;
default "false"; default "false";
} }