Ejemplo n.º 1
0
class IPAddressTypeTests(TypeTestHelper, unittest.TestCase):
    type = types.IPAddress()

    def test_ipv4_address(self):
        self.assertConvertedValue('192.168.0.1', '192.168.0.1')

    def test_ipv6_address(self):
        self.assertConvertedValue('abcd:ef::1', 'abcd:ef::1')

    def test_strings(self):
        self.assertInvalid('')
        self.assertInvalid('foo')

    def test_numbers(self):
        self.assertInvalid(1)
        self.assertInvalid(-1)
        self.assertInvalid(3.14)
Ejemplo n.º 2
0
class IPv6AddressTypeTests(IPAddressTypeTests):
    type = types.IPAddress(6)

    def test_ipv4_address(self):
        self.assertInvalid('192.168.0.1')
Ejemplo n.º 3
0
class IPv4AddressTypeTests(IPAddressTypeTests):
    type = types.IPAddress(4)

    def test_ipv6_address(self):
        self.assertInvalid('abcd:ef::1')
Ejemplo n.º 4
0
 def __init__(self, type_name="interface address value", version=4):
     super(InterfaceAddress, self).__init__(type_name=type_name)
     self.version = version
     self.family = self.FAMILY_MAP[version]
     self.ip_address = types.IPAddress(version)
    'default_network_policy': ['default-domain', 'admin', 'default'],
    'default_allow_transit': True,
    'default_api_address': '127.0.0.1',
}


def set_default_net_name(value):
    conf['default_net_name'] = value
    conf['default_net'][2] = value
    conf['default_pool'][2] = value


_common_opts = [
    cfg.Opt(
        'ip_prefix',
        type=types.IPAddress(),
        help='IP address prefix of the floating ip network. Example: 10.0.0.0'
    ),
    cfg.IntOpt(
        'ip_prefix_len',
        help=
        'IP address prefix length of the floating ip network. Example: 24 for ip_prefix/24'
    ),
    cfg.Opt(
        'gateway',
        type=types.IPAddress(),
        help='Default gatway of the floating ip network. Example: 10.0.0.1'),
    cfg.Opt(
        'route_target',
        type=RouteTarget(),
        help=