Skip to content
Merged
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
4 changes: 2 additions & 2 deletions ena-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
---
metadata:
schemaVersion: 2.0.0
release: 1.3.1
release: 1.3.2
repository:
codename: 3.1
component: main
Expand All @@ -19,7 +19,7 @@ packages:
version: 1.7.3
ociArtifact: edge-orch/en/deb/node-agent
- name: platform-manageability-agent
version: 0.1.8
version: 0.2.0
ociArtifact: edge-orch/en/deb/platform-manageability-agent
- name: platform-observability-agent
version: 1.9.0
Expand Down
2 changes: 1 addition & 1 deletion platform-manageability-agent/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0-dev
0.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ func (srv *Server) ReportAMTStatus(ctx context.Context, req *proto.AMTStatusRequ
if req.Status != proto.AMTStatus_ENABLED && req.Status != proto.AMTStatus_DISABLED {
return nil, fmt.Errorf("incorrect status provided")
}
if req.Status == proto.AMTStatus_ENABLED && req.Version == "" {
return nil, fmt.Errorf("failed to send version when AMT enabled")
}
log.Printf("AMTStatusRequest: %v/n", req)
return &proto.AMTStatusResponse{}, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io"
"os"
"os/exec"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -57,10 +58,15 @@ func TestDeviceConfiguration(t *testing.T) {
pmaCmd, err := startPlatformManageabilityAgent(ctx, platformManageabilityAgentBinary)
require.NoError(t, err)

time.Sleep(20 * time.Second)
time.Sleep(25 * time.Second)
require.Contains(t, pmaBuffer.String(), "Platform Manageability Agent started successfully")
require.Contains(t, pmaBuffer.String(), "Successfully reported AMT status for host")
require.Contains(t, pmaBuffer.String(), "Successfully retrieved activation details for host")

// Wait a bit more for status to become ready after activation completes
if !strings.Contains(pmaBuffer.String(), "Status Ready") {
time.Sleep(5 * time.Second)
}
require.Contains(t, pmaBuffer.String(), "Status Ready")
require.Contains(t, mockBuffer.String(), "AMTStatusRequest")
require.Contains(t, mockBuffer.String(), "ActivationRequest")
Expand Down
18 changes: 10 additions & 8 deletions platform-manageability-agent/go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
module github.com/open-edge-platform/edge-node-agents/platform-manageability-agent

go 1.24.4
go 1.24.6

toolchain go1.24.8

require (
github.com/cenkalti/backoff/v4 v4.3.0
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
github.com/open-edge-platform/edge-node-agents/common v1.8.0
github.com/open-edge-platform/infra-external/dm-manager v0.3.1
github.com/sirupsen/logrus v1.9.3
github.com/open-edge-platform/infra-external/dm-manager v0.5.0
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af
github.com/stretchr/testify v1.11.1
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0
google.golang.org/grpc v1.75.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0
google.golang.org/grpc v1.75.1
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -41,10 +43,10 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/oauth2 v0.31.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/protobuf v1.36.9 // indirect
Expand Down
30 changes: 14 additions & 16 deletions platform-manageability-agent/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDh
github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
github.com/open-edge-platform/edge-node-agents/common v1.8.0 h1:VhVhdftyDLQWbSeEDMXnzzP8jqDhJzph8B42IWQ6fFo=
github.com/open-edge-platform/edge-node-agents/common v1.8.0/go.mod h1:zTswftFqpDz/VE/RB5cUQMPLwKWbohjlNtbOgG6X0n8=
github.com/open-edge-platform/infra-external/dm-manager v0.3.1 h1:Q9Mt9ciTF8NRRoOCIhvcd7nLlmHIuH0XTH1a8ZzZ/34=
github.com/open-edge-platform/infra-external/dm-manager v0.3.1/go.mod h1:9PoYl/Z+994IeWTD1D4WGdFc/Feje9afT3iw3FBbqiQ=
github.com/open-edge-platform/infra-external/dm-manager v0.5.0 h1:bpMsyznc8Ys515PhcKy9jngTsDCdL+ZgVZuOQijiHfc=
github.com/open-edge-platform/infra-external/dm-manager v0.5.0/go.mod h1:/UCvMWa+yxR/zslsV5UP+4ib64oENkUWEXiiy8YJ/iA=
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.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -53,8 +53,8 @@ github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM=
github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af h1:Sp5TG9f7K39yfB+If0vjp97vuT74F72r8hfRpP8jLU0=
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
Expand All @@ -69,8 +69,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0 h1:rbRJ8BBoVMsQShESYZ0FkvcITu8X8QNwJogcLUmDNNw=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0/go.mod h1:ru6KHrNtNHxM4nD/vd6QrLVWgKhxPYgblq4VAtNawTQ=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 h1:YH4g8lQroajqUwWbq/tr2QX1JFmEXaDLgG+ew9bLMWo=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0/go.mod h1:fvPi2qXDqFs8M4B4fmJhE92TyQs9Ydjlg3RvfUp+NbQ=
go.opentelemetry.io/contrib/instrumentation/host v0.63.0 h1:zsaUrWypCf0NtYSUby+/BS6QqhXVNxMQD5w4dLczKCQ=
go.opentelemetry.io/contrib/instrumentation/host v0.63.0/go.mod h1:Ru+kuFO+ToZqBKwI59rCStOhW6LWrbGisYrFaX61bJk=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
Expand All @@ -87,28 +87,26 @@ go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJr
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY=
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc=
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
67 changes: 62 additions & 5 deletions platform-manageability-agent/internal/comms/comms.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,35 @@ const (
retryInterval = 10 * time.Second
tickerInterval = 500 * time.Millisecond
connTimeout = 5 * time.Second

// AMT and ISM feature constants.
AMTFeature = "AMT"
ISMFeature = "ISM"
ISMFeatureDetectionString = "Intel Standard Manageability Corporate"
)

var ErrActivationSkipped = errors.New("activation skipped")

// TO DO: Implement proper parsing of AMT info json output
// AMTInfo represents the JSON structure returned by "rpc amtinfo -json"
/*
type AMTInfo struct {
Version string `json:"version"`
BuildNumber string `json:"buildNumber"`
ControlMode string `json:"controlMode"`
DNSSuffix string `json:"dnsSuffix"`
Features string `json:"features"`
RAS struct {
NetworkStatus string `json:"networkStatus"`
RemoteStatus string `json:"remoteStatus"`
RemoteTrigger string `json:"remoteTrigger"`
MPSHostname string `json:"mpsHostname"`
} `json:"ras"`
SKU string `json:"sku"`
UUID string `json:"uuid"`
}
*/

type Client struct {
DMMgrServiceAddr string
Dialer grpc.DialOption
Expand Down Expand Up @@ -123,12 +148,14 @@ func parseAMTInfoField(output []byte, parseKey string) (string, bool) {
func (cli *Client) ReportAMTStatus(ctx context.Context, hostID string) (pb.AMTStatus, error) {
defaultStatus := pb.AMTStatus_DISABLED
var req *pb.AMTStatusRequest

// TODO: Implement proper parsing of AMT info json output
output, err := cli.Executor.ExecuteAMTInfo()
if err != nil {
req = &pb.AMTStatusRequest{
HostId: hostID,
Status: defaultStatus,
Version: "",
Feature: "",
}
_, reportErr := cli.DMMgrClient.ReportAMTStatus(ctx, req)
if reportErr != nil {
Expand All @@ -141,14 +168,44 @@ func (cli *Client) ReportAMTStatus(ctx context.Context, hostID string) (pb.AMTSt
return defaultStatus, fmt.Errorf("failed to execute `rpc amtinfo` command: %w", err)
}

value, ok := parseAMTInfoField(output, "Version")
// Parse Features field to determine if AMT or ISM is enabled
// TODO : Use json parser to fetch fields directly from json output
value, ok := parseAMTInfoField(output, "Features")
if ok {
log.Logger.Infof("Parsed Features field value: '%s' for host %s", value, hostID)
if strings.Contains(strings.ToUpper(value), AMTFeature) {
log.Logger.Debugf("AMT detected in features for host %s", hostID)
req = &pb.AMTStatusRequest{
HostId: hostID,
Status: pb.AMTStatus_ENABLED,
Feature: AMTFeature,
}
} else if strings.Contains(value, ISMFeatureDetectionString) {
log.Logger.Debugf("ISM detected in features for host %s", hostID)
req = &pb.AMTStatusRequest{
HostId: hostID,
Status: pb.AMTStatus_ENABLED,
Feature: ISMFeature,
}
} else {
log.Logger.Debugf("Unknown feature detected: '%s' for host %s", value, hostID)
// If features field contains other values, send empty string
req = &pb.AMTStatusRequest{
HostId: hostID,
Status: pb.AMTStatus_ENABLED,
Feature: "",
}
}
} else {
log.Logger.Debugf("Features field not found or empty for host %s", hostID)
// If we can't parse the Features field, send empty string
req = &pb.AMTStatusRequest{
HostId: hostID,
Status: pb.AMTStatus_ENABLED,
Version: value,
Feature: "",
}
}
// Send the AMT status to the device manager
_, err = cli.DMMgrClient.ReportAMTStatus(ctx, req)
if err != nil {
if st, ok := status.FromError(err); ok {
Expand All @@ -161,8 +218,8 @@ func (cli *Client) ReportAMTStatus(ctx context.Context, hostID string) (pb.AMTSt
return defaultStatus, fmt.Errorf("failed to report AMT status: %w", err)
}

log.Logger.Infof("Reported AMT status: HostID=%s, Status=%v, Version=%s",
req.HostId, req.Status, req.Version)
log.Logger.Infof("Reported AMT status: HostID=%s, Status=%v, Feature=%s",
req.HostId, req.Status, req.Feature)
return req.Status, nil
}

Expand Down
Loading