Skip to content

Commit

Permalink
fix: update network decoder strings to be more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-primrose committed Sep 12, 2024
1 parent 8590ddf commit 86b2424
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
36 changes: 18 additions & 18 deletions pkg/wsman/amt/ethernetport/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const (

// linkPolicyToString is a map of LinkPolicy values to their string representations.
var linkPolicyToString = map[LinkPolicy]string{
LinkPolicyS0AC: "LinkPolicyS0AC",
LinkPolicySxAC: "LinkPolicySxAC",
LinkPolicyS0DC: "LinkPolicyS0DC",
LinkPolicySxDC: "LinkPolicySxDC",
LinkPolicyS0AC: "S0 AC",
LinkPolicySxAC: "Sx AC",
LinkPolicyS0DC: "S0 DC",
LinkPolicySxDC: "Sx DC",
}

// String returns the string representation of the LinkPolicy value.
Expand All @@ -47,8 +47,8 @@ const (

// linkPreferenceToString is a map of LinkPreference values to their string representations.
var linkPreferenceToString = map[LinkPreference]string{
LinkPreferenceME: "LinkPreferenceME",
LinkPreferenceHOST: "LinkPreferenceHOST",
LinkPreferenceME: "Management Engine",
LinkPreferenceHOST: "Host",
}

// String returns the string representation of the LinkPreference value.
Expand All @@ -67,8 +67,8 @@ const (

// linkControlToString is a map of LinkControl values to their string representations.
var linkControlToString = map[LinkControl]string{
LinkControlME: "LinkControlME",
LinkControlHOST: "LinkControlHOST",
LinkControlME: "Management Engine",
LinkControlHOST: "Host",
}

// String returns the string representation of the LinkControl value.
Expand All @@ -89,10 +89,10 @@ const (

// wlanLinkProtectionLevelToString is a map of WLANLinkProtectionLevel values to their string representations.
var wlanLinkProtectionLevelToString = map[WLANLinkProtectionLevel]string{
WLANLinkProtectionLevelOverride: "WLANLinkProtectionLevelOverride",
WLANLinkProtectionLevelNone: "WLANLinkProtectionLevelNone",
WLANLinkProtectionLevelPassive: "WLANLinkProtectionLevelPassive",
WLANLinkProtectionLevelHigh: "WLANLinkProtectionLevelHigh",
WLANLinkProtectionLevelOverride: "Override",
WLANLinkProtectionLevelNone: "None",
WLANLinkProtectionLevelPassive: "Passive",
WLANLinkProtectionLevelHigh: "High",
}

// String returns the string representation of the WLANLinkProtectionLevel value.
Expand All @@ -113,10 +113,10 @@ const (

// PhysicalConnectionTypeToString is a map of PhysicalConnectionType values to their string representations.
var PhysicalConnectionTypeToString = map[PhysicalConnectionType]string{
PhysicalConnectionIntegratedLANNIC: "PhysicalConnectionIntegratedLANNIC",
PhysicalConnectionDiscreteLANNIC: "PhysicalConnectionDiscreteLANNIC",
PhysicalConnectionLANviaThunderboltDock: "PhysicalConnectionLANviaThunderboltDock",
PhysicalConnectionWirelessLAN: "PhysicalConnectionWirelessLAN",
PhysicalConnectionIntegratedLANNIC: "Integrated LAN NIC",
PhysicalConnectionDiscreteLANNIC: "Discrete LAN NIC",
PhysicalConnectionLANviaThunderboltDock: "LAN via Thunderbolt Dock",
PhysicalConnectionWirelessLAN: "Wireless LAN",
}

// String returns the string representation of the PhysicalConnectionType value.
Expand All @@ -135,8 +135,8 @@ const (

// PhysicalNicMediumToString is a map of PhysicalNicMedium values to their string representations.
var PhysicalNicMediumToString = map[PhysicalNicMedium]string{
PhysicalNicMediumSMBUS: "PhysicalNicMediumSMBUS",
PhysicalNicMediumPCIe: "PhysicalNicMediumPCIe",
PhysicalNicMediumSMBUS: "SMBUS",
PhysicalNicMediumPCIe: "PCIe",
}

// String returns the string representation of the PhysicalNicMedium value.
Expand Down
36 changes: 18 additions & 18 deletions pkg/wsman/amt/ethernetport/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ func TestLinkPolicy_String(t *testing.T) {
state LinkPolicy
expected string
}{
{LinkPolicyS0AC, "LinkPolicyS0AC"},
{LinkPolicySxAC, "LinkPolicySxAC"},
{LinkPolicyS0DC, "LinkPolicyS0DC"},
{LinkPolicySxDC, "LinkPolicySxDC"},
{LinkPolicyS0AC, "S0 AC"},
{LinkPolicySxAC, "Sx AC"},
{LinkPolicyS0DC, "S0 DC"},
{LinkPolicySxDC, "Sx DC"},
{LinkPolicy(999), "Value not found in map"},
}

Expand All @@ -32,8 +32,8 @@ func TestLinkPreference_String(t *testing.T) {
state LinkPreference
expected string
}{
{LinkPreferenceME, "LinkPreferenceME"},
{LinkPreferenceHOST, "LinkPreferenceHOST"},
{LinkPreferenceME, "Management Engine"},
{LinkPreferenceHOST, "Host"},
{LinkPreference(999), "Value not found in map"},
}

Expand All @@ -50,8 +50,8 @@ func TestLinkControl_String(t *testing.T) {
state LinkControl
expected string
}{
{LinkControlME, "LinkControlME"},
{LinkControlHOST, "LinkControlHOST"},
{LinkControlME, "Management Engine"},
{LinkControlHOST, "Host"},
{LinkControl(999), "Value not found in map"},
}

Expand All @@ -68,10 +68,10 @@ func TestWLANLinkProtectionLevel_String(t *testing.T) {
state WLANLinkProtectionLevel
expected string
}{
{WLANLinkProtectionLevelOverride, "WLANLinkProtectionLevelOverride"},
{WLANLinkProtectionLevelNone, "WLANLinkProtectionLevelNone"},
{WLANLinkProtectionLevelPassive, "WLANLinkProtectionLevelPassive"},
{WLANLinkProtectionLevelHigh, "WLANLinkProtectionLevelHigh"},
{WLANLinkProtectionLevelOverride, "Override"},
{WLANLinkProtectionLevelNone, "None"},
{WLANLinkProtectionLevelPassive, "Passive"},
{WLANLinkProtectionLevelHigh, "High"},
{WLANLinkProtectionLevel(999), "Value not found in map"},
}

Expand All @@ -88,10 +88,10 @@ func TestPhysicalConnectionType_String(t *testing.T) {
state PhysicalConnectionType
expected string
}{
{PhysicalConnectionIntegratedLANNIC, "PhysicalConnectionIntegratedLANNIC"},
{PhysicalConnectionDiscreteLANNIC, "PhysicalConnectionDiscreteLANNIC"},
{PhysicalConnectionLANviaThunderboltDock, "PhysicalConnectionLANviaThunderboltDock"},
{PhysicalConnectionWirelessLAN, "PhysicalConnectionWirelessLAN"},
{PhysicalConnectionIntegratedLANNIC, "Integrated LAN NIC"},
{PhysicalConnectionDiscreteLANNIC, "Discrete LAN NIC"},
{PhysicalConnectionLANviaThunderboltDock, "LAN via Thunderbolt Dock"},
{PhysicalConnectionWirelessLAN, "Wireless LAN"},
{PhysicalConnectionType(999), "Value not found in map"},
}

Expand All @@ -108,8 +108,8 @@ func TestPhysicalNicMediumToString(t *testing.T) {
state PhysicalNicMedium
expected string
}{
{PhysicalNicMediumSMBUS, "PhysicalNicMediumSMBUS"},
{PhysicalNicMediumPCIe, "PhysicalNicMediumPCIe"},
{PhysicalNicMediumSMBUS, "SMBUS"},
{PhysicalNicMediumPCIe, "PCIe"},
{PhysicalNicMedium(999), "Value not found in map"},
}

Expand Down

0 comments on commit 86b2424

Please sign in to comment.