vmware-nsx/vmware_nsx/tests/unit/nsx_v3/test_api_replay.py
Aaron Rosen b004985c24 NSX-v3: Initial framework for api-replay-mode
This patch includes the initial framework to allow existing
neutron deployments running different backends to be migrated
over to the nsx-v3 plugin. The main logic that is required to
do this is to allow the ability of an id to be specified for
a given resource. This patch makes this possible with the addition
of a new extension api-replay.

The reason why a new extension is needed is because the RESOURCE_MAP
is loaded after the plugin is loaded. Therefore, there is no way
for me to change the mapping directly in the plugin without creating
an extension to do so.

This patch also adds support for migrating the router-uplink and
floatingips which was missing in the previous patchset.

Here's an example output of the migration tool
running: http://codepad.org/I7x6Rq3u

Change-Id: I2ee9778374a8d137e06125f2732524c7c662c002
2016-06-01 09:41:44 -07:00

46 lines
2.0 KiB
Python

# Copyright (c) 2015 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from vmware_nsx.tests.unit.nsx_v3 import test_plugin
# FIXME(arosen): - these tests pass but seem to break the other tests
# as the attribute map doesn't get reset after each test class. I tried
# backing it up and restoring it here though that doesn't seem to be doing
# the trick either...
class TestApiReplay(test_plugin.NsxV3PluginTestCaseMixin):
def setUp(self, plugin=None, ext_mgr=None, service_plugins=None):
# enables api_replay_mode for these tests
super(TestApiReplay, self).setUp()
def test_create_port_specify_id(self):
self.skipTest("...fixme...")
specified_network_id = '555e762b-d7a1-4b44-b09b-2a34ada56c9f'
specified_port_id = 'e55e762b-d7a1-4b44-b09b-2a34ada56c9f'
network_res = self._create_network(self.fmt,
'test-network',
True,
arg_list=('id',),
id=specified_network_id)
network = self.deserialize(self.fmt, network_res)
self.assertEqual(specified_network_id, network['network']['id'])
port_res = self._create_port(self.fmt,
network['network']['id'],
arg_list=('id',),
id=specified_port_id)
port = self.deserialize(self.fmt, port_res)
self.assertEqual(specified_port_id, port['port']['id'])