return slice (!map) from ExtractNetworkAddresses
diff --git a/openstack/compute/v2/servers/fixtures.go b/openstack/compute/v2/servers/fixtures.go
index baa756f..e47bc0e 100644
--- a/openstack/compute/v2/servers/fixtures.go
+++ b/openstack/compute/v2/servers/fixtures.go
@@ -619,16 +619,14 @@
}
// ListNetworkAddressesExpected represents an expected repsonse from a ListAddressesByNetwork request.
-var ListNetworkAddressesExpected = map[string][]Address{
- "public": []Address{
- Address{
- Version: 4,
- Address: "80.56.136.39",
- },
- Address{
- Version: 6,
- Address: "2001:4800:790e:510:be76:4eff:fe04:82a8",
- },
+var ListNetworkAddressesExpected = []Address{
+ Address{
+ Version: 4,
+ Address: "50.56.176.35",
+ },
+ Address{
+ Version: 6,
+ Address: "2001:4800:780e:510:be76:4eff:fe04:84a8",
},
}
diff --git a/openstack/compute/v2/servers/requests_test.go b/openstack/compute/v2/servers/requests_test.go
index abfdec7..3527428 100644
--- a/openstack/compute/v2/servers/requests_test.go
+++ b/openstack/compute/v2/servers/requests_test.go
@@ -302,8 +302,8 @@
actual, err := ExtractNetworkAddresses(page)
th.AssertNoErr(t, err)
- if len(actual) != 1 {
- t.Fatalf("Expected 1 network, got %d", len(actual))
+ if len(actual) != 2 {
+ t.Fatalf("Expected 2 addresses, got %d", len(actual))
}
th.CheckDeepEquals(t, expected, actual)
diff --git a/openstack/compute/v2/servers/results.go b/openstack/compute/v2/servers/results.go
index 1fe6b4a..e2be6ba 100644
--- a/openstack/compute/v2/servers/results.go
+++ b/openstack/compute/v2/servers/results.go
@@ -328,8 +328,8 @@
}
// ExtractNetworkAddresses interprets the results of a single page from a ListAddressesByNetwork() call,
-// producing a map of addresses.
-func ExtractNetworkAddresses(page pagination.Page) (map[string][]Address, error) {
+// producing a slice of addresses.
+func ExtractNetworkAddresses(page pagination.Page) ([]Address, error) {
casted := page.(NetworkAddressPage).Body
var response map[string][]Address
@@ -338,5 +338,10 @@
return nil, err
}
- return response, err
+ var key string
+ for k := range response {
+ key = k
+ }
+
+ return response[key], err
}