Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auto Techsupport] Event driven Techsupport Changes #8670

Merged
merged 36 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
436f4ec
AUTO_TECHUPPORT yang model added
vivekrnv Aug 10, 2021
c88529f
auto TS changes
vivekrnv Aug 11, 2021
ba435fb
Flag added to slave.mk
vivekrnv Aug 11, 2021
9c68bc2
auto_ts model updated
vivekrnv Aug 11, 2021
995034b
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
vivekrnv Aug 11, 2021
acca347
init_cfg is modified
vivekrnv Aug 12, 2021
09dd71a
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
vivekrnv Aug 12, 2021
f2754d6
YANG model edited
vivekrnv Aug 12, 2021
9128b6e
init_cfg edit
vivekrnv Aug 12, 2021
91a1468
init_cfg corrected
vivekrnv Aug 13, 2021
ea0966e
tests modified
vivekrnv Aug 13, 2021
3531d47
Made the Compile time flag interactive
vivekrnv Aug 13, 2021
2359bb8
exit-listener updated
vivekrnv Aug 16, 2021
b375827
Yang model updated
vivekrnv Aug 17, 2021
750afc9
Table Name Change for proc_exit_event
vivekrnv Aug 20, 2021
8324fc3
Yang Updated for comments
vivekrnv Aug 29, 2021
7479a1f
Merge Conflict Resolved
vivekrnv Aug 29, 2021
e10bf07
init_cfg and YANG updated
vivekrnv Aug 30, 2021
ae855e0
Script updated for backward compatibility
vivekrnv Aug 30, 2021
301fb48
Description tag added to YANG
vivekrnv Aug 30, 2021
9b29fca
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
vivekrnv Aug 30, 2021
fc7b979
Indentation changes and minor edits
vivekrnv Aug 31, 2021
6dd95b8
YANG model updated
vivekrnv Aug 31, 2021
d0c70ed
init_cfg edited
vivekrnv Sep 1, 2021
c822b76
init_cfg updated
vivekrnv Sep 1, 2021
8bc38f9
YANG Models Updated
vivekrnv Sep 1, 2021
661065c
Merge branch 'master' into event_driven_ts
vivekrnv Sep 2, 2021
1f957c9
Updated the YANG model
vivekrnv Sep 2, 2021
2b79d52
Merge branch 'event_driven_ts' of https://github.com/vivekreddynv/son…
vivekrnv Sep 2, 2021
798b6b5
YANG updated
vivekrnv Sep 14, 2021
eaf28a2
Supervisor Proc exit listener dependency removed
vivekrnv Sep 14, 2021
ee95b7a
Updated description
vivekrnv Sep 14, 2021
f19eb34
Merge branch 'master' into event_driven_ts
vivekrnv Oct 17, 2021
c32e68f
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
vivekrnv Oct 26, 2021
559a5e2
Comment Updated
vivekrnv Nov 9, 2021
27a674b
Merge branch 'Azure:master' into event_driven_ts
vivekrnv Nov 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
# * SONIC_DPKG_CACHE_SOURCE: Debian package cache location when cache enabled for debian packages
# * BUILD_LOG_TIMESTAMP: Set timestamp in the build log (simple/none)
# * DOCKER_EXTRA_OPTS: Extra command line arguments for dockerd running in slave container.
# * ENABLE_AUTO_TECH_SUPPORT: Enable the configuration for event-driven techsupport & coredump mgmt feature
# * Default: y
# * Values: y,n
#
###############################################################################

Expand Down Expand Up @@ -280,6 +283,7 @@ SONIC_BUILD_INSTRUCTION := make \
SONIC_ENABLE_IMAGE_SIGNATURE=$(ENABLE_IMAGE_SIGNATURE) \
ENABLE_HOST_SERVICE_ON_START=$(ENABLE_HOST_SERVICE_ON_START) \
SLAVE_DIR=$(SLAVE_DIR) \
ENABLE_AUTO_TECH_SUPPORT=$(ENABLE_AUTO_TECH_SUPPORT) \
BUILD_MULTIASIC_KVM=$(BUILD_MULTIASIC_KVM) \
$(SONIC_OVERRIDE_BUILD_VARS)

