1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 23:34:57 +00:00

Refactor the cloud-init metadata to return a netconf.NetworkConfig

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-03-07 13:21:14 +10:00
parent 5dbb0f2a28
commit 0779e13d46
23 changed files with 459 additions and 287 deletions

View File

@@ -56,10 +56,10 @@ func TestFetchMetadata(t *testing.T) {
"interface.0.dhcp": "yes",
},
metadata: datasource.Metadata{
NetworkConfig: map[string]string{
"interface.0.mac": "test mac",
"interface.0.dhcp": "yes",
},
// NetworkConfig: map[string]string{
// "interface.0.mac": "test mac",
// "interface.0.dhcp": "yes",
// },
},
},
{
@@ -68,10 +68,10 @@ func TestFetchMetadata(t *testing.T) {
"interface.0.dhcp": "yes",
},
metadata: datasource.Metadata{
NetworkConfig: map[string]string{
"interface.0.name": "test name",
"interface.0.dhcp": "yes",
},
// NetworkConfig: map[string]string{
// "interface.0.name": "test name",
// "interface.0.dhcp": "yes",
// },
},
},
{
@@ -86,12 +86,12 @@ func TestFetchMetadata(t *testing.T) {
metadata: datasource.Metadata{
Hostname: "test host",
PrivateIPv6: net.ParseIP("fe00::100"),
NetworkConfig: map[string]string{
"interface.0.mac": "test mac",
"interface.0.ip.0.address": "fe00::100/64",
"interface.0.route.0.gateway": "fe00::1",
"interface.0.route.0.destination": "::",
},
// NetworkConfig: map[string]string{
// "interface.0.mac": "test mac",
// "interface.0.ip.0.address": "fe00::100/64",
// "interface.0.route.0.gateway": "fe00::1",
// "interface.0.route.0.destination": "::",
// },
},
},
{
@@ -113,17 +113,17 @@ func TestFetchMetadata(t *testing.T) {
Hostname: "test host",
PublicIPv4: net.ParseIP("10.0.0.101"),
PrivateIPv4: net.ParseIP("10.0.0.102"),
NetworkConfig: map[string]string{
"interface.0.name": "test name",
"interface.0.ip.0.address": "10.0.0.100/24",
"interface.0.ip.1.address": "10.0.0.101/24",
"interface.0.route.0.gateway": "10.0.0.1",
"interface.0.route.0.destination": "0.0.0.0",
"interface.1.mac": "test mac",
"interface.1.route.0.gateway": "10.0.0.2",
"interface.1.route.0.destination": "0.0.0.0",
"interface.1.ip.0.address": "10.0.0.102/24",
},
// NetworkConfig: map[string]string{
// "interface.0.name": "test name",
// "interface.0.ip.0.address": "10.0.0.100/24",
// "interface.0.ip.1.address": "10.0.0.101/24",
// "interface.0.route.0.gateway": "10.0.0.1",
// "interface.0.route.0.destination": "0.0.0.0",
// "interface.1.mac": "test mac",
// "interface.1.route.0.gateway": "10.0.0.2",
// "interface.1.route.0.destination": "0.0.0.0",
// "interface.1.ip.0.address": "10.0.0.102/24",
// },
},
},
}
@@ -257,17 +257,17 @@ func TestOvfTransport(t *testing.T) {
Hostname: "test host",
PublicIPv4: net.ParseIP("10.0.0.101"),
PrivateIPv4: net.ParseIP("10.0.0.102"),
NetworkConfig: map[string]string{
"interface.0.name": "test name",
"interface.0.ip.0.address": "10.0.0.100/24",
"interface.0.ip.1.address": "10.0.0.101/24",
"interface.0.route.0.gateway": "10.0.0.1",
"interface.0.route.0.destination": "0.0.0.0",
"interface.1.mac": "test mac",
"interface.1.route.0.gateway": "10.0.0.2",
"interface.1.route.0.destination": "0.0.0.0",
"interface.1.ip.0.address": "10.0.0.102/24",
},
//NetworkConfig: map[string]string{
// "interface.0.name": "test name",
// "interface.0.ip.0.address": "10.0.0.100/24",
// "interface.0.ip.1.address": "10.0.0.101/24",
// "interface.0.route.0.gateway": "10.0.0.1",
// "interface.0.route.0.destination": "0.0.0.0",
// "interface.1.mac": "test mac",
// "interface.1.route.0.gateway": "10.0.0.2",
// "interface.1.route.0.destination": "0.0.0.0",
// "interface.1.ip.0.address": "10.0.0.102/24",
// },
},
userdata: []byte("test config"),
},