Skip to content

Commit a81514f

Browse files
committed
Replace network.ProviderInterfaceInfo with its corenetwork equivalent
1 parent de695af commit a81514f

31 files changed

+291
-206
lines changed

api/machineundertaker/undertaker.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import (
99

1010
"github.com/juju/juju/api/base"
1111
"github.com/juju/juju/apiserver/params"
12-
corenetwork "github.com/juju/juju/core/network"
12+
"github.com/juju/juju/core/network"
1313
"github.com/juju/juju/core/watcher"
14-
"github.com/juju/juju/network"
1514
)
1615

1716
// NewWatcherFunc exists to let us test WatchMachineRemovals.
@@ -85,7 +84,7 @@ func (api *API) GetProviderInterfaceInfo(machine names.MachineTag) ([]network.Pr
8584
for i, info := range item.Interfaces {
8685
infos[i].InterfaceName = info.InterfaceName
8786
infos[i].MACAddress = info.MACAddress
88-
infos[i].ProviderId = corenetwork.Id(info.ProviderId)
87+
infos[i].ProviderId = network.Id(info.ProviderId)
8988
}
9089
return infos, nil
9190
}

api/machineundertaker/undertaker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"github.com/juju/juju/api/machineundertaker"
1515
"github.com/juju/juju/apiserver/common"
1616
"github.com/juju/juju/apiserver/params"
17+
"github.com/juju/juju/core/network"
1718
"github.com/juju/juju/core/watcher"
18-
"github.com/juju/juju/network"
1919
coretesting "github.com/juju/juju/testing"
2020
)
2121

apiserver/facades/controller/machineundertaker/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package machineundertaker
55

66
import (
7-
"github.com/juju/juju/network"
7+
"github.com/juju/juju/core/network"
88
"github.com/juju/juju/state"
99
)
1010

apiserver/facades/controller/machineundertaker/undertaker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/juju/juju/apiserver/common"
1212
"github.com/juju/juju/apiserver/facade"
1313
"github.com/juju/juju/apiserver/params"
14-
"github.com/juju/juju/network"
14+
"github.com/juju/juju/core/network"
1515
"github.com/juju/juju/state"
1616
"github.com/juju/juju/state/watcher"
1717
)

apiserver/facades/controller/machineundertaker/undertaker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/juju/juju/apiserver/facades/controller/machineundertaker"
1414
"github.com/juju/juju/apiserver/params"
1515
apiservertesting "github.com/juju/juju/apiserver/testing"
16-
"github.com/juju/juju/network"
16+
"github.com/juju/juju/core/network"
1717
"github.com/juju/juju/state"
1818
)
1919

environs/mocks/package_mock.go

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

environs/networking.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import (
88
"github.com/juju/names/v4"
99

1010
"github.com/juju/juju/core/instance"
11-
corenetwork "github.com/juju/juju/core/network"
11+
"github.com/juju/juju/core/network"
1212
"github.com/juju/juju/environs/context"
13-
"github.com/juju/juju/network"
1413
)
1514

1615
// SupportsNetworking is a convenience helper to check if an environment
@@ -20,16 +19,16 @@ var SupportsNetworking = supportsNetworking
2019

2120
// DefaultSpaceInfo should be passed into Networking.ProviderSpaceInfo
2221
// to get information about the default space.
23-
var DefaultSpaceInfo *corenetwork.SpaceInfo
22+
var DefaultSpaceInfo *network.SpaceInfo
2423

2524
// Networking interface defines methods that environments
2625
// with networking capabilities must implement.
2726
type Networking interface {
2827
// Subnets returns basic information about subnets known
2928
// by the provider for the environment.
3029
Subnets(
31-
ctx context.ProviderCallContext, inst instance.Id, subnetIds []corenetwork.Id,
32-
) ([]corenetwork.SubnetInfo, error)
30+
ctx context.ProviderCallContext, inst instance.Id, subnetIds []network.Id,
31+
) ([]network.SubnetInfo, error)
3332