Expand Down
21 changes: 21 additions & 0 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,26 @@
"high_mem_alert": "disabled"
}{% if not loop.last %},{% endif -%}
{% endfor %}
},
"AUTO_TECHSUPPORT": {
"GLOBAL": {
{%- if enable_auto_tech_support == "y" %}
"state" : "enabled", {% else %}
"state" : "disabled", {% endif %}
"rate_limit_interval" : "180",
"max_techsupport_limit" : "10.0",
"max_core_limit" : "5.0",
"since" : "2 days ago"
}
},
"AUTO_TECHSUPPORT_FEATURE": {
{%- for feature, _, _, _ in features %}
"{{feature}}": {
{%- if enable_auto_tech_support == "y" %}
"state" : "enabled", {% else %}
"state" : "disabled", {% endif %}
"rate_limit_interval" : "600"
}{%if not loop.last %},{% endif -%}
{% endfor %}
}
}
3 changes: 3 additions & 0 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ INCLUDE_NAT = y
# INCLUDE_DHCP_RELAY - build and install dhcp-relay package
INCLUDE_DHCP_RELAY = y

# ENABLE_AUTO_TECH_SUPPORT - Enable the configuration for event-driven techsupport & coredump mgmt feature
ENABLE_AUTO_TECH_SUPPORT = y

# TELEMETRY_WRITABLE - Enable write/config operations via the gNMI interface.
# Uncomment to enable:
# TELEMETRY_WRITABLE = y
Expand Down
6 changes: 6 additions & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ ifeq ($(SONIC_INCLUDE_MACSEC),y)
INCLUDE_MACSEC = y
endif

ifeq ($(ENABLE_AUTO_TECH_SUPPORT),y)
ENABLE_AUTO_TECH_SUPPORT = y
endif

include $(RULES_PATH)/functions

