Beispiel #1
0
    def setUp(self):
        super(NetworkCommandsTestCase, self).setUp()
        self.commands = manage.NetworkCommands()
        self.net = {
            'id': 0,
            'label': 'fake',
            'injected': False,
            'cidr': '192.168.0.0/24',
            'cidr_v6': 'dead:beef::/64',
            'multi_host': False,
            'gateway_v6': 'dead:beef::1',
            'netmask_v6': '64',
            'netmask': '255.255.255.0',
            'bridge': 'fa0',
            'bridge_interface': 'fake_fa0',
            'gateway': '192.168.0.1',
            'broadcast': '192.168.0.255',
            'dns1': '8.8.8.8',
            'dns2': '8.8.4.4',
            'vlan': 200,
            'vlan_start': 201,
            'vpn_public_address': '10.0.0.2',
            'vpn_public_port': '2222',
            'vpn_private_address': '192.168.0.2',
            'dhcp_start': '192.168.0.3',
            'project_id': 'fake_project',
            'host': 'fake_host',
            'uuid': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
        }

        def fake_network_get_by_cidr(context, cidr):
            self.assertTrue(context.to_dict()['is_admin'])
            self.assertEqual(cidr, self.fake_net['cidr'])
            return db_fakes.FakeModel(
                dict(test_network.fake_network, **self.fake_net))

        def fake_network_get_by_uuid(context, uuid):
            self.assertTrue(context.to_dict()['is_admin'])
            self.assertEqual(uuid, self.fake_net['uuid'])
            return db_fakes.FakeModel(
                dict(test_network.fake_network, **self.fake_net))

        def fake_network_update(context, network_id, values):
            self.assertTrue(context.to_dict()['is_admin'])
            self.assertEqual(network_id, self.fake_net['id'])
            self.assertEqual(values, self.fake_update_value)

        self.fake_network_get_by_cidr = fake_network_get_by_cidr
        self.fake_network_get_by_uuid = fake_network_get_by_uuid
        self.fake_network_update = fake_network_update
Beispiel #2
0
 def setUp(self):
     super(NeutronV2NetworkCommandsTestCase, self).setUp()
     self.flags(network_api_class='nova.network.neutronv2.api.API')
     self.commands = manage.NetworkCommands()
Beispiel #3
0
 def setUp(self):
     super(NeutronV2NetworkCommandsTestCase, self).setUp()
     self.flags(use_neutron=True)
     self.commands = manage.NetworkCommands()