Skip to content

Commit

Permalink
Remove NewProviderAddress constructor
Browse files Browse the repository at this point in the history
Instead use the cleaner NewMachineAddress().AsProviderAddress
  • Loading branch information
jack-w-shaw committed Dec 13, 2021
1 parent 519f63f commit b990d0c
Show file tree
Hide file tree
Showing 46 changed files with 236 additions and 235 deletions.
2 changes: 1 addition & 1 deletion api/instancepoller/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (s *MachineSuite) TestSetProviderNetworkConfigSuccess(c *gc.C) {
cfg := network.InterfaceInfos{{
DeviceIndex: 0,
Addresses: []network.ProviderAddress{
network.NewProviderAddress("10.0.0.42", network.WithCIDR("10.0.0.0/24")),
network.NewMachineAddress("10.0.0.42", network.WithCIDR("10.0.0.0/24")).AsProviderAddress(),
},
}}
expectArgs := params.SetProviderNetworkConfig{
Expand Down
6 changes: 3 additions & 3 deletions api/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,12 +954,12 @@ func (s *provisionerContainerSuite) TestPrepareContainerInterfaceInfoSingleNIC(c
Disabled: false,
NoAutoStart: false,
ConfigType: "static",
Addresses: corenetwork.ProviderAddresses{corenetwork.NewProviderAddress(
Addresses: corenetwork.ProviderAddresses{corenetwork.NewMachineAddress(
"192.168.0.6", corenetwork.WithCIDR("192.168.0.5/24"), corenetwork.WithConfigType(corenetwork.ConfigStatic),
)},
).AsProviderAddress()},
DNSServers: corenetwork.NewProviderAddresses("8.8.8.8"),
DNSSearchDomains: []string{"mydomain"},
GatewayAddress: corenetwork.NewProviderAddress("192.168.0.1"),
GatewayAddress: corenetwork.NewMachineAddress("192.168.0.1").AsProviderAddress(),
Routes: []corenetwork.Route{{
DestinationCIDR: "10.0.0.0/16",
GatewayIP: "192.168.0.1",
Expand Down
6 changes: 3 additions & 3 deletions api/testing/apiaddresser.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func (s *APIAddresserTests) TestAPIHostPorts(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)

expectServerAddrs := []network.ProviderHostPorts{
{network.ProviderHostPort{ProviderAddress: network.NewProviderAddress("0.1.2.24"), NetPort: 999}},
{network.ProviderHostPort{ProviderAddress: network.NewProviderAddress("example.com"), NetPort: 1234}},
{network.ProviderHostPort{ProviderAddress: network.NewProviderAddress(ipv6Addr.Value), NetPort: 999}},
{network.ProviderHostPort{ProviderAddress: network.NewMachineAddress("0.1.2.24").AsProviderAddress(), NetPort: 999}},
{network.ProviderHostPort{ProviderAddress: network.NewMachineAddress("example.com").AsProviderAddress(), NetPort: 1234}},
{network.ProviderHostPort{ProviderAddress: network.NewMachineAddress(ipv6Addr.Value).AsProviderAddress(), NetPort: 999}},
}
expectServerAddrs[2][0].Scope = network.ScopeCloudLocal

Expand Down
48 changes: 24 additions & 24 deletions apiserver/common/networkingcommon/networkconfigapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,28 @@ func (s *networkConfigSuite) TestSetObservedNetworkConfigCallsApplyOperation(c *
InterfaceName: "lo",
InterfaceType: "loopback",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("127.0.0.1", network.WithCIDR("127.0.0.0/8")),
network.NewMachineAddress("127.0.0.1", network.WithCIDR("127.0.0.0/8")).AsProviderAddress(),
},
// This is a quirk of the transformation.
// Due to the way address type is derived, this is not equivalent
// to the provider address zero-value.
GatewayAddress: network.NewProviderAddress(""),
GatewayAddress: network.NewMachineAddress("").AsProviderAddress(),
}, {
InterfaceName: "eth0",
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f0",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.10.0.2", network.WithCIDR("0.10.0.0/24")),
network.NewMachineAddress("0.10.0.2", network.WithCIDR("0.10.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress(""),
GatewayAddress: network.NewMachineAddress("").AsProviderAddress(),
}, {
InterfaceName: "eth1",
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f1",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")),
network.NewMachineAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress(""),
GatewayAddress: network.NewMachineAddress("").AsProviderAddress(),
},
})
}
Expand Down Expand Up @@ -174,9 +174,9 @@ func (s *networkConfigSuite) TestSetObservedNetworkConfigFixesFanSubs(c *gc.C) {
MACAddress: "aa:bb:cc:dd:ee:f0",
// Gets the CIDR from the Fan segment.
Addresses: network.ProviderAddresses{
network.NewProviderAddress("10.10.10.2", network.WithCIDR("10.10.0.0/16")),
network.NewMachineAddress("10.10.10.2", network.WithCIDR("10.10.0.0/16")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress(""),
GatewayAddress: network.NewMachineAddress("").AsProviderAddress(),
},
})
}
Expand Down Expand Up @@ -270,36 +270,36 @@ func (s *networkConfigSuite) TestUpdateMachineLinkLayerOpMultipleAddressSuccess(
InterfaceName: "lo",
InterfaceType: "loopback",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("127.0.0.1", network.WithCIDR("127.0.0.0/8")),
network.NewMachineAddress("127.0.0.1", network.WithCIDR("127.0.0.0/8")).AsProviderAddress(),
},
}, {
// Existing device with new address.
InterfaceName: "eth0",
InterfaceType: "ethernet",
MACAddress: ethMAC,
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.10.0.2", network.WithCIDR("0.10.0.0/24")),
network.NewMachineAddress("0.10.0.2", network.WithCIDR("0.10.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("0.10.0.1"),
GatewayAddress: network.NewMachineAddress("0.10.0.1").AsProviderAddress(),
IsDefaultGateway: true,
}, {
// New device and addresses for eth1.
InterfaceName: "eth1",
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f1",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")),
network.NewMachineAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("0.20.0.1"),
GatewayAddress: network.NewMachineAddress("0.20.0.1").AsProviderAddress(),
}, {
// A duplicate is effectively ignored.
InterfaceName: "eth1",
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f1",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")),
network.NewMachineAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("0.20.0.1"),
GatewayAddress: network.NewMachineAddress("0.20.0.1").AsProviderAddress(),
},
}, false, s.state)