ifeq ($(SONIC_USE_PDDF_FRAMEWORK),y)
Expand Down Expand Up @@ -282,6 +286,7 @@ $(info "INCLUDE_DHCP_RELAY" : "$(INCLUDE_DHCP_RELAY)")
$(info "INCLUDE_KUBERNETES" : "$(INCLUDE_KUBERNETES)")
$(info "INCLUDE_MACSEC" : "$(INCLUDE_MACSEC)")
$(info "TELEMETRY_WRITABLE" : "$(TELEMETRY_WRITABLE)")
$(info "ENABLE_AUTO_TECH_SUPPORT" : "$(ENABLE_AUTO_TECH_SUPPORT)")
$(info "PDDF_SUPPORT" : "$(PDDF_SUPPORT)")
$(info "MULTIARCH_QEMU_ENVIRON" : "$(MULTIARCH_QEMU_ENVIRON)")
$(info "SONIC_VERSION_CONTROL_COMPONENTS": "$(SONIC_VERSION_CONTROL_COMPONENTS)")
Expand Down Expand Up @@ -953,6 +958,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export include_restapi="$(INCLUDE_RESTAPI)"
export include_nat="$(INCLUDE_NAT)"
export include_sflow="$(INCLUDE_SFLOW)"
export enable_auto_tech_support="$(ENABLE_AUTO_TECH_SUPPORT)"
export include_macsec="$(INCLUDE_MACSEC)"
export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)"
export include_iccpd="$(INCLUDE_ICCPD)"
Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
version='1.0',
data_files=[
('yang-models', ['./yang-models/sonic-acl.yang',
'./yang-models/sonic-auto_techsupport.yang',
'./yang-models/sonic-bgp-common.yang',
'./yang-models/sonic-bgp-global.yang',
'./yang-models/sonic-bgp-neighbor.yang',
Expand Down
28 changes: 27 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,33 @@
"trap_group": "queue1_group1"
}
},
"AUTO_TECHSUPPORT": {
"GLOBAL": {
"state" : "enabled",
"rate_limit_interval" : "180",
"max_techsupport_limit" : "10.0",
"max_core_limit" : "0.0",
"since" : "2 days ago"
}
},
"AUTO_TECHSUPPORT_FEATURE": {
"bgp" :{
"state" : "disabled",
"rate_limit_interval" : "600"
},
"swss" : {
"state" : "enabled",
"rate_limit_interval" : "600"
},
"snmp" : {
"state" : "enabled",
"rate_limit_interval" : "500"
},
"dhcp_relay" : {
"state" : "disabled",
"rate_limit_interval" : "1000"
}
},
"LLDP": {
"GLOBAL": {
"mode": "TRANSMIT",
Expand All @@ -1071,7 +1098,6 @@
}

},

"SAMPLE_CONFIG_DB_UNKNOWN": {
"UNKNOWN_TABLE": {
"Error": "This Table is for testing, This Table does not have YANG models."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"AUTO_TECHSUPPORT_TEST":{
"desc": "Configure auto techsupport params in AUTO_TECHSUPPORT Table"
},
"AUTO_TECHSUPPORT_WRONG_STATE_VALUE": {
"desc": "Configure state key with invalid value",
"eStrKey": "InvalidValue"
},
"AUTO_TECHSUPPORT_INVALID_RATE_LIMIT_FORMAT": {
"desc" : "Configure cooloff with a value of invalid format",
"eStrKey": "InvalidValue"
},
"AUTO_TECHSUPPORT_OUT_OF_RANGE_DECIMAL": {
"desc" : "Configure a value for core-uage outside the range [0, 100)",
"eStr": "Value \"100.00\" does not satisfy the constraint \"0..99.99\" (range, length, or pattern)."
},
"AUTO_TECHSUPPORT_VALID_DECIMAL_VALUE": {
"desc" : "Configure a value for max_techsupport_size inside the range [0, 100)"
},
"AUTO_TECHSUPPORT_INVALID_FRACTION_DIGITS": {
"desc" : "Configure a value for max_techsupport_size inside the range [0, 100) but with 3 fractional digits",
"eStrKey": "InvalidValue"
},
"AUTO_TECHSUPPORT_RATE_LIMIT_INTERVAL_TEST": {
"desc" : "Configure and test the valid configuration"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"AUTO_TECHSUPPORT_TEST": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT": {
"sonic-auto_techsupport:GLOBAL": {
"state" : "enabled",
"rate_limit_interval" : "180",
"max_techsupport_limit" : "10.0",
"max_core_limit" : "5.0",
"since" : "2 days ago"
}
}
}
},
"AUTO_TECHSUPPORT_WRONG_STATE_VALUE": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT": {
"sonic-auto_techsupport:GLOBAL": {
"state" : "start",
"rate_limit_interval" : "180",
"max_techsupport_limit" : "10.0",
"max_core_limit" : "5.0",
"since" : "2 days ago"
}
}
}
},
"AUTO_TECHSUPPORT_INVALID_RATE_LIMIT_FORMAT": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT": {
"sonic-auto_techsupport:GLOBAL": {
"rate_limit_interval" : "whatever"
}
}
}
},
"AUTO_TECHSUPPORT_OUT_OF_RANGE_DECIMAL": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT": {
"sonic-auto_techsupport:GLOBAL": {
"max_core_limit" : "100.00",
"rate_limit_interval" : "180"
}
}
}
},
"AUTO_TECHSUPPORT_VALID_DECIMAL_VALUE": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT": {
"sonic-auto_techsupport:GLOBAL": {
"max_techsupport_limit" : "11.23",
"max_core_limit" : "99.99"
}
}
}
},
"AUTO_TECHSUPPORT_INVALID_FRACTION_DIGITS": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT": {
"sonic-auto_techsupport:GLOBAL": {
"max_techsupport_limit" : "11.111",
"max_core_limit" : "99.99"
}
}
}
},
"AUTO_TECHSUPPORT_RATE_LIMIT_INTERVAL_TEST": {
"sonic-auto_techsupport:sonic-auto_techsupport": {
"sonic-auto_techsupport:AUTO_TECHSUPPORT_FEATURE": {
"AUTO_TECHSUPPORT_FEATURE_LIST": [
{
"feature_name" : "bgp",
"state" : "enabled",
"rate_limit_interval" : "600"
},
{
"feature_name" : "swss",
"state" : "disabled",
"rate_limit_interval" : "400"
}
]
}
}
}
}
113 changes: 113 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
module sonic-auto_techsupport {

yang-version 1.1;

namespace "http://github.com/Azure/sonic-auto_techsupport";
prefix auto_techsupport;

import sonic-types {
prefix stypes;
}

description "Event Driven Techsupport & CoreDump Mgmt Capability in SONiC OS";

revision 2021-08-09 {
description "First Revision";
}

typedef decimal-repr {
type decimal64 {
fraction-digits 2;
range 0.0..99.99;
}
}

container sonic-auto_techsupport {

container AUTO_TECHSUPPORT {

description "AUTO_TECHSUPPORT part of config_db.json";

container GLOBAL {

leaf state {
description "Knob to make techsupport invocation event-driven based on core-dump generation";
type stypes:admin_mode;
}

leaf rate_limit_interval {
description "Minimum time in seconds between two successive techsupport invocations. Configure 0 to explicitly disable";
type uint16;
}

leaf max_techsupport_limit {
/*
A value between (0,100) should be specified.
Upto two decimal places will be used in the calculation
The actual value in bytes is calculate based on the available space in the filesystem hosting /var/dump
When the limit is crossed, the older core files are incrementally deleted
*/
description "Max Limit in percentage for the cummulative size of ts dumps. No cleanup is performed if the value isn't configured or is 0.0";
type decimal-repr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value is between (0, 100) here. But decimal-repr range is from 0.0 to 99.99, can you clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was intended to be b/w 0.0 to 99.99. As for the comment (A value between (0,100) should be specified, Upto two decimal places will be used in the calculation) , I've used open brackets to signify the value is between 0 & 100. and the next comment suggests that upto two decimal places are used. So, i think this is clear. Although, let me know, if i have to re-write comments to make them clear

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open brackets does not include 0 and 100? Please update comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment

}

leaf max_core_limit {
/*
A value between (0,100) should be specified.
Upto two decimal places will be used in the calculation
The actual value in bytes is calculated based on the available space in the filesystem hosting /var/core
When the limit is crossed, the older core files are deleted
*/
description "Max Limit in percentage for the cummulative size of core dumps. No cleanup is performed if the value isn't congiured or is 0.0";
type decimal-repr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range 0.0..99.99?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented above

}

leaf since {
/*
Any valid date string of the formats specified here (https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html)
can be used.
*/
description "Only collect the logs & core-dumps generated since the time provided. A default value of '2 days ago' is used if this value is not set explicitly or a non-valid string is provided";
type string {
length 1..255;
}
}
}
/* end of container GLOBAL */
}
/* end of container AUTO_TECHSUPPORT */

container AUTO_TECHSUPPORT_FEATURE {

description "AUTO_TECHSUPPORT_FEATURE part of config_db.json";

list AUTO_TECHSUPPORT_FEATURE_LIST {

key "feature_name";

leaf feature_name {
description "The name of this feature";
/* TODO: Leafref once the FEATURE YANG is added*/
type string {
length 1..255;
}
}

leaf state {
description "Enable auto techsupport invocation on the processes running inside this feature";
type stypes:admin_mode;
}

leaf rate_limit_interval {
description "Rate limit interval for the corresponding feature. Configure 0 to explicitly disable";
type uint16;
}

}
/* end of AUTO_TECHSUPPORT_FEATURE_LIST */
}
/* end of container AUTO_TECHSUPPORT_FEATURE */
}
/* end of top level container */
}