From 2f144d1d8868e4090ec06477041b0125b6c3ecbe Mon Sep 17 00:00:00 2001 From: Natarajan Subbiramani Date: Sat, 22 Aug 2026 13:21:28 -0400 Subject: [PATCH 1/2] [H6-128] Bringup bmc0 interface --- ...sonic-platform-nokia-ixr7220h6-128.install | 2 - ...onic-platform-nokia-ixr7220h6-128.postinst | 11 ++- ixr7220h6-128/scripts/bmc_network_init.sh | 70 ------------------- .../service/70-bmc-usb-network.rules | 5 +- .../service/bmc_network_init.service | 12 ---- 5 files changed, 10 insertions(+), 90 deletions(-) delete mode 100755 ixr7220h6-128/scripts/bmc_network_init.sh delete mode 100644 ixr7220h6-128/service/bmc_network_init.service diff --git a/debian/sonic-platform-nokia-ixr7220h6-128.install b/debian/sonic-platform-nokia-ixr7220h6-128.install index b6e2b22..bce18ad 100644 --- a/debian/sonic-platform-nokia-ixr7220h6-128.install +++ b/debian/sonic-platform-nokia-ixr7220h6-128.install @@ -1,8 +1,6 @@ ixr7220h6-128/scripts/h6_128_platform_init.sh usr/local/bin -ixr7220h6-128/scripts/bmc_network_init.sh usr/local/bin ixr7220h6-128/scripts/ports_notify.py usr/local/bin ixr7220h6-128/service/h6_128_platform_init.service etc/systemd/system -ixr7220h6-128/service/bmc_network_init.service etc/systemd/system ixr7220h6-128/service/ports_notify.service etc/systemd/system/ ixr7220h6-128/service/70-bmc-usb-network.rules etc/udev/rules.d ixr7220h6-128/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-nokia_ixr7220_h6_128-r0 diff --git a/debian/sonic-platform-nokia-ixr7220h6-128.postinst b/debian/sonic-platform-nokia-ixr7220h6-128.postinst index a795b5e..0cda0f5 100644 --- a/debian/sonic-platform-nokia-ixr7220h6-128.postinst +++ b/debian/sonic-platform-nokia-ixr7220h6-128.postinst @@ -4,13 +4,18 @@ # see: dh_installdeb(1) chmod a+x /usr/local/bin/h6_128_platform_init.sh -chmod a+x /usr/local/bin/bmc_network_init.sh systemctl daemon-reload || true systemctl enable h6_128_platform_init.service systemctl start h6_128_platform_init.service -# Bind service activation to usb0 device unit; avoid eager start at package install. -systemctl enable bmc_network_init.service udevadm control --reload-rules || true +# Rename on first deb installation if usb0 is already created +# before udev rule is copied +if [ -d /sys/class/net/usb0 ] && [ ! -d /sys/class/net/bmc0 ]; then + mac=$(cat /sys/class/net/usb0/address 2>/dev/null || true) + if [ "$mac" = "02:00:00:00:00:02" ]; then + ip link set usb0 name bmc0 || true + fi +fi udevadm trigger --subsystem-match=net || true chmod a+x /usr/local/bin/ports_notify.py systemctl enable ports_notify.service diff --git a/ixr7220h6-128/scripts/bmc_network_init.sh b/ixr7220h6-128/scripts/bmc_network_init.sh deleted file mode 100755 index c003cdb..0000000 --- a/ixr7220h6-128/scripts/bmc_network_init.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -CONFIG_FILE="/etc/sonic/bmc.json" - -check_jq() { - if ! command -v jq &> /dev/null; then - logger -t bmc-network "Error: 'jq' is not installed. Please install it to parse JSON." - echo "Error: 'jq' is not installed. Please install it to parse JSON." >&2 - exit 1 - fi -} - -check_jq - -if [ -z "$CONFIG_FILE" ]; then - logger -t bmc-network "Error: Configuration file not found at $CONFIG_FILE" - echo "Error: Configuration file not found at $CONFIG_FILE" >&2 - exit 1 -fi - -BMC_IF_NAME=$(jq -r '.bmc_if_name' "$CONFIG_FILE") -BMC_IF_ADDR=$(jq -r '.bmc_if_addr' "$CONFIG_FILE") -BMC_NET_MASK=$(jq -r '.bmc_net_mask' "$CONFIG_FILE") - -if [ -z "$BMC_IF_NAME" ] || [ -z "$BMC_IF_ADDR" ] || [ -z "$BMC_NET_MASK" ]; then - logger -t bmc-network "Error: Failed to extract all required values from $CONFIG_FILE. Check JSON format." - echo "Error: Failed to extract all required values from $CONFIG_FILE. Check JSON format." >&2 - exit 1 -fi - -echo " bmc_if_name: $BMC_IF_NAME" >&2 -echo " bmc_if_addr: $BMC_IF_ADDR" >&2 -echo " bmc_net_mask: $BMC_NET_MASK" >&2 - -if [ "$BMC_IF_NAME" != "usb0" ]; then - echo "Renaming interface 'usb0' to '$BMC_IF_NAME'..." >&2 - if ip link show usb0 &> /dev/null; then - ip link set usb0 name "$BMC_IF_NAME" - if [ $? -eq 0 ]; then - echo "Interface 'usb0' successfully renamed to '$BMC_IF_NAME'." >&2 - else - logger -t bmc-network "Error: Failed to rename 'usb0' to '$BMC_IF_NAME'." - echo "Error: Failed to rename 'usb0' to '$BMC_IF_NAME'." >&2 - exit 1 - fi - elif ip link show "$BMC_IF_NAME" &> /dev/null; then - echo "Interface '$BMC_IF_NAME' already exists. Skipping rename." >&2 - else - logger -t bmc-network "Error: Neither 'usb0' nor '$BMC_IF_NAME' found. Cannot configure BMC network." - echo "Error: Neither 'usb0' nor '$BMC_IF_NAME' found. Cannot configure BMC network." >&2 - exit 1 - fi -else - echo "Interface name is already 'usb0'. No rename needed." >&2 -fi - -echo "Configuring interface '$BMC_IF_NAME' with IP '$BMC_IF_ADDR' and netmask '$BMC_NET_MASK'..." >&2 -ifconfig "$BMC_IF_NAME" "$BMC_IF_ADDR" netmask "$BMC_NET_MASK" up - -if [ $? -eq 0 ]; then - echo "Interface '$BMC_IF_NAME' successfully configured." >&2 - echo "Current configuration for '$BMC_IF_NAME':" >&2 - ip addr show "$BMC_IF_NAME" >&2 -else - logger -t bmc-network "Error: Failed to configure interface '$BMC_IF_NAME'." - echo "Error: Failed to configure interface '$BMC_IF_NAME'." >&2 - exit 1 -fi - -echo "BMC service finished." >&2 diff --git a/ixr7220h6-128/service/70-bmc-usb-network.rules b/ixr7220h6-128/service/70-bmc-usb-network.rules index 214054b..f2198e9 100644 --- a/ixr7220h6-128/service/70-bmc-usb-network.rules +++ b/ixr7220h6-128/service/70-bmc-usb-network.rules @@ -1,3 +1,2 @@ -SUBSYSTEM=="net", ACTION=="add", KERNEL=="usb0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bmc_network_init.service" -SUBSYSTEM=="net", ACTION=="change", KERNEL=="usb0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bmc_network_init.service" -SUBSYSTEM=="net", ACTION=="change", KERNEL=="bmc0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bmc_network_init.service" +SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="02:00:00:00:00:02", NAME="bmc0" +SUBSYSTEM=="net", ACTION=="move", KERNEL=="bmc0", ATTR{address}=="02:00:00:00:00:02", TAG+="systemd", ENV{SYSTEMD_WANTS}+="ifup@bmc0.service" diff --git a/ixr7220h6-128/service/bmc_network_init.service b/ixr7220h6-128/service/bmc_network_init.service deleted file mode 100644 index e8c9b87..0000000 --- a/ixr7220h6-128/service/bmc_network_init.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Nokia BMC Network Service -Documentation=https://github.com/sonic-net/SONiC/wiki/ -After=systemd-modules-load.service local-fs.target sys-subsystem-net-devices-usb0.device -BindsTo=sys-subsystem-net-devices-usb0.device - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/bmc_network_init.sh - -[Install] -WantedBy=sys-subsystem-net-devices-usb0.device From da40934f0bd75bcb443457ecd80080ec5943c047 Mon Sep 17 00:00:00 2001 From: y7zhou Date: Mon, 24 Aug 2026 11:52:59 -0400 Subject: [PATCH 2/2] [H6-128]Fix the reboot-cause of BMC power off/cycle --- ixr7220h6-128/sonic_platform/chassis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ixr7220h6-128/sonic_platform/chassis.py b/ixr7220h6-128/sonic_platform/chassis.py index 22f17df..f408cf3 100644 --- a/ixr7220h6-128/sonic_platform/chassis.py +++ b/ixr7220h6-128/sonic_platform/chassis.py @@ -297,7 +297,7 @@ def get_reboot_cause(self): if val1 & 0x02: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "CPU Over Heat") if val2 == 0x5A: - return (self.REBOOT_CAUSE_POWER_LOSS, "BMC Remote Power Cycle") + return (self.REBOOT_CAUSE_POWER_DOWN_REQUEST_FROM_BMC, None) if val1 & 0x08: return (self.REBOOT_CAUSE_POWER_LOSS, "Power Cycle") return (self.REBOOT_CAUSE_NON_HARDWARE, None)