Ubuntu Pastebin

Paste from dooferlad at Mon, 23 Nov 2015 14:43:07 +0000

Download as text
 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
package gomaasapi

import (
	"net/http"
	"strings"
)

func Main() *http.ServeMux {
	ts := NewTestServer("1.0")

	subnetJSON := `{
        "dns_servers": [
            "192.168.1.2"
        ], 
        "name": "maas-eth0", 
        "space": "space-0", 
        "vlan": 0,
        "gateway_ip": "192.168.1.1", 
        "cidr": "192.168.1.0/24"
    }`

	subnet := ts.NewSubnet(strings.NewReader(subnetJSON))

	ts.NewIPAddress("192.168.1.10", "maas-eth0")

	ts.NewNode(`{"hwe_kernel": null, 
    "ip_addresses": [], 
    "cpu_count": 4, 
    "power_type": "amt", 
    "tag_names": [], 
    "swap_size": null, 
    "owner": null, 
    "macaddress_set": [
        {
            "mac_address": "00:e1:00:00:16:90"
        }, 
        {
            "mac_address": "c0:3f:d5:65:9f:1e"
        }
    ], 
    "zone": {
        "resource_uri": "/MAAS/api/1.0/zones/default/", 
        "name": "default", 
        "description": ""
    }, 
    "hostname": "anxious-bean.maas", 
    "storage": 240068, 
    "substatus_message": "Power state could not be queried: 'wsmancli' package(s) are not installed", 
    "system_id": "node-89d832ca-8877-11e5-b5a5-00163e86022b", 
    "boot_type": "fastpath", 
    "memory": 8192, 
    "substatus_action": "", 
    "disable_ipv4": false, 
    "architecture": "amd64/generic", 
    "status": 4, 
    "power_state": "off", 
    "substatus_name": "Ready", 
    "routers": []}`)

	var node Node
	node.UUID = "node-89d832ca-8877-11e5-b5a5-00163e86022b"
	var nni NodeNetworkInterface
	nni.Links = append(nni.Links, NetworkLink{"eth0", "dynamic", subnet})
	ts.SetNodeNetworkLink(node, nni)

	return ts.serveMux
}
Download as text