From 4766fcf100f1709dd598def1e96d74a69db12eb4 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 3 Apr 2021 01:41:30 +0000 Subject: [PATCH 1/8] [submodule update] sonic-db-syncd df46ed418e661a9bccdb2639d8873def356f8ba0 (HEAD -> master, origin/master, origin/HEAD) Fix the LLDP_LOC_CHASSIS not getting populated if no remote neighbors are present (#39) e487532e11cc0e97cfce573b6b997fdd0beeb660 [CI] Set up CI&PR with Azure Pipelines (#38) 3c9f488490a1dbded20dbf2d8a88a5ab4dbda8df Replace swsssdk's SonicV2Connector with swsscommon's implementation (#35) Signed-off-by: Abhishek Dosi --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 5cc29a1b32d8..df46ed418e66 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 5cc29a1b32d8d1f4dfbc967bfea2727c50a49c76 +Subproject commit df46ed418e661a9bccdb2639d8873def356f8ba0 From 6b3248a6a93ab6adc8bec2ed3f03ddd18419bda4 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 19 Aug 2022 20:48:08 +0000 Subject: [PATCH 2/8] Added Support to runtime render bgp and teamd feature state and lldp has_asic_scope flag. Signed-off-by: Abhishek Dosi --- files/build_templates/init_cfg.json.j2 | 8 +++++-- files/scripts/swss.sh | 33 +++++++++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 7de0ad977807..c84bf870fc6c 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -32,7 +32,7 @@ "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"), ("lldp", "enabled", true, "enabled"), ("pmon", "enabled", true, "enabled"), @@ -41,7 +41,7 @@ ("snmp", "enabled", true, "enabled"), ("swss", "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']) %}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 %} @@ -60,7 +60,11 @@ "state": "{{state}}", "has_timer" : {{has_timer | lower()}}, "has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, +{%- if feature in ["lldp"] %} + "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 %}", +{%- else %} "has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, +{%- endif %} "auto_restart": "{{autorestart}}", {# 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 #} diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 3ab4242c902f..3d734d277a76 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -9,10 +9,6 @@ LOCKFILE="/tmp/swss-syncd-lock$DEV" NAMESPACE_PREFIX="asic" 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 @@ -299,8 +295,6 @@ stop() { 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 if [ -f $GEARBOX_CONFIG ]; then @@ -308,6 +302,17 @@ function check_peer_gbsyncd() 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 +} + if [ "$DEV" ]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace SONIC_DB_CLI="sonic-db-cli -n $NET_NS" @@ -318,7 +323,23 @@ else DEPENDENT+=" bgp" fi +PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform` +HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku` + +# DEPENDENT initially contains namespace independent services +# namespace specific services are added later in this script. +DEPENDENT="radv" +MULTI_INST_DEPENDENT="" + check_peer_gbsyncd + +check_ports_present +PORTS_PRESENT=$? + +if [[ $PORTS_PRESENT == 0 ]]; then + MULTI_INST_DEPENDENT="teamd" +fi + read_dependent_services case "$1" in From 1f5b6dab1011032e71b88fc84693eaf467b19064 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 19 Aug 2022 20:48:08 +0000 Subject: [PATCH 3/8] Added Support to runtime render bgp and teamd feature state and lldp has_asic_scope flag. Signed-off-by: Abhishek Dosi --- files/build_templates/init_cfg.json.j2 | 8 ++++++-- files/scripts/swss.sh | 25 +++++++++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 38bd7c2e43a6..1ff7afe99017 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -32,7 +32,7 @@ "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"), ("lldp", "enabled", true, "enabled"), ("pmon", "enabled", true, "enabled"), @@ -42,7 +42,7 @@ ("eventd", "enabled", false, "enabled"), ("swss", "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']) %}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 %} @@ -61,7 +61,11 @@ "state": "{{state}}", "has_timer" : {{has_timer | lower()}}, "has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, +{%- if feature in ["lldp"] %} + "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 %}", +{%- else %} "has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, +{%- endif %} "auto_restart": "{{autorestart}}", {# 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 #} diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 3841f77cc30b..4dda9ebca495 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -9,10 +9,6 @@ LOCKFILE="/tmp/swss-syncd-lock$DEV" NAMESPACE_PREFIX="asic" 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 @@ -299,8 +295,6 @@ stop() { 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 if [ -f $GEARBOX_CONFIG ]; then @@ -321,6 +315,17 @@ function check_macsec() 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 +} + if [ "$DEV" ]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace SONIC_DB_CLI="sonic-db-cli -n $NET_NS" @@ -333,6 +338,14 @@ fi check_peer_gbsyncd check_macsec + +check_ports_present +PORTS_PRESENT=$? + +if [[ $PORTS_PRESENT == 0 ]]; then + MULTI_INST_DEPENDENT="teamd" +fi + read_dependent_services case "$1" in From 53ab35e19e0eb6635dced9e6a49e2ad59da4251c Mon Sep 17 00:00:00 2001 From: mlok Date: Fri, 14 Oct 2022 14:05:08 -0400 Subject: [PATCH 4/8] Modified the Yang model files to support the has_per_asic_scope as string type --- files/build_templates/init_cfg.json.j2 | 2 +- files/scripts/swss.sh | 8 ++++++++ src/sonic-yang-models/tests/files/sample_config_db.json | 2 +- .../tests/yang_model_tests/tests_config/feature.json | 6 +++--- src/sonic-yang-models/yang-models/sonic-feature.yang | 7 ++++++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 1ff7afe99017..de9260514ba8 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -62,7 +62,7 @@ "has_timer" : {{has_timer | lower()}}, "has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, {%- if feature in ["lldp"] %} - "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_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 %} diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 4dda9ebca495..997421773d37 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -336,6 +336,14 @@ else DEPENDENT+=" bgp" fi +PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform` +HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku` + +# DEPENDENT initially contains namespace independent services +# namespace specific services are added later in this script. +DEPENDENT="radv" +MULTI_INST_DEPENDENT="" + check_peer_gbsyncd check_macsec diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 7beca6d2af07..88e7b85ced7e 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1546,7 +1546,7 @@ "lldp": { "auto_restart": "enabled", "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", "high_mem_alert": "disabled", "state": "enabled", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json index 08c974d8e45f..31b12b6a19c3 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json @@ -49,7 +49,7 @@ "auto_restart": "disabled", "has_timer": "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", "check_up_status": "false" }, @@ -77,7 +77,7 @@ "auto_restart": "disabled", "has_timer": "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", "check_up_status": "false" } @@ -95,7 +95,7 @@ "auto_restart": "disabled", "has_timer": "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 %}", "check_up_status": "false" } ] diff --git a/src/sonic-yang-models/yang-models/sonic-feature.yang b/src/sonic-yang-models/yang-models/sonic-feature.yang index f27411788e8d..b07e0067c50c 100644 --- a/src/sonic-yang-models/yang-models/sonic-feature.yang +++ b/src/sonic-yang-models/yang-models/sonic-feature.yang @@ -24,6 +24,11 @@ module sonic-feature{ } } + typedef feature-scope-status { + description "configuration to set the feature running status true/false"; + type string; + } + container sonic-feature { container FEATURE { @@ -69,7 +74,7 @@ module sonic-feature{ leaf has_per_asic_scope { description "This configuration identicates there will only one service spawned per asic"; - type stypes:boolean_type; + type feature-scope-status; default "false"; } From 8b0c2f1aa40c7ddfda4b7317b68acacb2e892a5c Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 5 Nov 2022 16:16:31 +0000 Subject: [PATCH 5/8] Resolve Conflict Signed-off-by: Abhishek Dosi --- files/scripts/swss.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index c670bca26cc4..cf1eec4bd732 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -302,15 +302,6 @@ function check_peer_gbsyncd() 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 function check_macsec() { MACSEC_STATE=`show feature status | grep macsec | awk '{print $2}'` From 08977ba9a79fda04fccaaffdc39ec0a9e489d2d0 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 11 Nov 2022 00:38:59 +0000 Subject: [PATCH 6/8] Fix the KVM failure. Signed-off-by: Abhishek Dosi --- files/scripts/swss.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index cf1eec4bd732..ba0437a25e91 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -326,10 +326,6 @@ function check_ports_present() return 1 } - -PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform` -HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku` - # DEPENDENT initially contains namespace independent services # namespace specific services are added later in this script. DEPENDENT="radv" @@ -345,6 +341,9 @@ else DEPENDENT+=" bgp" 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_macsec From 9af84ac9d9eae194af3ec4ad7cc29aeaf47b0305 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 11 Nov 2022 00:44:57 +0000 Subject: [PATCH 7/8] Fix Signed-off-by: Abhishek Dosi --- src/sonic-yang-models/yang-models/sonic-feature.yang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-yang-models/yang-models/sonic-feature.yang b/src/sonic-yang-models/yang-models/sonic-feature.yang index 12081914bb90..fb3c6d65209e 100644 --- a/src/sonic-yang-models/yang-models/sonic-feature.yang +++ b/src/sonic-yang-models/yang-models/sonic-feature.yang @@ -25,7 +25,7 @@ module sonic-feature{ } typedef feature-scope-status { - description "configuration to set the feature running status true/false"; + description "configuration to set the feature has asic scope as true/false"; type string; } From 963cc5b29b806dcb0965a422988c7ea9e30ed98c Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Tue, 15 Nov 2022 18:43:30 +0000 Subject: [PATCH 8/8] Address review comment. Signed-off-by: Abhishek Dosi --- files/build_templates/init_cfg.json.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 5ca8d021307a..c0fc08e86e2e 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -64,7 +64,7 @@ {%- 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 %}, + "has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}"True"{% else %}"False"{% endif %}, {%- endif %} "auto_restart": "{{autorestart}}", {# Set check_up_status to true here when app readiness will be marked in state db #}