Removed all extension functionality from core package
diff --git a/openstack/networking/v2/networks/requests.go b/openstack/networking/v2/networks/requests.go
index f4fbe97..f87ea87 100644
--- a/openstack/networking/v2/networks/requests.go
+++ b/openstack/networking/v2/networks/requests.go
@@ -113,7 +113,7 @@
// The tenant ID that is contained in the URI is the tenant that creates the
// network. An admin user, however, has the option of specifying another tenant
// ID in the CreateOpts struct.
-func Create(c *gophercloud.ServiceClient, opts CreateOpts) (*NetworkCreateResult, error) {
+func Create(c *gophercloud.ServiceClient, opts CreateOpts) (*Network, error) {
// Define structures
type network struct {
AdminStateUp bool `json:"admin_state_up,omitempty"`
@@ -125,7 +125,7 @@
Network network `json:"network"`
}
type response struct {
- Network *NetworkCreateResult `json:"network"`
+ Network *Network `json:"network"`
}
// Populate request body
diff --git a/openstack/networking/v2/networks/requests_test.go b/openstack/networking/v2/networks/requests_test.go
index b637b50..1b309a0 100644
--- a/openstack/networking/v2/networks/requests_test.go
+++ b/openstack/networking/v2/networks/requests_test.go
@@ -41,14 +41,10 @@
"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
],
"name": "private-network",
- "provider:physical_network": null,
"admin_state_up": true,
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
- "provider:network_type": "local",
- "router:external": true,
"shared": true,
- "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
- "provider:segmentation_id": null
+ "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22"
},
{
"status": "ACTIVE",
@@ -56,14 +52,10 @@
"08eae331-0402-425a-923c-34f7cfe39c1b"
],
"name": "private",
- "provider:physical_network": null,
"admin_state_up": true,
"tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
- "provider:network_type": "local",
- "router:external": true,
"shared": true,
- "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
- "provider:segmentation_id": null
+ "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324"
}
]
}
@@ -83,30 +75,22 @@
expected := []Network{
Network{
- Status: "ACTIVE",
- Subnets: []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"},
- Name: "private-network",
- ProviderPhysicalNetwork: "",
- AdminStateUp: true,
- TenantID: "4fd44f30292945e481c7b8a0c8908869",
- ProviderNetworkType: "local",
- RouterExternal: true,
- Shared: true,
- ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22",
- ProviderSegmentationID: 0,
+ Status: "ACTIVE",
+ Subnets: []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"},
+ Name: "private-network",
+ AdminStateUp: true,
+ TenantID: "4fd44f30292945e481c7b8a0c8908869",
+ Shared: true,
+ ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22",
},
Network{
- Status: "ACTIVE",
- Subnets: []string{"08eae331-0402-425a-923c-34f7cfe39c1b"},
- Name: "private",
- ProviderPhysicalNetwork: "",
- AdminStateUp: true,
- TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e",
- ProviderNetworkType: "local",
- RouterExternal: true,
- Shared: true,
- ID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
- ProviderSegmentationID: 0,
+ Status: "ACTIVE",
+ Subnets: []string{"08eae331-0402-425a-923c-34f7cfe39c1b"},
+ Name: "private",
+ AdminStateUp: true,
+ TenantID: "26a7980765d0414dbc1fc1f88cdb7e6e",
+ Shared: true,
+ ID: "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
},
}
@@ -139,14 +123,10 @@
"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
],
"name": "private-network",
- "provider:physical_network": null,
"admin_state_up": true,
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
- "provider:network_type": "local",
- "router:external": true,
"shared": true,
- "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
- "provider:segmentation_id": null
+ "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22"
}
}
`)
@@ -158,12 +138,8 @@
th.AssertEquals(t, n.Status, "ACTIVE")
th.AssertDeepEquals(t, n.Subnets, []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"})
th.AssertEquals(t, n.Name, "private-network")
- th.AssertEquals(t, n.ProviderPhysicalNetwork, "")
- th.AssertEquals(t, n.ProviderNetworkType, "local")
- th.AssertEquals(t, n.ProviderSegmentationID, 0)
th.AssertEquals(t, n.AdminStateUp, true)
th.AssertEquals(t, n.TenantID, "4fd44f30292945e481c7b8a0c8908869")
- th.AssertEquals(t, n.RouterExternal, true)
th.AssertEquals(t, n.Shared, true)
th.AssertEquals(t, n.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
}
@@ -197,20 +173,7 @@
"name": "net1",
"admin_state_up": true,
"tenant_id": "9bacb3c5d39d41a79512987f338cf177",
- "segments": [
- {
- "provider:segmentation_id": 2,
- "provider:physical_network": "8bab8453-1bc9-45af-8c70-f83aa9b50453",
- "provider:network_type": "vlan"
- },
- {
- "provider:segmentation_id": null,
- "provider:physical_network": "8bab8453-1bc9-45af-8c70-f83aa9b50453",
- "provider:network_type": "stt"
- }
- ],
"shared": false,
- "port_security_enabled": true,
"id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c"
}
}
@@ -226,12 +189,7 @@
th.AssertEquals(t, n.Name, "net1")
th.AssertEquals(t, n.AdminStateUp, true)
th.AssertEquals(t, n.TenantID, "9bacb3c5d39d41a79512987f338cf177")
- th.AssertDeepEquals(t, n.Segments, []NetworkProvider{
- {ProviderSegmentationID: 2, ProviderPhysicalNetwork: "8bab8453-1bc9-45af-8c70-f83aa9b50453", ProviderNetworkType: "vlan"},
- {ProviderSegmentationID: 0, ProviderPhysicalNetwork: "8bab8453-1bc9-45af-8c70-f83aa9b50453", ProviderNetworkType: "stt"},
- })
th.AssertEquals(t, n.Shared, false)
- th.AssertEquals(t, n.PortSecurityEnabled, true)
th.AssertEquals(t, n.ID, "4e8e5957-649f-477b-9e5b-f1f75b21c03c")
}
@@ -292,14 +250,10 @@
"status": "ACTIVE",
"subnets": [],
"name": "new_network_name",
- "provider:physical_network": null,
"admin_state_up": false,
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
- "provider:network_type": "local",
- "router:external": false,
"shared": true,
- "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
- "provider:segmentation_id": null
+ "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c"
}
}
`)
diff --git a/openstack/networking/v2/networks/results.go b/openstack/networking/v2/networks/results.go
index 7f9e51a..03cfb31 100644
--- a/openstack/networking/v2/networks/results.go
+++ b/openstack/networking/v2/networks/results.go
@@ -5,13 +5,6 @@
"github.com/rackspace/gophercloud/pagination"
)
-// NetworkProvider represents provider extension data
-type NetworkProvider struct {
- ProviderSegmentationID int `json:"provider:segmentation_id"`
- ProviderPhysicalNetwork string `json:"provider:physical_network"`
- ProviderNetworkType string `json:"provider:network_type"`
-}
-
// Network represents, well, a network.
type Network struct {
// UUID for the network
@@ -29,18 +22,6 @@
TenantID string `mapstructure:"tenant_id" json:"tenant_id"`
// Specifies whether the network resource can be accessed by any tenant or not.
Shared bool `mapstructure:"shared" json:"shared"`
-
- ProviderSegmentationID int `mapstructure:"provider:segmentation_id" json:"provider:segmentation_id"`
- ProviderPhysicalNetwork string `mapstructure:"provider:physical_network" json:"provider:physical_network"`
- ProviderNetworkType string `mapstructure:"provider:network_type" json:"provider:network_type"`
- RouterExternal bool `mapstructure:"router:external" json:"router:external"`
-}
-
-// NetworkCreateResult represents what is returned by a create operation.
-type NetworkCreateResult struct {
- Network
- Segments []NetworkProvider `json:"segments"`
- PortSecurityEnabled bool `json:"port_security_enabled"`
}
// NetworkPage is the page returned by a pager when traversing over a
diff --git a/openstack/networking/v2/ports/requests_test.go b/openstack/networking/v2/ports/requests_test.go
index 83b0153..6f27e09 100644
--- a/openstack/networking/v2/ports/requests_test.go
+++ b/openstack/networking/v2/ports/requests_test.go
@@ -37,20 +37,11 @@
"status": "ACTIVE",
"binding:host_id": "devstack",
"name": "",
- "allowed_address_pairs": [],
"admin_state_up": true,
"network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",
"tenant_id": "",
- "extra_dhcp_opts": [],
- "binding:vif_details": {
- "port_filter": true,
- "ovs_hybrid_plug": true
- },
- "binding:vif_type": "ovs",
"device_owner": "network:router_gateway",
"mac_address": "fa:16:3e:58:42:ed",
- "binding:profile": {},
- "binding:vnic_type": "normal",
"fixed_ips": [
{
"subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062",
@@ -78,29 +69,22 @@
expected := []Port{
Port{
- Status: "ACTIVE",
- Name: "",
- AllowedAddressPairs: []interface{}(nil),
- AdminStateUp: true,
- NetworkID: "70c1db1f-b701-45bd-96e0-a313ee3430b3",
- TenantID: "",
- ExtraDHCPOpts: []interface{}{},
- DeviceOwner: "network:router_gateway",
- MACAddress: "fa:16:3e:58:42:ed",
+ Status: "ACTIVE",
+ Name: "",
+ AdminStateUp: true,
+ NetworkID: "70c1db1f-b701-45bd-96e0-a313ee3430b3",
+ TenantID: "",
+ DeviceOwner: "network:router_gateway",
+ MACAddress: "fa:16:3e:58:42:ed",
FixedIPs: []IP{
IP{
SubnetID: "008ba151-0b8c-4a67-98b5-0d2b87666062",
IPAddress: "172.24.4.2",
},
},
- ID: "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
- SecurityGroups: []string{},
- DeviceID: "9ae135f4-b6e0-4dad-9e91-3c223e385824",
- BindingHostID: "devstack",
- BindingVIFDetails: map[string]interface{}{"port_filter": true, "ovs_hybrid_plug": true},
- BindingVIFType: "ovs",
- BindingProfile: map[string]interface{}{},
- BindingVNICType: "normal",
+ ID: "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
+ SecurityGroups: []string{},
+ DeviceID: "9ae135f4-b6e0-4dad-9e91-3c223e385824",
},
}
@@ -129,22 +113,12 @@
{
"port": {
"status": "ACTIVE",
- "binding:host_id": "devstack",
"name": "",
- "allowed_address_pairs": [],
"admin_state_up": true,
"network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
"tenant_id": "7e02058126cc4950b75f9970368ba177",
- "extra_dhcp_opts": [],
- "binding:vif_details": {
- "port_filter": true,
- "ovs_hybrid_plug": true
- },
- "binding:vif_type": "ovs",
"device_owner": "network:router_interface",
"mac_address": "fa:16:3e:23:fd:d7",
- "binding:profile": {},
- "binding:vnic_type": "normal",
"fixed_ips": [
{
"subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
@@ -163,18 +137,12 @@
th.AssertNoErr(t, err)
th.AssertEquals(t, n.Status, "ACTIVE")
- th.AssertEquals(t, n.BindingHostID, "devstack")
th.AssertEquals(t, n.Name, "")
- th.AssertDeepEquals(t, n.AllowedAddressPairs, []interface{}(nil))
th.AssertEquals(t, n.AdminStateUp, true)
th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7")
th.AssertEquals(t, n.TenantID, "7e02058126cc4950b75f9970368ba177")
- th.AssertDeepEquals(t, n.ExtraDHCPOpts, []interface{}{})
- th.AssertDeepEquals(t, n.BindingVIFDetails, map[string]interface{}{"port_filter": true, "ovs_hybrid_plug": true})
th.AssertEquals(t, n.DeviceOwner, "network:router_interface")
th.AssertEquals(t, n.MACAddress, "fa:16:3e:23:fd:d7")
- th.AssertDeepEquals(t, n.BindingProfile, map[string]interface{}{})
- th.AssertEquals(t, n.BindingVNICType, "normal")
th.AssertDeepEquals(t, n.FixedIPs, []IP{
IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.1"},
})
@@ -210,18 +178,13 @@
{
"port": {
"status": "DOWN",
- "binding:host_id": "",
"name": "private-port",
"allowed_address_pairs": [],
"admin_state_up": true,
"network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
- "binding:vif_details": {},
- "binding:vnic_type": "normal",
- "binding:vif_type": "unbound",
"device_owner": "",
"mac_address": "fa:16:3e:c9:cb:f0",
- "binding:profile": {},
"fixed_ips": [
{
"subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
@@ -244,24 +207,17 @@
th.AssertNoErr(t, err)
th.AssertEquals(t, n.Status, "DOWN")
- th.AssertEquals(t, n.BindingHostID, "")
th.AssertEquals(t, n.Name, "private-port")
- th.AssertDeepEquals(t, n.AllowedAddressPairs, []interface{}(nil))
th.AssertEquals(t, n.AdminStateUp, true)
th.AssertEquals(t, n.NetworkID, "a87cc70a-3e15-4acf-8205-9b711a3531b7")
th.AssertEquals(t, n.TenantID, "d6700c0c9ffa4f1cb322cd4a1f3906fa")
- th.AssertDeepEquals(t, n.BindingVIFDetails, map[string]interface{}{})
th.AssertEquals(t, n.DeviceOwner, "")
th.AssertEquals(t, n.MACAddress, "fa:16:3e:c9:cb:f0")
- th.AssertDeepEquals(t, n.BindingProfile, map[string]interface{}{})
- th.AssertEquals(t, n.BindingVNICType, "normal")
- th.AssertEquals(t, n.BindingVIFType, "unbound")
th.AssertDeepEquals(t, n.FixedIPs, []IP{
IP{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.2"},
})
th.AssertEquals(t, n.ID, "65c0ee9f-d634-4522-8954-51021b570b0d")
th.AssertDeepEquals(t, n.SecurityGroups, []string{"f0ac4394-7e4a-4409-9701-ba8be283dbc3"})
- th.AssertEquals(t, n.DeviceID, "")
}
func TestUpdate(t *testing.T) {
@@ -297,18 +253,12 @@
{
"port": {
"status": "DOWN",
- "binding:host_id": "",
"name": "new_port_name",
- "allowed_address_pairs": [],
"admin_state_up": true,
"network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
- "binding:vif_details": {},
- "binding:vnic_type": "normal",
- "binding:vif_type": "unbound",
"device_owner": "",
"mac_address": "fa:16:3e:c9:cb:f0",
- "binding:profile": {},
"fixed_ips": [
{
"subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
diff --git a/openstack/networking/v2/ports/results.go b/openstack/networking/v2/ports/results.go
index cddb58d..c190ad2 100644
--- a/openstack/networking/v2/ports/results.go
+++ b/openstack/networking/v2/ports/results.go
@@ -38,14 +38,6 @@
SecurityGroups []string `mapstructure:"security_groups" json:"security_groups"`
// Identifies the device (e.g., virtual server) using this port.
DeviceID string `mapstructure:"device_id" json:"device_id"`
-
- AllowedAddressPairs []interface{} `mapstructure:"allowed" json:"allowed"`
- ExtraDHCPOpts interface{} `mapstructure:"extra_dhcp_opts" json:"extra_dhcp_opts"`
- BindingHostID string `mapstructure:"binding:host_id" json:"binding:host_id"`
- BindingVIFDetails interface{} `mapstructure:"binding:vif_details" json:"binding:vif_details"`
- BindingVIFType string `mapstructure:"binding:vif_type" json:"binding:vif_type"`
- BindingProfile interface{} `mapstructure:"binding:profile" json:"binding:profile"`
- BindingVNICType string `mapstructure:"binding:vnic_type" json:"binding:vnic_type"`
}
// PortPage is the page returned by a pager when traversing over a collection
diff --git a/openstack/networking/v2/subnets/requests_test.go b/openstack/networking/v2/subnets/requests_test.go
index 63e9cc2..b2b4d38 100644
--- a/openstack/networking/v2/subnets/requests_test.go
+++ b/openstack/networking/v2/subnets/requests_test.go
@@ -99,7 +99,7 @@
End: "10.0.0.254",
},
},
- HostRoutes: []interface{}{},
+ HostRoutes: []HostRoute{},
IPVersion: 4,
GatewayIP: "10.0.0.1",
CIDR: "10.0.0.0/24",
@@ -117,7 +117,7 @@
End: "192.255.255.254",
},
},
- HostRoutes: []interface{}{},
+ HostRoutes: []HostRoute{},
IPVersion: 4,
GatewayIP: "192.0.0.1",
CIDR: "192.0.0.0/8",
@@ -184,7 +184,7 @@
End: "192.255.255.254",
},
})
- th.AssertDeepEquals(t, s.HostRoutes, []interface{}{})
+ th.AssertDeepEquals(t, s.HostRoutes, []HostRoute{})
th.AssertEquals(t, s.IPVersion, 4)
th.AssertEquals(t, s.GatewayIP, "192.0.0.1")
th.AssertEquals(t, s.CIDR, "192.0.0.0/8")
@@ -252,7 +252,7 @@
End: "192.168.199.254",
},
})
- th.AssertDeepEquals(t, s.HostRoutes, []interface{}{})
+ th.AssertDeepEquals(t, s.HostRoutes, []HostRoute{})
th.AssertEquals(t, s.IPVersion, 4)
th.AssertEquals(t, s.GatewayIP, "192.168.199.1")
th.AssertEquals(t, s.CIDR, "192.168.199.0/24")
diff --git a/openstack/networking/v2/subnets/results.go b/openstack/networking/v2/subnets/results.go
index f89bb3b..ead2172 100644
--- a/openstack/networking/v2/subnets/results.go
+++ b/openstack/networking/v2/subnets/results.go
@@ -5,12 +5,20 @@
"github.com/rackspace/gophercloud/pagination"
)
-// AllocationPool is a sub-struct that represents an allocation pool
+// AllocationPool represents a sub-range of cidr available for dynamic
+// allocation to ports, e.g. {Start: "10.0.0.2", End: "10.0.0.254"}
type AllocationPool struct {
Start string `json:"start"`
End string `json:"end"`
}
+// HostRoute represents a route that should be used by devices with IPs from
+// a subnet (not including local subnet route).
+type HostRoute struct {
+ DestinationCIDR string `json:"destination"`
+ NextHop string `json:"nexthop"`
+}
+
// Subnet represents a subnet. See package documentation for a top-level
// description of what this is.
type Subnet struct {
@@ -31,7 +39,7 @@
// Sub-ranges of CIDR available for dynamic allocation to ports. See AllocationPool.
AllocationPools []AllocationPool `mapstructure:"allocation_pools" json:"allocation_pools"`
// Routes that should be used by devices with IPs from this subnet (not including local subnet route).
- HostRoutes []interface{} `mapstructure:"host_routes" json:"host_routes"`
+ HostRoutes []HostRoute `mapstructure:"host_routes" json:"host_routes"`
// Specifies whether DHCP is enabled for this subnet or not.
EnableDHCP bool `mapstructure:"enable_dhcp" json:"enable_dhcp"`
// Owner of network. Only admin users can specify a tenant_id other than its own.