Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add hgw-mac key in metadata while preparing online and offline message #507

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions deviceStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"strconv"
"time"
"strings"

"github.com/xmidt-org/webpa-common/v2/convey"
"github.com/xmidt-org/webpa-common/v2/device"
Expand Down Expand Up @@ -36,6 +37,7 @@ func statusMetadata(d device.Interface) map[string]string {
metadata["/compliance"] = convey.MissingFields.String()
}

metadata["hw-mac"] = strings.TrimPrefix(string(d.ID()), "mac:")
Copy link
Member

Choose a reason for hiding this comment

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

Device identifiers don't have to be a MAC address. Would it be ok to change this to:

metadata["/hw-deviceid"] = d.ID()

This will result in the metadata looking like:
/hw-deviceid = mac:112233445566 or uuid:1edfb5ba-acb8-4e33-9793-a032d1e352ed depending on the way the CPE is named?

For users that assign a uuid for the combination of a CPE + account this will work as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@schmidtw I have updated the code.

return metadata
}

Expand Down
Loading