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
}