3433
// SuperSubnets returns information about aggregated subnets - eg. global CIDR
3534
// for EC2 VPC.
@@ -41,7 +40,7 @@ type Networking interface {
4140
// but not all of the instances were found, the returned slice will
4241
// have some nil slots, and an ErrPartialInstances error will be
4342
// returned.
44-
NetworkInterfaces(ctx context.ProviderCallContext, ids []instance.Id) ([]corenetwork.InterfaceInfos, error)
43+
NetworkInterfaces(ctx context.ProviderCallContext, ids []instance.Id) ([]network.InterfaceInfos, error)
4544

4645
// SupportsSpaces returns whether the current environment supports
4746
// spaces. The returned error satisfies errors.IsNotSupported(),
@@ -56,7 +55,7 @@ type Networking interface {
5655
// Spaces returns a slice of network.SpaceInfo with info, including
5756
// details of all associated subnets, about all spaces known to the
5857
// provider that have subnets available.
59-
Spaces(ctx context.ProviderCallContext) ([]corenetwork.SpaceInfo, error)
58+
Spaces(ctx context.ProviderCallContext) ([]network.SpaceInfo, error)
6059

6160
// ProviderSpaceInfo returns the details of the space requested as
6261
// a ProviderSpaceInfo. This will contain everything needed to
@@ -77,7 +76,7 @@ type Networking interface {
7776
// authoritative. In that case the provider should collect up any
7877
// other information needed to determine routability and include
7978
// the passed-in space info in the ProviderSpaceInfo returned.
80-
ProviderSpaceInfo(ctx context.ProviderCallContext, space *corenetwork.SpaceInfo) (*ProviderSpaceInfo, error)
79+
ProviderSpaceInfo(ctx context.ProviderCallContext, space *network.SpaceInfo) (*ProviderSpaceInfo, error)
8180

8281
// AreSpacesRoutable returns whether the communication between the
8382
// two spaces can use cloud-local addresses.
@@ -91,7 +90,7 @@ type Networking interface {
9190
// AllocateContainerAddresses allocates a static address for each of the
9291
// container NICs in preparedInfo, hosted by the hostInstanceID. Returns the
9392
// network config including all allocated addresses on success.
94-
AllocateContainerAddresses(ctx context.ProviderCallContext, hostInstanceID instance.Id, containerTag names.MachineTag, preparedInfo corenetwork.InterfaceInfos) (corenetwork.InterfaceInfos, error)
93+
AllocateContainerAddresses(ctx context.ProviderCallContext, hostInstanceID instance.Id, containerTag names.MachineTag, preparedInfo network.InterfaceInfos) (network.InterfaceInfos, error)
9594

9695
// ReleaseContainerAddresses releases the previously allocated
9796
// addresses matching the interface details passed in.
@@ -106,7 +105,7 @@ type Networking interface {
106105
// - returns a subset based on public scope matching.
107106
// The address `Value` is then returned to the client,
108107
// which is just a string, so we do not actually leak a SpaceAddress.
109-
SSHAddresses(ctx context.ProviderCallContext, addresses corenetwork.SpaceAddresses) (corenetwork.SpaceAddresses, error)
108+
SSHAddresses(ctx context.ProviderCallContext, addresses network.SpaceAddresses) (network.SpaceAddresses, error)
110109
}
111110

112111
// NetworkingEnviron combines the standard Environ interface with the
@@ -161,7 +160,7 @@ func SupportsContainerAddresses(ctx context.ProviderCallContext, env BootstrapEn
161160
// ProviderSpaceInfo contains all the information about a space needed
162161
// by another environ to decide whether it can be routed to.
163162
type ProviderSpaceInfo struct {
164-
corenetwork.SpaceInfo
163+
network.SpaceInfo
165164

166165
// Cloud type governs what attributes will exist in the
167166
// provider-specific map.

environs/space/environs_mock_test.go

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

environs/testing/package_mock.go

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

network/network.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,6 @@ type NetworkInfo struct {
7272
Addresses []InterfaceAddress
7373
}
7474

75-
// ProviderInterfaceInfo holds enough information to identify an
76-
// interface or link layer device to a provider so that it can be
77-
// queried or manipulated. Its initial purpose is to pass to
78-
// provider.ReleaseContainerAddresses.
79-
type ProviderInterfaceInfo struct {
80-
// InterfaceName is the raw OS-specific network device name (e.g.
81-
// "eth1", even for a VLAN eth1.42 virtual interface).
82-
InterfaceName string
83-
84-
// ProviderId is a provider-specific NIC id.
85-
ProviderId corenetwork.Id
86-
87-
// MACAddress is the network interface's hardware MAC address
88-
// (e.g. "aa:bb:cc:dd:ee:ff").
89-
MACAddress string
90-
}
91-
9275
// DeviceToBridge gives the information about a particular device that
9376
// should be bridged.
9477
type DeviceToBridge struct {

provider/dummy/environs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ func (e *environ) AllocateContainerAddresses(ctx context.ProviderCallContext, ho
19321932
return nil, errors.NotSupportedf("container address allocation")
19331933
}
19341934

1935-
func (e *environ) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []network.ProviderInterfaceInfo) error {
1935+
func (e *environ) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []corenetwork.ProviderInterfaceInfo) error {
19361936
return errors.NotSupportedf("container address allocation")
19371937
}
19381938

provider/ec2/environ.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ func (e *environ) AllocateContainerAddresses(ctx context.ProviderCallContext, ho
22672267
return nil, errors.NotSupportedf("container address allocation")
22682268
}
22692269

2270-
func (e *environ) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []network.ProviderInterfaceInfo) error {
2270+
func (e *environ) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []corenetwork.ProviderInterfaceInfo) error {
22712271
return errors.NotSupportedf("container address allocation")
22722272
}
22732273

provider/gce/environ_network.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/juju/juju/environs"
1818
"github.com/juju/juju/environs/context"
1919
"github.com/juju/juju/environs/instances"
20-
"github.com/juju/juju/network"
2120
"github.com/juju/juju/provider/gce/google"
2221
)
2322

@@ -346,7 +345,7 @@ func (e *environ) AllocateContainerAddresses(context.ProviderCallContext, instan
346345
}
347346

348347
// ReleaseContainerAddresses implements environs.NetworkingEnviron.
349-
func (e *environ) ReleaseContainerAddresses(context.ProviderCallContext, []network.ProviderInterfaceInfo) error {
348+
func (e *environ) ReleaseContainerAddresses(context.ProviderCallContext, []corenetwork.ProviderInterfaceInfo) error {
350349
return errors.NotSupportedf("container addresses")
351350
}
352351

provider/maas/environ.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ func (env *maasEnviron) allocateContainerAddresses2(ctx context.ProviderCallCont
22562256
return interfaces, nil
22572257
}
22582258

2259-
func (env *maasEnviron) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []network.ProviderInterfaceInfo) error {
2259+
func (env *maasEnviron) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []corenetwork.ProviderInterfaceInfo) error {
22602260
macAddresses := make([]string, len(interfaces))
22612261
for i, info := range interfaces {
22622262
macAddresses[i] = info.MACAddress

provider/maas/environ_whitebox_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
envtesting "github.com/juju/juju/environs/testing"
3737
envtools "github.com/juju/juju/environs/tools"
3838
"github.com/juju/juju/juju/testing"
39-
"github.com/juju/juju/network"
4039
"github.com/juju/juju/provider/common"
4140
"github.com/juju/juju/storage"
4241
coretesting "github.com/juju/juju/testing"
@@ -999,7 +998,7 @@ func (s *environSuite) TestReleaseContainerAddresses(c *gc.C) {
999998

1000999
env := s.makeEnviron()
10011000
err := env.ReleaseContainerAddresses(s.callCtx,
1002-
[]network.ProviderInterfaceInfo{
1001+
[]corenetwork.ProviderInterfaceInfo{
10031002
{MACAddress: "mac1"},
10041003
{MACAddress: "mac3"},
10051004
{MACAddress: "mac4"},
@@ -1025,7 +1024,7 @@ func (s *environSuite) TestReleaseContainerAddresses_HandlesDupes(c *gc.C) {
10251024

10261025
env := s.makeEnviron()
10271026
err := env.ReleaseContainerAddresses(s.callCtx,
1028-
[]network.ProviderInterfaceInfo{
1027+
[]corenetwork.ProviderInterfaceInfo{
10291028
{MACAddress: "mac1"},
10301029
{MACAddress: "mac2"},
10311030
})

0 commit comments

Comments
 (0)