From 95452b7385cd23d032e280b95f9e7e21338a67f0 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Wed, 12 Jun 2019 17:10:43 +0800 Subject: [PATCH 01/37] [docker-pmon] install dmidecode tool to pmon (#2990) --- dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 2244828c2117..1f9f749f0751 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -7,7 +7,7 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ENV DEBIAN_FRONTEND=noninteractive # Install required packages -RUN apt-get update && apt-get install -y python-pip libpython2.7 ipmitool librrd8 librrd-dev rrdtool python-smbus ethtool +RUN apt-get update && apt-get install -y python-pip libpython2.7 ipmitool librrd8 librrd-dev rrdtool python-smbus ethtool dmidecode {% if docker_platform_monitor_debs.strip() -%} # Copy locally-built Debian package dependencies From ab5afad6a6946e544233aeb31e78b8a7285de8a5 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Wed, 12 Jun 2019 22:51:27 -0700 Subject: [PATCH 02/37] [FRR]: enable bgp graceful-restart preserve-fw-state for FRR warm reboot support on T0 (#2998) Signed-off-by: Jipan Yang --- dockers/docker-fpm-frr/bgpd.conf.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index aab7d0110404..7ca08c7dace9 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -29,6 +29,9 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} no bgp default ipv4-unicast bgp graceful-restart restart-time 240 bgp graceful-restart +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} + bgp graceful-restart preserve-fw-state +{% endif %} {% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %} {% if prefix | ipv4 and name == 'Loopback0' %} bgp router-id {{ prefix | ip }} From f5f7fb38b875989d64187635adaab631187117b1 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 13 Jun 2019 16:00:30 -0700 Subject: [PATCH 03/37] [gitignore] Ignore .DS_Store files (#2997) --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 7d355b8ff46f..486dde110639 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# OS-generated files +.DS_Store + # Build system related .platform .screen From 383fc0fa4b75a9f8762ae73dafdb48694994a037 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Fri, 14 Jun 2019 05:04:45 +0300 Subject: [PATCH 04/37] [FRR] fix pfx_filter to fix bgpd.conf.j2 rendering when no vlan interfaces (#2994) --- src/sonic-config-engine/sonic-cfggen | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index e0bd07ff8cf1..abf858782f3c 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -6,9 +6,9 @@ minigraph file, config DB, json file(s), yaml files(s), command line input, and write the data into DB, print as json, or render a jinja2 config template. Examples: - Render template with minigraph: + Render template with minigraph: sonic-cfggen -m -t /usr/share/template/bgpd.conf.j2 - Dump config DB content into json file: + Dump config DB content into json file: sonic-cfggen -d --print-data > db_dump.json Load content of json file into config DB: sonic-cfggen -j db_dump.json --write-to-db @@ -93,6 +93,10 @@ def pfx_filter(value): For eg - VLAN_INTERFACE|Vlan1000 vs VLAN_INTERFACE|Vlan1000|192.168.0.1/21 """ table = OrderedDict() + + if not value: + return table + for key,val in value.items(): if not isinstance(key, tuple): continue @@ -104,7 +108,7 @@ class FormatConverter: We will move to DB schema and remove this class when the config templates are modified. TODO(taoyl): Current version of config db only supports BGP admin states. - All other configuration are still loaded from minigraph. Plan to remove + All other configuration are still loaded from minigraph. Plan to remove minigraph and move everything into config db in a later commit. """ @staticmethod @@ -214,7 +218,7 @@ def main(): for yaml_file in args.yaml: with open(yaml_file, 'r') as stream: - additional_data = yaml.load(stream) + additional_data = yaml.load(stream) deep_update(data, FormatConverter.to_deserialized(additional_data)) for json_file in args.json: @@ -223,7 +227,7 @@ def main(): if args.additional_data != None: deep_update(data, json.loads(args.additional_data)) - + if args.from_db: configdb = ConfigDBConnector(**db_kwargs) configdb.connect() From 8f6ae90cbaeec2b13942677ccc11c0b443268c46 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 13 Jun 2019 22:24:09 -0700 Subject: [PATCH 05/37] [docker]: get hostname from config db instead of minigraph (#3004) minigraph may not be always available on the some system configuration. Should use config db as the source of truth. --- files/build_templates/docker_image_ctl.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 9b11ea517566..7dfc5e3c7c4e 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -130,8 +130,8 @@ start() { {%- else %} # Obtain our HWSKU as we will mount directories with these names in each docker HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'` + HOSTNAME=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hostname"]'` {%- endif %} - HOSTNAME=`sonic-cfggen -m -v 'DEVICE_METADATA["localhost"]["hostname"]'` if [ -z "$HOSTNAME" ] || ! [[ $HOSTNAME =~ ^[a-zA-Z0-9.\-]*$ ]]; then HOSTNAME=`hostname` fi From f8a4efc3e13be1c8a86c68c6412187c2b53599b1 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 14 Jun 2019 10:21:28 -0700 Subject: [PATCH 06/37] [swss]: Update swss submodules change (#2995) sonic-swss: [vnet]: Extend Bitmap VNET test with "remove" flows (#900) [vxlanorch] Ambiguous return code for removeNextHopTunnel (#880) Address review comment: remove data member m_entriesCreated, which is introduced for dependancy resolution purpose. (#839) Set LAG mtu value based on kernel netlink msg (#922) [orchagent]: Remove try/catch for correct coredump file (#790) [aclorch] unittest by gtest (#924) [orchagent]: Added support of PFC WD for BFN platform (#823) [vnetorch]: Fix tunnel route removal flow for bitmap VNET (#912) pkill -9 zebra for frr warm restart VS test fix (#927) swss-orchagent: add new orch for vnet routes/tunnel routes tables in CONFIG_DB (#907) [debian]: Do not build test when building with real SAI (#932) sonic-swss-common: Add schema for dot1p to tc mapping config table (#274) Fix MIRROR_SESSION table macro name (#264) [schema] Add VNET Route tables in config_db (#279) [debian] increment debian compatibility to 10 to enable parallel package build (#280) White-list clear_stats op from orchagent to syncd (#281) Correct comment (#282) sonic-sairedis: [debian]: Change build order in target binary (#452) [debian] increment debian compatibility to 10 to enable parallel package build (#461) Full sleep wait flex counter polling thread when POLL_COUNTER_STATUS is disable (#462) add support for SAI_ATTR_VALUE_TYPE_ACL_CAPABILITY (#460) Check if port VID exists in db on flex counter query (#464) Full sleep wait change for PFC watchdog (#465) Add synchronous clear_stats operation path (#463) Modify sai_create_port to breakout a port for virtual switch (#454) Fix typo (#467) Signed-off-by: Shu0T1an ChenG --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index dcab09f2881a..d5c89cd92d93 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit dcab09f2881a0b45a2c03c091e641ff66dfada8c +Subproject commit d5c89cd92d93cd0ec338c629046f67cf22a54e38 diff --git a/src/sonic-swss b/src/sonic-swss index d6167643c0ce..7a1a97c8b4d9 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit d6167643c0ce4778ce1ec5be2530f48ef94ccc29 +Subproject commit 7a1a97c8b4d9ada359b201f55fad0aa49771d3e6 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 485db073a17d..bd7d5941b6c0 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 485db073a17d2ac0cd9d6f29b0b8d7c245c66663 +Subproject commit bd7d5941b6c026f7eb839f409331c2ba91ecf5f2 From a5aa3bb0a5da944584d4bd3640e8a9d1f3ae21f9 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 14 Jun 2019 15:47:11 -0700 Subject: [PATCH 07/37] [Broadcom]: Update SAI version to 3.5.2.3 (#3014) --Create/remove port fix --Support SAI_PORT_ATTR_SERDES_IPREDRIVER --Egress ACL fix for PFC storm restoration --Memory corruption during warm reboot --SAI_OBJECT_TYPE_TUNNEL_MAP_ENTRY removal fix --Segfault/memory corruption fix during switch shutdown --Directed boardcast fix --Pre-emphasis value for Dell 6100 Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index eaf7afba0a21..28fdf57577c9 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.5.2.1_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.5s/libsaibcm_3.5.2.1_amd64.deb?sv=2015-04-05&sr=b&sig=VsOGePXPU9TtxXxQTkLfM%2FIzW6BL8q6RxP6QputuuEU%3D&se=2156-03-28T05%3A37%3A02Z&sp=r" +BRCM_SAI = libsaibcm_3.5.2.3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.5/libsaibcm_3.5.2.3_amd64.deb?sv=2015-04-05&sr=b&sig=anY6TeLouYsw7L6hfpH%2BTHOkvF8M3WR%2B6P2C7Dh8sHg%3D&se=2033-02-20T17%3A19%3A46Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.5.2.1_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.5.2.3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.5s/libsaibcm-dev_3.5.2.1_amd64.deb?sv=2015-04-05&sr=b&sig=3pWbROLKK5ZuVcAra%2BYo1pk4B0k1P3C76wVw4KiqOtY%3D&se=2156-03-28T05%3A35%3A35Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.5/libsaibcm-dev_3.5.2.3_amd64.deb?sv=2015-04-05&sr=b&sig=o%2BVIKwVnlNv8LAvVzcS2kIXc0%2BIKaTzmA8LIkIfsh6c%3D&se=2033-02-20T17%3A20%3A03Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 466334a8c9c178e3c9f8434815133733d83dc9bb Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 14 Jun 2019 17:26:58 -0700 Subject: [PATCH 08/37] [libteam]: Reimplement Warm-Reboot procedure (#3016) * Update sonic-quagga submodule * [libteam]: Reimplement Warm-Reboot procedure --- .../0008-libteam-Add-warm_reboot-mode.patch | 616 +++++++++++++----- 1 file changed, 454 insertions(+), 162 deletions(-) diff --git a/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch b/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch index 9e3f94e4412d..10770b8740b5 100644 --- a/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch +++ b/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch @@ -1,18 +1,15 @@ -From fe097ebcadd52e56a589c38a9c821cf1a84d6b67 Mon Sep 17 00:00:00 2001 -From: yorke -Date: Mon, 3 Jun 2019 14:48:14 +0800 -Subject: [PATCH 8/8] [libteam] Add warm_reboot mode From: pavel-shirshov - and Ying Xie - https://github.com/Azure/sonic-buildimage/pull/2173 +From a21a3dec9f9b9d825a0229e2963e07862395bbba Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Fri, 14 Jun 2019 14:20:05 -0700 +Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure -Signed-off-by: yorke --- libteam/ifinfo.c | 6 +- - teamd/teamd.c | 46 +++++++++- - teamd/teamd.h | 7 ++ - teamd/teamd_events.c | 13 +++ - teamd/teamd_runner_lacp.c | 209 +++++++++++++++++++++++++++++++++++++++------- - 5 files changed, 245 insertions(+), 36 deletions(-) + teamd/teamd.c | 42 +++- + teamd/teamd.h | 6 + + teamd/teamd_events.c | 13 ++ + teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++--- + 5 files changed, 498 insertions(+), 43 deletions(-) diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c index 46d56a2..b86d34c 100644 @@ -37,7 +34,7 @@ index 46d56a2..b86d34c 100644 } } diff --git a/teamd/teamd.c b/teamd/teamd.c -index 9dc85b5..1a974d1 100644 +index 9dc85b5..96794e8 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c @@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) { @@ -51,15 +48,6 @@ index 9dc85b5..1a974d1 100644 ctx->argv0); printf("Available runners: "); for (i = 0; i < TEAMD_RUNNER_LIST_SIZE; i++) { -@@ -130,7 +132,7 @@ static void print_help(const struct teamd_context *ctx) { - - static int parse_command_line(struct teamd_context *ctx, - int argc, char *argv[]) { -- int opt; -+ int opt, err; - static const struct option long_options[] = { - { "help", no_argument, NULL, 'h' }, - { "daemonize", no_argument, NULL, 'd' }, @@ -151,10 +153,12 @@ static int parse_command_line(struct teamd_context *ctx, { "zmq-enable", required_argument, NULL, 'Z' }, { "usock-enable", no_argument, NULL, 'U' }, @@ -74,13 +62,12 @@ index 9dc85b5..1a974d1 100644 long_options, NULL)) >= 0) { switch(opt) { -@@ -236,11 +240,29 @@ static int parse_command_line(struct teamd_context *ctx, +@@ -236,11 +240,27 @@ static int parse_command_line(struct teamd_context *ctx, case 'u': ctx->usock.enabled = false; break; + case 'w': -+ ctx->warm_start_read = true; -+ ctx->warm_start_carrier = true; ++ ctx->warm_start_mode = true; + break; + case 'L': + ctx->lacp_directory = strdup(optarg); @@ -95,16 +82,15 @@ index 9dc85b5..1a974d1 100644 } } -+ if (ctx->warm_start_read && !ctx->lacp_directory) { ++ if (ctx->warm_start_mode && !ctx->lacp_directory) { + fprintf(stderr, "Can't enable warm-start mode without lacp-directory specified\n"); -+ ctx->warm_start_read = false; -+ ctx->warm_start_carrier = false; ++ ctx->warm_start_mode = false; + } + if (optind < argc) { fprintf(stderr, "Too many arguments\n"); return -1; -@@ -390,8 +412,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) +@@ -390,8 +410,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) if (err != -1) { switch(ctrl_byte) { case 'q': @@ -119,7 +105,7 @@ index 9dc85b5..1a974d1 100644 teamd_refresh_ports(ctx); err = teamd_flush_ports(ctx); if (err) -@@ -434,6 +462,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) +@@ -434,6 +460,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) teamd_run_loop_sent_ctrl_byte(ctx, 'q'); } @@ -132,7 +118,7 @@ index 9dc85b5..1a974d1 100644 void teamd_run_loop_restart(struct teamd_context *ctx) { teamd_run_loop_sent_ctrl_byte(ctx, 'r'); -@@ -700,6 +734,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, +@@ -700,6 +732,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM."); teamd_run_loop_quit(ctx, 0); break; @@ -143,7 +129,7 @@ index 9dc85b5..1a974d1 100644 } return 0; } -@@ -1531,7 +1569,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) +@@ -1531,7 +1567,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) return -errno; } @@ -153,21 +139,20 @@ index 9dc85b5..1a974d1 100644 daemon_retval_send(errno); err = -errno; diff --git a/teamd/teamd.h b/teamd/teamd.h -index e71a5dc..f83a2d9 100644 +index e71a5dc..418214d 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h -@@ -126,6 +126,10 @@ struct teamd_context { +@@ -126,6 +126,9 @@ struct teamd_context { char * hwaddr; uint32_t hwaddr_len; bool hwaddr_explicit; -+ bool warm_start_read; -+ bool warm_start_carrier; ++ bool warm_start_mode; + bool keep_ports; + char * lacp_directory; struct { struct list_item callback_list; int ctrl_pipe_r; -@@ -195,12 +199,15 @@ struct teamd_event_watch_ops { +@@ -195,12 +198,15 @@ struct teamd_event_watch_ops { void *priv); void (*refresh)(struct teamd_context *ctx, struct teamd_port *tdport, void *priv); @@ -208,7 +193,7 @@ index 221803e..bd4dcc1 100644 struct teamd_port *tdport) { diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 4016b15..087efa9 100644 +index 4016b15..81be5b7 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -31,6 +31,7 @@ @@ -219,55 +204,348 @@ index 4016b15..087efa9 100644 #include "teamd.h" #include "teamd_config.h" -@@ -131,6 +132,7 @@ struct lacp { +@@ -127,10 +128,18 @@ static const char *lacp_agg_select_policy_names_list[] = { + + struct lacp_port; + ++struct wr_tdport_state ++{ ++ char name[IFNAMSIZ+1]; ++ bool enabled; ++ bool checked; ++}; ++ + struct lacp { struct teamd_context *ctx; struct lacp_port *selected_agg_lead; /* leading port of selected aggregator */ bool carrier_up; -+ time_t warm_start_carrier_timer; ++ time_t warm_start_mode_timer; struct { bool active; #define LACP_CFG_DFLT_ACTIVE true -@@ -174,6 +176,9 @@ struct lacp_port { +@@ -145,6 +154,11 @@ struct lacp { + enum lacp_agg_select_policy agg_select_policy; + #define LACP_CFG_DFLT_AGG_SELECT_POLICY LACP_AGG_SELECT_LACP_PRIO + } cfg; ++ struct { ++ bool carrier_up; ++ uint16_t nr_of_tdports; ++ struct wr_tdport_state *state; ++ } wr; + struct teamd_balancer *tb; + }; + +@@ -174,6 +188,8 @@ struct lacp_port { struct lacp_port *agg_lead; /* leading port of aggregator. * NULL in case this port is not selected */ enum lacp_port_state state; + bool lacpdu_saved; -+ bool lacpdu_read; + struct lacpdu last_pdu; struct { uint32_t speed; uint8_t duplex; -@@ -493,15 +498,28 @@ static int lacp_update_carrier(struct lacp *lacp) - bool state; +@@ -189,6 +205,201 @@ struct lacp_port { + } cfg; + }; + ++static void generate_path(struct teamd_context *ctx, char path[PATH_MAX], const char* filename) ++{ ++ strcpy(path, ctx->lacp_directory); ++ /* Add trailing slash if we don't have one in the filename */ ++ if (path[strlen(path) - 1] != '/') ++ strcat(path, "/"); ++ strcat(path, filename); ++} ++ ++static int find_wr_info(struct lacp_port *lacp_port) { ++ struct lacp* lacp = lacp_port->lacp; ++ int i, found = -1; ++ ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ if (strcmp(lacp->wr.state[i].name, lacp_port->tdport->ifname) == 0) { ++ found = i; ++ break; ++ } ++ } ++ ++ if (found == -1) ++ teamd_log_warn("WR-mode. Found a newly added LAG member port: '%s' after restart. " ++ "The configuration was changed?", lacp_port->tdport->ifname); ++ ++ return found; ++} ++ ++static void remove_file(struct teamd_context *ctx, const char *name) { ++ char filename[PATH_MAX]; ++ int err; ++ ++ generate_path(ctx, filename, name); ++ ++ err = access(filename, R_OK); ++ if (err != 0) { ++ /* file is not present. Skip it */ ++ return; ++ } ++ ++ err = unlink(filename); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't remove file %s: %s", filename, strerror(errno)); ++ } ++} ++ ++static void stop_wr_mode(struct lacp *lacp) { ++ int i; ++ ++ teamd_log_info("WR-mode. Stopping WR start mode"); ++ ++ lacp->ctx->warm_start_mode = false; ++ lacp->warm_start_mode_timer = 0; ++ ++ remove_file(lacp->ctx, lacp->ctx->team_devname); ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ remove_file(lacp->ctx, lacp->wr.state[i].name); ++ } ++ ++ lacp->wr.nr_of_tdports = 0; ++ if (lacp->wr.state) ++ free(lacp->wr.state); ++ lacp->wr.state = NULL; ++} ++ ++static int lacpdu_read(struct lacp_port *lacp_port, struct lacpdu *lacpdu) ++{ ++ FILE* fp; ++ char filename[PATH_MAX]; ++ int err, nitems; ++ ++ teamd_log_dbg("WR-mode. function lacpdu_read(): %s", lacp_port->tdport->ifname); ++ ++ generate_path(lacp_port->ctx, filename, lacp_port->tdport->ifname); ++ ++ /* check that file is readable. if there is no file, don't do anything */ ++ err = access(filename, R_OK); ++ if (err != 0) { ++ teamd_log_err("WR-mode. LACPDU state file '%s' is unreadable", filename); ++ return err; ++ } ++ ++ fp = fopen(filename, "r"); ++ if (!fp) { ++ teamd_log_err("WR-mode. Can't open lacp-saved dump from file '%s': %s", filename, strerror(errno)); ++ return errno; ++ } ++ ++ nitems = fread(lacpdu, sizeof(struct lacpdu), 1, fp); ++ (void)fclose(fp); ++ ++ err = unlink(filename); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't remove file '%s': %s", filename, strerror(errno)); ++ } ++ ++ if (nitems != 1) { ++ teamd_log_err("WR-mode. Can't read lacp-saved dump from file '%s': %s", filename, strerror(errno)); ++ return -EINVAL; ++ } ++ ++ teamd_log_info("WR-mode. LACP state was read for port '%s'", lacp_port->tdport->ifname); ++ ++ return 0; ++} ++ ++static void lacp_state_save(struct teamd_context *ctx, struct lacp *lacp) ++{ ++ char filename[PATH_MAX]; ++ FILE *fp; ++ int i, err; ++ ++ generate_path(ctx, filename, ctx->team_devname); ++ ++ fp = fopen(filename, "wt"); ++ if (!fp) { ++ teamd_log_err("WR-mode. Can't open the file '%s' to save the lacp dump: %s", filename, strerror(errno)); ++ goto error; ++ } ++ ++ err = fprintf(fp, "%d\n%d\n", lacp->carrier_up ? 1 : 0, lacp->wr.nr_of_tdports); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't write to the file '%s' to save the lacp dump: %s", filename, strerror(errno)); ++ goto error_with_close; ++ } ++ ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ err = fprintf(fp, "%s\n%d\n", lacp->wr.state[i].name, lacp->wr.state[i].enabled ? 1 : 0); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't write to the file '%s' to save the lacp dump: %s", filename, strerror(errno)); ++ goto error_with_close; ++ } ++ } ++ ++error_with_close: ++ (void)fclose(fp); ++ ++error: ++ (void)free(lacp->wr.state); ++ lacp->wr.state = NULL; ++ lacp->wr.nr_of_tdports = 0; ++} ++ ++static int lacp_state_load(struct teamd_context *ctx, struct lacp *lacp) ++{ ++ char filename[PATH_MAX]; ++ FILE *fp; ++ int data1, data2, i, err; ++ ++ teamd_log_dbg("WR-mode. function lacp_state_load()"); ++ ++ generate_path(ctx, filename, ctx->team_devname); ++ ++ fp = fopen(filename, "rt"); ++ if (!fp) { ++ teamd_log_err("WR-mode. Can't open the file '%s' to load the lacp dump: %s", filename, strerror(errno)); ++ return errno; ++ } ++ ++ err = fscanf(fp, "%d\n%d\n", &data1, &data2); ++ if (err != 2) { ++ teamd_log_err("WR-mode. Can't read the file '%s'. Wrong format", filename); ++ (void)fclose(fp); ++ return -1; ++ } ++ lacp->wr.carrier_up = data1 == 1; ++ lacp->wr.nr_of_tdports = data2; ++ ++ lacp->wr.state = calloc(lacp->wr.nr_of_tdports, sizeof(struct wr_tdport_state)); ++ if (!lacp->wr.state) { ++ teamd_log_err("WR-mode. lacp_state_load: Not enough memory. %s", ctx->team_devname); ++ return -1; ++ } ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ err = fscanf(fp, "%16s\n%d\n", &lacp->wr.state[i].name[0], &data1); ++ if (err != 2) { ++ teamd_log_err("WR-mode. Can't read the file '%s'. Wrong format", filename); ++ (void)free(lacp->wr.state); ++ lacp->wr.state = NULL; ++ (void)fclose(fp); ++ return -1; ++ } ++ lacp->wr.state[i].enabled = data1 == 1; ++ lacp->wr.state[i].checked = false; ++ } ++ ++ (void)fclose(fp); ++ ++ err = unlink(filename); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't remove file %s: %s", filename, strerror(errno)); ++ } ++ ++ return 0; ++} ++ + static struct lacp_port *lacp_port_get(struct lacp *lacp, + struct teamd_port *tdport) + { +@@ -486,20 +697,95 @@ static int lacp_set_carrier(struct lacp *lacp, bool carrier_up) + return 0; + } + ++static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu); ++ ++#define LACP_WARM_START_CARRIER_TIMEOUT 3 ++ + static int lacp_update_carrier(struct lacp *lacp) + { + struct teamd_port *tdport; + int ports_enabled; +- bool state; int err; -+ #define WARM_START_CARRIER_TIMEOUT 3 -+ /* wait three seconds until disable warm_start_carrier mode */ -+ if (lacp->ctx->warm_start_carrier && -+ lacp->warm_start_carrier_timer >= (time(NULL) + WARM_START_CARRIER_TIMEOUT)) { -+ lacp->ctx->warm_start_carrier = false; -+ lacp->warm_start_carrier_timer = 0; ++ if (lacp->ctx->warm_start_mode) { ++ teamd_log_dbg("WR-mode. function lacp_update_carrier()"); + } + ports_enabled = 0; teamd_for_each_tdport(tdport, lacp->ctx) { ++ bool state; err = teamd_port_enabled(lacp->ctx, tdport, &state); if (err) return err; - if (state && ++ports_enabled >= lacp->cfg.min_ports) -+ if (state && ++ports_enabled >= lacp->cfg.min_ports) { -+ lacp->ctx->warm_start_carrier = false; - return lacp_set_carrier(lacp, true); +- return lacp_set_carrier(lacp, true); ++ ++ if (state) ++ ++ports_enabled; ++ ++ if (lacp->ctx->warm_start_mode) { ++ int found; ++ struct lacp_port* lacp_port; ++ bool linkup; ++ ++ lacp_port = lacp_port_get(lacp, tdport); ++ found = find_wr_info(lacp_port); ++ if (found < 0) /* newly added port was found */ ++ continue; ++ ++ linkup = team_is_port_link_up(lacp_port->tdport->team_port); ++ if (linkup) { /* read when the port is in carrier up state */ ++ if (!lacp->wr.state[found].checked) { ++ lacp->wr.state[found].checked = true; ++ ++ if(lacp->wr.state[found].enabled) { ++ /* the port was up before the WR. Trying to restore it */ ++ struct lacpdu lacpdu; ++ err = lacpdu_read(lacp_port, &lacpdu); ++ if (err) /* Can't read, so the port will start from scratch */ ++ continue; ++ teamd_log_info("WR-mode. State of the LAG member port '%s' was restored.", ++ tdport->ifname); ++ return lacpdu_process(lacp_port, &lacpdu); /* it runs lacp_update_carrier() inside of it */ ++ } else { ++ teamd_log_info("WR-mode. State of the LAG member port '%s' was down before the restart. Nothing to read", ++ tdport->ifname); ++ } ++ } ++ } + } ++ } ++ ++ if (lacp->ctx->warm_start_mode) { ++ int i; ++ bool has_all_ports_added = true; ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) ++ has_all_ports_added = has_all_ports_added && lacp->wr.state[i].checked; ++ ++ if (has_all_ports_added) { ++ teamd_log_info("WR-mode. The state for all %d LAG member ports was restored.", ++ lacp->wr.nr_of_tdports); ++ stop_wr_mode(lacp); ++ } ++ } ++ ++ if (lacp->ctx->warm_start_mode) { ++ if (lacp->warm_start_mode_timer == 0) { ++ lacp->warm_start_mode_timer = time(NULL) + LACP_WARM_START_CARRIER_TIMEOUT; ++ } else if (time(NULL) >= lacp->warm_start_mode_timer) { ++ teamd_log_err("WR-mode. Timeout occured. Can't start in WR mode in %d seconds", ++ LACP_WARM_START_CARRIER_TIMEOUT); ++ stop_wr_mode(lacp); ++ } ++ } ++ ++ if (ports_enabled >= lacp->cfg.min_ports) { ++ teamd_log_dbg("Enable carrier. Number of enabled ports %d >= configured min_ports %d", ++ ports_enabled, lacp->cfg.min_ports); ++ return lacp_set_carrier(lacp, true); ++ } ++ ++ if (lacp->ctx->warm_start_mode) { ++ teamd_log_info("WR-mode. lacp_update_carrier(): Keep LAG interface up because of WR start mode"); ++ return lacp_set_carrier(lacp, true); } -+ if (lacp->ctx->warm_start_carrier) -+ return 0; /* Don't put carrier down if we're in warm_start_carrier mode */ -+ return lacp_set_carrier(lacp, false); - } - -@@ -919,6 +937,18 @@ static void lacp_port_actor_system_update(struct lacp_port *lacp_port) +@@ -919,6 +1205,18 @@ static void lacp_port_actor_system_update(struct lacp_port *lacp_port) memcpy(actor->system, lacp_port->ctx->hwaddr, ETH_ALEN); } @@ -286,7 +564,7 @@ index 4016b15..087efa9 100644 static void lacp_port_actor_init(struct lacp_port *lacp_port) { struct lacpdu_info *actor = &lacp_port->actor; -@@ -926,7 +956,7 @@ static void lacp_port_actor_init(struct lacp_port *lacp_port) +@@ -926,7 +1224,7 @@ static void lacp_port_actor_init(struct lacp_port *lacp_port) actor->system_priority = htons(lacp_port->lacp->cfg.sys_prio); actor->key = htons(lacp_port->cfg.lacp_key); actor->port_priority = htons(lacp_port->cfg.lacp_prio); @@ -295,7 +573,7 @@ index 4016b15..087efa9 100644 lacp_port_actor_system_update(lacp_port); } -@@ -1006,6 +1036,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, +@@ -1006,6 +1304,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, break; } @@ -309,7 +587,7 @@ index 4016b15..087efa9 100644 teamd_log_info("%s: Changed port state: \"%s\" -> \"%s\"", lacp_port->tdport->ifname, lacp_port_state_name[lacp_port->state], -@@ -1095,34 +1132,26 @@ static int lacpdu_send(struct lacp_port *lacp_port) +@@ -1095,34 +1400,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) return err; } @@ -329,9 +607,9 @@ index 4016b15..087efa9 100644 - admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); - if (!admin_state) - return 0; - - if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) - return 0; +- +- if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) +- return 0; - if (!lacpdu_check(&lacpdu)) { + if (!lacpdu_check(lacpdu)) { @@ -352,7 +630,7 @@ index 4016b15..087efa9 100644 err = lacp_port_partner_update(lacp_port); if (err) return err; -@@ -1138,7 +1167,7 @@ static int lacpdu_recv(struct lacp_port *lacp_port) +@@ -1138,21 +1432,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port) lacp_port_actor_update(lacp_port); /* Check if the other side has correct info about us */ @@ -361,7 +639,16 @@ index 4016b15..087efa9 100644 sizeof(struct lacpdu_info))) { err = lacpdu_send(lacp_port); if (err) -@@ -1153,6 +1182,70 @@ static int lacpdu_recv(struct lacp_port *lacp_port) + return err; + } + err = lacp_port_timeout_set(lacp_port, false); +- if (err) { ++ if (err) + return err; +- } ++ + teamd_loop_callback_enable(lacp_port->ctx, + LACP_TIMEOUT_CB_NAME, lacp_port); return 0; } @@ -377,62 +664,42 @@ index 4016b15..087efa9 100644 + if (err <= 0) + return err; + ++ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) ++ return 0; ++ + admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); + if (!admin_state) + return 0; + -+ return lacpdu_process(lacp_port, &lacpdu); -+} -+ -+static int lacpdu_read(struct lacp_port *lacp_port) -+{ -+ FILE* fp; -+ char filename[PATH_MAX]; -+ struct lacpdu lacpdu; -+ int err, nitems; -+ struct teamd_port *tdport; -+ -+ /* we read saved lacpdu for the current lacp_port */ -+ lacp_port->lacpdu_read = true; -+ -+ strcpy(filename, lacp_port->ctx->lacp_directory); -+ if (filename[strlen(filename) - 1] != '/') -+ strcat(filename, "/"); /* Add trailing slash if we don't have one in the filename */ -+ strcat(filename, lacp_port->tdport->ifname); -+ -+ /* check that file is readable. if there is no file, don't do anything */ -+ if (access(filename, R_OK) != 0) { -+ return 0; -+ } ++ /* if the lacpdu wasn't read yet, don't process received pdu */ ++ if (lacp_port->ctx->warm_start_mode) { ++ int found; + -+ fp = fopen(filename, "r"); -+ if (!fp) { -+ teamd_log_err("Can't open lacp-saved dump from file %s: %s", filename, strerror(errno)); -+ return errno; -+ } -+ -+ nitems = fread(&lacpdu, sizeof(struct lacpdu), 1, fp); -+ (void)fclose(fp); -+ -+ err = unlink(filename); -+ if (err < 0) { -+ teamd_log_err("Can't remove file %s: %s", filename, strerror(errno)); -+ } -+ -+ if (nitems != 1) { -+ teamd_log_err("Can't read lacp-saved dump from file %s: %s", filename, strerror(errno)); -+ return err; ++ found = find_wr_info(lacp_port); ++ if (found >= 0 && !lacp_port->lacp->wr.state[found].checked) { ++ teamd_log_info("WR-mode. Received LACP PDU on %s. " ++ "But saved LACP PDU wasn't processed yet.", ++ lacp_port->tdport->ifname); ++ return 0; ++ } + } + -+ teamd_log_info("%s: LACP state was read", lacp_port->tdport->ifname); -+ + return lacpdu_process(lacp_port, &lacpdu); +} + static int lacp_callback_timeout(struct teamd_context *ctx, int events, void *priv) { -@@ -1304,6 +1397,13 @@ static int lacp_port_added(struct teamd_context *ctx, +@@ -1258,6 +1587,8 @@ static int lacp_port_added(struct teamd_context *ctx, + struct lacp *lacp = creator_priv; + int err; + ++ teamd_log_dbg("function lacp_port_added(): %s", tdport->ifname); ++ + lacp_port->ctx = ctx; + lacp_port->tdport = tdport; + lacp_port->lacp = lacp; +@@ -1304,6 +1635,13 @@ static int lacp_port_added(struct teamd_context *ctx, goto periodic_callback_del; } @@ -446,25 +713,13 @@ index 4016b15..087efa9 100644 /* Newly added ports are disabled */ err = team_set_port_enabled(ctx->th, tdport->ifindex, false); if (err) { -@@ -1319,6 +1419,13 @@ static int lacp_port_added(struct teamd_context *ctx, - lacp_port_actor_init(lacp_port); - lacp_port_link_update(lacp_port); - -+ /* Read data from file and process it */ -+ if (ctx->warm_start_read) { -+ err = lacpdu_read(lacp_port); -+ if (err) -+ goto timeout_callback_del; -+ } -+ - teamd_loop_callback_enable(ctx, LACP_SOCKET_CB_NAME, lacp_port); - return 0; - -@@ -1341,7 +1448,11 @@ static void lacp_port_removed(struct teamd_context *ctx, +@@ -1341,7 +1679,13 @@ static void lacp_port_removed(struct teamd_context *ctx, { struct lacp_port *lacp_port = priv; - lacp_port_set_state(lacp_port, PORT_STATE_DISABLED); ++ teamd_log_dbg("function lacp_port_removed(): %s", tdport->ifname); ++ + if (!lacp_port->ctx->keep_ports) { + /* Don't transition into DISABLED state, + which sends EXPIRED LACP PDU update */ @@ -473,7 +728,19 @@ index 4016b15..087efa9 100644 teamd_loop_callback_del(ctx, LACP_TIMEOUT_CB_NAME, lacp_port); teamd_loop_callback_del(ctx, LACP_PERIODIC_CB_NAME, lacp_port); teamd_loop_callback_del(ctx, LACP_SOCKET_CB_NAME, lacp_port); -@@ -1459,6 +1570,31 @@ static void lacp_event_watch_refresh(struct teamd_context *ctx, +@@ -1449,16 +1793,51 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, + return lacp_port_link_update(lacp_port); + } + +-static void lacp_event_watch_refresh(struct teamd_context *ctx, +- struct teamd_port *tdport, void *priv) ++static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) + { + struct lacp *lacp = priv; +- struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + ++ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + if (lacp_port_selected(lacp_port)) (void) lacpdu_send(lacp_port); } @@ -481,31 +748,42 @@ index 4016b15..087efa9 100644 +{ + struct lacp *lacp = priv; + ++ /* save dump information for each tdport */ ++ lacp->wr.nr_of_tdports++; ++ lacp->wr.state = realloc(lacp->wr.state, sizeof(struct wr_tdport_state) * lacp->wr.nr_of_tdports); ++ if (lacp->wr.state) { ++ int err; ++ strcpy(lacp->wr.state[lacp->wr.nr_of_tdports-1].name, tdport->ifname); ++ err = teamd_port_enabled(ctx, tdport, &lacp->wr.state[lacp->wr.nr_of_tdports-1].enabled); ++ if (err) ++ lacp->wr.state[lacp->wr.nr_of_tdports-1].enabled = false; ++ } else { ++ teamd_log_err("WR-mode. Can't reallocate memory for LACP member %s dump", tdport->ifname); ++ lacp->wr.nr_of_tdports = 0; ++ } ++ + struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + if (lacp_port->lacpdu_saved && lacp_port->ctx->lacp_directory) { + char filename[PATH_MAX]; -+ strcpy(filename, lacp_port->ctx->lacp_directory); -+ if (filename[strlen(filename) - 1] != '/') -+ strcat(filename, "/"); /* Add trailing slash if we don't have one in the filename */ -+ strcat(filename, lacp_port->tdport->ifname); ++ generate_path(lacp_port->ctx, filename, lacp_port->tdport->ifname); + FILE *fp = fopen(filename, "wb"); + if (fp != NULL) { + (void)fwrite(&lacp_port->last_pdu, sizeof(struct lacpdu), 1, fp); + (void)fclose(fp); + } else { -+ teamd_log_err("Can't open file %s for writing %s", filename, strerror(errno)); ++ teamd_log_err("WR-mode. Can't open file %s for writing %s", filename, strerror(errno)); + } + } else { -+ teamd_log_err("Can't dump received lacp pdu for port %s. " -+ "Either it wasn't received, or directory to save wasn't configured", -+ lacp_port->tdport->ifname); ++ if (lacp_port->ctx->lacp_directory == NULL) ++ teamd_log_err("WR-mode. Can't dump received lacp pdu for port %s. " ++ "LACP directory wasn't configured", lacp_port->tdport->ifname); + } +} + static const struct teamd_event_watch_ops lacp_event_watch_ops = { .hwaddr_changed = lacp_event_watch_hwaddr_changed, .port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed, -@@ -1467,21 +1603,38 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { +@@ -1467,21 +1846,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { .port_changed = lacp_event_watch_port_changed, .admin_state_changed = lacp_event_watch_admin_state_changed, .refresh = lacp_event_watch_refresh, @@ -518,32 +796,27 @@ index 4016b15..087efa9 100644 - /* initialize carrier control */ - err = team_carrier_set(ctx->th, false); -- if (err && err != -EOPNOTSUPP) { -- teamd_log_err("Failed to set carrier down."); -- return err; -+ if (ctx->warm_start_carrier) { -+ /* Read the current carrier state, don't change it */ -+ bool state; -+ err = team_carrier_get(ctx->th, &state); -+ if (err && err != -EOPNOTSUPP) { -+ teamd_log_err("Failed to read carrier."); -+ return err; -+ } -+ lacp->carrier_up = state; -+ if (state) { -+ /* enable timer for warm_start_carrier mode */ -+ lacp->warm_start_carrier_timer = time(NULL); ++ lacp->carrier_up = false; ++ ++ if (ctx->warm_start_mode) { ++ teamd_log_dbg("WR-mode. function lacp_carrier_init()"); ++ ++ /* Disable WR start mode if LAG interface was down */ ++ if (lacp->wr.carrier_up) { ++ teamd_log_info("WR-mode. Starting in WR mode"); + } else { -+ /* disable warm_start_carrier mode. The LAG interface is already down. */ -+ ctx->warm_start_carrier = false; -+ } -+ } else { -+ err = team_carrier_set(ctx->th, false); -+ if (err && err != -EOPNOTSUPP) { -+ teamd_log_err("Failed to set carrier down."); -+ return err; ++ teamd_log_info("WR-mode. Starting in normal mode. The LAG interface was down before restart"); + } -+ lacp->carrier_up = false; ++ ctx->warm_start_mode = lacp->wr.carrier_up; ++ lacp->carrier_up = lacp->wr.carrier_up; ++ lacp->warm_start_mode_timer = 0; ++ } ++ ++ err = team_carrier_set(ctx->th, lacp->carrier_up); + if (err && err != -EOPNOTSUPP) { +- teamd_log_err("Failed to set carrier down."); ++ teamd_log_err("Failed to set carrier"); + return err; } - lacp->carrier_up = false; @@ -551,15 +824,34 @@ index 4016b15..087efa9 100644 return 0; } -@@ -1993,7 +2146,7 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) +@@ -1949,6 +2342,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv) + } + + lacp->ctx = ctx; ++ if (ctx->warm_start_mode) { ++ err = lacp_state_load(ctx, lacp); ++ if (err) ++ stop_wr_mode(lacp); ++ } ++ + err = teamd_hash_func_set(ctx); + if (err) + return err; +@@ -1990,10 +2389,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) + { + struct lacp *lacp = priv; + ++ if (ctx->lacp_directory) ++ lacp_state_save(ctx, lacp); teamd_state_val_unregister(ctx, &lacp_state_vg, lacp); teamd_balancer_fini(lacp->tb); teamd_event_watch_unregister(ctx, &lacp_event_watch_ops, lacp); - lacp_carrier_fini(ctx, lacp); -+ if (!ctx->keep_ports) lacp_carrier_fini(ctx, lacp); ++ if (!ctx->keep_ports) ++ lacp_carrier_fini(ctx, lacp); } const struct teamd_runner teamd_runner_lacp = { -- -2.7.4 +2.17.1.windows.2 From c92751735577346923dcc929ea934fd0d046a9b7 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 15 Jun 2019 08:38:24 +0800 Subject: [PATCH 09/37] [Mellanox] Inject SDK libs dependency to pmon on Mellanox platform (#3000) * inject sdk libs to pmon * fix wrong code --- files/build_templates/docker_image_ctl.j2 | 11 ++++------- platform/mellanox/rules.mk | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 7dfc5e3c7c4e..881d562de901 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -175,19 +175,16 @@ start() { {%- endif %} {%- if sonic_asic_platform == "mellanox" %} {%- if docker_container_name == "syncd" %} - -e SX_SNIFFER_ENABLE \ - -e SX_SNIFFER_TARGET \ - -e PRM_SNIFFER \ - -e PRM_SNIFFER_FILE_PATH \ -v /var/log/mellanox/sniffer:/var/log/mellanox/sniffer:rw \ -v mlnx_sdk_socket:/tmp \ -v /dev/shm:/dev/shm:rw \ +{%- elif docker_container_name == "pmon" %} + -v /var/run/hw-management:/var/run/hw-management:rw \ + -v mlnx_sdk_socket:/tmp \ + -v /dev/shm:/dev/shm:rw \ {%- else %} --tmpfs /tmp \ {%- endif %} -{%- if docker_container_name == "pmon" %} - -v /var/run/hw-management:/var/run/hw-management:rw \ -{%- endif %} {%- endif %} -v /var/run/redis:/var/run/redis:rw \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 4d391f44ebcb..2c302212d274 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -22,3 +22,6 @@ $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAITHRIFT_DEV) # Runtime dependency on mlnx sai is set only for syncd $(SYNCD)_RDEPENDS += $(MLNX_SAI) + +# Inject mlnx sdk libs to platform monitor +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(APPLIBS) $(SX_COMPLIB) $(SXD_LIBS) $(SX_GEN_UTILS) $(PYTHON_SDK_API) $(APPLIBS_DEV) $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(SX_GEN_UTILS_DEV) From d67c6d4bf751e7db3e31726ac7c0b1e716ae55aa Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Sat, 15 Jun 2019 15:57:10 -0700 Subject: [PATCH 10/37] Set the default mac ageing time to 600 seconds (#2365) * Set the default mac ageing time to 300 seconds The current mac ageing was disabled, this could lead the mac address table to increase over time and lead to resource and performance issues. Signed-off-by: Zhenggen Xu * Update the default HW ageing timer to be 600 seconds. This is to be on the safer side where ARP update interval is 300 seconds and SONiC does not flood when ARP is aged out. Signed-off-by: Zhenggen Xu --- dockers/docker-orchagent/switch.json.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index 7aaada1b1e40..a7dafd40f267 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -12,7 +12,8 @@ { "SWITCH_TABLE:switch": { "ecmp_hash_seed": "{{ hash_seed }}", - "lag_hash_seed": "{{ hash_seed }}" + "lag_hash_seed": "{{ hash_seed }}", + "fdb_aging_time": "600" }, "OP": "SET" } From e7b1988638f43fae1a17591c846961a6e648053b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 18 Jun 2019 10:00:16 -0700 Subject: [PATCH 11/37] [submodule] update sonic-linux-kernel (#2985) * [submodule] update sonic-linux-kernel * update linux kernel version * Fix many version strings * update mellanox components (built with new kernel) * [mlnx] add make files for SDK WJH libs * Update arista driver submodule (#8) Make the debian packaging point to a newer kernel version. --- build_debian.sh | 6 ++-- files/build_templates/swss.service.j2 | 2 +- files/build_templates/syncd.service.j2 | 4 +-- installer/x86_64/install.sh | 10 +++---- platform/barefoot/bfn-modules/debian/control | 2 +- .../barefoot/sonic-platform-modules-arista | 2 +- .../debian/control | 2 +- .../sonic-platform-modules-bfn/debian/control | 2 +- platform/broadcom/sai-modules.mk | 2 +- .../broadcom/saibcm-modules/debian/control | 2 +- .../debian/opennsl-modules.dirs | 2 +- .../debian/opennsl-modules.install | 8 +++--- platform/broadcom/saibcm-modules/debian/rules | 6 ++-- .../debian/control | 4 +-- .../broadcom/sonic-platform-modules-arista | 2 +- .../sonic-platform-modules-cel/debian/control | 4 +-- .../debian/control | 6 ++-- .../debian/control | 8 +++--- .../debian/platform-modules-et-6248brb.init | 2 +- .../et-6248brb/scripts/led_status.sh | 2 +- .../debian/control | 10 +++---- .../debian/control | 2 +- .../debian/control | 4 +-- platform/mellanox/fw.mk | 4 +-- platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/mlnx-sai/SAI-Implementation | 2 +- platform/mellanox/sdk-src/wjh-libs/Makefile | 28 +++++++++++++++++++ platform/mellanox/sdk.mk | 19 +++++++++---- platform/nephos/nephos-modules/debian/control | 2 +- .../init.d/nps-modules-4.9.0-8-2-amd64 | 2 +- .../nps-modules-4.9.0-8-2-amd64.service | 4 +-- .../debian/control | 2 +- .../sonic-platform-modules-cig/debian/control | 2 +- rules/linux-kernel.mk | 6 ++-- src/sonic-linux-kernel | 2 +- 35 files changed, 102 insertions(+), 67 deletions(-) create mode 100644 platform/mellanox/sdk-src/wjh-libs/Makefile diff --git a/build_debian.sh b/build_debian.sh index b3556009fad7..44c3524ed96b 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -30,7 +30,7 @@ set -x -e ## docker engine version (with platform) DOCKER_VERSION=5:18.09.2~3-0~debian-stretch -LINUX_KERNEL_VERSION=4.9.0-8-2 +LINUX_KERNEL_VERSION=4.9.0-9-2 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot @@ -121,7 +121,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/initramfs-tools_*.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install acl -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install dmidecode +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install dmidecode ## Update initramfs for booting with squashfs+overlay cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null @@ -409,7 +409,7 @@ fi ## Organization specific extensions such as Configuration & Scripts for features like AAA, ZTP... if [ "${enable_organization_extensions}" = "y" ]; then if [ -f files/build_templates/organization_extensions.sh ]; then - sudo chmod 755 files/build_templates/organization_extensions.sh + sudo chmod 755 files/build_templates/organization_extensions.sh ./files/build_templates/organization_extensions.sh -f $FILESYSTEM_ROOT -h $HOSTNAME fi fi diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 048c9c34704b..b7a6396749bd 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -4,7 +4,7 @@ Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-8-2-amd64.service +Requires=nps-modules-4.9.0-9-2-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index 60f2b6a542bb..b52772e9b114 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -4,14 +4,14 @@ Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-8-2-amd64.service +Requires=nps-modules-4.9.0-9-2-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules.service {% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-4.9.0-8-2-amd64.service +After=nps-modules-4.9.0-9-2-amd64.service {% endif %} After=swss.service Before=ntp-config.service diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 8fb0274ddfbe..680e5c5f3297 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -162,7 +162,7 @@ if [ "$install_env" = "onie" ]; then fi # Creates a new partition for the DEMO OS. -# +# # arg $1 -- base block device # # Returns the created partition number in $demo_part @@ -177,7 +177,7 @@ create_demo_gpt_partition() tmpfifo=$(mktemp -u) trap_push "rm $tmpfifo || true" mkfifo -m 600 "$tmpfifo" - + # See if demo partition already exists demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}') if [ -n "$demo_part" ] ; then @@ -438,7 +438,7 @@ if [ "$install_env" = "onie" ]; then echo "Error: Unable to mount $demo_dev on $demo_mnt" exit 1 } - + elif [ "$install_env" = "sonic" ]; then demo_mnt="/host" eval running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") @@ -595,12 +595,12 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-4.9.0-8-2-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-4.9.0-9-2-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ net.ifnames=0 biosdevname=0 \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-4.9.0-8-2-amd64 + initrd /$image_dir/boot/initrd.img-4.9.0-9-2-amd64 } EOF diff --git a/platform/barefoot/bfn-modules/debian/control b/platform/barefoot/bfn-modules/debian/control index 95c6eed39438..c9a53ec1d08b 100644 --- a/platform/barefoot/bfn-modules/debian/control +++ b/platform/barefoot/bfn-modules/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: bfn-modules Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for bfn asic for mmap diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 7b7c79ee463b..ad5abe1205c0 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 7b7c79ee463b43e570c48915215cdbf6ec250225 +Subproject commit ad5abe1205c0bf6926d62a497a9b435aaeb174ee diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control index 092283dda9e3..192da9dab95c 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn-montara Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/control b/platform/barefoot/sonic-platform-modules-bfn/debian/control index 1865dab3b839..04d4c598e9d9 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk index 4a128b536aab..dc77c4b5cb78 100644 --- a/platform/broadcom/sai-modules.mk +++ b/platform/broadcom/sai-modules.mk @@ -1,6 +1,6 @@ # Broadcom SAI modules -KVERSION = 4.9.0-8-2-amd64 +KVERSION = 4.9.0-9-2-amd64 BRCM_OPENNSL_KERNEL_VERSION = 3.4.1.11-1 BRCM_OPENNSL_KERNEL = opennsl-modules_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb diff --git a/platform/broadcom/saibcm-modules/debian/control b/platform/broadcom/saibcm-modules/debian/control index 80bb88bfe8be..75b77c8a2f00 100644 --- a/platform/broadcom/saibcm-modules/debian/control +++ b/platform/broadcom/saibcm-modules/debian/control @@ -10,5 +10,5 @@ Standards-Version: 3.9.3 Package: opennsl-modules Architecture: amd64 Section: main -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for broadcom SAI diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs index 527413704523..38af58a5c5ee 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs @@ -1 +1 @@ -lib/modules/4.9.0-8-2-amd64/extra +lib/modules/4.9.0-9-2-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install index 508dd101bb85..11b100d37f30 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install @@ -1,5 +1,5 @@ -systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-8-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-8-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-8-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.9.0-8-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-9-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-9-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-9-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.9.0-9-2-amd64/extra systemd/opennsl-modules.service lib/systemd/system diff --git a/platform/broadcom/saibcm-modules/debian/rules b/platform/broadcom/saibcm-modules/debian/rules index 51aa6244d169..33abe645d44a 100755 --- a/platform/broadcom/saibcm-modules/debian/rules +++ b/platform/broadcom/saibcm-modules/debian/rules @@ -60,7 +60,7 @@ kdist_config: prep-deb-files kdist_clean: clean dh_testdir dh_clean - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-8-2-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-8-2-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-9-2-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-9-2-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean # rm -f driver/*.o driver/*.ko # ### end KERNEL SETUP @@ -78,7 +78,7 @@ build-arch-stamp: dh_testdir # Add here command to compile/build the package. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-8-2-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-8-2-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-9-2-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-9-2-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 touch $@ @@ -103,7 +103,7 @@ clean: rm -f build-arch-stamp build-indep-stamp configure-stamp # Add here commands to clean up after the build process. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-8-2-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-8-2-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-9-2-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-9-2-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean dh_clean diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control index 846461525da4..9a53b9823222 100644 --- a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: sonic-platform-alphanetworks-snh60a0-320fv2 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-alphanetworks-snh60b0-640f Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 7b7c79ee463b..ad5abe1205c0 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 7b7c79ee463b43e570c48915215cdbf6ec250225 +Subproject commit ad5abe1205c0bf6926d62a497a9b435aaeb174ee diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index 3cc94225a4b8..445189822039 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-dx010 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-haliburton Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control index fa606f96c125..c30a261fd9dc 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/control +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -7,16 +7,16 @@ Standards-Version: 3.9.3 Package: platform-modules-z9264f Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-z9100 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s6100 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 9053d0aa04e4..c1acfab915fc 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -7,21 +7,21 @@ Standards-Version: 3.9.3 Package: platform-modules-ag9032v1 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag9064 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag5648 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-et-6248brb Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init index d87c3d661e8b..64361ced6b6c 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init @@ -25,7 +25,7 @@ start) modprobe dni_gpio modprobe delta_et-6248brb_platform - if [ `uname -a | awk '{print $3}'` = "4.9.0-8-2-amd64" ]; then + if [ `uname -a | awk '{print $3}'` = "4.9.0-9-2-amd64" ]; then echo "453" > "/sys/class/gpio/export" echo "454" > "/sys/class/gpio/export" echo "455" > "/sys/class/gpio/export" diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh index 7c33fce91764..734a44a6ca95 100644 --- a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh @@ -7,7 +7,7 @@ FAN2_RPM="/sys/bus/i2c/devices/0-002e/fan2_input" FAN_TRAY1_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan1_led_ag" FAN_TRAY2_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan2_led_ag" -if [ `uname -a | awk '{print $3}'` = "4.9.0-8-2-amd64" ]; then +if [ `uname -a | awk '{print $3}'` = "4.9.0-9-2-amd64" ]; then SYS_LED_G="/sys/class/gpio/gpio453/value" SYS_LED_R="/sys/class/gpio/gpio454/value" PWR_LED_G="/sys/class/gpio/gpio455/value" diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control index 0c9b5822b060..45aa6ba10bc6 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/control +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -7,25 +7,25 @@ Standards-Version: 3.9.3 Package: platform-modules-d7032q28b Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7054q28b Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d6254qs Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d6556 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7264q28b Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/control b/platform/broadcom/sonic-platform-modules-s6000/debian/control index 1bcdb271674c..a9f2a76ebedd 100644 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/control +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-s6000 Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/centec/sonic-platform-modules-e582/debian/control b/platform/centec/sonic-platform-modules-e582/debian/control index 9be4df3dba85..ba30e04f0388 100644 --- a/platform/centec/sonic-platform-modules-e582/debian/control +++ b/platform/centec/sonic-platform-modules-e582/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-e582-48x2q4z Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-e582-48x6q Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 4d1e8edd9d5f..72425644a5c1 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -2,12 +2,12 @@ MLNX_FW_BASE_URL = $(MLNX_SDK_BASE_URL) -MLNX_SPC_FW_VERSION = 13.2000.1140 +MLNX_SPC_FW_VERSION = 13.2000.1420 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2000.1140 +MLNX_SPC2_FW_VERSION = 29.2000.1420 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_SPC2_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index eba727499a59..04f1f608e606 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.14.0-master +MLNX_SAI_VERSION = SAIRel1.14.1-master export MLNX_SAI_VERSION diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index ed2f0d276577..ee4aab2c7e90 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit ed2f0d2765773bde8ee2d3ae552c96edd1d4859e +Subproject commit ee4aab2c7e90c10c52925ba72d43eda393b50634 diff --git a/platform/mellanox/sdk-src/wjh-libs/Makefile b/platform/mellanox/sdk-src/wjh-libs/Makefile new file mode 100644 index 000000000000..fd1e53168ea2 --- /dev/null +++ b/platform/mellanox/sdk-src/wjh-libs/Makefile @@ -0,0 +1,28 @@ +.ONESHELL: +SHELL = /bin/bash + +MAIN_TARGET = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +DERIVED_TARGETS = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ + wjh-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +PACKAGE_NAME = wjh_libs + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # get sources + rm -rf $(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION) + + wget -c $(MLNX_SDK_SOURCE_BASE_URL)/$(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION).tar.gz -O - | tar -xz + + # build + pushd $(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION) + + if [ -f autogen.sh ]; then + ./autogen.sh + fi + + debuild -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 56ef185cdcd0..1c5b10428027 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,21 +1,21 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/e7da154ddf8447c04b852195f43c83802c6934c9/sdk -MLNX_SDK_VERSION = 4.3.1104 -MLNX_SDK_ISSU_VERSION = 100 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/ee4aab2c7e90c10c52925ba72d43eda393b50634/sdk +MLNX_SDK_VERSION = 4.3.1420 +MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst _,.,$(MLNX_SDK_VERSION)) # Place here URL where SDK sources exist -MLNX_SDK_SOURCE_BASE_URL = +MLNX_SDK_SOURCE_BASE_URL = export MLNX_SDK_SOURCE_BASE_URL MLNX_SDK_VERSION MLNX_SDK_ISSU_VERSION MLNX_SDK_DEB_VERSION MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ - $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) + $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) $(WJH_LIBS) MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \ $(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \ $(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \ - $(SXD_LIBS_DEV) $(SXD_LIBS_DEV_STATIC) + $(SXD_LIBS_DEV) $(SXD_LIBS_DEV_STATIC) $(WJH_LIBS_DEV) APPLIBS = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(APPLIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/applibs @@ -71,6 +71,13 @@ $(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) +WJH_LIBS = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +$(WJH_LIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/wjh-libs +$(WJH_LIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(APPLIBS_DEV) +$(WJH_LIBS)_RDEPENDS += $(SX_COMPLIB) $(PYTHON_SDK_API) +WJH_LIBS_DEV = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DEV))) + define make_url $(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) diff --git a/platform/nephos/nephos-modules/debian/control b/platform/nephos/nephos-modules/debian/control index 49cc83b9c524..f5e6e00d13c0 100644 --- a/platform/nephos/nephos-modules/debian/control +++ b/platform/nephos/nephos-modules/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: nephos-modules Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for nephos asic diff --git a/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 b/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 index 22755dbaf778..470f18f7c526 100755 --- a/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 +++ b/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 @@ -45,7 +45,7 @@ force-reload|restart) ;; *) - echo "Usage: /etc/init.d/nps-modules-4.9.0-8-2-amd64.init {start|stop}" + echo "Usage: /etc/init.d/nps-modules-4.9.0-9-2-amd64.init {start|stop}" exit 1 ;; esac diff --git a/platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-8-2-amd64.service b/platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-8-2-amd64.service index f044c95311e4..246226ea9d40 100644 --- a/platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-8-2-amd64.service +++ b/platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-8-2-amd64.service @@ -5,8 +5,8 @@ Before=syncd.service [Service] Type=oneshot -ExecStart=-/etc/init.d/nps-modules-4.9.0-8-2-amd64 start -ExecStop=-/etc/init.d/nps-modules-4.9.0-8-2-amd64 stop +ExecStart=-/etc/init.d/nps-modules-4.9.0-9-2-amd64 start +ExecStop=-/etc/init.d/nps-modules-4.9.0-9-2-amd64 stop RemainAfterExit=yes [Install] diff --git a/platform/nephos/sonic-platform-modules-accton/debian/control b/platform/nephos/sonic-platform-modules-accton/debian/control index 9824d4489e68..1d5c3a8201a7 100755 --- a/platform/nephos/sonic-platform-modules-accton/debian/control +++ b/platform/nephos/sonic-platform-modules-accton/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.9.3 Package: sonic-platform-accton-as7116-54x Architecture: amd64 -Depends: linux-image-4.9.0-8-2-amd64 +Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/nephos/sonic-platform-modules-cig/debian/control b/platform/nephos/sonic-platform-modules-cig/debian/control index c617c76bbba3..356ce313ab63 100755 --- a/platform/nephos/sonic-platform-modules-cig/debian/control +++ b/platform/nephos/sonic-platform-modules-cig/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.9.3 Package: sonic-platform-cig-cs6436-56p Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 07462f2108c5..5a217c667db7 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 4.9.0-8-2 +KVERSION_SHORT = 4.9.0-9-2 KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 4.9.110 -KERNEL_SUBVERSION = 3+deb9u6 +KERNEL_VERSION = 4.9.168 +KERNEL_SUBVERSION = 1+deb9u2 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 6fc9850e83d0..e57148b92d1e 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 6fc9850e83d0cba3f8eff7c98ea371e131be8d8a +Subproject commit e57148b92d1eb54784177df9e816bb15b98e6a03 From 8a0859500611a8d7e4c69ccea8dd4104fd0c4700 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 19 Jun 2019 02:02:24 +0800 Subject: [PATCH 12/37] [Pmon] Add new daemon "syseepromd" to pmon docker (#2866) --- .../docker-pmon.supervisord.conf.j2 | 11 +++++++++++ dockers/docker-platform-monitor/start.sh.j2 | 5 +++++ rules/docker-platform-monitor.mk | 2 +- rules/sonic-syseepromd.mk | 5 +++++ src/sonic-platform-daemons | 2 +- 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 rules/sonic-syseepromd.mk diff --git a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 index a10b94c25e92..c6a571da9335 100644 --- a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 +++ b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 @@ -69,3 +69,14 @@ stdout_logfile=syslog stderr_logfile=syslog startsecs=0 {% endif %} + +{% if not skip_syseepromd %} +[program:syseepromd] +command=/usr/bin/syseepromd +priority=8 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog +startsecs=0 +{% endif %} diff --git a/dockers/docker-platform-monitor/start.sh.j2 b/dockers/docker-platform-monitor/start.sh.j2 index e9f0ebf6cd83..3520ba5894ab 100644 --- a/dockers/docker-platform-monitor/start.sh.j2 +++ b/dockers/docker-platform-monitor/start.sh.j2 @@ -48,3 +48,8 @@ supervisorctl start xcvrd {% if not skip_psud %} supervisorctl start psud {% endif %} + +{% if not skip_syseepromd %} +supervisorctl start syseepromd +{% endif %} + diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index e18cda705d0f..7f1f4022e4a3 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -7,7 +7,7 @@ DOCKER_PLATFORM_MONITOR_DBG = $(DOCKER_PLATFORM_MONITOR_STEM)-$(DBG_IMAGE_MARK). $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/$(DOCKER_PLATFORM_MONITOR_STEM) $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(SMARTMONTOOLS) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD) $(SONIC_XCVRD) $(SONIC_PSUD) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD) $(SONIC_XCVRD) $(SONIC_PSUD) $(SONIC_SYSEEPROMD) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2) diff --git a/rules/sonic-syseepromd.mk b/rules/sonic-syseepromd.mk new file mode 100644 index 000000000000..8f7a6e5e902f --- /dev/null +++ b/rules/sonic-syseepromd.mk @@ -0,0 +1,5 @@ +# sonic-syseepromd (SONiC Syseeprom gathering daemon) Debian package + +SONIC_SYSEEPROMD = python-sonic-syseepromd_1.0-1_all.deb +$(SONIC_SYSEEPROMD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-syseepromd +SONIC_PYTHON_STDEB_DEBS += $(SONIC_SYSEEPROMD) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 366ac0e3dd92..84bca6465b5d 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 366ac0e3dd92be276217be2432f3170312cf50da +Subproject commit 84bca6465b5d089bb40fb47d7c4006b7558e1091 From 4bfc9eff41660a48d251889d938932d5f4824fe3 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 19 Jun 2019 00:13:39 -0700 Subject: [PATCH 13/37] [sonic-slave]: install openjdk-8 for jenkins slave (#3037) Signed-off-by: Guohan Lu --- sonic-slave/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index a59d23b711d0..d1b6f09d5324 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -321,3 +321,8 @@ RUN add-apt-repository \ RUN apt-get update RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-jessie RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker + +# For jenkins slave +RUN echo "deb http://archive.debian.org/debian jessie-backports main" >> /etc/apt/sources.list +RUN apt-get -o Acquire::Check-Valid-Until=false update +RUN apt-get -y -o Acquire::Check-Valid-Until=false install ca-certificates-java=20161107~bpo8+1 openjdk-8-jdk From 319d854e46df1ce7d4ce0840f35d180d31fa53de Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 19 Jun 2019 00:16:01 -0700 Subject: [PATCH 14/37] [baseimage]: Increase TMOUT for serial port connections to 15 minutes (#3032) Increase TMOUT value in order to close inactive serial console connections after 900 seconds (15 minutes) of inactivity --- files/image_config/bash/bash.bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/bash/bash.bashrc b/files/image_config/bash/bash.bashrc index d65beb5b0847..6651a51ceed0 100644 --- a/files/image_config/bash/bash.bashrc +++ b/files/image_config/bash/bash.bashrc @@ -54,5 +54,5 @@ if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-no } fi -# enable auto-logout for console ttyS* sessions -tty | grep ttyS >/dev/null && TMOUT=300 +# Automatically log out console ttyS* sessions after 15 minutes of inactivity +tty | grep ttyS >/dev/null && TMOUT=900 From 2e121f3329e6bfc13322f8e2e5178004734363b9 Mon Sep 17 00:00:00 2001 From: neethajohn <48968228+neethajohn@users.noreply.github.com> Date: Wed, 19 Jun 2019 00:17:06 -0700 Subject: [PATCH 15/37] [submodule]: Update submodule sonic-quagga (#3030) Reduce the retry time for IPV6 connections to avoid reprogramming IPv6 routes after warm-reboot (#37) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 6397c2c9b588..b1d01a2dd841 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 6397c2c9b588a2271aaf3f4d7383111db16d090a +Subproject commit b1d01a2dd841f76e73067171702f7c6321793c49 From c67c29f7ae8ebe6962ebaf21e84659b0777b1060 Mon Sep 17 00:00:00 2001 From: Greg Paussa <50457169+gpaussabrcm@users.noreply.github.com> Date: Wed, 19 Jun 2019 03:18:12 -0400 Subject: [PATCH 16/37] [build]: Add missing 'rm -rf' to component Makefiles for clean rebuild (#3028) * src/iproute2/Makefile * src/python3/Makefile These Makefiles do not properly clean out the src build subdirectory prior to downloading the source code contents. This causes an error during a rebuild following a 'make clean'. Signed-off-by: Greg Paussa --- src/iproute2/Makefile | 3 +++ src/python3/Makefile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/iproute2/Makefile b/src/iproute2/Makefile index 0181c9ca6d31..0a9e75394054 100644 --- a/src/iproute2/Makefile +++ b/src/iproute2/Makefile @@ -8,6 +8,9 @@ IPROUTE2_VERSION_FULL = $(IPROUTE2_VERSION)-1 MAIN_TARGET = iproute2_$(IPROUTE2_VERSION_FULL)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf iproute2-$(IPROUTE2_VERSION) + wget -O iproute2_$(IPROUTE2_VERSION).orig.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0.orig.tar.xz?sv=2015-04-05&sr=b&sig=9nvybd1xkXyRQbaG6Fy6wBazPA8IbZV0AO41GWXPEP8%3D&se=2154-10-23T11%3A59%3A00Z&sp=r" wget -O iproute2_$(IPROUTE2_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.dsc?sv=2015-04-05&sr=b&sig=m6FcMH9dOh8ggipBgOsONiXvDxoi6bfUO%2BxvidsMNMQ%3D&se=2154-10-23T11%3A59%3A53Z&sp=r" wget -O iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.debian.tar.xz?sv=2015-04-05&sr=b&sig=U5NFuwG5C3vZXlUUNvoPMnKDtMKk66zbweA9rQYbEVY%3D&se=2154-10-23T12%3A00%3A15Z&sp=r" diff --git a/src/python3/Makefile b/src/python3/Makefile index d7718cbeccf6..3325f285b6a6 100644 --- a/src/python3/Makefile +++ b/src/python3/Makefile @@ -15,6 +15,9 @@ DERIVED_TARGETS = lib$(PYTHON_PNAME)-stdlib_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd6 #$(PYTHON_PNAME)-dev_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf $(PYTHON_PNAME)-$(PYTHON_VER) + ## Obtaining the python3 wget 'https://sonicstorage.blob.core.windows.net/packages/$(PYTHON_PNAME)_$(PYTHON_VER).orig.tar.xz?sv=2015-04-05&sr=b&sig=d42Wh1CA9NZvlskhW4fpWcHVgc7N3IKhdFzyeO2zbRA%3D&se=2027-02-02T01%3A00%3A57Z&sp=r' -O $(PYTHON_PNAME)_$(PYTHON_VER).orig.tar.xz wget 'https://sonicstorage.blob.core.windows.net/packages/$(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).debian.tar.xz?sv=2015-04-05&sr=b&sig=KLX9pMJ3zpQvGBo6ZjzoZXgooMJRUUwMx8ZaTJtywK0%3D&se=2027-02-02T00%3A59%3A34Z&sp=r' -O $(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).debian.tar.xz From 18544530d3cb1bcba6213a447a1f4dc0a818dbdc Mon Sep 17 00:00:00 2001 From: Michel Moriniaux Date: Wed, 19 Jun 2019 01:24:42 -0700 Subject: [PATCH 17/37] [FRR] Enable SNMP support (#2981) This is a follow-up of sonic-snmpagent PR 92 Now that licensing issues have been solved FRR is distributed with SNMP support compiled-in. This PR adds the last bits of configuration to get the frr-snmp debian packages added to the docker container and the config bits to enable the snmp module in FRR This PR brings the functionality of being able to poll bgpd for routes and peer status. Signed-off-by: Michel Moriniaux --- dockers/docker-fpm-frr/Dockerfile.j2 | 1 + dockers/docker-fpm-frr/bgpd.conf.j2 | 1 + dockers/docker-fpm-frr/frr.conf.j2 | 1 + dockers/docker-fpm-frr/snmp.conf | 7 +++++++ dockers/docker-fpm-frr/supervisord.conf | 4 ++-- dockers/docker-snmp-sv2/snmpd.conf.j2 | 8 ++++++++ rules/docker-fpm-frr.mk | 2 +- rules/frr.mk | 8 +++++++- src/sonic-config-engine/tests/sample_output/frr.conf | 1 + src/sonic-frr/Makefile | 2 +- 10 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 dockers/docker-fpm-frr/snmp.conf diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 748c9b29a5ff..e6abef67aca2 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -41,5 +41,6 @@ RUN rm -rf /debs ~/.cache COPY ["bgpcfgd", "start.sh", "/usr/bin/"] COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["snmp.conf", "/etc/snmp/frr.conf"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 7ca08c7dace9..9153a2455010 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -11,6 +11,7 @@ hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 +agentx ! enable password {# {{ en_passwd }} TODO: param needed #} {% endblock system_init %} ! diff --git a/dockers/docker-fpm-frr/frr.conf.j2 b/dockers/docker-fpm-frr/frr.conf.j2 index 7e3d0f458b1f..297f79b2d302 100644 --- a/dockers/docker-fpm-frr/frr.conf.j2 +++ b/dockers/docker-fpm-frr/frr.conf.j2 @@ -11,6 +11,7 @@ hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 +agentx ! enable password {# {{ en_passwd }} TODO: param needed #} {% endblock system_init %} ! diff --git a/dockers/docker-fpm-frr/snmp.conf b/dockers/docker-fpm-frr/snmp.conf new file mode 100644 index 000000000000..0d875a61fe87 --- /dev/null +++ b/dockers/docker-fpm-frr/snmp.conf @@ -0,0 +1,7 @@ +# This line allows the FRR docker to speak with the snmp container +# Make sure this line matches the one in the snmp docker +# snmp:/etc/snmp/snmpd.conf +# To verify this works you need to have a valid bgp daemon running and configured +# Check that a snmpwalk to 1.3.6.1.2.1.15 gives an output +# Further verification: 1.3.6.1.2.1.15.2.0 = INTEGER: 65000 the returned value should be the confiugred ASN +agentXSocket tcp:localhost:3161 diff --git a/dockers/docker-fpm-frr/supervisord.conf b/dockers/docker-fpm-frr/supervisord.conf index 0b1c813847b6..ba9f38507b80 100644 --- a/dockers/docker-fpm-frr/supervisord.conf +++ b/dockers/docker-fpm-frr/supervisord.conf @@ -31,7 +31,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:zebra] -command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm +command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm -M snmp priority=4 autostart=false autorestart=false @@ -49,7 +49,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:bgpd] -command=/usr/lib/frr/bgpd -A 127.0.0.1 +command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp priority=5 stopsignal=KILL autostart=false diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 6353246acb08..68d08318cb98 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -118,6 +118,14 @@ load 12 10 5 # # Run as an AgentX master agent master agentx +# internal socket to allow extension to other docker containers +# Currently the other container using this is docker-fpm-frr +# make sure this line matches bgp:/etc/snmp/frr.conf +# please see testing procedure in the same file to verify this works +# to verify the SNMP docker side look for the following string in the log file: +# INFO snmp-subagent [ax_interface] INFO: Using agentx socket type tcp with path tcp:localhost:3161 +# INFO supervisord snmp-subagent INFO:ax_interface:Using agentx socket type tcp with path tcp:localhost:3161 +agentxsocket tcp:localhost:3161 # # SysDescription pass-through diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index fd593c5cb92a..d10ac325f27e 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -2,7 +2,7 @@ DOCKER_FPM_FRR = docker-fpm-frr.gz $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/docker-fpm-frr -$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(SWSS) $(LIBYANG) +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG) $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) diff --git a/rules/frr.mk b/rules/frr.mk index ac110d03f54d..52dfbe13ec2d 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -18,4 +18,10 @@ $(eval $(call add_derived_package,$(FRR),$(FRR_PYTHONTOOLS))) FRR_DBG = frr-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb $(eval $(call add_derived_package,$(FRR),$(FRR_DBG))) -export FRR FRR_PYTHONTOOLS FRR_DBG +FRR_SNMP = frr-snmp_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_SNMP))) + +FRR_SNMP_DBG = frr-snmp-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_SNMP_DBG))) + +export FRR FRR_PYTHONTOOLS FRR_DBG FRR_SNMP FRR_SNMP_DBG diff --git a/src/sonic-config-engine/tests/sample_output/frr.conf b/src/sonic-config-engine/tests/sample_output/frr.conf index 7ea45508f236..56d7122186b2 100644 --- a/src/sonic-config-engine/tests/sample_output/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/frr.conf @@ -8,6 +8,7 @@ hostname switch-t0 password zebra log syslog informational log facility local4 +agentx ! enable password ! ! Enable link-detect (default disabled) interface PortChannel01 diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index 48da9c72116e..5ba70addf17e 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -3,7 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = $(FRR) -DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG) +DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG) $(FRR_SNMP) $(FRR_SNMP_DBG) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package From 6370d64b3d1fb9be9ee05065bb6bf1f9d3939c5b Mon Sep 17 00:00:00 2001 From: RAMA CHANDRA REDDY GADDAM <45847882+ramachandrareddygaddam@users.noreply.github.com> Date: Wed, 19 Jun 2019 13:55:37 +0530 Subject: [PATCH 18/37] [broadcom]: Check for broadcom platform sdk init ready during syncd start. (#2931) - What I did During boot/reload time, wait in a loop to check for bcm initialization. Break the loop, once sdk is ready to process the 'bcmcmd' request (or) loop count reached the maximum value. - How I did it In the existing implementation during syncd start process will sleep for a fixed time (3 secs) for sdk initialization to happen. But the time taken for sdk initialization is varying for different platforms. To fix this issue, the syncd start process wait in a loop and check whether sdk is ready to process 'bcmcmd' command. - How to verify it Check for syncd process status and interface status. Check for syslogs and no failures related to syncd should be present. --- platform/broadcom/docker-syncd-brcm/start.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 45c4ab92dabf..146b2efa7406 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -15,7 +15,20 @@ wait_syncd() { done # wait until bcm sdk is ready to get a request - sleep 3 + counter=0 + while true; do + /usr/bin/bcmcmd -t 1 "show unit" | grep BCM >/dev/null 2>&1 + rv=$? + if [ $rv -eq 0 ]; then + break + fi + counter=$((counter+1)) + if [ $counter -ge 60 ]; then + echo "syncd is not ready to take commands after $counter re-tries; Exiting!" + break + fi + sleep 1 + done } From 69b8ad7be0ee74fa6a45501d022d4fa32a17c29a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 19 Jun 2019 14:20:38 -0700 Subject: [PATCH 19/37] [submodule] update sonic-linux-kernel to 4.9.168-1+deb9u3 (#3034) --- rules/linux-kernel.mk | 2 +- src/sonic-linux-kernel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 5a217c667db7..6983dbf181b4 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -3,7 +3,7 @@ KVERSION_SHORT = 4.9.0-9-2 KVERSION = $(KVERSION_SHORT)-amd64 KERNEL_VERSION = 4.9.168 -KERNEL_SUBVERSION = 1+deb9u2 +KERNEL_SUBVERSION = 1+deb9u3 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index e57148b92d1e..51f4ece36d24 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit e57148b92d1eb54784177df9e816bb15b98e6a03 +Subproject commit 51f4ece36d2436d624dcf5f9441bb17cd38cb108 From 1bcd54d38c9837bb1947a77c07e24ccce0cbd8d2 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Thu, 20 Jun 2019 19:19:33 +0300 Subject: [PATCH 20/37] [build]: Upgrade docker to 18.09 in stretch slave (#3049) Also add an option to use docker buildkit for image build Signed-off-by: Stepan Blyschak --- Makefile.work | 1 + rules/config | 8 ++++++++ slave.mk | 7 +++++++ sonic-slave-stretch/Dockerfile | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index 975b9a5dcd21..2cb6eae1258f 100644 --- a/Makefile.work +++ b/Makefile.work @@ -117,6 +117,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + SONIC_USE_DOCKER_BUILDKIT=$(SONIC_USE_DOCKER_BUILDKIT) \ VS_PREPARE_MEM=$(VS_PREPARE_MEM) \ KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ HTTP_PROXY=$(http_proxy) \ diff --git a/rules/config b/rules/config index c5213bddd409..31e5d40ff1f9 100644 --- a/rules/config +++ b/rules/config @@ -16,6 +16,14 @@ SONIC_CONFIG_BUILD_JOBS = 1 # Corresponding -j argument will be passed to make/dpkg commands that build separate packages SONIC_CONFIG_MAKE_JOBS = $(shell nproc) +# SONIC_USE_DOCKER_BUILDKIT - use docker buildkit for build. +# If set to y SONiC build system will set environment variable DOCKER_BUILDKIT=1 +# to enable docker buildkit. +# This options will speed up docker image build time. +# NOTE: SONIC_USE_DOCKER_BUILDKIT will produce larger installable SONiC image +# because of a docker bug (more details: https://github.com/moby/moby/issues/38903) +# SONIC_USE_DOCKER_BUILDKIT = y + # SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD - use native dockerd for build. # If set to y SONiC build container will use native dockerd instead of dind for faster build # SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD = y diff --git a/slave.mk b/slave.mk index 3697f6002e88..1174cb148949 100644 --- a/slave.mk +++ b/slave.mk @@ -151,6 +151,7 @@ $(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFI $(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") $(info "SONIC_BUILD_JOBS" : "$(SONIC_BUILD_JOBS)") $(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") +$(info "SONIC_USE_DOCKER_BUILDKIT" : "$(SONIC_USE_DOCKER_BUILDKIT)") $(info "USERNAME" : "$(USERNAME)") $(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") @@ -175,6 +176,12 @@ $(info "BLDENV" : "$(BLDENV)") $(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)") $(info ) +ifeq ($(SONIC_USE_DOCKER_BUILDKIT),y) +$(warning "Using SONIC_USE_DOCKER_BUILDKIT will produce larger installable SONiC image because of a docker bug (more details: https://github.com/moby/moby/issues/38903)") +export DOCKER_BUILDKIT=1 +endif + + ############################################################################### ## Generic rules section ## All rules must go after includes for propper targets expansion diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 9d94d11197e0..915f0ac6817f 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -326,5 +326,5 @@ RUN add-apt-repository \ $(lsb_release -cs) \ stable" RUN apt-get update -RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-stretch +RUN apt-get install -y docker-ce=5:18.09.5~3-0~debian-stretch RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker From e680892f390d2135e8741894aee62db464c32022 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 20 Jun 2019 09:20:34 -0700 Subject: [PATCH 21/37] [build] Improve overlay check in Makefile (#3050) Some kernels are built with overlayfs as a builtin and not a module. For these the check via lsmod currently fails. This improvement now checks the kernel configuration for the CONFIG_OVERLAY_FS entry. Depending on the OS and kernel version the build configuration can be in multiple places. --- Makefile.work | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index 2cb6eae1258f..88780724ea76 100644 --- a/Makefile.work +++ b/Makefile.work @@ -61,7 +61,11 @@ SLAVE_IMAGE = sonic-slave-$(USER) SLAVE_DIR = sonic-slave endif -OVERLAY_MODULE_CHECK := lsmod | grep "^overlay " > /dev/null 2>&1 || (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1) +OVERLAY_MODULE_CHECK := \ + lsmod | grep -q "^overlay " &>/dev/null || \ + zgrep -q 'CONFIG_OVERLAY_FS=y' /proc/config.gz &>/dev/null || \ + grep -q 'CONFIG_OVERLAY_FS=y' /boot/config-$(shell uname -r) &>/dev/null || \ + (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1) BUILD_TIMESTAMP := $(shell date +%Y%m%d\.%H%M%S) From f4d07dc0030aa12c0dd8f45b7857e98345b808f8 Mon Sep 17 00:00:00 2001 From: Myron Sosyak <49795530+msosyak@users.noreply.github.com> Date: Fri, 21 Jun 2019 13:29:35 -0700 Subject: [PATCH 22/37] fixed BFN target build (#3061) Signed-off-by: Myron Sosyak --- platform/barefoot/bfn-platform.mk | 9 ++------- platform/barefoot/bfn-sai.mk | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk index bdba34177604..837f86c335e7 100644 --- a/platform/barefoot/bfn-platform.mk +++ b/platform/barefoot/bfn-platform.mk @@ -1,10 +1,5 @@ -ifdef BLDENV -BFN_PLATFORM = bfnplatform_8.9.x.98de3ce_pr_deb9.deb -$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_9/bfnplatform_8.9.x.98de3ce_pr_deb9.deb" -else -BFN_PLATFORM = bfnplatform_8.9.x.98de3ce_pr_deb8.deb -$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_9/bfnplatform_8.9.x.98de3ce_pr_deb8.deb" -endif +BFN_PLATFORM = bfnplatform_8_9_1.x.ab1e16f.deb +$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_9_1/bfnplatform_8_9_1.x.ab1e16f.deb" SONIC_ONLINE_DEBS += $(BFN_PLATFORM) # $(BFN_SAI_DEV) $(BFN_SAI_DEV)_DEPENDS += $(BFN_PLATFORM) diff --git a/platform/barefoot/bfn-sai.mk b/platform/barefoot/bfn-sai.mk index a93dd71bc1bb..e3253348e720 100644 --- a/platform/barefoot/bfn-sai.mk +++ b/platform/barefoot/bfn-sai.mk @@ -1,10 +1,5 @@ -ifdef BLDENV -BFN_SAI = bfnsdk_8.9.x.98de3ce_pr_deb9.deb -$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_9/bfnsdk_8.9.x.98de3ce_pr_deb9.deb" -else -BFN_SAI = bfnsdk_8.9.x.98de3ce_pr_deb8.deb -$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_9/bfnsdk_8.9.x.98de3ce_pr_deb8.deb" -endif +BFN_SAI = bfnsdk_8_9_1.x.ab1e16f.deb +$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_9_1/bfnsdk_8_9_1.x.ab1e16f.deb" SONIC_ONLINE_DEBS += $(BFN_SAI) # $(BFN_SAI_DEV) $(BFN_SAI_DEV)_DEPENDS += $(BFN_SAI) From 817c6370bf60fb91f68fc4f0dc5428b317aa00ce Mon Sep 17 00:00:00 2001 From: Pavlo Yadvichuk Date: Sat, 22 Jun 2019 20:29:41 +0300 Subject: [PATCH 23/37] [frr.conf] Advertise /64 prefix for ipv6 lo addresses in case 'unified' config mode (#3045) Signed-off-by: Pavlo Yadvychuk --- dockers/docker-fpm-frr/frr.conf.j2 | 2 +- src/sonic-config-engine/tests/sample_output/frr.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-fpm-frr/frr.conf.j2 b/dockers/docker-fpm-frr/frr.conf.j2 index 297f79b2d302..d9dd6bf05633 100644 --- a/dockers/docker-fpm-frr/frr.conf.j2 +++ b/dockers/docker-fpm-frr/frr.conf.j2 @@ -99,7 +99,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} network {{ prefix | ip }}/32 {% elif prefix | ipv6 and name == 'Loopback0' %} address-family ipv6 - network {{ prefix | ip }}/128 + network {{ prefix | ip }}/64 exit-address-family {% endif %} {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/frr.conf b/src/sonic-config-engine/tests/sample_output/frr.conf index 56d7122186b2..8e7f97cf8c55 100644 --- a/src/sonic-config-engine/tests/sample_output/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/frr.conf @@ -55,7 +55,7 @@ router bgp 65100 bgp router-id 10.1.0.32 network 10.1.0.32/32 address-family ipv6 - network fc00:1::32/128 + network fc00:1::32/64 exit-address-family network 192.168.0.1/27 neighbor 10.0.0.57 remote-as 64600 From 81cf33231fa503e61cb629f7bcbb6bc8fff1865f Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 22 Jun 2019 21:26:23 +0300 Subject: [PATCH 24/37] [build]: Improve dockerfile instructions (#3048) - create a dockerfile-marcros.j2 file with all common operations written as j2 macro - use single dockerfile instruction for COPY and RUN commands when possible to improve build time - reorganize dockerfile instructions to make more cache friendly (in case someday we will remove --no-cache to build docker images) Signed-off-by: Stepan Blyschak --- dockers/docker-base-stretch/Dockerfile.j2 | 63 +++++++++--------- .../Dockerfile.j2 | 64 +++++++++--------- dockers/docker-database/Dockerfile.j2 | 20 +++--- dockers/docker-dhcp-relay/Dockerfile.j2 | 15 ++--- dockers/docker-fpm-frr/Dockerfile.j2 | 37 ++++++----- dockers/docker-lldp-sv2/Dockerfile.j2 | 30 ++++----- dockers/docker-orchagent/Dockerfile.j2 | 65 +++++++++++-------- dockers/docker-platform-monitor/Dockerfile.j2 | 50 +++++++------- .../docker-router-advertiser/Dockerfile.j2 | 15 ++--- dockers/docker-snmp-sv2/Dockerfile.j2 | 62 +++++++++--------- dockers/docker-sonic-telemetry/Dockerfile.j2 | 37 ++++++----- dockers/docker-teamd/Dockerfile.j2 | 44 +++++++------ dockers/dockerfile-macros.j2 | 18 +++++ .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 35 +++++----- .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 45 ++++++------- 15 files changed, 309 insertions(+), 291 deletions(-) create mode 100644 dockers/dockerfile-macros.j2 diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index eafbad8e6a31..fedc0254ba11 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -1,11 +1,12 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM debian:stretch # Clean documentation in FROM image RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true # Clean doc directories that are empty or only contain empty directories -RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done -RUN rm -rf \ +RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done && \ + rm -rf \ /usr/share/man/* \ /usr/share/groff/* \ /usr/share/info/* \ @@ -21,28 +22,22 @@ ENV DEBIAN_FRONTEND=noninteractive COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] COPY ["sources.list", "/etc/apt/sources.list"] COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] -RUN apt-get update - -# Pre-install fundamental packages -RUN apt-get -y install \ - less \ - perl \ - procps \ - python \ - rsyslog \ - vim-tiny - -COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] -COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] -COPY ["root/.vimrc", "/root/.vimrc"] +# Update apt cache and +# pre-install fundamental packages +RUN apt-get update && \ + apt-get -y install \ + less \ + perl \ + procps \ + python \ + rsyslog \ + vim-tiny \ # Install dependencies of supervisor -RUN apt-get -y install python-pkg-resources python-meld3 - -RUN mkdir -p /etc/supervisor -RUN mkdir -p /var/log/supervisor + python-pkg-resources \ + python-meld3 -COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"] +RUN mkdir -p /etc/supervisor /var/log/supervisor RUN apt-get -y purge \ exim4 \ @@ -51,29 +46,29 @@ RUN apt-get -y purge \ exim4-daemon-light {% if docker_base_stretch_debs.strip() -%} -# Copy built Debian packages -{%- for deb in docker_base_stretch_debs.split(' ') %} -COPY debs/{{ deb }} debs/ -{%- endfor %} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_base_stretch_debs.split(' '), "/debs/") }} # Install built Debian packages and implicitly install their dependencies -{%- for deb in docker_base_stretch_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_base_stretch_debs.split(' ')) }} {%- endif %} {% if docker_base_stretch_dbgs.strip() -%} # Install common debug-packages -{%- for dbg_pkg in docker_base_stretch_dbgs.split(' ') %} -RUN apt-get -y install {{ dbg_pkg }} -{%- endfor %} +RUN apt-get -y install docker_base_stretch_dbgs.split(' ') | join(' ') {% else %} RUN ln /usr/bin/vim.tiny /usr/bin/vim {%- endif %} # Clean up apt # Remove /var/lib/apt/lists/*, could be obsoleted for derived images -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /var/lib/apt/lists/* +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* /tmp/* + +COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] +COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] +COPY ["root/.vimrc", "/root/.vimrc"] -RUN rm -rf /tmp/* +COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"] diff --git a/dockers/docker-config-engine-stretch/Dockerfile.j2 b/dockers/docker-config-engine-stretch/Dockerfile.j2 index 7c85e583ca6b..8b958b8f4f59 100644 --- a/dockers/docker-config-engine-stretch/Dockerfile.j2 +++ b/dockers/docker-config-engine-stretch/Dockerfile.j2 @@ -1,47 +1,49 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-base-stretch ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update - -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev python-natsort python-setuptools +RUN apt-get update && \ + apt-get install -y \ + # Dependencies for sonic-cfggen + python-lxml \ + python-yaml \ + python-bitarray \ + python-pip \ + python-dev \ + python-natsort \ + python-setuptools RUN pip install --upgrade pip -RUN pip install netaddr ipaddr jinja2 pyangbind==0.5.10 +RUN pip install \ + netaddr \ + ipaddr \ + jinja2 \ + pyangbind==0.5.10 {% if docker_config_engine_stretch_debs.strip() %} -COPY \ -{% for deb in docker_config_engine_stretch_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ -{%- endif -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_config_engine_stretch_debs.split(' '), "/debs/") }} -{% if docker_config_engine_stretch_debs.strip() %} -RUN dpkg -i \ -{% for deb in docker_config_engine_stretch_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} -{%- endif -%} +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_config_engine_stretch_debs.split(' ')) }} +{% endif %} {% if docker_config_engine_stretch_whls.strip() %} -COPY \ -{% for whl in docker_config_engine_stretch_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} -{%- endfor -%} -python-wheels/ -{%- endif -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_config_engine_stretch_whls.split(' '), "/python-wheels/") }} -{% if docker_config_engine_stretch_whls.strip() %} -RUN pip install \ -{% for whl in docker_config_engine_stretch_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} -{%- endfor %} -{%- endif -%} +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_config_engine_stretch_whls.split(' ')) }} +{% endif %} ## Clean up -RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs /python-wheels +RUN apt-get purge -y \ + python-pip \ + python-dev && \ + apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs /python-wheels diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 5200c1a5dde8..c89f4d63d225 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -11,23 +12,18 @@ RUN apt-get update {% if docker_database_debs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_database_debs.split(' ') %} -COPY debs/{{ deb }} /debs/ -{%- endfor %} +{{ copy_files("debs/", docker_database_debs.split(' '), "/debs/") }} # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_database_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_database_debs.split(' ')) }} {%- endif %} # Clean up -RUN apt-get clean -y -RUN apt-get autoclean -y -RUN apt-get autoremove -y -RUN rm -rf /debs ~/.cache - -RUN sed -ri 's/^(save .*$)/# \1/g; \ +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs ~/.cache && \ + sed -ri 's/^(save .*$)/# \1/g; \ s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 3db714d4df94..e365adab1716 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -11,19 +12,17 @@ RUN apt-get update {% if docker_dhcp_relay_debs.strip() -%} # Copy built Debian packages -{%- for deb in docker_dhcp_relay_debs.split(' ') %} -COPY debs/{{ deb }} debs/ -{%- endfor %} +{{ copy_files("debs/", docker_dhcp_relay_debs.split(' '), "/debs/") }} # Install built Debian packages and implicitly install their dependencies -{%- for deb in docker_dhcp_relay_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_dhcp_relay_debs.split(' ')) }} {%- endif %} # Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs COPY ["docker_init.sh", "start.sh", "/usr/bin/"] COPY ["docker-dhcp-relay.supervisord.conf.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index e6abef67aca2..b4cf40773f07 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -10,33 +11,37 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ENV DEBIAN_FRONTEND=noninteractive # Update apt's cache of available packages -RUN apt-get update - # Install required packages -RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute2 libpython2.7 libjson-c3 logrotate libunwind8 - -{% if docker_fpm_frr_debs.strip() -%} -# Copy locally-built Debian package dependencies -{%- for deb in docker_fpm_frr_debs.split(' ') %} -COPY debs/{{ deb }} /debs/ -{%- endfor %} +RUN apt-get update && \ + apt-get install -y \ + libdbus-1-3 \ + libdaemon0 \ + libjansson4 \ + libc-ares2 \ + iproute2 \ + libpython2.7 \ + libjson-c3 \ + logrotate \ + libunwind8 RUN groupadd -g ${frr_user_gid} frr RUN useradd -u ${frr_user_uid} -g ${frr_user_gid} -M -s /bin/false frr +{% if docker_fpm_frr_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_fpm_frr_debs.split(' '), "/debs/") }} + # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_fpm_frr_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_fpm_frr_debs.split(' ')) }} {%- endif %} RUN chown -R ${frr_user_uid}:${frr_user_gid} /etc/frr/ # Clean up -RUN apt-get clean -y -RUN apt-get autoclean -y -RUN apt-get autoremove -y -RUN rm -rf /debs ~/.cache +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs ~/.cache COPY ["bgpcfgd", "start.sh", "/usr/bin/"] COPY ["*.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 4b1c95f9e523..2a76c2cc6f0b 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -9,37 +10,30 @@ ENV DEBIAN_FRONTEND=noninteractive # Update apt's cache of available packages RUN apt-get update - {% if docker_lldp_sv2_debs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_lldp_sv2_debs.split(' ') %} -COPY debs/{{ deb }} /debs/ -{%- endfor %} +{{ copy_files("debs/", docker_lldp_sv2_debs.split(' '), "/debs/") }} # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_lldp_sv2_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_lldp_sv2_debs.split(' ')) }} {%- endif %} {% if docker_lldp_sv2_whls.strip() -%} # Copy locally-built Python wheel dependencies -{%- for whl in docker_lldp_sv2_whls.split(' ') %} -COPY python-wheels/{{ whl }} /python-wheels/ -{%- endfor %} +{{ copy_files("python-wheels/", docker_lldp_sv2_whls.split(' '), "/python-wheels/") }} # Install locally-built Python wheel dependencies -{%- for whl in docker_lldp_sv2_whls.split(' ') %} -RUN pip install /python-wheels/{{ whl }} -{%- endfor %} +{{ install_python_wheels(docker_lldp_sv2_whls.split(' ')) }} {% endif %} # Clean up -RUN apt-get purge -y python-pip -RUN apt-get clean -y -RUN apt-get autoclean -y -RUN apt-get autoremove -y -RUN rm -rf /debs /python-wheels ~/.cache +RUN apt-get purge -y python-pip && \ + apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs \ + /python-wheels \ + ~/.cache COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 8f480a53287e..8b6fe8845885 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -6,36 +7,44 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update - -RUN apt-get install -f -y ifupdown arping libdbus-1-3 libdaemon0 libjansson4 libpython2.7 iproute2 - -RUN apt-get install -f -y ndisc6 tcpdump -RUN pip install scapy==2.4.2 -## Install redis-tools dependencies -## TODO: implicitly install dependencies -RUN apt-get -y install libjemalloc1 - -RUN apt-get install -y libelf1 libmnl0 bridge-utils - -RUN pip install setuptools -RUN pip install pyroute2==0.5.3 netifaces==0.10.7 -RUN pip install monotonic==1.5 - -COPY \ -{% for deb in docker_orchagent_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - -RUN dpkg -i \ -{% for deb in docker_orchagent_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} +RUN apt-get update && \ + apt-get install -f -y \ + ifupdown \ + arping \ + libdbus-1-3 \ + libdaemon0 \ + libjansson4 \ + libpython2.7 \ + iproute2 \ + ndisc6 \ + tcpdump \ + # Install redis-tools dependencies + # TODO: implicitly install dependencies + libjemalloc1 \ + libelf1 \ + libmnl0 \ + bridge-utils + +RUN pip install \ + scapy==2.4.2 \ + setuptools \ + pyroute2==0.5.3 \ + netifaces==0.10.7 \ + monotonic==1.5 + +{% if docker_orchagent_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_orchagent_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_orchagent_debs.split(' ')) }} +{%- endif %} ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs COPY ["files/arp_update", "/usr/bin"] COPY ["enable_counters.py", "/usr/bin"] diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 1f9f749f0751..9a3deebef34a 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -7,50 +8,51 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ENV DEBIAN_FRONTEND=noninteractive # Install required packages -RUN apt-get update && apt-get install -y python-pip libpython2.7 ipmitool librrd8 librrd-dev rrdtool python-smbus ethtool dmidecode +RUN apt-get update && \ + apt-get install -y \ + python-pip \ + libpython2.7 \ + ipmitool \ + librrd8 \ + librrd-dev \ + rrdtool \ + python-smbus \ + ethtool \ + dmidecode {% if docker_platform_monitor_debs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_platform_monitor_debs.split(' ') %} -COPY debs/{{ deb }} /debs/ -{%- endfor %} +{{ copy_files("debs/", docker_platform_monitor_debs.split(' '), "/debs/") }} # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_platform_monitor_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_platform_monitor_debs.split(' ')) }} {%- endif %} {% if docker_platform_monitor_pydebs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_platform_monitor_pydebs.split(' ') %} -COPY python-debs/{{ deb }} /debs/ -{%- endfor %} +{{ copy_files("python-debs/", docker_platform_monitor_pydebs.split(' '), "/debs/") }} # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_platform_monitor_pydebs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_platform_monitor_pydebs.split(' ')) }} {%- endif %} {% if docker_platform_monitor_whls.strip() -%} # Copy locally-built Python wheel dependencies -{%- for whl in docker_platform_monitor_whls.split(' ') %} -COPY python-wheels/{{ whl }} /python-wheels/ -{%- endfor %} +{{ copy_files("python-wheels/", docker_platform_monitor_whls.split(' '), "/python-wheels/") }} # Install locally-built Python wheel dependencies -{%- for whl in docker_platform_monitor_whls.split(' ') %} -RUN pip install /python-wheels/{{ whl }} -{%- endfor %} +{{ install_python_wheels(docker_platform_monitor_whls.split(' ')) }} {% endif %} # Clean up -RUN apt-get purge -y python-pip -RUN apt-get clean -y -RUN apt-get autoclean -y -RUN apt-get autoremove -y -RUN rm -rf /debs /python-wheels ~/.cache +RUN apt-get purge -y \ + python-pip && \ + apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs \ + /python-wheels \ + ~/.cache COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"] COPY ["docker-pmon.supervisord.conf.j2", "start.sh.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 1be7ae1a662d..1594a59c5e8a 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -11,19 +12,17 @@ RUN apt-get update {% if docker_router_advertiser_debs.strip() -%} # Copy built Debian packages -{%- for deb in docker_router_advertiser_debs.split(' ') %} -COPY debs/{{ deb }} debs/ -{%- endfor %} +{{ copy_files("debs/", docker_router_advertiser_debs.split(' '), "/debs/") }} # Install built Debian packages and implicitly install their dependencies -{%- for deb in docker_router_advertiser_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_router_advertiser_debs.split(' ')) }} {%- endif %} # Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs COPY ["start.sh", "/usr/bin/"] COPY ["docker-router-advertiser.supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 9b1b18c306e5..42d2f8522667 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -10,62 +11,65 @@ ENV PYTHONOPTIMIZE 1 ENV DEBIAN_FRONTEND=noninteractive # Update apt's cache of available packages -RUN apt-get update - # Install curl so we can download and install pip later # Also install major root CA certificates for curl to reference -RUN apt-get install -y curl ca-certificates - # Install gcc which is required for installing hiredis -RUN apt-get install -y gcc make - # Install libdpkg-perl which is required for python3.6-3.6.0 as one of its specs i.e. no-pie-compile.specs # The file referenced (`/usr/share/dpkg/no-pie-compile.specs`) is in the `libdpkg-perl` package on Debian -RUN apt-get install -y libdpkg-perl +RUN apt-get update && \ + apt-get install -y \ + curl \ + ca-certificates \ + gcc \ + make \ + libdpkg-perl {% if docker_snmp_sv2_debs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_snmp_sv2_debs.split(' ') %} -COPY debs/{{ deb }} /debs/ -{%- endfor %} +{{ copy_files("debs/", docker_snmp_sv2_debs.split(' '), "/debs/") }} # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_snmp_sv2_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +{{ install_debian_packages(docker_snmp_sv2_debs.split(' ')) }} {%- endif %} # Install up-to-date version of pip RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6 -RUN python3.6 -m pip install --no-cache-dir hiredis # Install pyyaml dependency for use by some plugins -RUN python3.6 -m pip install --no-cache-dir pyyaml - # Install smbus dependency for use by some plugins -RUN python3.6 -m pip install --no-cache-dir smbus +RUN python3.6 -m pip install --no-cache-dir \ + hiredis \ + pyyaml \ + smbus {% if docker_snmp_sv2_whls.strip() -%} # Copy locally-built Python wheel dependencies -{%- for whl in docker_snmp_sv2_whls.split(' ') %} -COPY python-wheels/{{ whl }} /python-wheels/ -{%- endfor %} +{{ copy_files("python-wheels/", docker_snmp_sv2_whls.split(' '), "/python-wheels/") }} # Install locally-built Python wheel dependencies -{%- for whl in docker_snmp_sv2_whls.split(' ') %} -RUN pip install /python-wheels/{{ whl }} -{%- endfor %} +{{ install_python_wheels(docker_snmp_sv2_whls.split(' ')) }} {% endif %} RUN python3.6 -m sonic_ax_impl install # Clean up -RUN apt-get -y purge libpython3.6-dev libpython3.6 curl gcc make libdpkg-perl -# Note: these packages should be removed with autoremove but actually not, so explicitly purged -RUN apt-get -y purge libldap-2.4-2 libsasl2-2 libsasl2-modules libsasl2-modules-db -RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge -RUN find / | grep -E "__pycache__" | xargs rm -rf -RUN rm -rf /debs /python-wheels ~/.cache +RUN apt-get -y purge \ + libpython3.6-dev \ + libpython3.6 \ + curl \ + gcc \ + make \ + libdpkg-perl \ + # Note: these packages should be removed with autoremove but actually not, so explicitly purged + libldap-2.4-2 \ + libsasl2-2 \ + libsasl2-modules \ + libsasl2-modules-db && \ + apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y --purge && \ + find / | grep -E "__pycache__" | xargs rm -rf && \ + rm -rf /debs /python-wheels ~/.cache COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index c311efbfbe58..8592f6573721 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -6,29 +7,29 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update +RUN apt-get update && \ + apt-get install -f -y \ + libdbus-1-3 \ + libdaemon0 \ + libjansson4 \ + # Install redis-tools dependencies + # TODO: implicitly install dependencies + libjemalloc1 -RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 +{% if docker_sonic_telemetry_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_sonic_telemetry_debs.split(' '), "/debs/") }} -## Install redis-tools dependencies -## TODO: implicitly install dependencies -RUN apt-get -y install libjemalloc1 +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_sonic_telemetry_debs.split(' ')) }} +{%- endif %} -COPY \ -{% for deb in docker_sonic_telemetry_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - -RUN dpkg -i \ -{% for deb in docker_sonic_telemetry_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} +RUN apt-get clean -y && \ + apt-get autoclean - && \ + apt-get autoremove -y && \ + rm -rf /debs COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 551608b6fbef..d09aad2415fa 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -6,29 +7,30 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update - -RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 libpython2.7 - -## Install redis-tools dependencies -## TODO: implicitly install dependencies -RUN apt-get -y install libjemalloc1 - -COPY \ -{% for deb in docker_teamd_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - -RUN dpkg -i \ -{% for deb in docker_teamd_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} +RUN apt-get update && \ + apt-get install -f -y \ + libdbus-1-3 \ + libdaemon0 \ + libjansson4 \ + libpython2.7 \ + # Install redis-tools dependencies + # TODO: implicitly install dependencies + libjemalloc1 + +{% if docker_teamd_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_teamd_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_teamd_debs.split(' ')) }} +{%- endif %} + +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/dockerfile-macros.j2 b/dockers/dockerfile-macros.j2 new file mode 100644 index 000000000000..408ee9fec622 --- /dev/null +++ b/dockers/dockerfile-macros.j2 @@ -0,0 +1,18 @@ +{% macro install_debian_packages(packages) -%} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + {%- for deb in packages %} + dpkg_apt /debs/{{ deb }} {%- if not loop.last %} && \ {%- endif %} + {%- endfor %} +{%- endmacro %} + +{% macro install_python_wheels(packages) -%} +RUN cd /python-wheels/ && pip install {{ packages | join(' ') }} +{%- endmacro %} + +{% macro copy_files(prefix, files, dest) -%} +COPY \ + {%- for file in files %} + {{ prefix }}/{{ file }} \ + {%- endfor %} + {{ dest }} +{%- endmacro %} diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index addfa62cd4f4..aaafd39f510f 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -1,31 +1,26 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-syncd-mlnx ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -COPY \ -{% for deb in docker_syncd_mlnx_rpc_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +{% if docker_syncd_mlnx_rpc_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_syncd_mlnx_rpc_debs.split(' '), "/debs/") }} -COPY \ -{% for deb in docker_syncd_mlnx_rpc_pydebs.split(' ') -%} -python-debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_mlnx_rpc_debs.split(' ')) }} +{% endif %} -RUN apt-get purge -y syncd +{% if docker_syncd_mlnx_rpc_pydebs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("python-debs/", docker_syncd_mlnx_rpc_pydebs.split(' '), "/debs/") }} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -{% for deb in docker_syncd_mlnx_rpc_debs.split(' ') -%} -dpkg_apt debs/{{ deb }}{{'; '}} -{%- endfor %} +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_mlnx_rpc_pydebs.split(' ')) }} +{% endif %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -{% for deb in docker_syncd_mlnx_rpc_pydebs.split(' ') -%} -dpkg_apt debs/{{ deb }}{{'; '}} -{%- endfor %} +RUN apt-get purge -y syncd ## Pre-install the fundamental packages RUN apt-get update \ @@ -58,5 +53,5 @@ RUN apt-get update \ && rm -rf /root/deps COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] - + ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 179a34bb10bf..d3716dffcbbc 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,3 +1,4 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-stretch ARG docker_container_name @@ -6,37 +7,33 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update +RUN apt-get update && \ + apt-get install -y \ + libxml2 -COPY \ -{% for deb in docker_syncd_mlnx_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +{% if docker_syncd_mlnx_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_syncd_mlnx_debs.split(' '), "/debs/") }} -COPY \ -{% for deb in docker_syncd_mlnx_pydebs.split(' ') -%} -python-debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_mlnx_debs.split(' ')) }} +{% endif %} -RUN apt-get install -y libxml2 +{% if docker_syncd_mlnx_pydebs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("python-debs/", docker_syncd_mlnx_pydebs.split(' '), "/debs/") }} -RUN dpkg -i \ -{% for deb in docker_syncd_mlnx_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_mlnx_pydebs.split(' ')) }} +{% endif %} -RUN dpkg -i \ -{% for deb in docker_syncd_mlnx_pydebs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} +## Clean up +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - ENTRYPOINT ["/usr/bin/supervisord"] From 40330bcbdff9aa9696981757d80b3ff093fd603e Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 22 Jun 2019 14:40:05 -0700 Subject: [PATCH 25/37] [build]: wait up to 60 seconds for docker engine to start (#3067) * [build]: wait 60 seconds for docker engine to start On some platforms, it can take more than 1 second for docker engine to start. Signed-off-by: Guohan Lu --- scripts/wait_for_docker.sh | 15 +++++++++++++++ slave.mk | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 scripts/wait_for_docker.sh diff --git a/scripts/wait_for_docker.sh b/scripts/wait_for_docker.sh new file mode 100755 index 000000000000..744646732826 --- /dev/null +++ b/scripts/wait_for_docker.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +total_time=$1 +cnt=0 +while [ $cnt -le $total_time ]; do + docker info 1>/dev/null + rv=$? + if [ $rv -eq 0 ]; then + exit 0 + fi + sleep 1 + cnt=$((cnt+1)) +done + +exit 1 diff --git a/slave.mk b/slave.mk index 1174cb148949..05285971af58 100644 --- a/slave.mk +++ b/slave.mk @@ -454,7 +454,7 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff docker-start : @sudo sed -i '/http_proxy/d' /etc/default/docker @sudo bash -c "echo \"export http_proxy=$$http_proxy\" >> /etc/default/docker" - @test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && sleep 1 ) + @test x$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != x"y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && ./scripts/wait_for_docker.sh 60 ) # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) From 9cf34ec464427d60015433f64d64b60f4e98984f Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Sun, 23 Jun 2019 03:15:43 +0530 Subject: [PATCH 26/37] Revert "[Dell] [Z9100] Supporting PreEmphasis Settings for Optics (#2501)" (#3060) This reverts commit ed2d87a7102efb602606b0d3a4c2964248650ceb. --- .../debian/platform-modules-z9100.install | 4 - .../debian/platform-modules-z9100.postinst | 3 - .../z9100/scripts/qsfp_monitor | 4 - .../z9100/scripts/z9100_preemp_db.py | 1076 ----------------- .../z9100/scripts/z9100_qsfp_monitor.py | 522 -------- .../z9100/systemd/z9100-qsfp-monitor.service | 11 - 6 files changed, 1620 deletions(-) delete mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/qsfp_monitor delete mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_preemp_db.py delete mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_qsfp_monitor.py delete mode 100644 platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-qsfp-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install index e332f1affdcf..aa6cd7af7e5f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -4,10 +4,6 @@ common/dell_i2c_utils.sh usr/local/bin common/io_rd_wr.py usr/local/bin common/platform_reboot usr/share/sonic/device/x86_64-dell_z9100_c2538-r0 z9100/scripts/platform_sensors.py usr/local/bin -z9100/scripts/z9100_qsfp_monitor.py usr/local/bin -z9100/scripts/z9100_preemp_db.py usr/local/bin -z9100/scripts/qsfp_monitor usr/local/bin z9100/scripts/sensors usr/bin z9100/cfg/z9100-modules.conf etc/modules-load.d z9100/systemd/platform-modules-z9100.service etc/systemd/system -z9100/systemd/z9100-qsfp-monitor.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst index 59d58b84e742..05983e16d4f7 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst @@ -5,8 +5,5 @@ depmod -a systemctl enable platform-modules-z9100.service systemctl start platform-modules-z9100.service -# Enable Dell-Z9100-Qsfp-Monitor-service -systemctl enable z9100-qsfp-monitor.service -systemctl start z9100-qsfp-monitor.service #DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/qsfp_monitor b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/qsfp_monitor deleted file mode 100755 index 35120a56e643..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/qsfp_monitor +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -if [ -r /usr/local/bin/z9100_qsfp_monitor.py ]; then - python /usr/local/bin/z9100_qsfp_monitor.py & -fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_preemp_db.py b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_preemp_db.py deleted file mode 100755 index 994a485999e8..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_preemp_db.py +++ /dev/null @@ -1,1076 +0,0 @@ -# ========================== Globals ================================== -# z9100_lane_mapping -lane_mapping = {} - -lane_mapping["Ethernet0"] = [2, 3, 1, 0] -lane_mapping["Ethernet4"] = [1, 0, 3, 2] -lane_mapping["Ethernet8"] = [3, 2, 1, 0] -lane_mapping["Ethernet12"] = [1, 0, 2, 3] -lane_mapping["Ethernet16"] = [0, 1, 2, 3] -lane_mapping["Ethernet20"] = [1, 0, 3, 2] -lane_mapping["Ethernet24"] = [0, 2, 3, 1] -lane_mapping["Ethernet28"] = [0, 2, 3, 1] -lane_mapping["Ethernet32"] = [2, 3, 0, 1] -lane_mapping["Ethernet36"] = [1, 3, 0, 2] -lane_mapping["Ethernet40"] = [3, 2, 0, 1] -lane_mapping["Ethernet44"] = [2, 3, 1, 0] -lane_mapping["Ethernet48"] = [3, 1, 2, 0] -lane_mapping["Ethernet52"] = [2, 3, 0, 1] -lane_mapping["Ethernet56"] = [2, 3, 1, 0] -lane_mapping["Ethernet60"] = [3, 2, 1, 0] -lane_mapping["Ethernet64"] = [3, 2, 1, 0] -lane_mapping["Ethernet68"] = [3, 2, 1, 0] -lane_mapping["Ethernet72"] = [2, 3, 0, 1] -lane_mapping["Ethernet76"] = [3, 2, 1, 0] -lane_mapping["Ethernet80"] = [1, 0, 3, 2] -lane_mapping["Ethernet84"] = [2, 0, 1, 3] -lane_mapping["Ethernet88"] = [3, 2, 0, 1] -lane_mapping["Ethernet92"] = [0, 3, 1, 2] -lane_mapping["Ethernet96"] = [0, 1, 3, 2] -lane_mapping["Ethernet100"] = [3, 1, 0, 2] -lane_mapping["Ethernet104"] = [2, 3, 1, 0] -lane_mapping["Ethernet108"] = [3, 2, 1, 0] -lane_mapping["Ethernet112"] = [3, 1, 2, 0] -lane_mapping["Ethernet116"] = [3, 2, 1, 0] -lane_mapping["Ethernet120"] = [1, 0, 3, 2] -lane_mapping["Ethernet124"] = [3, 2, 1, 0] - -# 40G Optics -preEmphasis_40g = {} -preEmphasis_40g["Ethernet0"] = [[0xb, 0x4, 0x2c, 0x40], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x4, 0x2c, 0x40]] -preEmphasis_40g["Ethernet4"] = [[0xb, 0x3, 0x2b, 0x42], - [0xa, 0x3, 0x29, 0x44], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x3, 0x2b, 0x42]] -preEmphasis_40g["Ethernet8"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_40g["Ethernet12"] = [[0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_40g["Ethernet16"] = [[0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x28, 0x45]] -preEmphasis_40g["Ethernet20"] = [[0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x26, 0x47]] -preEmphasis_40g["Ethernet24"] = [[0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x26, 0x47], - [0x9, 0x3, 0x24, 0x49]] -preEmphasis_40g["Ethernet28"] = [[0x9, 0x2, 0x23, 0x4b], - [0xa, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49], - [0x9, 0x2, 0x23, 0x4b]] -preEmphasis_40g["Ethernet32"] = [[0xa, 0x3, 0x29, 0x44], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2e, 0x3e]] -preEmphasis_40g["Ethernet36"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_40g["Ethernet40"] = [[0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x27, 0x46], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x24, 0x49]] -preEmphasis_40g["Ethernet44"] = [[0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x27, 0x46], - [0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x26, 0x47]] -preEmphasis_40g["Ethernet48"] = [[0x9, 0x2, 0x20, 0x4e], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1f, 0x4f], - [0x8, 0x2, 0x1f, 0x4f]] -preEmphasis_40g["Ethernet52"] = [[0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e]] -preEmphasis_40g["Ethernet56"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x8, 0x2, 0x1f, 0x4f], - [0x8, 0x2, 0x1f, 0x4f]] -preEmphasis_40g["Ethernet60"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50]] -preEmphasis_40g["Ethernet64"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50]] -preEmphasis_40g["Ethernet68"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50]] -preEmphasis_40g["Ethernet72"] = [[0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e]] -preEmphasis_40g["Ethernet76"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1f, 0x4f], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1f, 0x4f]] -preEmphasis_40g["Ethernet80"] = [[0xa, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49]] -preEmphasis_40g["Ethernet84"] = [[0xa, 0x3, 0x26, 0x47], - [0x9, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49]] -preEmphasis_40g["Ethernet88"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x28, 0x45]] -preEmphasis_40g["Ethernet92"] = [[0xa, 0x3, 0x29, 0x44], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x4, 0x2d, 0x3f]] -preEmphasis_40g["Ethernet96"] = [[0x9, 0x2, 0x23, 0x4b], - [0x9, 0x2, 0x23, 0x4b], - [0x9, 0x2, 0x23, 0x4b], - [0x9, 0x2, 0x23, 0x4b]] -preEmphasis_40g["Ethernet100"] = [[0x9, 0x2, 0x23, 0x4b], - [0x9, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49]] -preEmphasis_40g["Ethernet104"] = [[0xa, 0x3, 0x27, 0x46], - [0xa, 0x3, 0x26, 0x47], - [0x9, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49]] -preEmphasis_40g["Ethernet108"] = [[0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x27, 0x46]] -preEmphasis_40g["Ethernet112"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x28, 0x45]] -preEmphasis_40g["Ethernet116"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_40g["Ethernet120"] = [[0xb, 0x3, 0x2b, 0x42], - [0xa, 0x3, 0x29, 0x44], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x3, 0x2b, 0x42]] -preEmphasis_40g["Ethernet124"] = [[0xb, 0x3, 0x2b, 0x42], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x4, 0x2c, 0x40]] - -# 100G Optics -preEmphasis_100g = {} -preEmphasis_100g["Ethernet0"] = [[0xb, 0x4, 0x2c, 0x40], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x4, 0x2c, 0x40]] -preEmphasis_100g["Ethernet4"] = [[0xb, 0x3, 0x2b, 0x42], - [0xa, 0x3, 0x29, 0x44], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x3, 0x2b, 0x42]] -preEmphasis_100g["Ethernet8"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_100g["Ethernet12"] = [[0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_100g["Ethernet16"] = [[0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x28, 0x45]] -preEmphasis_100g["Ethernet20"] = [[0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x26, 0x47]] -preEmphasis_100g["Ethernet24"] = [[0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x26, 0x47], - [0x9, 0x3, 0x24, 0x49]] -preEmphasis_100g["Ethernet28"] = [[0x9, 0x2, 0x23, 0x4b], - [0xa, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49], - [0x9, 0x2, 0x23, 0x4b]] -preEmphasis_100g["Ethernet32"] = [[0xa, 0x3, 0x29, 0x44], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2e, 0x3e]] -preEmphasis_100g["Ethernet36"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_100g["Ethernet40"] = [[0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x27, 0x46], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x24, 0x49]] -preEmphasis_100g["Ethernet44"] = [[0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x27, 0x46], - [0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x26, 0x47]] -preEmphasis_100g["Ethernet48"] = [[0x9, 0x2, 0x20, 0x4e], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1f, 0x4f], - [0x8, 0x2, 0x1f, 0x4f]] -preEmphasis_100g["Ethernet52"] = [[0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e]] -preEmphasis_100g["Ethernet56"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x8, 0x2, 0x1f, 0x4f], - [0x8, 0x2, 0x1f, 0x4f]] -preEmphasis_100g["Ethernet60"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50]] -preEmphasis_100g["Ethernet64"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50]] -preEmphasis_100g["Ethernet68"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50]] -preEmphasis_100g["Ethernet72"] = [[0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1e, 0x50], - [0x9, 0x2, 0x20, 0x4e]] -preEmphasis_100g["Ethernet76"] = [[0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1f, 0x4f], - [0x9, 0x2, 0x20, 0x4e], - [0x8, 0x2, 0x1f, 0x4f]] -preEmphasis_100g["Ethernet80"] = [[0xa, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49]] -preEmphasis_100g["Ethernet84"] = [[0xa, 0x3, 0x26, 0x47], - [0x9, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49]] -preEmphasis_100g["Ethernet88"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x28, 0x45]] -preEmphasis_100g["Ethernet92"] = [[0xa, 0x3, 0x29, 0x44], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x4, 0x2d, 0x3f]] -preEmphasis_100g["Ethernet96"] = [[0x9, 0x2, 0x23, 0x4b], - [0x9, 0x2, 0x23, 0x4b], - [0x9, 0x2, 0x23, 0x4b], - [0x9, 0x2, 0x23, 0x4b]] -preEmphasis_100g["Ethernet100"] = [[0x9, 0x2, 0x23, 0x4b], - [0x9, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49], - [0x9, 0x3, 0x24, 0x49]] -preEmphasis_100g["Ethernet104"] = [[0xa, 0x3, 0x27, 0x46], - [0xa, 0x3, 0x26, 0x47], - [0x9, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x24, 0x49]] -preEmphasis_100g["Ethernet108"] = [[0xa, 0x3, 0x26, 0x47], - [0xa, 0x3, 0x24, 0x49], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x27, 0x46]] -preEmphasis_100g["Ethernet112"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x28, 0x45]] -preEmphasis_100g["Ethernet116"] = [[0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x28, 0x45], - [0xa, 0x3, 0x29, 0x44], - [0xa, 0x3, 0x29, 0x44]] -preEmphasis_100g["Ethernet120"] = [[0xb, 0x3, 0x2b, 0x42], - [0xa, 0x3, 0x29, 0x44], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x3, 0x2b, 0x42]] -preEmphasis_100g["Ethernet124"] = [[0xb, 0x3, 0x2b, 0x42], - [0xb, 0x3, 0x2b, 0x42], - [0xb, 0x4, 0x2c, 0x40], - [0xb, 0x4, 0x2c, 0x40]] - -# 100G DAC 0.75m Optics -preEmphasis_100g_dac_750mm = {} -preEmphasis_100g_dac_750mm["Ethernet0"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet4"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet8"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet12"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet16"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet20"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet24"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet28"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet32"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet36"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet40"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet44"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet48"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet52"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet56"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet60"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet64"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet68"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet72"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet76"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet80"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet84"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet88"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet92"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet96"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet100"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet104"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet108"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet112"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet116"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet120"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_750mm["Ethernet124"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -# 100G DAC 1.0m Optics -preEmphasis_100g_dac_1_0m = {} -preEmphasis_100g_dac_1_0m["Ethernet0"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet4"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet8"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet12"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet16"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet20"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet24"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet28"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet32"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet36"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet40"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet44"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet48"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet52"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet56"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet60"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet64"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet68"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet72"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet76"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet80"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet84"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] -preEmphasis_100g_dac_1_0m["Ethernet88"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet92"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet96"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet100"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet104"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet108"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet112"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet116"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet120"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_0m["Ethernet124"] = [[0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08], - [0x8, 0x00, 0x68, 0x08]] - -# 100G DAC 1.5m Optics -preEmphasis_100g_dac_1_5m = {} -preEmphasis_100g_dac_1_5m["Ethernet0"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet4"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet8"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet12"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet16"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet20"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet24"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet28"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet32"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet36"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet40"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet44"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet48"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet52"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet56"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet60"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet64"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet68"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet72"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet76"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet80"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet84"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet88"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet92"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet96"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet100"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet104"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet108"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet112"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet116"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet120"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_1_5m["Ethernet124"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -# 100G DAC 2.0m Optics -preEmphasis_100g_dac_2_0m = {} -preEmphasis_100g_dac_2_0m["Ethernet0"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet4"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet8"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet12"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet16"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet20"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet24"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet28"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet32"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet36"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet40"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet44"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet48"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet52"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet56"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet60"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet64"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet68"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet72"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet76"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet80"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet84"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet88"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet92"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet96"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet100"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet104"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet108"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet112"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet116"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet120"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_2_0m["Ethernet124"] = [[0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08], - [0xb, 0x00, 0x68, 0x08]] - -# 100G DAC 3.0m Optics -preEmphasis_100g_dac_3_0m = {} -preEmphasis_100g_dac_3_0m["Ethernet0"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet4"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet8"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet12"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet16"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet20"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet24"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet28"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet32"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet36"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet40"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet44"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet48"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet52"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet56"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet60"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet64"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet68"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet72"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet76"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet80"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet84"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet88"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet92"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet96"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet100"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet104"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet108"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet112"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet116"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet120"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] - -preEmphasis_100g_dac_3_0m["Ethernet124"] = [[0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08], - [0xe, 0x00, 0x68, 0x08]] diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_qsfp_monitor.py b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_qsfp_monitor.py deleted file mode 100755 index 34644b389294..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_qsfp_monitor.py +++ /dev/null @@ -1,522 +0,0 @@ -import os -import re -import signal -import subprocess -import sys -import imp -import syslog -import time -import os.path -import z9100_preemp_db -from sonic_sfp.bcmshell import bcmshell - -SYSLOG_IDENTIFIER = "dell_qsfp_monitor" - -HWSKU_KEY = 'DEVICE_METADATA.localhost.hwsku' -PLATFORM_KEY = 'DEVICE_METADATA.localhost.platform' -SONIC_CFGGEN_PATH = '/usr/local/bin/sonic-cfggen' -PLATFORM_ROOT_PATH = '/usr/share/sonic/device' -PLATFORM_SPECIFIC_CLASS_NAME = "SfpUtil" -PLATFORM_SPECIFIC_MODULE_NAME = "sfputil" - -# Global platform-specific sfputil class instance -platform_sfputil = None - -# Timer Value -DEFAULT_WAIT_FOR_SWSS_SYNCD = 45 -MINIMUM_WAIT_FOR_BCM_SHELL = 3 -MINIMUM_WAIT_FOR_SWSS_SYNCD = 5 -MINIMUM_RETRY_FOR_SWSS_DB = 10 - - -# ========================== Syslog wrappers ========================== -def log_debug(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_DEBUG, msg) - syslog.closelog() - - -def log_info(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - - -def log_warning(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_WARNING, msg) - syslog.closelog() - - -def log_error(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - -# ========================== Signal Handling ========================== -def signal_handler(sig, frame): - if sig == signal.SIGHUP: - log_info("Caught SIGHUP - ignoring...") - return - elif sig == signal.SIGINT: - log_info("Caught SIGINT - exiting...") - sys.exit(128 + sig) - elif sig == signal.SIGTERM: - log_info("Caught SIGTERM - exiting...") - sys.exit(128 + sig) - else: - log_warning("Caught unhandled signal '" + sig + "'") - - -class BcmShell(bcmshell): - bcm_port_mapping = {} - - def port_mapping_populate(self): - try: - content = self.run("ps") - count = 0 - for line in content.split("\n"): - PSOutput = re.search(r"(?P(xe|ce)\d+)" - "\(\s*(?P\d+)\).+\s+" - "(?P\d+)G", line) - if PSOutput is not None: - port = "Ethernet" + str(count) - self.bcm_port_mapping[port] = list() - self.bcm_port_mapping[port].append( - int(PSOutput.group("bcm_id"))) - self.bcm_port_mapping[port].append( - PSOutput.group("port_name")) - speed = PSOutput.group("speed") - if ((speed == "100") or (speed == "40")): - lane_count = 4 - count = count + 4 - elif (speed == "50"): - lane_count = 2 - count = count + 2 - else: - lane_count = 1 - count = count + 1 - self.bcm_port_mapping[port].append(str(lane_count)) - self.bcm_port_mapping[port].append(speed) - if (speed == "10"): - del self.bcm_port_mapping[port] - except: - log_error("Unable to read bcm port status") - sys.exit(3) - - def execute_command(self, cmd): - self.cmd(cmd) - - -class dell_qsfp_monitor(object): - """ - Class which configures the preEmphasis Settings corresponding to - optics inserted. This script will run only once after reload. - Support Insertion/Removal of optics is not provided - Attributes: - """ - - # Instantiate BCM Shell - def __init__(self): - self.bcm_shell = BcmShell() - self.bcm_shell.port_mapping_populate() - - # For the given eeprom data, return the PreEmphasisDB to be used - def get_preemphasis_db(self, port, eeprom_dict): - preemphasis_db = {} - - if (eeprom_dict == {}): - return z9100_preemp_db.preEmphasis_100g - else: - qsfp_identifier = eeprom_dict["Identifier"] - cable_length = eeprom_dict["Length Cable Assembly(m)"] - - if (qsfp_identifier == "QSFP28"): - if (cable_length == 0.75): - preemphasis_db = z9100_preemp_db.preEmphasis_100g_dac_750mm - elif (cable_length == 1): - preemphasis_db = z9100_preemp_db.preEmphasis_100g_dac_1_0m - elif (cable_length == 1.5): - preemphasis_db = z9100_preemp_db.preEmphasis_100g_dac_1_5m - elif (cable_length == 2): - preemphasis_db = z9100_preemp_db.preEmphasis_100g_dac_2_0m - elif (cable_length == 3): - preemphasis_db = z9100_preemp_db.preEmphasis_100g_dac_3_0m - elif (qsfp_identifier == "QSFP+"): - preemphasis_db = z9100_preemp_db.preEmphasis_40g - - return preemphasis_db - - # For Given Port, Lane and PreEmp Register, retrive the value from - # PreEmphasisDB which needs to be programmed into ASIC, - # In case of Fanned-out ports, use the values from base port - def get_preemphasis_value(self, port, bcm_hw_lane, - preemphasis_dict, preemp_idx): - portIdStr = re.findall('\d+', port) - portId = int(portIdStr[0]) - basePortId = (portId//4)*4 - portIndex = "Ethernet" + str(basePortId) - value = preemphasis_dict[portIndex][bcm_hw_lane][preemp_idx] - - return value - - # For Given port, return bcmPortname (Ex:- ce21, xe4, ce0 ) - def get_bcm_port_name(self, port): - if (self.bcm_shell.bcm_port_mapping == {}): - log_error("bcm port mapping is null") - sys.exit(3) - bcm_port_name = self.bcm_shell.bcm_port_mapping[port][1] - - return bcm_port_name - - # Return the number of lanes for the port - # (Ex:- 100G - 4, 50G - 2, 40G - 4) - def get_lane_count(self, port): - if (self.bcm_shell.bcm_port_mapping == {}): - log_error("bcm port mapping is null") - sys.exit(3) - laneCntStr = self.bcm_shell.bcm_port_mapping[port][2] - lane_count = int(laneCntStr) - - return lane_count - - # For Given port, return bcmPortname (Ex:- ce21, xe4, ce0 ) - def get_bcm_port_speed(self, port): - if (self.bcm_shell.bcm_port_mapping == {}): - log_error("bcm port mapping is null") - sys.exit(3) - bcm_port_speed = self.bcm_shell.bcm_port_mapping[port][3] - - return bcm_port_speed - - # For Given, Port and lane_id, return the hardware lane number - def get_bcm_lane_info(self, port, lane_id): - lane_count = self.get_lane_count(port) - portIdStr = re.findall('\d+', port) - portId = int(portIdStr[0]) - basePortId = (portId//4)*4 - portIndex = "Ethernet" + str(basePortId) - if ((portId % 4) == 0): - laneIndex = lane_id - elif ((portId % 2) == 0): - if (lane_count == 2): - laneIndex = lane_id + 2 - else: - laneIndex = (PortId - basePortId) - else: - laneIndex = (PortId - basePortId) - - return z9100_preemp_db.lane_mapping[portIndex][laneIndex] - - # Form the AMS_TX_AMP_CTL command string - # "serdes_driver_current" config variable in BCM Chipset - def form_bcm_phy_ams_cmd(self, port, preemphasis_dict): - ams_idx = 0 - ams_cmd = list() - - bcm_port_name = self.get_bcm_port_name(port) - lane_count = self.get_lane_count(port) - for lane_id in range(lane_count): - bcm_hw_lane = self.get_bcm_lane_info(port, lane_id) - value = self.get_preemphasis_value(port, bcm_hw_lane, - preemphasis_dict, ams_idx) - ams_cmd_str = "phy " + bcm_port_name + " AMS_TX_CTL2r." + str( - bcm_hw_lane) + " AMS_TX_AMP_CTL" + "=" + hex(value) - ams_cmd.append(ams_cmd_str) - - return ams_cmd - - # Form the TXFIR_POST command string - # "serdes_preemphasis" Bits 23:16 config variable in BCM Chipset - def form_bcm_phy_txfir_post_cmd(self, port, preemphasis_dict): - txfir_post_idx = 1 - txfir_post_cmd = list() - - bcm_port_name = self.get_bcm_port_name(port) - lane_count = self.get_lane_count(port) - for lane_id in range(lane_count): - bcm_hw_lane = self.get_bcm_lane_info(port, lane_id) - value = self.get_preemphasis_value(port, bcm_hw_lane, - preemphasis_dict, - txfir_post_idx) - txfir_post_str_p1 = "phy " + bcm_port_name + " CL93N72_UT_CTL2r." - txfir_post_str_p2 = txfir_post_str_p1 + str(bcm_hw_lane) - txfir_post_str_p3 = txfir_post_str_p2 + " CL93N72_TXFIR_POST" - txfir_post_cmd_str = txfir_post_str_p3 + "=" + hex(value) - txfir_post_cmd.append(txfir_post_cmd_str) - - return txfir_post_cmd - - # Form the TXFIR_MAIN command string - # "serdes_preemphasis" Bits 15:8 config variable in BCM Chipset - def form_bcm_phy_txfir_main_cmd(self, port, preemphasis_dict): - txfir_main_idx = 2 - txfir_main_cmd = list() - - bcm_port_name = self.get_bcm_port_name(port) - lane_count = self.get_lane_count(port) - for lane_id in range(lane_count): - bcm_hw_lane = self.get_bcm_lane_info(port, lane_id) - value = self.get_preemphasis_value(port, bcm_hw_lane, - preemphasis_dict, - txfir_main_idx) - txfir_main_str_p1 = "phy " + bcm_port_name + " CL93N72_UT_CTL3r." - txfir_main_str_p2 = txfir_main_str_p1 + str(bcm_hw_lane) - txfir_main_str_p3 = txfir_main_str_p2 + " CL93N72_TXFIR_MAIN" - txfir_main_cmd_str = txfir_main_str_p3 + "=" + hex(value) - txfir_main_cmd.append(txfir_main_cmd_str) - - return txfir_main_cmd - - # Form the TXFIR_PRE command string - # "serdes_preemphasis" Bits 7:0 config variable in BCM Chipset - def form_bcm_phy_txfir_pre_cmd(self, port, preemphasis_dict): - txfir_pre_idx = 3 - txfir_pre_cmd = list() - - bcm_port_name = self.get_bcm_port_name(port) - lane_count = self.get_lane_count(port) - for lane_id in range(lane_count): - bcm_hw_lane = self.get_bcm_lane_info(port, lane_id) - value = self.get_preemphasis_value(port, bcm_hw_lane, - preemphasis_dict, - txfir_pre_idx) - txfir_pre_str_p1 = "phy " + bcm_port_name + " CL93N72_UT_CTL2r." - txfir_pre_str_p2 = txfir_pre_str_p1 + str(bcm_hw_lane) - txfir_pre_str_p3 = txfir_pre_str_p2 + " CL93N72_TXFIR_PRE" - txfir_pre_cmd_str = txfir_pre_str_p3 + "=" + hex(value) - txfir_pre_cmd.append(txfir_pre_cmd_str) - - return txfir_pre_cmd - - # For the Given port and eeprom_dict, configure - # the preemphasis settings. This invokes the bcmcmd and configures - # the preemphasis settings for each lane in all the ports - def preemphasis_set(self, port, eeprom_dict): - preemphasis_dict = self.get_preemphasis_db(port, eeprom_dict) - lane_count = self.get_lane_count(port) - - ams_cmd = self.form_bcm_phy_ams_cmd(port, preemphasis_dict) - txfir_pre_cmd = self.form_bcm_phy_txfir_pre_cmd(port, - preemphasis_dict) - txfir_post_cmd = self.form_bcm_phy_txfir_post_cmd(port, - preemphasis_dict) - txfir_main_cmd = self.form_bcm_phy_txfir_main_cmd(port, - preemphasis_dict) - for lane_id in range(lane_count): - self.bcm_shell.execute_command(ams_cmd[lane_id]) - self.bcm_shell.execute_command(txfir_pre_cmd[lane_id]) - self.bcm_shell.execute_command(txfir_post_cmd[lane_id]) - self.bcm_shell.execute_command(txfir_main_cmd[lane_id]) - - return 0 - - # Loop through all the ports, read the eeprom and configure - # PreEmphasis Values based on eeprom data - def run(self): - self.bcm_shell.bcm_port_mapping - - for logical_port in self.bcm_shell.bcm_port_mapping: - eeprom_dict = get_eeprom_info_dict(logical_port) - ret_val = self.preemphasis_set(logical_port, eeprom_dict) - - -# ============================= Functions ============================= -# Populate Eeprom Info Dict -# Based on the existing sfputil infra -def get_eeprom_info_dict(logical_port_name): - eeprom_info_dict = {} - phy_port_list = logical_port_name_to_physical_port_list(logical_port_name) - - for physical_port in phy_port_list: - if not platform_sfputil.get_presence(physical_port): - return eeprom_info_dict - eeprom_dict = platform_sfputil.get_eeprom_dict(physical_port) - - # Only print detected sfp ports for oneline - if eeprom_dict is not None: - eeprom_iface_dict = eeprom_dict.get('interface') - eeprom_info_dict = eeprom_iface_dict.get('data') - - return eeprom_info_dict - - -# Returns platform and HW SKU -def get_platform_and_hwsku(): - try: - proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-H', '-v', PLATFORM_KEY], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - platform = stdout.rstrip('\n') - - proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-d', '-v', HWSKU_KEY], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - hwsku = stdout.rstrip('\n') - except OSError, e: - raise OSError("Cannot detect platform") - - return (platform, hwsku) - - -def logical_port_name_to_physical_port_list(port_name): - if port_name.startswith("Ethernet"): - if platform_sfputil.is_logical_port(port_name): - return platform_sfputil.get_logical_to_physical(port_name) - else: - print "Error: Invalid port '%s'" % port_name - return None - else: - return [int(port_name)] - - -# Returns path to port config file -def get_path_to_port_config_file(): - # Get platform and hwsku - (platform, hwsku) = get_platform_and_hwsku() - - # Load platform module from source - platform_path = "/".join([PLATFORM_ROOT_PATH, platform]) - hwsku_path = "/".join([platform_path, hwsku]) - - # First check for the presence of the new 'port_config.ini' file - port_config_file_path = "/".join([hwsku_path, "port_config.ini"]) - if not os.path.isfile(port_config_file_path): - # port_config.ini doesn't exist. - # Try loading the legacy 'portmap.ini' file - port_config_file_path = "/".join([hwsku_path, "portmap.ini"]) - - return port_config_file_path - - -# Wait for bcmshell to be running -def check_bcm_shell_status(): - while (1): - # Check if bcmshell is ready. - # Execute ps command, - # If bcmShell is not ready it raises exception - # Wait till bcmcmd returns success - cmd = "bcmcmd ps" - try: - result = subprocess.check_output(cmd, shell=True) - return 0 - except subprocess.CalledProcessError as e: - log_info("Waiting for bcmShell to get ready !!!") - time.sleep(MINIMUM_WAIT_FOR_BCM_SHELL) - continue - return 0 - - -# Wait for syncd to be running -def check_swss_sycnd_status(): - redis_db_cnt = 0 - while (1): - # Check if syncd starts and redisDb populated - # Wait till redis Db return valid output - cmd_p1 = "docker exec -i swss bash -c " - cmd_p2 = cmd_p1 + "\"echo -en \\\"SELECT 1\\\\nHLEN HIDDEN\\\" | " - cmd = cmd_p2 + "redis-cli | sed -n 2p\"" - try: - result = subprocess.check_output(cmd, shell=True) - except subprocess.CalledProcessError as e: - # Wait till swss is spawned - log_info("Waiting for swss to spawn !!!") - time.sleep(MINIMUM_WAIT_FOR_SWSS_SYNCD) - continue - if (result.rstrip() == "5"): - # Check if bcm_shell server,client is ready - ret = check_bcm_shell_status() - return ret - else: - if (redis_db_cnt == MINIMUM_RETRY_FOR_SWSS_DB): - log_error("Fail : RedisDb in swss not populated") - sys.exit(2) - - # Wait till redisDb is populated - log_info("Waiting for redisDb to be populated !!!") - time.sleep(MINIMUM_WAIT_FOR_SWSS_SYNCD) - redis_db_cnt = redis_db_cnt + 1 - return 0 - - -# Loads platform specific sfputil module from source -def load_platform_sfputil(): - global platform_sfputil - - # Get platform and hwsku - (platform, hwsku) = get_platform_and_hwsku() - - # Load platform module from source - platform_path = "/".join([PLATFORM_ROOT_PATH, platform]) - hwsku_path = "/".join([platform_path, hwsku]) - - try: - module_file = "/".join([platform_path, "plugins", - PLATFORM_SPECIFIC_MODULE_NAME + ".py"]) - module = imp.load_source(PLATFORM_SPECIFIC_MODULE_NAME, module_file) - except IOError, e: - log_error("Failed to load platform module '%s': %s" % - (PLATFORM_SPECIFIC_MODULE_NAME, str(e)), True) - return -1 - - try: - platform_sfputil_class = getattr(module, PLATFORM_SPECIFIC_CLASS_NAME) - platform_sfputil = platform_sfputil_class() - except AttributeError, e: - log_error("Failed to instantiate '%s' class: %s" % - (PLATFORM_SPECIFIC_CLASS_NAME, str(e)), True) - return -2 - - return 0 - - -def main(): - log_info("Starting up...") - - if not os.geteuid() == 0: - log_error("Must be root to run this daemon") - print "Error: Must be root to run this daemon" - sys.exit(1) - - # Register our signal handlers - signal.signal(signal.SIGHUP, signal_handler) - signal.signal(signal.SIGINT, signal_handler) - signal.signal(signal.SIGTERM, signal_handler) - - # Default Wait Time till SWSS spawns - time.sleep(DEFAULT_WAIT_FOR_SWSS_SYNCD) - - err = check_swss_sycnd_status() - if (err != 0): - log_error("Error timeout for swss service spawn") - sys.exit(3) - - # Use the existing sfputil infra to read the eeprom data of inserted Qsfps - err = load_platform_sfputil() - if (err != 0): - sys.exit(2) - - # Load port info - try: - port_config_file_path = get_path_to_port_config_file() - platform_sfputil.read_porttab_mappings(port_config_file_path) - except Exception, e: - log_error("Error reading port info (%s)" % str(e), True) - sys.exit(3) - - # Instantiate Dell QSFP Monitor object - dell_qsfpd = dell_qsfp_monitor() - dell_qsfpd.run() - - log_info("QSFP Monitor Completed Successfully...") - - -if __name__ == "__main__": - main() diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-qsfp-monitor.service b/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-qsfp-monitor.service deleted file mode 100644 index 59543a53e81e..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-qsfp-monitor.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Dell Z9100 Qsfp Monitor -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/qsfp_monitor start -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target From 4f35cce27bc37debab433db6ce92728f077b17b4 Mon Sep 17 00:00:00 2001 From: Andriy Kokhan <43479230+akokhan@users.noreply.github.com> Date: Sat, 22 Jun 2019 14:50:14 -0700 Subject: [PATCH 27/37] [bfn] added TNA config for all devices (#3029) Signed-off-by: Andriy Kokhan --- .../Arista-7170-64C/switch-tna-sai.conf | 39 ++++++++++++++++++ .../Arista-7170-Q59S20/switch-tna-sai.conf | 39 ++++++++++++++++++ .../INGRASYS-S9180-32X/switch-tna-sai.conf | 40 +++++++++++++++++++ .../INGRASYS-S9280-64X/switch-tna-sai.conf | 40 +++++++++++++++++++ .../OSW1800-48x6q/switch-tna-sai.conf | 40 +++++++++++++++++++ 5 files changed, 198 insertions(+) create mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf create mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf new file mode 100644 index 000000000000..2a2270767d87 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf @@ -0,0 +1,39 @@ +{ + "instance": 0, + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "p4_devices": [ + { + "device-id": 0, + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/tofinopd/switch/pipe/tofino.bin", + "context": "share/tofinopd/switch/pipe/context.json" + } + ], + "program-name": "switch", + "switchsai": "lib/libswitchsai.so", + "bfrt-config": "share/tofinopd/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ] +} diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf new file mode 100644 index 000000000000..2a2270767d87 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf @@ -0,0 +1,39 @@ +{ + "instance": 0, + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "p4_devices": [ + { + "device-id": 0, + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/tofinopd/switch/pipe/tofino.bin", + "context": "share/tofinopd/switch/pipe/context.json" + } + ], + "program-name": "switch", + "switchsai": "lib/libswitchsai.so", + "bfrt-config": "share/tofinopd/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ] +} diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf new file mode 100644 index 000000000000..6ad356614a0b --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf @@ -0,0 +1,40 @@ +{ + "instance": 0, + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "p4_devices": [ + { + "device-id": 0, + "agent0": "lib/platform/x86_64-ingrasys_s9180_32x-r0/libpltfm_mgr.so", + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/tofinopd/switch/pipe/tofino.bin", + "context": "share/tofinopd/switch/pipe/context.json" + } + ], + "program-name": "switch", + "switchsai": "lib/libswitchsai.so", + "bfrt-config": "share/tofinopd/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ] +} diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf new file mode 100644 index 000000000000..36f2ca83df73 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf @@ -0,0 +1,40 @@ +{ + "instance": 0, + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "p4_devices": [ + { + "device-id": 0, + "agent0": "lib/platform/x86_64-ingrasys_s9280_64x-r0/libpltfm_mgr.so", + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/tofinopd/switch/pipe/tofino.bin", + "context": "share/tofinopd/switch/pipe/context.json" + } + ], + "program-name": "switch", + "switchsai": "lib/libswitchsai.so", + "bfrt-config": "share/tofinopd/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ] +} diff --git a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf new file mode 100644 index 000000000000..4bff0a177b60 --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf @@ -0,0 +1,40 @@ +{ + "instance": 0, + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "p4_devices": [ + { + "device-id": 0, + "agent0": "lib/platform/x86_64-wnc_osw1800-r0/libpltfm_mgr.so", + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/tofinopd/switch/pipe/tofino.bin", + "context": "share/tofinopd/switch/pipe/context.json" + } + ], + "program-name": "switch", + "switchsai": "lib/libswitchsai.so", + "bfrt-config": "share/tofinopd/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ] +} From 622c426a84ea97764094a3003de87f41668a5f0c Mon Sep 17 00:00:00 2001 From: paavaanan Date: Sun, 23 Jun 2019 05:45:22 +0530 Subject: [PATCH 28/37] [devices]: DellEMC Z9264f remove 115200 baud-ratesupport (#3046) --- device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf index 925a32fc0c3a..924e0fb81963 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf @@ -1,3 +1,2 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -CONSOLE_SPEED=115200 From 34e790bfce0e86b6ff96cc589e43e8644b9b53dc Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Sun, 23 Jun 2019 03:40:26 +0300 Subject: [PATCH 29/37] [swss] update swss pointer (#3055) to include update in mellanox PFCWD lua script matching new SAI sonic-swss: 407d048 [mellanox] convert logic to use quanta in pfc_detect_mellanox.lua (#930) 67c0940 [test]: Skip test_clear in test_watermark (#937) c72c34f Enable Vnet/Vxlan VS test (#935) 4c771d0 add incCrmAclUsedCounter and decCrmAclUsedCounter for SAI_ACL_BIND_POINT_TYPE_SWITCH case. (#899) 825c0cb [vs]: Fix bitmap VNET virtual switch test (#936) 4577b40 Add buffer pool watermark support (#853) 4a67378 Add support of VXLAN tunnel removal (#931) Signed-off-by: Stepan Blyschak --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 7a1a97c8b4d9..407d04835c5f 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 7a1a97c8b4d9ada359b201f55fad0aa49771d3e6 +Subproject commit 407d04835c5f6d01637fa0f7791fa626a317ae84 From 93582c7af9ce14f705713c4c6bb2bf0edb87f608 Mon Sep 17 00:00:00 2001 From: brandonchuang Date: Mon, 24 Jun 2019 02:54:27 +0800 Subject: [PATCH 30/37] [devices]: Add lpmode in sfputil.py for Accton AS7726-32X (#3040) Signed-off-by: brandon_chuang --- .../plugins/sfputil.py | 64 +++++++++++++++++-- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/device/accton/x86_64-accton_as7726_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7726_32x-r0/plugins/sfputil.py index 63506d3abaec..5eb4d77ee4d0 100755 --- a/device/accton/x86_64-accton_as7726_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7726_32x-r0/plugins/sfputil.py @@ -5,6 +5,8 @@ try: import time + import string + from ctypes import create_string_buffer from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -110,11 +112,63 @@ def get_presence(self, port_num): return False - def get_low_power_mode(self, port_num): - raise NotImplementedError - - def set_low_power_mode(self, port_num, lpmode): - raise NotImplementedError + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + eeprom = None + + if not self.get_presence(port_num): + return False + + eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") + eeprom.seek(93) + lpmode = ord(eeprom.read(1)) + + if ((lpmode & 0x3) == 0x3): + return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 + else: + return False # High Power Mode if one of the following conditions is matched: + # 1. "Power override" bit is 0 + # 2. "Power override" bit is 1 and "Power set" bit is 0 + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + eeprom = None + + if not self.get_presence(port_num): + return False # Port is not present, unable to set the eeprom + + # Fill in write buffer + regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode + buffer = create_string_buffer(1) + buffer[0] = chr(regval) + + # Write to eeprom + eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") + eeprom.seek(93) + eeprom.write(buffer[0]) + return True + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) def reset(self, port_num): if port_num < self.port_start or port_num > self.port_end: From dd0f005b8a97f66144de29a2da2c2256d24b03f7 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Sun, 23 Jun 2019 15:26:02 -0700 Subject: [PATCH 31/37] [FRR]: Port some patches from sonic-quagga repo (#3017) * Update sonic-quagga submodule * Port some patches from sonic-quagga * Fix Makefile * Another patch * Uncomment bgp test * Downport Nikos's patch * Add a patch to alleviate the vendor issue * use patch instead of stg --- platform/vs/tests/bgp/test_invalid_nexthop.py | 1 - src/sonic-frr/Makefile | 4 + ...01-Add-support-of-bgp-tcp-DSCP-value.patch | 141 ++++++++++++++++ ...verity-of-Vty-connected-from-message.patch | 25 +++ ...xthop-attribute-when-NLRI-is-present.patch | 156 ++++++++++++++++++ ...EXT_HOP-to-be-0.0.0.0-due-to-allevia.patch | 27 +++ src/sonic-frr/patch/series | 4 + 7 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch create mode 100644 src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch create mode 100644 src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch create mode 100644 src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch create mode 100644 src/sonic-frr/patch/series diff --git a/platform/vs/tests/bgp/test_invalid_nexthop.py b/platform/vs/tests/bgp/test_invalid_nexthop.py index 9458ecdeee5c..021e3bfea002 100644 --- a/platform/vs/tests/bgp/test_invalid_nexthop.py +++ b/platform/vs/tests/bgp/test_invalid_nexthop.py @@ -5,7 +5,6 @@ import json import pytest -@pytest.mark.skip(reason="not working for frr") def test_InvalidNexthop(dvs, testlog): dvs.copy_file("/etc/frr/", "bgp/files/invalid_nexthop/bgpd.conf") diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index 5ba70addf17e..0d68706a8977 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -8,6 +8,10 @@ DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG) $(FRR_SNMP) $(FRR_SNMP_DBG) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package pushd ./frr + patch -p1 < ../patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch + patch -p1 < ../patch/0002-Reduce-severity-of-Vty-connected-from-message.patch + patch -p1 < ../patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch + patch -p1 < ../patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch tools/tarsource.sh -V -e '-sonic' dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS) popd diff --git a/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch b/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch new file mode 100644 index 000000000000..e9f496d7af62 --- /dev/null +++ b/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch @@ -0,0 +1,141 @@ +From ef017a613691a40f32cdaa5396bbd4889b1cb647 Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Fri, 14 Jun 2019 17:45:31 -0700 +Subject: [PATCH] Add support of bgp tcp DSCP value + +--- + bgpd/bgp_network.c | 11 ++++------- + bgpd/bgp_vty.c | 40 ++++++++++++++++++++++++++++++++++++++++ + bgpd/bgpd.c | 5 ++++- + bgpd/bgpd.h | 3 +++ + 4 files changed, 51 insertions(+), 8 deletions(-) + +diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c +index 4153da5a6..fed133eb7 100644 +--- a/bgpd/bgp_network.c ++++ b/bgpd/bgp_network.c +@@ -569,11 +569,9 @@ int bgp_connect(struct peer *peer) + #ifdef IPTOS_PREC_INTERNETCONTROL + frr_elevate_privs(&bgpd_privs) { + if (sockunion_family(&peer->su) == AF_INET) +- setsockopt_ipv4_tos(peer->fd, +- IPTOS_PREC_INTERNETCONTROL); ++ setsockopt_ipv4_tos(peer->fd, peer->bgp->tcp_dscp); + else if (sockunion_family(&peer->su) == AF_INET6) +- setsockopt_ipv6_tclass(peer->fd, +- IPTOS_PREC_INTERNETCONTROL); ++ setsockopt_ipv6_tclass(peer->fd, peer->bgp->tcp_dscp); + } + #endif + +@@ -643,10 +641,9 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, + + #ifdef IPTOS_PREC_INTERNETCONTROL + if (sa->sa_family == AF_INET) +- setsockopt_ipv4_tos(sock, IPTOS_PREC_INTERNETCONTROL); ++ setsockopt_ipv4_tos(sock, bgp->tcp_dscp); + else if (sa->sa_family == AF_INET6) +- setsockopt_ipv6_tclass(sock, +- IPTOS_PREC_INTERNETCONTROL); ++ setsockopt_ipv6_tclass(sock, bgp->tcp_dscp); + #endif + + sockopt_v6only(sa->sa_family, sock); +diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c +index 7445df883..f91b908a4 100644 +--- a/bgpd/bgp_vty.c ++++ b/bgpd/bgp_vty.c +@@ -1113,6 +1113,42 @@ DEFUN (no_router_bgp, + return CMD_SUCCESS; + } + ++/* bgp session-dscp */ ++ ++DEFUN (bgp_session_dscp, ++ bgp_session_dscp_cmd, ++ "bgp session-dscp DSCP", ++ BGP_STR ++ "Override default (C0) bgp TCP session DSCP value\n" ++ "Manually configured dscp parameter\n") ++{ ++ struct bgp *bgp = VTY_GET_CONTEXT(bgp); ++ ++ uint8_t value = (uint8_t)strtol(argv[2]->arg, NULL, 16); ++ if ((value == 0 && errno == EINVAL) || (value > 0x3f)) ++ { ++ vty_out (vty, "%% Malformed bgp session-dscp parameter\n"); ++ return CMD_WARNING_CONFIG_FAILED; ++ } ++ ++ bgp->tcp_dscp = value << 2; ++ ++ return CMD_SUCCESS; ++} ++ ++DEFUN (no_bgp_session_dscp, ++ no_bgp_session_dscp_cmd, ++ "no bgp session-dscp", ++ NO_STR ++ BGP_STR ++ "Override default (C0) bgp tcp session ip dscp value\n") ++{ ++ struct bgp *bgp = VTY_GET_CONTEXT(bgp); ++ ++ bgp->tcp_dscp = IPTOS_PREC_INTERNETCONTROL; ++ ++ return CMD_SUCCESS; ++} + + /* BGP router-id. */ + +@@ -12798,6 +12834,10 @@ void bgp_vty_init(void) + /* "no router bgp" commands. */ + install_element(CONFIG_NODE, &no_router_bgp_cmd); + ++ /* "bgp session-dscp command */ ++ install_element (BGP_NODE, &bgp_session_dscp_cmd); ++ install_element (BGP_NODE, &no_bgp_session_dscp_cmd); ++ + /* "bgp router-id" commands. */ + install_element(BGP_NODE, &bgp_router_id_cmd); + install_element(BGP_NODE, &no_bgp_router_id_cmd); +diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c +index 6fb3a70c7..503e6b4ed 100644 +--- a/bgpd/bgpd.c ++++ b/bgpd/bgpd.c +@@ -2995,7 +2995,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, + + bgp->evpn_info = XCALLOC(MTYPE_BGP_EVPN_INFO, + sizeof(struct bgp_evpn_info)); +- ++ bgp->tcp_dscp = IPTOS_PREC_INTERNETCONTROL; + bgp_evpn_init(bgp); + bgp_pbr_init(bgp); + return bgp; +@@ -7516,6 +7516,9 @@ int bgp_config_write(struct vty *vty) + if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) + vty_out(vty, " no bgp fast-external-failover\n"); + ++ if (bgp->tcp_dscp != IPTOS_PREC_INTERNETCONTROL) ++ vty_out(vty, " bgp session-dscp %02X\n", bgp->tcp_dscp >> 2); ++ + /* BGP router ID. */ + if (bgp->router_id_static.s_addr != 0) + vty_out(vty, " bgp router-id %s\n", +diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h +index df3fde840..a6546457c 100644 +--- a/bgpd/bgpd.h ++++ b/bgpd/bgpd.h +@@ -553,6 +553,9 @@ struct bgp { + /* Count of peers in established state */ + uint32_t established_peers; + ++ /* dscp value for tcp sessions */ ++ uint8_t tcp_dscp; ++ + QOBJ_FIELDS + }; + DECLARE_QOBJ_TYPE(bgp) +-- +2.17.1.windows.2 + diff --git a/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch b/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch new file mode 100644 index 000000000000..ae2b3ba91223 --- /dev/null +++ b/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch @@ -0,0 +1,25 @@ +From 87760a6a04d6ffbcc7a1093549bfb76656002b61 Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Fri, 14 Jun 2019 17:48:50 -0700 +Subject: [PATCH] Reduce severity of 'Vty connected from' message + +--- + lib/vty.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/vty.c b/lib/vty.c +index 8450922c2..f159d1b4b 100644 +--- a/lib/vty.c ++++ b/lib/vty.c +@@ -1875,7 +1875,7 @@ static int vty_accept(struct thread *thread) + zlog_info("can't set sockopt to vty_sock : %s", + safe_strerror(errno)); + +- zlog_info("Vty connection from %s", ++ zlog_debug("Vty connection from %s", + sockunion2str(&su, buf, SU_ADDRSTRLEN)); + + vty_create(vty_sock, &su); +-- +2.17.1.windows.2 + diff --git a/src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch b/src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch new file mode 100644 index 000000000000..5d55ce547fd1 --- /dev/null +++ b/src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch @@ -0,0 +1,156 @@ +From 7c31178d8f1b8cc3a9627dc7c7bd1d2a51fe54ce Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Tue, 18 Jun 2019 15:27:19 -0700 +Subject: [PATCH] ignore nexthop attribute when NLRI is present + +Backport of https://github.com/FRRouting/frr/pull/4258 +--- + bgpd/bgp_attr.c | 73 ++++++++++++++++++++++++++++++----------------- + bgpd/bgp_attr.h | 3 ++ + bgpd/bgp_packet.c | 11 +++++++ + 3 files changed, 61 insertions(+), 26 deletions(-) + +diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c +index 05e103142..ea7f761ab 100644 +--- a/bgpd/bgp_attr.c ++++ b/bgpd/bgp_attr.c +@@ -1257,6 +1257,32 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args, + return BGP_ATTR_PARSE_PROCEED; + } + ++/* ++ * Check that the nexthop attribute is valid. ++ */ ++bgp_attr_parse_ret_t ++bgp_attr_nexthop_valid(struct peer *peer, struct attr *attr) ++{ ++ in_addr_t nexthop_h; ++ ++ nexthop_h = ntohl(attr->nexthop.s_addr); ++ if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h) ++ || IPV4_CLASS_DE(nexthop_h)) ++ && !BGP_DEBUG(allow_martians, ALLOW_MARTIANS)) { ++ char buf[INET_ADDRSTRLEN]; ++ ++ inet_ntop(AF_INET, &attr->nexthop.s_addr, buf, ++ INET_ADDRSTRLEN); ++ flog_err(EC_BGP_ATTR_MARTIAN_NH, "Martian nexthop %s", ++ buf); ++ bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, ++ BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP); ++ return BGP_ATTR_PARSE_ERROR; ++ } ++ ++ return BGP_ATTR_PARSE_PROCEED; ++} ++ + /* Nexthop attribute. */ + static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) + { +@@ -1264,8 +1290,6 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) + struct attr *const attr = args->attr; + const bgp_size_t length = args->length; + +- in_addr_t nexthop_h, nexthop_n; +- + /* Check nexthop attribute length. */ + if (length != 4) { + flog_err(EC_BGP_ATTR_LEN, +@@ -1275,30 +1299,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) + args->total); + } + +- /* According to section 6.3 of RFC4271, syntactically incorrect NEXT_HOP +- attribute must result in a NOTIFICATION message (this is implemented +- below). +- At the same time, semantically incorrect NEXT_HOP is more likely to +- be just +- logged locally (this is implemented somewhere else). The UPDATE +- message +- gets ignored in any of these cases. */ +- nexthop_n = stream_get_ipv4(peer->curr); +- nexthop_h = ntohl(nexthop_n); +- if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h) +- || IPV4_CLASS_DE(nexthop_h)) +- && !BGP_DEBUG( +- allow_martians, +- ALLOW_MARTIANS)) /* loopbacks may be used in testing */ +- { +- char buf[INET_ADDRSTRLEN]; +- inet_ntop(AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN); +- flog_err(EC_BGP_ATTR_MARTIAN_NH, "Martian nexthop %s", buf); +- return bgp_attr_malformed( +- args, BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, args->total); +- } +- +- attr->nexthop.s_addr = nexthop_n; ++ attr->nexthop.s_addr = stream_get_ipv4(peer->curr); + attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); + + return BGP_ATTR_PARSE_PROCEED; +@@ -2669,6 +2670,26 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, + return BGP_ATTR_PARSE_ERROR; + } + ++ /* ++ * RFC4271: If the NEXT_HOP attribute field is syntactically incorrect, ++ * then the Error Subcode MUST be set to Invalid NEXT_HOP Attribute. ++ * This is implemented below and will result in a NOTIFICATION. If the ++ * NEXT_HOP attribute is semantically incorrect, the error SHOULD be ++ * logged, and the route SHOULD be ignored. In this case, a NOTIFICATION ++ * message SHOULD NOT be sent. This is implemented elsewhere. ++ * ++ * RFC4760: An UPDATE message that carries no NLRI, other than the one ++ * encoded in the MP_REACH_NLRI attribute, SHOULD NOT carry the NEXT_HOP ++ * attribute. If such a message contains the NEXT_HOP attribute, the BGP ++ * speaker that receives the message SHOULD ignore this attribute. ++ */ ++ if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) ++ && !CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_MP_REACH_NLRI))) { ++ if (bgp_attr_nexthop_valid(peer, attr) < 0) { ++ return BGP_ATTR_PARSE_ERROR; ++ } ++ } ++ + /* Check all mandatory well-known attributes are present */ + if ((ret = bgp_attr_check(peer, attr)) < 0) { + if (as4_path) +diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h +index 47a4182fe..a86684583 100644 +--- a/bgpd/bgp_attr.h ++++ b/bgpd/bgp_attr.h +@@ -350,6 +350,9 @@ extern void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p, + uint32_t, int, uint32_t, struct attr *); + extern void bgp_packet_mpunreach_end(struct stream *s, size_t attrlen_pnt); + ++extern bgp_attr_parse_ret_t bgp_attr_nexthop_valid(struct peer *peer, ++ struct attr *attr); ++ + static inline int bgp_rmap_nhop_changed(uint32_t out_rmap_flags, + uint32_t in_rmap_flags) + { +diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c +index fe8a1a256..13f4cf436 100644 +--- a/bgpd/bgp_packet.c ++++ b/bgpd/bgp_packet.c +@@ -1533,6 +1533,17 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) + nlris[NLRI_UPDATE].nlri = stream_pnt(s); + nlris[NLRI_UPDATE].length = update_len; + stream_forward_getp(s, update_len); ++ ++ if (CHECK_FLAG(attr.flag, ATTR_FLAG_BIT(BGP_ATTR_MP_REACH_NLRI))) { ++ /* ++ * We skipped nexthop attribute validation earlier so ++ * validate the nexthop now. ++ */ ++ if (bgp_attr_nexthop_valid(peer, &attr) < 0) { ++ bgp_attr_unintern_sub(&attr); ++ return BGP_Stop; ++ } ++ } + } + + if (BGP_DEBUG(update, UPDATE_IN)) +-- +2.17.1.windows.2 + diff --git a/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch b/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch new file mode 100644 index 000000000000..22cf08b82cd4 --- /dev/null +++ b/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch @@ -0,0 +1,27 @@ +From 4cd83e56e4f67fdc06325d92a82534fb4cb69952 Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Thu, 20 Jun 2019 15:35:50 -0700 +Subject: [PATCH] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to alleviate the + vendor bug + +--- + bgpd/bgp_route.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c +index 38f3cad5a..55240eab8 100644 +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -2873,8 +2873,7 @@ static int bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, + + /* If NEXT_HOP is present, validate it. */ + if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { +- if (attr->nexthop.s_addr == 0 +- || IPV4_CLASS_DE(ntohl(attr->nexthop.s_addr)) ++ if (IPV4_CLASS_DE(ntohl(attr->nexthop.s_addr)) + || bgp_nexthop_self(bgp, attr->nexthop)) + return 1; + } +-- +2.17.1.windows.2 + diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series new file mode 100644 index 000000000000..05df330b9bae --- /dev/null +++ b/src/sonic-frr/patch/series @@ -0,0 +1,4 @@ +0001-Add-support-of-bgp-tcp-DSCP-value.patch +0002-Reduce-severity-of-Vty-connected-from-message.patch +0003-ignore-nexthop-attribute-when-NLRI-is-present.patch +0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch From 2e40fa5dbe43201b282531eba151ea083dbe53da Mon Sep 17 00:00:00 2001 From: "Sudharsan D.G" Date: Mon, 24 Jun 2019 08:13:40 -0700 Subject: [PATCH 32/37] [devices]: Poller to detect Intel Rangely LPC failure for dell z9100/s6100 (#3065) - What I did Added Daemon to Log LPC bus degradation in Intel C2000 processor. Intel Rangeley C2000 processors with revision less than or equal to 2 have issue where LPC bus degrades over time in some processors. To identify the problem and to notify the issue, a daemon has been added which will log on encountering the issue. - How I did it Added a daemon which validates the CPLD scratch(0x102) and SMF scratch(0x202) registers by writing and reading values on regular polling intervals (300 seconds). If there is a discrepancy between read and write, a critical log will be thrown. - How to verify it The infra is verify by simulating the issue where between write and read, the value in register is modified and the log appearance is checked. - Description for the changelog Added Daemon to identify LPC bus degradation issue and notify using syslog in Dell S6100 and Z9100 platforms. This daemon will only run on processors with revision less than or equal to 2. --- .../common/dell_lpc_mon.sh | 46 +++++++++++++++++++ .../debian/platform-modules-s6100.install | 2 + .../debian/platform-modules-s6100.postinst | 4 ++ .../debian/platform-modules-z9100.install | 2 + .../debian/platform-modules-z9100.postinst | 3 ++ .../s6100/systemd/s6100-lpc-monitor.service | 12 +++++ .../z9100/systemd/z9100-lpc-monitor.service | 12 +++++ 7 files changed, 81 insertions(+) create mode 100755 platform/broadcom/sonic-platform-modules-dell/common/dell_lpc_mon.sh create mode 100644 platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-lpc-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-lpc-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_lpc_mon.sh b/platform/broadcom/sonic-platform-modules-dell/common/dell_lpc_mon.sh new file mode 100755 index 000000000000..0f8d24a7f515 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_lpc_mon.sh @@ -0,0 +1,46 @@ +#!/bin/bash +REV=$(lspci -xxx -s 0:0.0 | grep rev | awk -F 'rev ' '{print $2}' | sed 's/)//') +if [ $REV -gt 2 ] +then + exit 0 +fi + +test_val=(55 aa) +num_val=${#test_val[@]} +index=0 +poll_interval=300 +cpld_scratch_reg=0x102 +smf_scratch_reg=0x202 + +function log_crit() { + local msg=$1 + + `logger -p user.crit -t DELL_LPC_BUS_MON $msg` +} + +function validate_lpc() { + local reg=$1 + local val=$2 + local reg_str="CPLD scratch register" + + if [ $reg == $smf_scratch_reg ] + then + reg_str="SMF scratch register" + fi + io_rd_wr.py --set --val $val --offset $reg + get_val=$(io_rd_wr.py --get --offset $reg | cut -d " " -f3) + if [ $val != $get_val ] + then + log_crit "LPC bus has deteriorated on this unit. \ + $reg_str has value $get_val while expected is $val \ + Please contact technical support" + fi +} +while true +do + val=${test_val[$index]} + validate_lpc $cpld_scratch_reg $val + validate_lpc $smf_scratch_reg $val + index=$(((index+1)%num_val)) + sleep $poll_interval +done diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index eef7c106304b..7766db5c7ed4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -2,7 +2,9 @@ s6100/scripts/iom_power_*.sh usr/local/bin s6100/scripts/s6100_platform.sh usr/local/bin common/dell_i2c_utils.sh usr/local/bin common/io_rd_wr.py usr/local/bin +common/dell_lpc_mon.sh usr/local/bin common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_sensors.py usr/local/bin s6100/scripts/sensors usr/bin s6100/systemd/platform-modules-s6100.service etc/systemd/system +s6100/systemd/s6100-lpc-monitor.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst index 7a8abd7921a3..eda8f7c8a41a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst @@ -4,4 +4,8 @@ depmod -a systemctl enable platform-modules-s6100.service systemctl start platform-modules-s6100.service + +systemctl enable s6100-lpc-monitor.service +systemctl start s6100-lpc-monitor.service + #DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install index aa6cd7af7e5f..21fcb3dd0fdc 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -1,9 +1,11 @@ z9100/scripts/check_qsfp.sh usr/local/bin z9100/scripts/z9100_platform.sh usr/local/bin common/dell_i2c_utils.sh usr/local/bin +common/dell_lpc_mon.sh usr/local/bin common/io_rd_wr.py usr/local/bin common/platform_reboot usr/share/sonic/device/x86_64-dell_z9100_c2538-r0 z9100/scripts/platform_sensors.py usr/local/bin z9100/scripts/sensors usr/bin z9100/cfg/z9100-modules.conf etc/modules-load.d z9100/systemd/platform-modules-z9100.service etc/systemd/system +z9100/systemd/z9100-lpc-monitor.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst index 05983e16d4f7..77750fe626a4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst @@ -6,4 +6,7 @@ systemctl enable platform-modules-z9100.service systemctl start platform-modules-z9100.service +systemctl enable z9100-lpc-monitor.service +systemctl start z9100-lpc-monitor.service + #DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-lpc-monitor.service b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-lpc-monitor.service new file mode 100644 index 000000000000..86dac18a310e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-lpc-monitor.service @@ -0,0 +1,12 @@ +[Unit] +Description=Dell S6100 LPC bus monitoring poller +DefaultDependencies=no + +[Service] +User=root +ExecStart=/usr/local/bin/dell_lpc_mon.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-lpc-monitor.service b/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-lpc-monitor.service new file mode 100644 index 000000000000..136081a63f3e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/z9100-lpc-monitor.service @@ -0,0 +1,12 @@ +[Unit] +Description=Dell Z9100 LPC bus monitoring poller +DefaultDependencies=no + +[Service] +User=root +ExecStart=/usr/local/bin/dell_lpc_mon.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target + From 3f54b58a67befd6d8055768189d990b302e271ea Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Mon, 24 Jun 2019 23:14:27 +0800 Subject: [PATCH 33/37] [nephos]: update to support linux-kernel-4.9.0-9-2 (#3058) --- ...{nps-modules-4.9.0-8-2-amd64 => nps-modules-4.9.0-9-2-amd64} | 2 +- ....0-8-2-amd64.service => nps-modules-4.9.0-9-2-amd64.service} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename platform/nephos/nephos-modules/modules/init.d/{nps-modules-4.9.0-8-2-amd64 => nps-modules-4.9.0-9-2-amd64} (97%) rename platform/nephos/nephos-modules/modules/service/{nps-modules-4.9.0-8-2-amd64.service => nps-modules-4.9.0-9-2-amd64.service} (100%) diff --git a/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 b/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-9-2-amd64 similarity index 97% rename from platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 rename to platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-9-2-amd64 index 470f18f7c526..366ca6b08456 100755 --- a/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-8-2-amd64 +++ b/platform/nephos/nephos-modules/modules/init.d/nps-modules-4.9.0-9-2-amd64 @@ -25,7 +25,7 @@ start) echo "25165824" > /proc/sys/net/core/wmem_max fi - modprobe nps_dev + modprobe nps_dev modprobe nps_netif echo "done." diff --git a/platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-8-2-amd64.service b/platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-9-2-amd64.service similarity index 100% rename from platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-8-2-amd64.service rename to platform/nephos/nephos-modules/modules/service/nps-modules-4.9.0-9-2-amd64.service From 9a1bebe4965185ad1070cac5ebb5c2ec44b9375f Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Mon, 24 Jun 2019 12:36:16 -0700 Subject: [PATCH 34/37] [telemetry]: change the service dependency from swss to database (#3072) Signed-off-by: Jipan Yang --- files/build_templates/telemetry.service.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 index d6f70a13206e..8781ce7afb47 100644 --- a/files/build_templates/telemetry.service.j2 +++ b/files/build_templates/telemetry.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=Telemetry container -Requires=swss.service -After=swss.service +Requires=database.service +After=database.service Before=ntp-config.service [Service] From 331866dbe3f4af4716f81adda152b5ed9b1a1dbf Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 25 Jun 2019 13:56:35 +0800 Subject: [PATCH 35/37] [sonic-cfggen] Add Mellanox platform specific code to read base mac from machine.conf (#2991) * add code to read base mac from machine.conf * rewording the comments * add mac validation with re * fix review comments * remove empty line --- src/sonic-config-engine/sonic_device_util.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/sonic-config-engine/sonic_device_util.py b/src/sonic-config-engine/sonic_device_util.py index ac03ca818df1..f9c200eebd93 100644 --- a/src/sonic-config-engine/sonic_device_util.py +++ b/src/sonic-config-engine/sonic_device_util.py @@ -2,6 +2,7 @@ import os import yaml import subprocess +import re DOCUMENTATION = ''' --- @@ -44,10 +45,26 @@ def get_sonic_version_info(): data = yaml.load(stream) return data +def valid_mac_address(mac): + return bool(re.match("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", mac)) + def get_system_mac(): version_info = get_sonic_version_info() if (version_info['asic_type'] == 'mellanox'): + # With Mellanox ONIE release(2019.05-5.2.0012) and above + # "onie_base_mac" was added to /host/machine.conf: + # onie_base_mac=e4:1d:2d:44:5e:80 + # So we have another way to get the mac address besides decode syseeprom + # By this can mitigate the dependency on the hw-management service + base_mac_key = "onie_base_mac" + machine_vars = get_machine_info() + if machine_vars is not None and base_mac_key in machine_vars: + mac = machine_vars[base_mac_key] + mac = mac.strip() + if valid_mac_address(mac): + return mac + get_mac_cmd = "sudo decode-syseeprom -m" else: get_mac_cmd = "ip link show eth0 | grep ether | awk '{print $2}'" @@ -59,6 +76,9 @@ def get_system_mac(): mac = mac.strip() + if not valid_mac_address(mac): + return None + # Align last byte of MAC if necessary if version_info and version_info['asic_type'] == 'centec': last_byte = mac[-2:] From 94b3c362f8e68190e6faac8d8ebe8905c4e744e4 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Wed, 26 Jun 2019 02:22:13 +0700 Subject: [PATCH 36/37] [device/celestica] Implement PSU APIs based on the new platform API (#2874) --- .../sonic_platform/chassis.py | 5 ++ .../x86_64-cel_e1031-r0/sonic_platform/psu.py | 61 +++++++++++++++ .../sonic_platform/chassis.py | 5 ++ .../sonic_platform/psu.py | 78 +++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py create mode 100644 device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py index 33fa88f8e700..4dee5ac87784 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py @@ -17,6 +17,7 @@ try: from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.fan import Fan + from sonic_platform.psu import Psu except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -26,6 +27,7 @@ SMC_CPLD_PATH = "/sys/devices/platform/e1031.smc/version" MMC_CPLD_PATH = "/sys/devices/platform/e1031.smc/getreg" NUM_FAN = 3 +NUM_PSU = 2 class Chassis(ChassisBase): @@ -36,6 +38,9 @@ def __init__(self): for index in range(0, NUM_FAN): fan = Fan(index) self._fan_list.append(fan) + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) ChassisBase.__init__(self) def __get_register_value(self, path, register): diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..8fd32fd64d86 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/psu.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path +import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_E1031_SPEED_PATH = "/sys/class/hwmon/hwmon{}/fan1_input" +FAN_MAX_RPM = 11000 + + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index): + PsuBase.__init__(self) + self.index = psu_index + + def get_fan(self): + """ + Retrieves object representing the fan module contained in this PSU + Returns: + An object dervied from FanBase representing the fan module + contained in this PSU + """ + fan_speed_path = FAN_E1031_SPEED_PATH.format( + str(self.index+3)) + try: + with open(fan_speed_path) as fan_speed_file: + fan_speed_rpm = int(fan_speed_file.read()) + except IOError: + fan_speed = 0 + + fan_speed = float(fan_speed_rpm)/FAN_MAX_RPM * 100 + fan = Fan(0) + fan.fan_speed = int(fan_speed) if int(fan_speed) <= 100 else 100 + return fan + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + # Hardware not supported + return False diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py index 1d2e9af3757b..e7c62e372b34 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py @@ -17,6 +17,7 @@ try: from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.fan import Fan + from sonic_platform.psu import Psu except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -24,6 +25,7 @@ GETREG_PATH = "/sys/devices/platform/dx010_cpld/getreg" CONFIG_DB_PATH = "/etc/sonic/config_db.json" NUM_FAN = 5 +NUM_PSU = 2 CPLD_ADDR_MAPPING = { "CPLD1": "0x100", "CPLD2": "0x200", @@ -41,6 +43,9 @@ def __init__(self): for index in range(0, NUM_FAN): fan = Fan(index) self._fan_list.append(fan) + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) ChassisBase.__init__(self) def __get_register_value(self, path, register): diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..c70e45214475 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path +import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_DX010_SPEED_PATH = "/sys/class/hwmon/hwmon{}/fan1_input" +GREEN_LED_PATH = "/sys/devices/platform/leds_dx010/leds/dx010:green:p-{}/brightness" +FAN_MAX_RPM = 11000 + + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index): + PsuBase.__init__(self) + self.index = psu_index + self.green_led_path = GREEN_LED_PATH.format(self.index+1) + + def get_fan(self): + """ + Retrieves object representing the fan module contained in this PSU + Returns: + An object dervied from FanBase representing the fan module + contained in this PSU + """ + + fan_speed_path = FAN_DX010_SPEED_PATH.format( + str(self.index+8)) + try: + with open(fan_speed_path) as fan_speed_file: + fan_speed_rpm = int(fan_speed_file.read()) + except IOError: + fan_speed = 0 + + fan_speed = float(fan_speed_rpm)/FAN_MAX_RPM * 100 + fan = Fan(0) + fan.fan_speed = int(fan_speed) if int(fan_speed) <= 100 else 100 + return fan + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + set_status_str = { + self.STATUS_LED_COLOR_GREEN: '1', + self.STATUS_LED_COLOR_OFF: '0' + }.get(color, None) + + if not set_status_str: + return False + + try: + with open(self.green_led_path, 'w') as file: + file.write(set_status_str) + except IOError: + return False + + return True From b92d98076959db2cda2eeb96f89f7a4fd0b67b07 Mon Sep 17 00:00:00 2001 From: Karthik Gengan <50580882+gengankarthik@users.noreply.github.com> Date: Wed, 26 Jun 2019 00:53:24 +0530 Subject: [PATCH 37/37] Remapping S6000 platform files under Vendor (DellEmc) specific directory (#3079) --- platform/broadcom/platform-modules-dell.mk | 16 +++- platform/broadcom/platform-modules-s6000.mk | 13 --- platform/broadcom/rules.mk | 1 - .../debian/control | 6 +- .../debian/platform-modules-s6000.init | 0 .../debian/platform-modules-s6000.install | 2 + .../debian/platform-modules-s6000.postinst | 7 ++ .../sonic-platform-modules-dell/debian/rules | 6 +- .../s6000}/LICENSE | 0 .../s6000}/MAINTAINERS | 0 .../s6000}/README.md | 0 .../s6000}/modules/Makefile | 0 .../s6000}/modules/dell_s6000_platform.c | 0 .../s6000}/scripts/reset-qsfp | 0 .../s6000}/scripts/set-fan-speed | 0 .../systemd/platform-modules-s6000.service | 0 .../sonic-platform-modules-s6000/.gitignore | 50 ---------- .../debian/changelog | 5 - .../debian/compat | 1 - .../debian/control | 12 --- .../debian/copyright | 16 ---- .../debian/platform-modules-s6000.install | 2 - .../sonic-platform-modules-s6000/debian/rules | 32 ------- .../scripts/io_rd_wr.py | 93 ------------------- 24 files changed, 32 insertions(+), 230 deletions(-) delete mode 100644 platform/broadcom/platform-modules-s6000.mk rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell}/debian/platform-modules-s6000.init (100%) create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/LICENSE (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/MAINTAINERS (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/README.md (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/modules/Makefile (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/modules/dell_s6000_platform.c (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/scripts/reset-qsfp (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/scripts/set-fan-speed (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/systemd/platform-modules-s6000.service (100%) delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/.gitignore delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/changelog delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/compat delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/control delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/copyright delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install delete mode 100755 platform/broadcom/sonic-platform-modules-s6000/debian/rules delete mode 100755 platform/broadcom/sonic-platform-modules-s6000/scripts/io_rd_wr.py diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index a2d051ffd911..5c8032c8b436 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -1,26 +1,36 @@ -# Dell Z9100, S6100, Z9264F Platform modules +# Dell S6000, Z9100, S6100, Z9264F Platform modules -DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1 +DELL_S6000_PLATFORM_MODULE_VERSION = 1.1 DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1 DELL_S6100_PLATFORM_MODULE_VERSION = 1.1 +DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1 -export DELL_Z9264F_PLATFORM_MODULE_VERSION +export DELL_S6000_PLATFORM_MODULE_VERSION export DELL_Z9100_PLATFORM_MODULE_VERSION export DELL_S6100_PLATFORM_MODULE_VERSION +export DELL_Z9264F_PLATFORM_MODULE_VERSION + +# Dell Z9100 Platform modules DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell $(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(DELL_Z9100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_z9100_c2538-r0 SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) +# Dell S6100 Platform modules DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6100_PLATFORM_MODULE))) +# Dell Z9264F Platform modules DELL_Z9264F_PLATFORM_MODULE = platform-modules-z9264f_$(DELL_Z9264F_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_Z9264F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_z9264f_c3538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_Z9264F_PLATFORM_MODULE))) +# Dell S6000 Platform modules +DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 +$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6000_PLATFORM_MODULE))) SONIC_STRETCH_DEBS += $(DELL_Z9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-s6000.mk b/platform/broadcom/platform-modules-s6000.mk deleted file mode 100644 index 00cd2cadf2d3..000000000000 --- a/platform/broadcom/platform-modules-s6000.mk +++ /dev/null @@ -1,13 +0,0 @@ -# Dell S6000 Platform modules - -DELL_S6000_PLATFORM_MODULE_VERSION = 1.0 - -export DELL_S6000_PLATFORM_MODULE_VERSION - -DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb -$(DELL_S6000_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-s6000 -$(DELL_S6000_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -$(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 -SONIC_DPKG_DEBS += $(DELL_S6000_PLATFORM_MODULE) - -SONIC_STRETCH_DEBS += $(DELL_S6000_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index abedbbe1d656..02eb58df0ccb 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,6 +1,5 @@ include $(PLATFORM_PATH)/sai-modules.mk include $(PLATFORM_PATH)/sai.mk -include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control index c30a261fd9dc..cc24fa13cc62 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/control +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -5,7 +5,7 @@ Maintainer: Dell Team Build-Depends: debhelper (>= 8.0.0), bzip2 Standards-Version: 3.9.3 -Package: platform-modules-z9264f +Package: platform-modules-s6000 Architecture: amd64 Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp @@ -20,3 +20,7 @@ Architecture: amd64 Depends: linux-image-4.9.0-9-2-amd64 Description: kernel modules for platform devices such as fan, led, sfp +Package: platform-modules-z9264f +Architecture: amd64 +Depends: linux-image-4.9.0-9-2-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init rename to platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install new file mode 100644 index 000000000000..63eeddf04e96 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install @@ -0,0 +1,2 @@ +s6000/systemd/platform-modules-s6000.service etc/systemd/system +common/io_rd_wr.py usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst new file mode 100644 index 000000000000..a9b90fa86f3a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst @@ -0,0 +1,7 @@ +# postinst script for S6000 + +# Enable Dell-S6000-platform-service +depmod -a +systemctl enable platform-modules-s6000.service +systemctl start platform-modules-s6000.service +#DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules index 860e46bf7005..5f8fffd39945 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/rules +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= s6100 z9100 z9264f +MODULE_DIRS:= s6000 z9100 s6100 z9264f COMMON_DIR := common %: @@ -30,6 +30,10 @@ override_dh_auto_install: $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + if [ $$mod = "s6000" ]; then \ + dh_installdirs -pplatform-modules-$${mod} usr/local/bin ; \ + cp -r $(MOD_SRC_DIR)/$${mod}/scripts/* debian/platform-modules-$${mod}/usr/local/bin; \ + fi; \ done) override_dh_usrlocal: diff --git a/platform/broadcom/sonic-platform-modules-s6000/LICENSE b/platform/broadcom/sonic-platform-modules-dell/s6000/LICENSE similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/LICENSE rename to platform/broadcom/sonic-platform-modules-dell/s6000/LICENSE diff --git a/platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS b/platform/broadcom/sonic-platform-modules-dell/s6000/MAINTAINERS similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS rename to platform/broadcom/sonic-platform-modules-dell/s6000/MAINTAINERS diff --git a/platform/broadcom/sonic-platform-modules-s6000/README.md b/platform/broadcom/sonic-platform-modules-dell/s6000/README.md similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/README.md rename to platform/broadcom/sonic-platform-modules-dell/s6000/README.md diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/Makefile similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/modules/Makefile rename to platform/broadcom/sonic-platform-modules-dell/s6000/modules/Makefile diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c rename to platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/reset-qsfp similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp rename to platform/broadcom/sonic-platform-modules-dell/s6000/scripts/reset-qsfp diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed rename to platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed diff --git a/platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service b/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service rename to platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service diff --git a/platform/broadcom/sonic-platform-modules-s6000/.gitignore b/platform/broadcom/sonic-platform-modules-s6000/.gitignore deleted file mode 100644 index 7f287d538227..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/.gitignore +++ /dev/null @@ -1,50 +0,0 @@ -# Object files -*.o -*.ko -*.obj -*.elf - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su - -# Kernel Module Compile Results -*.mod* -*.cmd -*.o.d -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -# Debian packaging -*.debhelper.log -*.postinst.debhelper -*.postrm.debhelper -*.prerm.debhelper -*.substvars diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/changelog b/platform/broadcom/sonic-platform-modules-s6000/debian/changelog deleted file mode 100644 index 0a6b7820bdeb..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -platform-modules-s6000 (1.0) unstable; urgency=low - - * Initial release - - -- Shuotian Cheng Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/compat b/platform/broadcom/sonic-platform-modules-s6000/debian/compat deleted file mode 100644 index 45a4fb75db86..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/control b/platform/broadcom/sonic-platform-modules-s6000/debian/control deleted file mode 100644 index a9f2a76ebedd..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/control +++ /dev/null @@ -1,12 +0,0 @@ -Source: platform-modules-s6000 -Section: main -Priority: extra -Maintainer: Shuotian Cheng -Build-Depends: debhelper (>= 8.0.0), bzip2 -Standards-Version: 3.9.3 - -Package: platform-modules-s6000 -Architecture: amd64 -Depends: linux-image-4.9.0-9-2-amd64 -Description: kernel modules for platform devices such as fan, led, sfp - diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/copyright b/platform/broadcom/sonic-platform-modules-s6000/debian/copyright deleted file mode 100644 index 6fbc5a7f6ca0..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/copyright +++ /dev/null @@ -1,16 +0,0 @@ -Provides linux sysfs interface to Dell S6000 platform hardware peripherals -Copyright (C) 2016 Microsoft - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install deleted file mode 100644 index 8fdf12a41c80..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install +++ /dev/null @@ -1,2 +0,0 @@ -systemd/platform-modules-s6000.service lib/systemd/system -scripts/io_rd_wr.py usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/rules b/platform/broadcom/sonic-platform-modules-s6000/debian/rules deleted file mode 100755 index 5473743ea38d..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/rules +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/make -f - -export INSTALL_MOD_DIR:=extra - -PACKAGE_NAME := platform-modules-s6000 -KVERSION ?= $(shell uname -r) -KERNEL_SRC := /lib/modules/$(KVERSION) -MODULE_SRC := $(shell pwd)/modules -SCRIPT_SRC := $(shell pwd)/scripts - -%: - dh $@ --with=systemd - -override_dh_auto_build: - make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) - -override_dh_auto_install: - dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) - cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) - dh_installdirs -p$(PACKAGE_NAME) usr/local/bin - cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin - -override_dh_usrlocal: - -override_dh_pysupport: - -override_dh_clean: - dh_clean - rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd - rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order - rm -rf $(MODULE_SRC)/.tmp_versions - diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/io_rd_wr.py b/platform/broadcom/sonic-platform-modules-s6000/scripts/io_rd_wr.py deleted file mode 100755 index dc9dd09807c2..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/scripts/io_rd_wr.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/python -#Script to read/write the io based registers - -import sys -import os -import getopt -import struct - -io_resource='/dev/port' - -def usage(): - ''' This is the Usage Method ''' - - print 'Utility for IO read/write' - print '\t\t io_rd_wr.py --get --offset ' - print '\t\t io_rd_wr.py --set --val --offset ' - sys.exit(1) - -def io_reg_read(io_resource,offset): - fd=os.open(io_resource, os.O_RDONLY) - if(fd<0): - print 'file open failed %s"%io_resource' - return - if(os.lseek(fd, offset, os.SEEK_SET) != offset): - print 'lseek failed on %s'%io_resource - return - buf=os.read(fd,1) - reg_val1=ord(buf) - print 'reg value %x'%reg_val1 - os.close(fd) - -def io_reg_write(io_resource,offset,val): - fd=os.open(io_resource,os.O_RDWR) - if(fd<0): - print 'file open failed %s"%io_resource' - return - if(os.lseek(fd, offset, os.SEEK_SET) != offset): - print 'lseek failed on %s'%io_resource - return - ret=os.write(fd,struct.pack('B',val)) - if(ret != 1): - print 'write failed %d'%ret - return - os.close(fd) - -def main(argv): - - ''' The main function will read the user input from the - command line argument and process the request ''' - - opts = '' - val = '' - choice = '' - resouce = '' - offset = '' - - try: - opts, args = getopt.getopt(argv, "hgs:" , \ - ["val=","offset=","help", "get", "set"]) - - except getopt.GetoptError: - usage() - - for opt,arg in opts: - - if opt in ('-h','--help'): - choice = 'help' - - elif opt in ('-g', '--get'): - choice = 'get' - - elif opt in ('-s', '--set'): - choice = 'set' - - elif opt == '--offset': - offset = int(arg,16) - - elif opt == '--val': - val = int(arg,16) - - if choice == 'get' and offset != '': - io_reg_read(io_resource,offset) - - elif choice == 'set' and offset != '' and val != '': - io_reg_write(io_resource,offset,val) - - else: - usage() - -#Calling the main method -if __name__ == "__main__": - main(sys.argv[1:]) -