-
Notifications
You must be signed in to change notification settings - Fork 6
/
poe_value_mappings.go
62 lines (53 loc) · 1.07 KB
/
poe_value_mappings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
import (
"sort"
"strings"
)
// bidiMapLookup bidirectional map lookup, will return either key or value depending on the input
func bidiMapLookup(value string, mapName map[string]string) string {
if val, ok := mapName[value]; ok {
return val
} else {
for k, v := range mapName {
if v == value {
return k
}
}
}
return "unknown"
}
// comma separated string list, alphabetically sorted
func valuesAsString(strMap map[string]string) string {
var vals []string
for _, val := range strMap {
vals = append(vals, val)
}
sort.Strings(vals)
return strings.Join(vals, ", ")
}
var pwrModeMap = map[string]string{
"0": "802.3af",
"1": "legacy",
"2": "pre-802.3at",
"3": "802.3at",
}
var portPrioMap = map[string]string{
"0": "low",
"2": "high",
"3": "critical",
}
var limitTypeMap = map[string]string{
"0": "none",
"1": "class",
"2": "user",
}
var detecTypeMap = map[string]string{
"1": "Legacy",
"2": "IEEE 802",
"3": "4pt 802.3af + Legacy",
}
var longerDetectMap = map[string]string{
"0": "Get Value Fault",
"2": "disable",
"3": "enable",
}