Exemplo n.º 1
0
    def test_create_subnet_empty_name(self):
        """
        Tests the neutron_utils.create_neutron_net() function with an empty name
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        neutron_utils.create_subnet(self.neutron, self.net_config.subnet_settings, network=self.network)
        validate_subnet(self.neutron, '', self.net_config.subnet_cidr, True)
Exemplo n.º 2
0
    def test_create_subnet_empty_cidr(self):
        """
        Tests the neutron_utils.create_neutron_subnet() function for an Exception when the subnet CIDR value is empty
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        with self.assertRaises(Exception):
            sub_sets = create_network.SubnetSettings(cidr='', name=self.net_config.subnet_name)
            neutron_utils.create_subnet(self.neutron, sub_sets, network=self.network)
Exemplo n.º 3
0
    def test_create_subnet_null_name(self):
        """
        Tests the neutron_utils.create_neutron_subnet() function for an Exception when the subnet name is None
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        sub_sets = create_network.SubnetSettings(cidr=self.net_config.subnet_cidr)
        self.subnet = neutron_utils.create_subnet(self.neutron, sub_sets, network=self.network)
        validate_subnet(self.neutron, self.net_config.subnet_name, self.net_config.subnet_cidr, True)
Exemplo n.º 4
0
    def test_create_port_invalid_ip_to_subnet(self):
        """
        Tests the neutron_utils.create_port() function for an Exception when the IP value is None
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        self.subnet = neutron_utils.create_subnet(self.neutron, self.net_config.subnet_settings, self.network)
        validate_subnet(self.neutron, self.net_config.subnet_name, self.net_config.subnet_cidr, True)

        with self.assertRaises(Exception):
            self.port = neutron_utils.create_port(self.neutron, port_name, self.network, '10.197.123.100')
Exemplo n.º 5
0
    def test_create_port_null_network_object(self):
        """
        Tests the neutron_utils.create_port() function for an Exception when the network object is None
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        self.subnet = neutron_utils.create_subnet(self.neutron, self.net_config.subnet_settings, self.network)
        validate_subnet(self.neutron, self.net_config.subnet_name, self.net_config.subnet_cidr, True)

        with self.assertRaises(Exception):
            self.port = neutron_utils.create_port(self.neutron, port_name, None, ip_1)
Exemplo n.º 6
0
    def test_create_port_empty_name(self):
        """
        Tests the neutron_utils.create_port() function
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        self.subnet = neutron_utils.create_subnet(self.neutron, self.net_config.subnet_settings, self.network)
        validate_subnet(self.neutron, self.net_config.subnet_name, self.net_config.subnet_cidr, True)

        self.port = neutron_utils.create_port(self.neutron, create_network.PortSettings(ip_address=ip_1), self.network)
        validate_port(self.neutron, port_name, True)
Exemplo n.º 7
0
    def test_add_interface_router_null_router(self):
        """
        Tests the neutron_utils.add_interface_router() function for an Exception when the router value is None
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        self.subnet = neutron_utils.create_subnet(self.neutron, self.net_config.subnet_settings, self.network)
        validate_subnet(self.neutron, self.net_config.subnet_name, self.net_config.subnet_cidr, True)

        with self.assertRaises(Exception):
            self.interface_router = neutron_utils.add_interface_router(self.neutron, self.router, self.subnet)
Exemplo n.º 8
0
    def test_add_interface_router(self):
        """
        Tests the neutron_utils.add_interface_router() function
        """
        self.network = neutron_utils.create_network(self.neutron, self.net_config.network_settings)
        self.assertEqual(self.net_config.net_name, self.network['network']['name'])
        self.assertTrue(validate_network(self.neutron, self.net_config.net_name, True))

        self.subnet = neutron_utils.create_subnet(self.neutron, self.net_config.subnet_settings, self.network)
        validate_subnet(self.neutron, self.net_config.subnet_name, self.net_config.subnet_cidr, True)

        self.router = neutron_utils.create_router(self.neutron, self.net_config.router_settings)
        validate_router(self.neutron, self.net_config.router_name, True)

        self.interface_router = neutron_utils.add_interface_router(self.neutron, self.router, self.subnet)
        validate_interface_router(self.interface_router, self.router, self.subnet)