Example #1
0
    def test_network_ipv6(self):
        network = Network.create(name='mixednetwork', ipv6_network='fc00::/7')
        self.assertTrue(network.href.startswith('http'))

        network = Network('mixednetwork')
        self.assertEqual(network.ipv6_network, 'fc00::/7')
        network.delete()
Example #2
0
    def testNetwork(self):
        # Invalid host bits
        with self.assertRaises(CreateElementFailed):
            Network.create('foonetwork', '12.1.1.1/24', 'comment')

        Network.create('foonetwork',
                       ipv4_network='12.1.1.0/24',
                       ipv6_network='2001:db8:abcd:12::/64')

        network = Network('foonetwork')
        self.assertEqual(network.ipv4_network, '12.1.1.0/24')
        self.assertEqual(network.ipv6_network, '2001:db8:abcd:12::/64')
        network.rename('foonetwork2')
        network = Network('foonetwork2')
        network.delete()

        # Not CIDR format
        with self.assertRaises(CreateElementFailed):
            Network.create('foonetwork', '12.1.1.0/255.255.255.0')