From 86b24244239d07357008e6a627847022c75a6b20 Mon Sep 17 00:00:00 2001 From: Matt Primrose Date: Thu, 12 Sep 2024 10:47:04 -0700 Subject: [PATCH] fix: update network decoder strings to be more readable --- pkg/wsman/amt/ethernetport/decoder.go | 36 +++++++++++----------- pkg/wsman/amt/ethernetport/decoder_test.go | 36 +++++++++++----------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/pkg/wsman/amt/ethernetport/decoder.go b/pkg/wsman/amt/ethernetport/decoder.go index 8f53e5e8..f6091c3f 100644 --- a/pkg/wsman/amt/ethernetport/decoder.go +++ b/pkg/wsman/amt/ethernetport/decoder.go @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/pkg/wsman/amt/ethernetport/decoder_test.go b/pkg/wsman/amt/ethernetport/decoder_test.go index c0ae3a77..6750015f 100644 --- a/pkg/wsman/amt/ethernetport/decoder_test.go +++ b/pkg/wsman/amt/ethernetport/decoder_test.go @@ -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"}, } @@ -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"}, } @@ -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"}, } @@ -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"}, } @@ -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"}, } @@ -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"}, }