-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.go
70 lines (63 loc) · 1.35 KB
/
data.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
63
64
65
66
67
68
69
70
package ilo
import (
"fmt"
"math/rand"
"net/http"
"time"
)
const dataFormat = `<?xml version="1.0"?>
<RIMP>
<HSI>
<SBSN>%s</SBSN>
<SPN>%s</SPN>
<UUID>xxxxxxxx</UUID>
<SP>1</SP>
<cUUID>0000-0000-0000-0000</cUUID>
<VIRTUAL>
<STATE>Inactive</STATE>
<VID>
<BSN></BSN>
<cUUID></cUUID>
</VID>
</VIRTUAL>
</HSI>
<MP>
<ST>1</ST>
<PN>%s</PN>
<FWRI>%s</FWRI>
<BBLK>3; Jul 11 2004</BBLK>
<HWRI>ASIC: 7</HWRI>
<SN>00xx00xx00xx </SN>
<UUID>ILO000xxx000</UUID>
<IPM>1</IPM>
<SSO>0</SSO>
<PWRM>3.4</PWRM>
</MP>
</RIMP>`
var sProductNames = []string{
"ProLiant DL380 G5",
"ProLiant BL480 G6",
"ProLiant DL360 G9",
"ProLiant DL580 G9",
}
var productNames = []string{
"Integrated Lights-Out 2 (iLO 2)",
"Integrated Lights-Out 3 (iLO 3)",
"Integrated Lights-Out 4 (iLO 4)",
}
var firmwareVersions = []string{"2.02", "2.04"}
var data string
func iloData(w http.ResponseWriter, r *http.Request) {
if data == "" {
rand.Seed(time.Now().UnixNano())
// Initialize data
data = fmt.Sprintf(
dataFormat,
randomString(10),
sProductNames[rand.Intn(len(sProductNames))],
productNames[rand.Intn(len(productNames))],
firmwareVersions[rand.Intn(len(firmwareVersions))],
)
}
fmt.Fprintf(w, data)
}