provider/openstack: gophercloud migration: networking router

This commit is contained in:
Joe Topjian 2016-09-04 02:54:46 +00:00
parent 53bb3187fc
commit 2f957e24fe
6 changed files with 26 additions and 26 deletions

View File

@ -8,9 +8,9 @@ import (
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud" "github.com/gophercloud/gophercloud"
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
"github.com/rackspace/gophercloud/openstack/networking/v2/ports" "github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
) )
func resourceNetworkingRouterInterfaceV2() *schema.Resource { func resourceNetworkingRouterInterfaceV2() *schema.Resource {
@ -52,7 +52,7 @@ func resourceNetworkingRouterInterfaceV2Create(d *schema.ResourceData, meta inte
return fmt.Errorf("Error creating OpenStack networking client: %s", err) return fmt.Errorf("Error creating OpenStack networking client: %s", err)
} }
createOpts := routers.InterfaceOpts{ createOpts := routers.AddInterfaceOpts{
SubnetID: d.Get("subnet_id").(string), SubnetID: d.Get("subnet_id").(string),
PortID: d.Get("port_id").(string), PortID: d.Get("port_id").(string),
} }
@ -91,7 +91,7 @@ func resourceNetworkingRouterInterfaceV2Read(d *schema.ResourceData, meta interf
n, err := ports.Get(networkingClient, d.Id()).Extract() n, err := ports.Get(networkingClient, d.Id()).Extract()
if err != nil { if err != nil {
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) httpError, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return fmt.Errorf("Error retrieving OpenStack Neutron Router Interface: %s", err) return fmt.Errorf("Error retrieving OpenStack Neutron Router Interface: %s", err)
} }
@ -152,14 +152,14 @@ func waitForRouterInterfaceDelete(networkingClient *gophercloud.ServiceClient, d
log.Printf("[DEBUG] Attempting to delete OpenStack Router Interface %s.\n", routerInterfaceId) log.Printf("[DEBUG] Attempting to delete OpenStack Router Interface %s.\n", routerInterfaceId)
removeOpts := routers.InterfaceOpts{ removeOpts := routers.RemoveInterfaceOpts{
SubnetID: d.Get("subnet_id").(string), SubnetID: d.Get("subnet_id").(string),
PortID: d.Get("port_id").(string), PortID: d.Get("port_id").(string),
} }
r, err := ports.Get(networkingClient, routerInterfaceId).Extract() r, err := ports.Get(networkingClient, routerInterfaceId).Extract()
if err != nil { if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError) errCode, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return r, "ACTIVE", err return r, "ACTIVE", err
} }
@ -171,7 +171,7 @@ func waitForRouterInterfaceDelete(networkingClient *gophercloud.ServiceClient, d
_, err = routers.RemoveInterface(networkingClient, routerId, removeOpts).Extract() _, err = routers.RemoveInterface(networkingClient, routerId, removeOpts).Extract()
if err != nil { if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError) errCode, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return r, "ACTIVE", err return r, "ACTIVE", err
} }

View File

@ -7,10 +7,10 @@ import (
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
"github.com/rackspace/gophercloud/openstack/networking/v2/networks" "github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/rackspace/gophercloud/openstack/networking/v2/ports" "github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
"github.com/rackspace/gophercloud/openstack/networking/v2/subnets" "github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
) )
func TestAccNetworkingV2RouterInterface_basic_subnet(t *testing.T) { func TestAccNetworkingV2RouterInterface_basic_subnet(t *testing.T) {

View File

@ -6,8 +6,8 @@ import (
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud" "github.com/gophercloud/gophercloud"
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
) )
func resourceNetworkingRouterRouteV2() *schema.Resource { func resourceNetworkingRouterRouteV2() *schema.Resource {
@ -59,7 +59,7 @@ func resourceNetworkingRouterRouteV2Create(d *schema.ResourceData, meta interfac
n, err := routers.Get(networkingClient, routerId).Extract() n, err := routers.Get(networkingClient, routerId).Extract()
if err != nil { if err != nil {
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) httpError, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err) return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err)
} }
@ -121,7 +121,7 @@ func resourceNetworkingRouterRouteV2Read(d *schema.ResourceData, meta interface{
n, err := routers.Get(networkingClient, routerId).Extract() n, err := routers.Get(networkingClient, routerId).Extract()
if err != nil { if err != nil {
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) httpError, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err) return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err)
} }
@ -168,7 +168,7 @@ func resourceNetworkingRouterRouteV2Delete(d *schema.ResourceData, meta interfac
n, err := routers.Get(networkingClient, routerId).Extract() n, err := routers.Get(networkingClient, routerId).Extract()
if err != nil { if err != nil {
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) httpError, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err) return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err)
} }

View File

@ -7,9 +7,9 @@ import (
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
"github.com/rackspace/gophercloud/openstack/networking/v2/networks" "github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/rackspace/gophercloud/openstack/networking/v2/subnets" "github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
) )
func TestAccNetworkingV2RouterRoute_basic(t *testing.T) { func TestAccNetworkingV2RouterRoute_basic(t *testing.T) {

View File

@ -8,8 +8,8 @@ import (
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud" "github.com/gophercloud/gophercloud"
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
) )
func resourceNetworkingRouterV2() *schema.Resource { func resourceNetworkingRouterV2() *schema.Resource {
@ -171,7 +171,7 @@ func resourceNetworkingRouterV2Read(d *schema.ResourceData, meta interface{}) er
n, err := routers.Get(networkingClient, d.Id()).Extract() n, err := routers.Get(networkingClient, d.Id()).Extract()
if err != nil { if err != nil {
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) httpError, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err) return fmt.Errorf("Error retrieving OpenStack Neutron Router: %s", err)
} }
@ -276,7 +276,7 @@ func waitForRouterDelete(networkingClient *gophercloud.ServiceClient, routerId s
r, err := routers.Get(networkingClient, routerId).Extract() r, err := routers.Get(networkingClient, routerId).Extract()
if err != nil { if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError) errCode, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return r, "ACTIVE", err return r, "ACTIVE", err
} }
@ -288,7 +288,7 @@ func waitForRouterDelete(networkingClient *gophercloud.ServiceClient, routerId s
err = routers.Delete(networkingClient, routerId).ExtractErr() err = routers.Delete(networkingClient, routerId).ExtractErr()
if err != nil { if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError) errCode, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
if !ok { if !ok {
return r, "ACTIVE", err return r, "ACTIVE", err
} }

View File

@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/routers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
) )
func TestAccNetworkingV2Router_basic(t *testing.T) { func TestAccNetworkingV2Router_basic(t *testing.T) {