Expand Down Expand Up @@ -366,9 +366,9 @@ func (s *networkConfigSuite) TestUpdateMachineLinkLayerOpUnobservedParentNotRemo
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f1",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")),
network.NewMachineAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("0.20.0.1"),
GatewayAddress: network.NewMachineAddress("0.20.0.1").AsProviderAddress(),
ParentInterfaceName: "eth99",
Origin: network.OriginMachine,
},
Expand Down Expand Up @@ -401,25 +401,25 @@ func (s *networkConfigSuite) TestUpdateMachineLinkLayerOpNewSubnetsAdded(c *gc.C
InterfaceName: "lo",
InterfaceType: "loopback",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("127.0.0.1", network.WithCIDR("127.0.0.0/8")),
network.NewMachineAddress("127.0.0.1", network.WithCIDR("127.0.0.0/8")).AsProviderAddress(),
},
}, {
InterfaceName: "eth0",
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:ff",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.10.0.2", network.WithCIDR("0.10.0.0/24")),
network.NewMachineAddress("0.10.0.2", network.WithCIDR("0.10.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("0.10.0.1"),
GatewayAddress: network.NewMachineAddress("0.10.0.1").AsProviderAddress(),
IsDefaultGateway: true,
}, {
InterfaceName: "eth1",
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f1",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")),
network.NewMachineAddress("0.20.0.2", network.WithCIDR("0.20.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("0.20.0.1"),
GatewayAddress: network.NewMachineAddress("0.20.0.1").AsProviderAddress(),
},
}, true, s.state)

