Example #1
0
func (s *networkSuite) TestExtractAddressesEmpty(c *gc.C) {
	s.NetworkInterface.AccessConfigs = nil
	s.NetworkInterface.NetworkIP = ""
	addresses := google.ExtractAddresses(&s.NetworkInterface)

	c.Check(addresses, gc.HasLen, 0)
}
Example #2
0
func (s *networkSuite) TestExtractAddresses(c *gc.C) {
	addresses := google.ExtractAddresses(&s.NetworkInterface)

	c.Check(addresses, jc.DeepEquals, []network.Address{{
		Value: "10.0.0.1",
		Type:  network.IPv4Address,
		Scope: network.ScopeCloudLocal,
	}})
}
Example #3
0
func (s *networkSuite) TestExtractAddressesExternal(c *gc.C) {
	s.NetworkInterface.NetworkIP = ""
	s.NetworkInterface.AccessConfigs[0].NatIP = "8.8.8.8"
	addresses := google.ExtractAddresses(&s.NetworkInterface)

	c.Check(addresses, jc.DeepEquals, []network.Address{{
		Value: "8.8.8.8",
		Type:  network.IPv4Address,
		Scope: network.ScopePublic,
	}})
}