Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ profile hda_sudo {
/run/systemd/resolve/stub-resolv.conf r,
/usr/bin/ipmitool rPx -> hda_ipmitool,
/usr/bin/lshw rPx -> hda_lshw,
/usr/bin/rpc ix,
/usr/bin/sudo mr,
/usr/libexec/sudo/libsudo_util.so.* mr,
/usr/sbin/dmidecode rPx -> hda_dmidecode,
Expand Down
2 changes: 1 addition & 1 deletion hardware-discovery-agent/config/sudoers.d/hd-agent
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hd-agent ALL=(root) NOPASSWD:/usr/sbin/dmidecode,/usr/bin/ipmitool,/usr/bin/lshw,/usr/sbin/lshw
hd-agent ALL=(root) NOPASSWD:/usr/sbin/dmidecode,/usr/bin/ipmitool,/usr/bin/lshw,/usr/sbin/lshw,/usr/bin/rpc
2 changes: 1 addition & 1 deletion hardware-discovery-agent/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/cenkalti/backoff/v4 v4.3.0
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3
github.com/open-edge-platform/edge-node-agents/common v1.10.1
github.com/open-edge-platform/infra-managers/host v1.25.4
github.com/open-edge-platform/infra-managers/host v1.25.5-0.20260327130440-6e311d484d46
github.com/safchain/ethtool v0.7.0
github.com/sirupsen/logrus v1.9.4
github.com/stretchr/testify v1.11.1
Expand Down
4 changes: 4 additions & 0 deletions hardware-discovery-agent/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ github.com/open-edge-platform/edge-node-agents/common v1.10.1 h1:o25PgbWvAMSmtWW
github.com/open-edge-platform/edge-node-agents/common v1.10.1/go.mod h1:AsVGM6J0GfIzHYEZav6eWpNGcz/PzIyVGg6fxr4C2rg=
github.com/open-edge-platform/infra-managers/host v1.25.4 h1:5Ulfpasc3y8F5TwpSZYMQAA58SkIwWItKHrd/lai3gE=
github.com/open-edge-platform/infra-managers/host v1.25.4/go.mod h1:1aEoXXhxW9OIBIK71u+SHg9vn60pemsyLZIzAkBZU9o=
github.com/open-edge-platform/infra-managers/host v1.25.5-0.20260318161218-8db11f57899b h1:tBqLy/6CuoJBEN+4G8HTITPEeyPwexNSKDQQl9f7pbc=
github.com/open-edge-platform/infra-managers/host v1.25.5-0.20260318161218-8db11f57899b/go.mod h1:wh8qa1GjMTMVM78275y4lZR9iJEZZRnoWDldkVk4ygU=
github.com/open-edge-platform/infra-managers/host v1.25.5-0.20260327130440-6e311d484d46 h1:j9eFqADXZerzCcxLy7bLa6n9soqMkt7i4xh8Pja3bdU=
github.com/open-edge-platform/infra-managers/host v1.25.5-0.20260327130440-6e311d484d46/go.mod h1:BjQEDPZRaGLaS/DSAvx9JbUyFuGDUJ91hc9VM1xG06c=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
Expand Down
55 changes: 55 additions & 0 deletions hardware-discovery-agent/internal/amt/amt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-FileCopyrightText: (C) 2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

package amt

import (
"encoding/json"
"fmt"

"github.com/open-edge-platform/edge-node-agents/hardware-discovery-agent/internal/system"
"github.com/open-edge-platform/edge-node-agents/hardware-discovery-agent/internal/utils"
)

type RASInfo struct {
NetworkStatus string `json:"networkStatus"`
RemoteStatus string `json:"remoteStatus"`
RemoteTrigger string `json:"remoteTrigger"`
MPSHostname string `json:"mpsHostname"`
}

type AmtInfo struct {
Version string `json:"amt"`
DeviceName string `json:"hostnameOS"`
OperationalState string `json:"operationalState"`
BuildNumber string `json:"buildNumber"`
Sku string `json:"sku"`
Features string `json:"features"`
Uuid string `json:"uuid"`
ControlMode string `json:"controlMode"`
DNSSuffix string `json:"dnsSuffix"`
RAS *RASInfo `json:"ras"`
}

func GetAmtInfo(executor utils.CmdExecutor) (*AmtInfo, error) {
var amtInfo AmtInfo
dataBytes, err := utils.ReadFromCommand(executor, "sudo", "rpc", "amtinfo", "-json")
if err != nil {
return &AmtInfo{}, fmt.Errorf("failed to read data from command; error: %w", err)
}

err = json.Unmarshal(dataBytes, &amtInfo)
if err != nil {
return &AmtInfo{}, fmt.Errorf("failed to parse data from command; error: %w", err)
}

if amtInfo.Uuid == "" {
systemId, err := system.GetSystemUUID(executor)
if err != nil {
return &AmtInfo{}, fmt.Errorf("failed to retrieve system uuid; error: %w", err)
}
amtInfo.Uuid = systemId
}

return &amtInfo, nil
}
Loading
Loading