Expand Down Expand Up @@ -499,9 +499,9 @@ func (s *networkConfigSuite) TestUpdateMachineLinkLayerOpBridgedDeviceMovesAddre
InterfaceType: "bridge",
MACAddress: hwAddr,
Addresses: network.ProviderAddresses{
network.NewProviderAddress("10.0.0.6", network.WithCIDR("10.0.0.0/24")),
network.NewMachineAddress("10.0.0.6", network.WithCIDR("10.0.0.0/24")).AsProviderAddress(),
},
GatewayAddress: network.NewProviderAddress("10.0.0.1"),
GatewayAddress: network.NewMachineAddress("10.0.0.1").AsProviderAddress(),
Origin: network.OriginMachine,
},
}, false, s.state)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/facades/client/client/instanceconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (s *machineConfigSuite) TestMachineConfig(c *gc.C) {
InstanceId: instance.Id("1234"),
Nonce: "foo",
HardwareCharacteristics: hc,
Addrs: params.FromProviderAddresses(network.NewProviderAddress("1.2.3.4")),
Addrs: params.FromProviderAddresses(network.NewMachineAddress("1.2.3.4").AsProviderAddress()),
}
machines, err := s.APIState.Client().AddMachines([]params.AddMachineParams{apiParams})
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -80,7 +80,7 @@ func (s *machineConfigSuite) TestMachineConfigNoTools(c *gc.C) {
InstanceId: instance.Id("1234"),
Nonce: "foo",
HardwareCharacteristics: hc,
Addrs: params.FromProviderAddresses(network.NewProviderAddress("1.2.3.4")),
Addrs: params.FromProviderAddresses(network.NewMachineAddress("1.2.3.4").AsProviderAddress()),
}
machines, err := s.APIState.Client().AddMachines([]params.AddMachineParams{apiParams})
c.Assert(err, jc.ErrorIsNil)
Expand Down
6 changes: 3 additions & 3 deletions apiserver/params/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func InterfaceInfoFromNetworkConfig(configs []NetworkConfig) network.InterfaceIn
ShadowAddresses: ToProviderAddresses(v.ShadowAddresses...),
DNSServers: network.NewProviderAddresses(v.DNSServers...),
DNSSearchDomains: v.DNSSearchDomains,
GatewayAddress: network.NewProviderAddress(v.GatewayAddress),
GatewayAddress: network.NewMachineAddress(v.GatewayAddress).AsProviderAddress(),
Routes: routes,
IsDefaultGateway: v.IsDefaultGateway,
VirtualPortType: network.VirtualPortType(v.VirtualPortType),
Expand Down Expand Up @@ -334,11 +334,11 @@ func InterfaceInfoFromNetworkConfig(configs []NetworkConfig) network.InterfaceIn
// 2) For even older clients that do not populate Addresses.
if v.Address != "" {
result[i].Addresses = network.ProviderAddresses{
network.NewProviderAddress(
network.NewMachineAddress(
v.Address,
network.WithCIDR(v.CIDR),
network.WithConfigType(configType),
),
).AsProviderAddress(),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions apiserver/params/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ func (s *NetworkSuite) TestPortRangeConvenience(c *gc.C) {

func (s *NetworkSuite) TestProviderAddressConversion(c *gc.C) {
pAddrs := network.ProviderAddresses{
network.NewProviderAddress("1.2.3.4", network.WithScope(network.ScopeCloudLocal), network.WithCIDR("1.2.3.0/24")),
network.NewProviderAddress("1.2.3.5", network.WithScope(network.ScopeCloudLocal), network.WithSecondary(true)),
network.NewProviderAddress("2.3.4.5", network.WithScope(network.ScopePublic), network.WithConfigType("dhcp")),
network.NewMachineAddress("1.2.3.4", network.WithScope(network.ScopeCloudLocal), network.WithCIDR("1.2.3.0/24")).AsProviderAddress(),
network.NewMachineAddress("1.2.3.5", network.WithScope(network.ScopeCloudLocal), network.WithSecondary(true)).AsProviderAddress(),
network.NewMachineAddress("2.3.4.5", network.WithScope(network.ScopePublic), network.WithConfigType("dhcp")).AsProviderAddress(),
}
pAddrs[0].SpaceName = "test-space"
pAddrs[0].ProviderSpaceID = "666"
Expand Down Expand Up @@ -290,17 +290,17 @@ func (s *NetworkSuite) TestProviderHostPortConversion(c *gc.C) {
pHPs := []network.ProviderHostPorts{
{
{
ProviderAddress: network.NewProviderAddress("1.2.3.4", network.WithScope(network.ScopeCloudLocal)),
ProviderAddress: network.NewMachineAddress("1.2.3.4", network.WithScope(network.ScopeCloudLocal)).AsProviderAddress(),
NetPort: 1234,
},
{
ProviderAddress: network.NewProviderAddress("2.3.4.5", network.WithScope(network.ScopePublic)),
ProviderAddress: network.NewMachineAddress("2.3.4.5", network.WithScope(network.ScopePublic)).AsProviderAddress(),
NetPort: 2345,
},
},
{
{
ProviderAddress: network.NewProviderAddress("3.4.5.6", network.WithScope(network.ScopeCloudLocal)),
ProviderAddress: network.NewMachineAddress("3.4.5.6", network.WithScope(network.ScopeCloudLocal)).AsProviderAddress(),
NetPort: 3456,
},
},
Expand Down
16 changes: 8 additions & 8 deletions caas/kubernetes/provider/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3105,8 +3105,8 @@ func (s *K8sBrokerSuite) TestGetServiceSvcFoundNoWorkload(c *gc.C) {
&caas.Service{
Id: "uid-xxxxx",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("10.0.0.1", network.WithScope(network.ScopePublic)),
network.NewProviderAddress("host.com.au", network.WithScope(network.ScopePublic)),
network.NewMachineAddress("10.0.0.1", network.WithScope(network.ScopePublic)).AsProviderAddress(),
network.NewMachineAddress("host.com.au", network.WithScope(network.ScopePublic)).AsProviderAddress(),
},
},
s.mockStatefulSets.EXPECT().Get(gomock.Any(), "app-name", v1.GetOptions{}).
Expand Down Expand Up @@ -3196,8 +3196,8 @@ func (s *K8sBrokerSuite) assertGetServiceSvcFoundWithStatefulSet(c *gc.C, mode c
&caas.Service{
Id: "uid-xxxxx",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("10.0.0.1", network.WithScope(network.ScopePublic)),
network.NewProviderAddress("host.com.au", network.WithScope(network.ScopePublic)),
network.NewMachineAddress("10.0.0.1", network.WithScope(network.ScopePublic)).AsProviderAddress(),
network.NewMachineAddress("host.com.au", network.WithScope(network.ScopePublic)).AsProviderAddress(),
},
Scale: k8sutils.IntPtr(2),
Generation: pointer.Int64Ptr(1),
Expand Down Expand Up @@ -3288,8 +3288,8 @@ func (s *K8sBrokerSuite) assertGetServiceSvcFoundWithDeployment(c *gc.C, mode ca
&caas.Service{
Id: "uid-xxxxx",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("10.0.0.1", network.WithScope(network.ScopePublic)),
network.NewProviderAddress("host.com.au", network.WithScope(network.ScopePublic)),
network.NewMachineAddress("10.0.0.1", network.WithScope(network.ScopePublic)).AsProviderAddress(),
network.NewMachineAddress("host.com.au", network.WithScope(network.ScopePublic)).AsProviderAddress(),
},
Scale: k8sutils.IntPtr(2),
Generation: pointer.Int64Ptr(1),
Expand Down Expand Up @@ -3352,8 +3352,8 @@ func (s *K8sBrokerSuite) TestGetServiceSvcFoundWithDaemonSet(c *gc.C) {
&caas.Service{
Id: "uid-xxxxx",
Addresses: network.ProviderAddresses{
network.NewProviderAddress("10.0.0.1", network.WithScope(network.ScopePublic)),
network.NewProviderAddress("host.com.au", network.WithScope(network.ScopePublic)),
network.NewMachineAddress("10.0.0.1", network.WithScope(network.ScopePublic)).AsProviderAddress(),
network.NewMachineAddress("host.com.au", network.WithScope(network.ScopePublic)).AsProviderAddress(),
},
Scale: k8sutils.IntPtr(2),
Generation: pointer.Int64Ptr(1),
Expand Down
2 changes: 1 addition & 1 deletion caas/kubernetes/provider/utils/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func GetSvcAddresses(svc *core.Service, includeClusterIP bool) []network.Provide
appendUniqueAddrs := func(scope network.Scope, addrs ...string) {
for _, v := range addrs {
if v != "" && v != "None" && !addressExist(v) {
netAddrs = append(netAddrs, network.NewProviderAddress(v, network.WithScope(scope)))
netAddrs = append(netAddrs, network.NewMachineAddress(v, network.WithScope(scope)).AsProviderAddress())
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions cloudconfig/cloudinit/network_ubuntu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ func (s *NetworkUbuntuSuite) SetUpTest(c *gc.C) {
ConfigType: corenetwork.ConfigStatic,
NoAutoStart: false,
Addresses: corenetwork.ProviderAddresses{
corenetwork.NewProviderAddress("0.1.2.3", corenetwork.WithCIDR("0.1.2.0/24"))},
corenetwork.NewMachineAddress("0.1.2.3", corenetwork.WithCIDR("0.1.2.0/24")).AsProviderAddress()},
DNSServers: corenetwork.NewProviderAddresses("ns1.invalid", "ns2.invalid"),
DNSSearchDomains: []string{"foo", "bar"},
GatewayAddress: corenetwork.NewProviderAddress("0.1.2.1"),
GatewayAddress: corenetwork.NewMachineAddress("0.1.2.1").AsProviderAddress(),
MACAddress: "aa:bb:cc:dd:ee:f0",
MTU: 8317,
}, {
InterfaceName: "any1",
ConfigType: corenetwork.ConfigStatic,
NoAutoStart: false,
Addresses: corenetwork.ProviderAddresses{
corenetwork.NewProviderAddress("0.2.2.4", corenetwork.WithCIDR("0.2.2.0/24"))},
corenetwork.NewMachineAddress("0.2.2.4", corenetwork.WithCIDR("0.2.2.0/24")).AsProviderAddress()},
DNSServers: corenetwork.NewProviderAddresses("ns1.invalid", "ns2.invalid"),
DNSSearchDomains: []string{"foo", "bar"},
GatewayAddress: corenetwork.NewProviderAddress("0.2.2.1"),
GatewayAddress: corenetwork.NewMachineAddress("0.2.2.1").AsProviderAddress(),
MACAddress: "aa:bb:cc:dd:ee:f1",
Routes: []corenetwork.Route{{
DestinationCIDR: "0.5.6.0/24",
Expand Down Expand Up @@ -110,8 +110,8 @@ func (s *NetworkUbuntuSuite) SetUpTest(c *gc.C) {
MACAddress: "aa:bb:cc:dd:ee:f5",
NoAutoStart: false,
Addresses: corenetwork.ProviderAddresses{
corenetwork.NewProviderAddress("2001:db8::dead:beef", corenetwork.WithCIDR("2001:db8::/64"))},
GatewayAddress: corenetwork.NewProviderAddress("2001:db8::dead:f00"),
corenetwork.NewMachineAddress("2001:db8::dead:beef", corenetwork.WithCIDR("2001:db8::/64")).AsProviderAddress()},
GatewayAddress: corenetwork.NewMachineAddress("2001:db8::dead:f00").AsProviderAddress(),
}}

for _, version := range []string{
Expand Down
4 changes: 2 additions & 2 deletions container/broker/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ var fakeInterfaceInfo = corenetwork.InterfaceInfo{
MACAddress: "aa:bb:cc:dd:ee:ff",
InterfaceName: "dummy0",
Addresses: corenetwork.ProviderAddresses{
corenetwork.NewProviderAddress("0.1.2.3", corenetwork.WithCIDR("0.1.2.0/24")),
corenetwork.NewMachineAddress("0.1.2.3", corenetwork.WithCIDR("0.1.2.0/24")).AsProviderAddress(),
},
GatewayAddress: corenetwork.NewProviderAddress("0.1.2.1"),
GatewayAddress: corenetwork.NewMachineAddress("0.1.2.1").AsProviderAddress(),
// Explicitly set only DNSServers, but not DNSSearchDomains to test this is
// detected and the latter populated by parsing the fake resolv.conf created
// by patchResolvConf(). See LP bug http://pad.lv/1575940 for more info.
Expand Down
2 changes: 1 addition & 1 deletion container/lxd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (s *Server) ContainerAddresses(name string) ([]corenetwork.ProviderAddress,
continue
}
for _, addr := range net.Addresses {
netAddr := corenetwork.NewProviderAddress(addr.Address)
netAddr := corenetwork.NewMachineAddress(addr.Address).AsProviderAddress()
if netAddr.Scope == corenetwork.ScopeLinkLocal || netAddr.Scope == corenetwork.ScopeMachineLocal {
logger.Tracef("ignoring address %q for container %q", addr, name)
continue
Expand Down
2 changes: 1 addition & 1 deletion container/lxd/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (s *containerSuite) TestContainerAddresses(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)

expected := []corenetwork.ProviderAddress{
corenetwork.NewProviderAddress("10.0.8.173", corenetwork.WithScope(corenetwork.ScopeCloudLocal)),
corenetwork.NewMachineAddress("10.0.8.173", corenetwork.WithScope(corenetwork.ScopeCloudLocal)).AsProviderAddress(),
}
c.Check(addrs, gc.DeepEquals, expected)
}
Expand Down
2 changes: 1 addition & 1 deletion container/lxd/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (s *managerSuite) TestNetworkDevicesFromConfigWithParentDevice(c *gc.C) {
InterfaceType: "ethernet",
MACAddress: "aa:bb:cc:dd:ee:f0",
Addresses: corenetwork.ProviderAddresses{
corenetwork.NewProviderAddress("", corenetwork.WithCIDR("10.10.0.0/24")),
corenetwork.NewMachineAddress("", corenetwork.WithCIDR("10.10.0.0/24")).AsProviderAddress(),
},
}}

Expand Down
Loading

0 comments on commit b990d0c

Please sign in to comment.