summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kurilin <akurilin@mirantis.com>2015-02-03 02:32:58 +0200
committerAndrey Kurilin <akurilin@mirantis.com>2015-02-04 17:40:46 +0200
commit0a60aae852d2688861d0b4ba097a1a00529f0611 (patch)
treeb08ba9344b88e38767f54c5d5c7366c2ef306608
parent4e76f9590b49c925703cbbf42d1e232725465eff (diff)
Rename v1_1 to v2
Module novaclient.v1_1 is used as implementation of V1.1, V2 and V3. Since future development(microversioning) will be done across V2, implementation should be done in appropriate module(to prevent misleading). Despite the fact that implementation for all versions are equal, discover method for contrib path worked only for v1.1. This patch fixes this bug and modifies shell tests to check all versions. Change-Id: Ib6798f4dfe177586302141f522dc593560ce6a5b
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Kevin L. Mitchell <kevin.mitchell@rackspace.com> Code-Review+2: Sean Dague <sean@dague.net> Workflow+1: Sean Dague <sean@dague.net> Submitted-by: Jenkins Submitted-at: Thu, 05 Feb 2015 00:17:20 +0000 Reviewed-on: https://review.openstack.org/149006 Project: openstack/python-novaclient Branch: refs/heads/master
-rw-r--r--README.rst4
-rw-r--r--doc/source/api.rst3
-rw-r--r--doc/source/conf.py6
-rw-r--r--doc/source/index.rst3
-rw-r--r--doc/source/shell.rst2
-rw-r--r--novaclient/client.py6
-rw-r--r--novaclient/shell.py16
-rw-r--r--novaclient/tests/unit/fixture_data/client.py12
-rw-r--r--novaclient/tests/unit/test_auth_plugins.py2
-rw-r--r--novaclient/tests/unit/test_base.py4
-rw-r--r--novaclient/tests/unit/test_client.py38
-rw-r--r--novaclient/tests/unit/v2/__init__.py (renamed from novaclient/tests/unit/v1_1/__init__.py)0
-rw-r--r--novaclient/tests/unit/v2/contrib/__init__.py (renamed from novaclient/tests/unit/v1_1/contrib/__init__.py)0
-rw-r--r--novaclient/tests/unit/v2/contrib/fakes.py (renamed from novaclient/tests/unit/v1_1/contrib/fakes.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py (renamed from novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_baremetal.py (renamed from novaclient/tests/unit/v1_1/contrib/test_baremetal.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_cells.py (renamed from novaclient/tests/unit/v1_1/contrib/test_cells.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_instance_actions.py (renamed from novaclient/tests/unit/v1_1/contrib/test_instance_actions.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_list_extensions.py (renamed from novaclient/tests/unit/v1_1/contrib/test_list_extensions.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_migrations.py (renamed from novaclient/tests/unit/v1_1/contrib/test_migrations.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_server_external_events.py (renamed from novaclient/tests/unit/v1_1/contrib/test_server_external_events.py)4
-rw-r--r--novaclient/tests/unit/v2/contrib/test_tenant_networks.py (renamed from novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py)4
-rw-r--r--novaclient/tests/unit/v2/fakes.py (renamed from novaclient/tests/unit/v1_1/fakes.py)2
-rw-r--r--novaclient/tests/unit/v2/test_agents.py (renamed from novaclient/tests/unit/v1_1/test_agents.py)2
-rw-r--r--novaclient/tests/unit/v2/test_aggregates.py (renamed from novaclient/tests/unit/v1_1/test_aggregates.py)2
-rw-r--r--novaclient/tests/unit/v2/test_auth.py (renamed from novaclient/tests/unit/v1_1/test_auth.py)2
-rw-r--r--novaclient/tests/unit/v2/test_availability_zone.py (renamed from novaclient/tests/unit/v1_1/test_availability_zone.py)4
-rw-r--r--novaclient/tests/unit/v2/test_certs.py (renamed from novaclient/tests/unit/v1_1/test_certs.py)2
-rw-r--r--novaclient/tests/unit/v2/test_client.py (renamed from novaclient/tests/unit/v1_1/test_client.py)2
-rw-r--r--novaclient/tests/unit/v2/test_cloudpipe.py (renamed from novaclient/tests/unit/v1_1/test_cloudpipe.py)2
-rw-r--r--novaclient/tests/unit/v2/test_fixed_ips.py (renamed from novaclient/tests/unit/v1_1/test_fixed_ips.py)0
-rw-r--r--novaclient/tests/unit/v2/test_flavor_access.py (renamed from novaclient/tests/unit/v1_1/test_flavor_access.py)4
-rw-r--r--novaclient/tests/unit/v2/test_flavors.py (renamed from novaclient/tests/unit/v1_1/test_flavors.py)4
-rw-r--r--novaclient/tests/unit/v2/test_floating_ip_dns.py (renamed from novaclient/tests/unit/v1_1/test_floating_ip_dns.py)2
-rw-r--r--novaclient/tests/unit/v2/test_floating_ip_pools.py (renamed from novaclient/tests/unit/v1_1/test_floating_ip_pools.py)2
-rw-r--r--novaclient/tests/unit/v2/test_floating_ips.py (renamed from novaclient/tests/unit/v1_1/test_floating_ips.py)2
-rw-r--r--novaclient/tests/unit/v2/test_floating_ips_bulk.py (renamed from novaclient/tests/unit/v1_1/test_floating_ips_bulk.py)2
-rw-r--r--novaclient/tests/unit/v2/test_fping.py (renamed from novaclient/tests/unit/v1_1/test_fping.py)2
-rw-r--r--novaclient/tests/unit/v2/test_hosts.py (renamed from novaclient/tests/unit/v1_1/test_hosts.py)2
-rw-r--r--novaclient/tests/unit/v2/test_hypervisors.py (renamed from novaclient/tests/unit/v1_1/test_hypervisors.py)0
-rw-r--r--novaclient/tests/unit/v2/test_images.py (renamed from novaclient/tests/unit/v1_1/test_images.py)2
-rw-r--r--novaclient/tests/unit/v2/test_keypairs.py (renamed from novaclient/tests/unit/v1_1/test_keypairs.py)2
-rw-r--r--novaclient/tests/unit/v2/test_limits.py (renamed from novaclient/tests/unit/v1_1/test_limits.py)2
-rw-r--r--novaclient/tests/unit/v2/test_networks.py (renamed from novaclient/tests/unit/v1_1/test_networks.py)2
-rw-r--r--novaclient/tests/unit/v2/test_quota_classes.py (renamed from novaclient/tests/unit/v1_1/test_quota_classes.py)2
-rw-r--r--novaclient/tests/unit/v2/test_quotas.py (renamed from novaclient/tests/unit/v1_1/test_quotas.py)0
-rw-r--r--novaclient/tests/unit/v2/test_security_group_rules.py (renamed from novaclient/tests/unit/v1_1/test_security_group_rules.py)2
-rw-r--r--novaclient/tests/unit/v2/test_security_groups.py (renamed from novaclient/tests/unit/v1_1/test_security_groups.py)2
-rw-r--r--novaclient/tests/unit/v2/test_server_groups.py (renamed from novaclient/tests/unit/v1_1/test_server_groups.py)2
-rw-r--r--novaclient/tests/unit/v2/test_servers.py (renamed from novaclient/tests/unit/v1_1/test_servers.py)2
-rw-r--r--novaclient/tests/unit/v2/test_services.py (renamed from novaclient/tests/unit/v1_1/test_services.py)4
-rw-r--r--novaclient/tests/unit/v2/test_shell.py (renamed from novaclient/tests/unit/v1_1/test_shell.py)52
-rw-r--r--novaclient/tests/unit/v2/test_usage.py (renamed from novaclient/tests/unit/v1_1/test_usage.py)4
-rw-r--r--novaclient/tests/unit/v2/test_volumes.py (renamed from novaclient/tests/unit/v1_1/test_volumes.py)4
-rw-r--r--novaclient/tests/unit/v2/testfile.txt (renamed from novaclient/tests/unit/v1_1/testfile.txt)0
-rw-r--r--novaclient/tests/unit/v2/utils.py (renamed from novaclient/tests/unit/v1_1/utils.py)0
-rw-r--r--novaclient/v1_1/__init__.py30
-rw-r--r--novaclient/v2/__init__.py16
-rw-r--r--novaclient/v2/agents.py (renamed from novaclient/v1_1/agents.py)0
-rw-r--r--novaclient/v2/aggregates.py (renamed from novaclient/v1_1/aggregates.py)0
-rw-r--r--novaclient/v2/availability_zones.py (renamed from novaclient/v1_1/availability_zones.py)0
-rw-r--r--novaclient/v2/certs.py (renamed from novaclient/v1_1/certs.py)0
-rw-r--r--novaclient/v2/client.py (renamed from novaclient/v1_1/client.py)66
-rw-r--r--novaclient/v2/cloudpipe.py (renamed from novaclient/v1_1/cloudpipe.py)0
-rw-r--r--novaclient/v2/contrib/__init__.py (renamed from novaclient/v1_1/contrib/__init__.py)0
-rw-r--r--novaclient/v2/contrib/assisted_volume_snapshots.py (renamed from novaclient/v1_1/contrib/assisted_volume_snapshots.py)0
-rw-r--r--novaclient/v2/contrib/baremetal.py (renamed from novaclient/v1_1/contrib/baremetal.py)0
-rw-r--r--novaclient/v2/contrib/cells.py (renamed from novaclient/v1_1/contrib/cells.py)0
-rw-r--r--novaclient/v2/contrib/deferred_delete.py (renamed from novaclient/v1_1/contrib/deferred_delete.py)0
-rw-r--r--novaclient/v2/contrib/host_evacuate.py (renamed from novaclient/v1_1/contrib/host_evacuate.py)0
-rw-r--r--novaclient/v2/contrib/host_evacuate_live.py (renamed from novaclient/v1_1/contrib/host_evacuate_live.py)0
-rw-r--r--novaclient/v2/contrib/host_servers_migrate.py (renamed from novaclient/v1_1/contrib/host_servers_migrate.py)0
-rw-r--r--novaclient/v2/contrib/instance_action.py (renamed from novaclient/v1_1/contrib/instance_action.py)0
-rw-r--r--novaclient/v2/contrib/list_extensions.py (renamed from novaclient/v1_1/contrib/list_extensions.py)0
-rw-r--r--novaclient/v2/contrib/metadata_extensions.py (renamed from novaclient/v1_1/contrib/metadata_extensions.py)2
-rw-r--r--novaclient/v2/contrib/migrations.py (renamed from novaclient/v1_1/contrib/migrations.py)0
-rw-r--r--novaclient/v2/contrib/server_external_events.py (renamed from novaclient/v1_1/contrib/server_external_events.py)0
-rw-r--r--novaclient/v2/contrib/tenant_networks.py (renamed from novaclient/v1_1/contrib/tenant_networks.py)0
-rw-r--r--novaclient/v2/fixed_ips.py (renamed from novaclient/v1_1/fixed_ips.py)0
-rw-r--r--novaclient/v2/flavor_access.py (renamed from novaclient/v1_1/flavor_access.py)0
-rw-r--r--novaclient/v2/flavors.py (renamed from novaclient/v1_1/flavors.py)0
-rw-r--r--novaclient/v2/floating_ip_dns.py (renamed from novaclient/v1_1/floating_ip_dns.py)0
-rw-r--r--novaclient/v2/floating_ip_pools.py (renamed from novaclient/v1_1/floating_ip_pools.py)0
-rw-r--r--novaclient/v2/floating_ips.py (renamed from novaclient/v1_1/floating_ips.py)0
-rw-r--r--novaclient/v2/floating_ips_bulk.py (renamed from novaclient/v1_1/floating_ips_bulk.py)0
-rw-r--r--novaclient/v2/fping.py (renamed from novaclient/v1_1/fping.py)0
-rw-r--r--novaclient/v2/hosts.py (renamed from novaclient/v1_1/hosts.py)0
-rw-r--r--novaclient/v2/hypervisors.py (renamed from novaclient/v1_1/hypervisors.py)0
-rw-r--r--novaclient/v2/images.py (renamed from novaclient/v1_1/images.py)0
-rw-r--r--novaclient/v2/keypairs.py (renamed from novaclient/v1_1/keypairs.py)0
-rw-r--r--novaclient/v2/limits.py (renamed from novaclient/v1_1/limits.py)0
-rw-r--r--novaclient/v2/networks.py (renamed from novaclient/v1_1/networks.py)0
-rw-r--r--novaclient/v2/quota_classes.py (renamed from novaclient/v1_1/quota_classes.py)0
-rw-r--r--novaclient/v2/quotas.py (renamed from novaclient/v1_1/quotas.py)0
-rw-r--r--novaclient/v2/security_group_default_rules.py (renamed from novaclient/v1_1/security_group_default_rules.py)0
-rw-r--r--novaclient/v2/security_group_rules.py (renamed from novaclient/v1_1/security_group_rules.py)0
-rw-r--r--novaclient/v2/security_groups.py (renamed from novaclient/v1_1/security_groups.py)0
-rw-r--r--novaclient/v2/server_groups.py (renamed from novaclient/v1_1/server_groups.py)0
-rw-r--r--novaclient/v2/servers.py (renamed from novaclient/v1_1/servers.py)2
-rw-r--r--novaclient/v2/services.py (renamed from novaclient/v1_1/services.py)0
-rw-r--r--novaclient/v2/shell.py (renamed from novaclient/v1_1/shell.py)6
-rw-r--r--novaclient/v2/usage.py (renamed from novaclient/v1_1/usage.py)0
-rw-r--r--novaclient/v2/versions.py (renamed from novaclient/v1_1/versions.py)0
-rw-r--r--novaclient/v2/virtual_interfaces.py (renamed from novaclient/v1_1/virtual_interfaces.py)0
-rw-r--r--novaclient/v2/volume_snapshots.py (renamed from novaclient/v1_1/volume_snapshots.py)0
-rw-r--r--novaclient/v2/volume_types.py (renamed from novaclient/v1_1/volume_types.py)0
-rw-r--r--novaclient/v2/volumes.py (renamed from novaclient/v1_1/volumes.py)0
107 files changed, 218 insertions, 156 deletions
diff --git a/README.rst b/README.rst
index 4b8b8bb..a7edf87 100644
--- a/README.rst
+++ b/README.rst
@@ -46,7 +46,7 @@ and the version of the API with ``--os-compute-api-version``. Or set them as
46an environment variables as well:: 46an environment variables as well::
47 47
48 export OS_AUTH_URL=http://example.com:8774/v1.1/ 48 export OS_AUTH_URL=http://example.com:8774/v1.1/
49 export OS_COMPUTE_API_VERSION=1.1 49 export OS_COMPUTE_API_VERSION=2
50 50
51If you are using Keystone, you need to set the OS_AUTH_URL to the keystone 51If you are using Keystone, you need to set the OS_AUTH_URL to the keystone
52endpoint:: 52endpoint::
@@ -69,7 +69,7 @@ There's also a complete Python API, but it has not yet been documented.
69To use with nova, with keystone as the authentication system:: 69To use with nova, with keystone as the authentication system::
70 70
71 # use v2.0 auth with http://example.com:5000/v2.0/") 71 # use v2.0 auth with http://example.com:5000/v2.0/")
72 >>> from novaclient.v1_1 import client 72 >>> from novaclient.v2 import client
73 >>> nt = client.Client(USER, PASS, TENANT, AUTH_URL, service_type="compute") 73 >>> nt = client.Client(USER, PASS, TENANT, AUTH_URL, service_type="compute")
74 >>> nt.flavors.list() 74 >>> nt.flavors.list()
75 [...] 75 [...]
diff --git a/doc/source/api.rst b/doc/source/api.rst
index e53f2a1..9db8172 100644
--- a/doc/source/api.rst
+++ b/doc/source/api.rst
@@ -60,5 +60,4 @@ For more information, see the reference:
60 :maxdepth: 2 60 :maxdepth: 2
61 61
62 ref/index 62 ref/index
63 ref/v1_1/index 63 ref/v2/index
64 ref/v3/index
diff --git a/doc/source/conf.py b/doc/source/conf.py
index d33aea2..61437fd 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -71,17 +71,13 @@ def gen_ref(ver, title, names):
71 "pkg": pkg, "name": name}) 71 "pkg": pkg, "name": name})
72 72
73gen_ref(None, "Exceptions", ["exceptions"]) 73gen_ref(None, "Exceptions", ["exceptions"])
74gen_ref("v1_1", "Version 1.1, Version 2 API Reference", 74gen_ref("v2", "Version 1.1, Version 2 API Reference, Version 3 API Reference",
75 ["flavors", "images", "servers", "hosts", "agents", "aggregates", 75 ["flavors", "images", "servers", "hosts", "agents", "aggregates",
76 "availability_zones", "certs", "fixed_ips", "floating_ip_pools", 76 "availability_zones", "certs", "fixed_ips", "floating_ip_pools",
77 "floating_ips", "hypervisors", "keypairs", "limits", "networks", 77 "floating_ips", "hypervisors", "keypairs", "limits", "networks",
78 "quota_classes", "quotas", "security_group_rules", 78 "quota_classes", "quotas", "security_group_rules",
79 "security_groups", "services", "virtual_interfaces", 79 "security_groups", "services", "virtual_interfaces",
80 "volume_snapshots", "volumes", "volume_types"]) 80 "volume_snapshots", "volumes", "volume_types"])
81gen_ref("v3", "Version 3 API Reference",
82 ["flavors", "hosts", "agents", "aggregates", "availability_zones",
83 "certs", "hypervisors", "images", "keypairs", "quotas",
84 "quotas_classes", "servers", "services"])
85 81
86# -- General configuration ---------------------------------------------------- 82# -- General configuration ----------------------------------------------------
87 83
diff --git a/doc/source/index.rst b/doc/source/index.rst
index eb551e1..9bd302b 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -25,8 +25,7 @@ Contents:
25 shell 25 shell
26 api 26 api
27 ref/index 27 ref/index
28 ref/v1_1/index 28 ref/v2/index
29 ref/v3/index
30 releases 29 releases
31 30
32Contributing 31Contributing
diff --git a/doc/source/shell.rst b/doc/source/shell.rst
index f02c159..52bcfb4 100644
--- a/doc/source/shell.rst
+++ b/doc/source/shell.rst
@@ -41,7 +41,7 @@ For example, in Bash you'd use::
41 export OS_PASSWORD=yadayadayada 41 export OS_PASSWORD=yadayadayada
42 export OS_TENANT_NAME=myproject 42 export OS_TENANT_NAME=myproject
43 export OS_AUTH_URL=http://... 43 export OS_AUTH_URL=http://...
44 export OS_COMPUTE_API_VERSION=1.1 44 export OS_COMPUTE_API_VERSION=2
45 45
46From there, all shell commands take the form:: 46From there, all shell commands take the form::
47 47
diff --git a/novaclient/client.py b/novaclient/client.py
index a44ade0..200d75c 100644
--- a/novaclient/client.py
+++ b/novaclient/client.py
@@ -773,9 +773,9 @@ def _construct_http_client(username=None, password=None, project_id=None,
773 773
774def get_client_class(version): 774def get_client_class(version):
775 version_map = { 775 version_map = {
776 '1.1': 'novaclient.v1_1.client.Client', 776 '1.1': 'novaclient.v2.client.Client',
777 '2': 'novaclient.v1_1.client.Client', 777 '2': 'novaclient.v2.client.Client',
778 '3': 'novaclient.v1_1.client.Client', 778 '3': 'novaclient.v2.client.Client',
779 } 779 }
780 try: 780 try:
781 client_path = version_map[str(version)] 781 client_path = version_map[str(version)]
diff --git a/novaclient/shell.py b/novaclient/shell.py
index 0cc6b43..940a01e 100644
--- a/novaclient/shell.py
+++ b/novaclient/shell.py
@@ -55,9 +55,9 @@ import novaclient.extension
55from novaclient.i18n import _ 55from novaclient.i18n import _
56from novaclient.openstack.common import cliutils 56from novaclient.openstack.common import cliutils
57from novaclient import utils 57from novaclient import utils
58from novaclient.v1_1 import shell as shell_v1_1 58from novaclient.v2 import shell as shell_v2
59 59
60DEFAULT_OS_COMPUTE_API_VERSION = "1.1" 60DEFAULT_OS_COMPUTE_API_VERSION = "2"
61DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL' 61DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL'
62# NOTE(cyeoh): Having the service type dependent on the API version 62# NOTE(cyeoh): Having the service type dependent on the API version
63# is pretty ugly, but we have to do this because traditionally the 63# is pretty ugly, but we have to do this because traditionally the
@@ -446,12 +446,12 @@ class OpenStackComputeShell(object):
446 446
447 try: 447 try:
448 actions_module = { 448 actions_module = {
449 '1.1': shell_v1_1, 449 '1.1': shell_v2,
450 '2': shell_v1_1, 450 '2': shell_v2,
451 '3': shell_v1_1, 451 '3': shell_v2,
452 }[version] 452 }[version]
453 except KeyError: 453 except KeyError:
454 actions_module = shell_v1_1 454 actions_module = shell_v2
455 455
456 self._find_actions(subparsers, actions_module) 456 self._find_actions(subparsers, actions_module)
457 self._find_actions(subparsers, self) 457 self._find_actions(subparsers, self)
@@ -491,6 +491,10 @@ class OpenStackComputeShell(object):
491 def _discover_via_contrib_path(self, version): 491 def _discover_via_contrib_path(self, version):
492 module_path = os.path.dirname(os.path.abspath(__file__)) 492 module_path = os.path.dirname(os.path.abspath(__file__))
493 version_str = "v%s" % version.replace('.', '_') 493 version_str = "v%s" % version.replace('.', '_')
494 # NOTE(akurilin): v1.1, v2 and v3 have one implementation, so
495 # we should discover contrib modules in one place.
496 if version_str in ["v1_1", "v3"]:
497 version_str = "v2"
494 ext_path = os.path.join(module_path, version_str, 'contrib') 498 ext_path = os.path.join(module_path, version_str, 'contrib')
495 ext_glob = os.path.join(ext_path, "*.py") 499 ext_glob = os.path.join(ext_path, "*.py")
496 500
diff --git a/novaclient/tests/unit/fixture_data/client.py b/novaclient/tests/unit/fixture_data/client.py
index c6ddad3..5f933b7 100644
--- a/novaclient/tests/unit/fixture_data/client.py
+++ b/novaclient/tests/unit/fixture_data/client.py
@@ -15,7 +15,7 @@ from keystoneclient.auth.identity import v2
15from keystoneclient import fixture 15from keystoneclient import fixture
16from keystoneclient import session 16from keystoneclient import session
17 17
18from novaclient.v1_1 import client as v1_1client 18from novaclient.v2 import client as v2client
19 19
20IDENTITY_URL = 'http://identityserver:5000/v2.0' 20IDENTITY_URL = 'http://identityserver:5000/v2.0'
21COMPUTE_URL = 'http://compute.host' 21COMPUTE_URL = 'http://compute.host'
@@ -51,10 +51,10 @@ class V1(fixtures.Fixture):
51 self.client = self.new_client() 51 self.client = self.new_client()
52 52
53 def new_client(self): 53 def new_client(self):
54 return v1_1client.Client(username='xx', 54 return v2client.Client(username='xx',
55 api_key='xx', 55 api_key='xx',
56 project_id='xx', 56 project_id='xx',
57 auth_url=self.identity_url) 57 auth_url=self.identity_url)
58 58
59 59
60class SessionV1(V1): 60class SessionV1(V1):
@@ -62,4 +62,4 @@ class SessionV1(V1):
62 def new_client(self): 62 def new_client(self):
63 self.session = session.Session() 63 self.session = session.Session()
64 self.session.auth = v2.Password(self.identity_url, 'xx', 'xx') 64 self.session.auth = v2.Password(self.identity_url, 'xx', 'xx')
65 return v1_1client.Client(session=self.session) 65 return v2client.Client(session=self.session)
diff --git a/novaclient/tests/unit/test_auth_plugins.py b/novaclient/tests/unit/test_auth_plugins.py
index 992077d..675102c 100644
--- a/novaclient/tests/unit/test_auth_plugins.py
+++ b/novaclient/tests/unit/test_auth_plugins.py
@@ -28,7 +28,7 @@ except ImportError:
28from novaclient import auth_plugin 28from novaclient import auth_plugin
29from novaclient import exceptions 29from novaclient import exceptions
30from novaclient.tests.unit import utils 30from novaclient.tests.unit import utils
31from novaclient.v1_1 import client 31from novaclient.v2 import client
32 32
33 33
34def mock_http_request(resp=None): 34def mock_http_request(resp=None):
diff --git a/novaclient/tests/unit/test_base.py b/novaclient/tests/unit/test_base.py
index d3fc6c7..b7bceb7 100644
--- a/novaclient/tests/unit/test_base.py
+++ b/novaclient/tests/unit/test_base.py
@@ -14,8 +14,8 @@
14from novaclient import base 14from novaclient import base
15from novaclient import exceptions 15from novaclient import exceptions
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v1_1 import fakes 17from novaclient.tests.unit.v2 import fakes
18from novaclient.v1_1 import flavors 18from novaclient.v2 import flavors
19 19
20 20
21cs = fakes.FakeClient() 21cs = fakes.FakeClient()
diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py
index f816115..2c7f7ea 100644
--- a/novaclient/tests/unit/test_client.py
+++ b/novaclient/tests/unit/test_client.py
@@ -24,7 +24,7 @@ import requests
24import novaclient.client 24import novaclient.client
25import novaclient.extension 25import novaclient.extension
26from novaclient.tests.unit import utils 26from novaclient.tests.unit import utils
27import novaclient.v1_1.client 27import novaclient.v2.client
28 28
29 29
30class ClientConnectionPoolTest(utils.TestCase): 30class ClientConnectionPoolTest(utils.TestCase):
@@ -138,57 +138,57 @@ class ClientTest(utils.TestCase):
138 138
139 def test_get_client_class_v3(self): 139 def test_get_client_class_v3(self):
140 output = novaclient.client.get_client_class('3') 140 output = novaclient.client.get_client_class('3')
141 self.assertEqual(output, novaclient.v1_1.client.Client) 141 self.assertEqual(output, novaclient.v2.client.Client)
142 142
143 def test_get_client_class_v2(self): 143 def test_get_client_class_v2(self):
144 output = novaclient.client.get_client_class('2') 144 output = novaclient.client.get_client_class('2')
145 self.assertEqual(output, novaclient.v1_1.client.Client) 145 self.assertEqual(output, novaclient.v2.client.Client)
146 146
147 def test_get_client_class_v2_int(self): 147 def test_get_client_class_v2_int(self):
148 output = novaclient.client.get_client_class(2) 148 output = novaclient.client.get_client_class(2)
149 self.assertEqual(output, novaclient.v1_1.client.Client) 149 self.assertEqual(output, novaclient.v2.client.Client)
150 150
151 def test_get_client_class_v1_1(self): 151 def test_get_client_class_v1_1(self):
152 output = novaclient.client.get_client_class('1.1') 152 output = novaclient.client.get_client_class('1.1')
153 self.assertEqual(output, novaclient.v1_1.client.Client) 153 self.assertEqual(output, novaclient.v2.client.Client)
154 154
155 def test_get_client_class_unknown(self): 155 def test_get_client_class_unknown(self):
156 self.assertRaises(novaclient.exceptions.UnsupportedVersion, 156 self.assertRaises(novaclient.exceptions.UnsupportedVersion,
157 novaclient.client.get_client_class, '0') 157 novaclient.client.get_client_class, '0')
158 158
159 def test_client_with_os_cache_enabled(self): 159 def test_client_with_os_cache_enabled(self):
160 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 160 cs = novaclient.v2.client.Client("user", "password", "project_id",
161 auth_url="foo/v2", os_cache=True) 161 auth_url="foo/v2", os_cache=True)
162 self.assertEqual(True, cs.os_cache) 162 self.assertEqual(True, cs.os_cache)
163 self.assertEqual(True, cs.client.os_cache) 163 self.assertEqual(True, cs.client.os_cache)
164 164
165 def test_client_with_os_cache_disabled(self): 165 def test_client_with_os_cache_disabled(self):
166 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 166 cs = novaclient.v2.client.Client("user", "password", "project_id",
167 auth_url="foo/v2", os_cache=False) 167 auth_url="foo/v2", os_cache=False)
168 self.assertEqual(False, cs.os_cache) 168 self.assertEqual(False, cs.os_cache)
169 self.assertEqual(False, cs.client.os_cache) 169 self.assertEqual(False, cs.client.os_cache)
170 170
171 def test_client_with_no_cache_enabled(self): 171 def test_client_with_no_cache_enabled(self):
172 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 172 cs = novaclient.v2.client.Client("user", "password", "project_id",
173 auth_url="foo/v2", no_cache=True) 173 auth_url="foo/v2", no_cache=True)
174 self.assertEqual(False, cs.os_cache) 174 self.assertEqual(False, cs.os_cache)
175 self.assertEqual(False, cs.client.os_cache) 175 self.assertEqual(False, cs.client.os_cache)
176 176
177 def test_client_with_no_cache_disabled(self): 177 def test_client_with_no_cache_disabled(self):
178 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 178 cs = novaclient.v2.client.Client("user", "password", "project_id",
179 auth_url="foo/v2", no_cache=False) 179 auth_url="foo/v2", no_cache=False)
180 self.assertEqual(True, cs.os_cache) 180 self.assertEqual(True, cs.os_cache)
181 self.assertEqual(True, cs.client.os_cache) 181 self.assertEqual(True, cs.client.os_cache)
182 182
183 def test_client_set_management_url_v1_1(self): 183 def test_client_set_management_url_v1_1(self):
184 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 184 cs = novaclient.v2.client.Client("user", "password", "project_id",
185 auth_url="foo/v2") 185 auth_url="foo/v2")
186 cs.set_management_url("blabla") 186 cs.set_management_url("blabla")
187 self.assertEqual("blabla", cs.client.management_url) 187 self.assertEqual("blabla", cs.client.management_url)
188 188
189 def test_client_get_reset_timings_v1_1(self): 189 def test_client_get_reset_timings_v1_1(self):
190 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 190 cs = novaclient.v2.client.Client("user", "password", "project_id",
191 auth_url="foo/v2") 191 auth_url="foo/v2")
192 self.assertEqual(0, len(cs.get_timings())) 192 self.assertEqual(0, len(cs.get_timings()))
193 cs.client.times.append("somevalue") 193 cs.client.times.append("somevalue")
194 self.assertEqual(1, len(cs.get_timings())) 194 self.assertEqual(1, len(cs.get_timings()))
@@ -201,8 +201,8 @@ class ClientTest(utils.TestCase):
201 def test_contextmanager_v1_1(self, mock_http_client): 201 def test_contextmanager_v1_1(self, mock_http_client):
202 fake_client = mock.Mock() 202 fake_client = mock.Mock()
203 mock_http_client.return_value = fake_client 203 mock_http_client.return_value = fake_client
204 with novaclient.v1_1.client.Client("user", "password", "project_id", 204 with novaclient.v2.client.Client("user", "password", "project_id",
205 auth_url="foo/v2"): 205 auth_url="foo/v2"):
206 pass 206 pass
207 self.assertTrue(fake_client.open_session.called) 207 self.assertTrue(fake_client.open_session.called)
208 self.assertTrue(fake_client.close_session.called) 208 self.assertTrue(fake_client.close_session.called)
diff --git a/novaclient/tests/unit/v1_1/__init__.py b/novaclient/tests/unit/v2/__init__.py
index e69de29..e69de29 100644
--- a/novaclient/tests/unit/v1_1/__init__.py
+++ b/novaclient/tests/unit/v2/__init__.py
diff --git a/novaclient/tests/unit/v1_1/contrib/__init__.py b/novaclient/tests/unit/v2/contrib/__init__.py
index e69de29..e69de29 100644
--- a/novaclient/tests/unit/v1_1/contrib/__init__.py
+++ b/novaclient/tests/unit/v2/contrib/__init__.py
diff --git a/novaclient/tests/unit/v1_1/contrib/fakes.py b/novaclient/tests/unit/v2/contrib/fakes.py
index e961ae1..8703395 100644
--- a/novaclient/tests/unit/v1_1/contrib/fakes.py
+++ b/novaclient/tests/unit/v2/contrib/fakes.py
@@ -12,8 +12,8 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15from novaclient.tests.unit.v1_1 import fakes 15from novaclient.tests.unit.v2 import fakes
16from novaclient.v1_1 import client 16from novaclient.v2 import client
17 17
18 18
19class FakeClient(fakes.FakeClient): 19class FakeClient(fakes.FakeClient):
diff --git a/novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py b/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py
index 37f584c..8ab732a 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py
+++ b/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py
@@ -18,8 +18,8 @@ Assisted volume snapshots - to be used by Cinder and not end users.
18 18
19from novaclient import extension 19from novaclient import extension
20from novaclient.tests.unit import utils 20from novaclient.tests.unit import utils
21from novaclient.tests.unit.v1_1.contrib import fakes 21from novaclient.tests.unit.v2.contrib import fakes
22from novaclient.v1_1.contrib import assisted_volume_snapshots as assisted_snaps 22from novaclient.v2.contrib import assisted_volume_snapshots as assisted_snaps
23 23
24 24
25extensions = [ 25extensions = [
diff --git a/novaclient/tests/unit/v1_1/contrib/test_baremetal.py b/novaclient/tests/unit/v2/contrib/test_baremetal.py
index 1866eea..a5ee414 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_baremetal.py
+++ b/novaclient/tests/unit/v2/contrib/test_baremetal.py
@@ -16,8 +16,8 @@
16 16
17from novaclient import extension 17from novaclient import extension
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.tests.unit.v1_1.contrib import fakes 19from novaclient.tests.unit.v2.contrib import fakes
20from novaclient.v1_1.contrib import baremetal 20from novaclient.v2.contrib import baremetal
21 21
22 22
23extensions = [ 23extensions = [
diff --git a/novaclient/tests/unit/v1_1/contrib/test_cells.py b/novaclient/tests/unit/v2/contrib/test_cells.py
index ccdcd37..e411502 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_cells.py
+++ b/novaclient/tests/unit/v2/contrib/test_cells.py
@@ -15,8 +15,8 @@
15 15
16from novaclient import extension 16from novaclient import extension
17from novaclient.tests.unit import utils 17from novaclient.tests.unit import utils
18from novaclient.tests.unit.v1_1.contrib import fakes 18from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v1_1.contrib import cells 19from novaclient.v2.contrib import cells
20 20
21 21
22extensions = [ 22extensions = [
diff --git a/novaclient/tests/unit/v1_1/contrib/test_instance_actions.py b/novaclient/tests/unit/v2/contrib/test_instance_actions.py
index 66dbb41..0b0400a 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_instance_actions.py
+++ b/novaclient/tests/unit/v2/contrib/test_instance_actions.py
@@ -15,8 +15,8 @@
15 15
16from novaclient import extension 16from novaclient import extension
17from novaclient.tests.unit import utils 17from novaclient.tests.unit import utils
18from novaclient.tests.unit.v1_1.contrib import fakes 18from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v1_1.contrib import instance_action 19from novaclient.v2.contrib import instance_action
20 20
21 21
22extensions = [ 22extensions = [
diff --git a/novaclient/tests/unit/v1_1/contrib/test_list_extensions.py b/novaclient/tests/unit/v2/contrib/test_list_extensions.py
index dfb742e..3fa5253 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_list_extensions.py
+++ b/novaclient/tests/unit/v2/contrib/test_list_extensions.py
@@ -13,8 +13,8 @@
13 13
14from novaclient import extension 14from novaclient import extension
15from novaclient.tests.unit import utils 15from novaclient.tests.unit import utils
16from novaclient.tests.unit.v1_1 import fakes 16from novaclient.tests.unit.v2 import fakes
17from novaclient.v1_1.contrib import list_extensions 17from novaclient.v2.contrib import list_extensions
18 18
19 19
20extensions = [ 20extensions = [
diff --git a/novaclient/tests/unit/v1_1/contrib/test_migrations.py b/novaclient/tests/unit/v2/contrib/test_migrations.py
index 5fe5c8f..881fd1e 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_migrations.py
+++ b/novaclient/tests/unit/v2/contrib/test_migrations.py
@@ -12,8 +12,8 @@
12 12
13from novaclient import extension 13from novaclient import extension
14from novaclient.tests.unit import utils 14from novaclient.tests.unit import utils
15from novaclient.tests.unit.v1_1 import fakes 15from novaclient.tests.unit.v2 import fakes
16from novaclient.v1_1.contrib import migrations 16from novaclient.v2.contrib import migrations
17 17
18extensions = [ 18extensions = [
19 extension.Extension(migrations.__name__.split(".")[-1], 19 extension.Extension(migrations.__name__.split(".")[-1],
diff --git a/novaclient/tests/unit/v1_1/contrib/test_server_external_events.py b/novaclient/tests/unit/v2/contrib/test_server_external_events.py
index a933ad8..1b941c9 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_server_external_events.py
+++ b/novaclient/tests/unit/v2/contrib/test_server_external_events.py
@@ -18,8 +18,8 @@ External event triggering for servers, not to be used by users.
18 18
19from novaclient import extension 19from novaclient import extension
20from novaclient.tests.unit import utils 20from novaclient.tests.unit import utils
21from novaclient.tests.unit.v1_1.contrib import fakes 21from novaclient.tests.unit.v2.contrib import fakes
22from novaclient.v1_1.contrib import server_external_events as ext_events 22from novaclient.v2.contrib import server_external_events as ext_events
23 23
24 24
25extensions = [ 25extensions = [
diff --git a/novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
index a1a76ce..13159ce 100644
--- a/novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py
+++ b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
@@ -15,8 +15,8 @@
15 15
16from novaclient import extension 16from novaclient import extension
17from novaclient.tests.unit import utils 17from novaclient.tests.unit import utils
18from novaclient.tests.unit.v1_1.contrib import fakes 18from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v1_1.contrib import tenant_networks 19from novaclient.v2.contrib import tenant_networks
20 20
21 21
22extensions = [ 22extensions = [
diff --git a/novaclient/tests/unit/v1_1/fakes.py b/novaclient/tests/unit/v2/fakes.py
index 7e659cb..68322a1 100644
--- a/novaclient/tests/unit/v1_1/fakes.py
+++ b/novaclient/tests/unit/v2/fakes.py
@@ -25,7 +25,7 @@ from novaclient import client as base_client
25from novaclient import exceptions 25from novaclient import exceptions
26from novaclient.tests.unit import fakes 26from novaclient.tests.unit import fakes
27from novaclient.tests.unit import utils 27from novaclient.tests.unit import utils
28from novaclient.v1_1 import client 28from novaclient.v2 import client
29 29
30 30
31class FakeClient(fakes.FakeClient, client.Client): 31class FakeClient(fakes.FakeClient, client.Client):
diff --git a/novaclient/tests/unit/v1_1/test_agents.py b/novaclient/tests/unit/v2/test_agents.py
index a269b32..e7fa7d6 100644
--- a/novaclient/tests/unit/v1_1/test_agents.py
+++ b/novaclient/tests/unit/v2/test_agents.py
@@ -16,7 +16,7 @@
16from novaclient.tests.unit.fixture_data import agents as data 16from novaclient.tests.unit.fixture_data import agents as data
17from novaclient.tests.unit.fixture_data import client 17from novaclient.tests.unit.fixture_data import client
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.v1_1 import agents 19from novaclient.v2 import agents
20 20
21 21
22class AgentsTest(utils.FixturedTestCase): 22class AgentsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_aggregates.py b/novaclient/tests/unit/v2/test_aggregates.py
index 40cc7d9..97a3ffc 100644
--- a/novaclient/tests/unit/v1_1/test_aggregates.py
+++ b/novaclient/tests/unit/v2/test_aggregates.py
@@ -16,7 +16,7 @@
16from novaclient.tests.unit.fixture_data import aggregates as data 16from novaclient.tests.unit.fixture_data import aggregates as data
17from novaclient.tests.unit.fixture_data import client 17from novaclient.tests.unit.fixture_data import client
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.v1_1 import aggregates 19from novaclient.v2 import aggregates
20 20
21 21
22class AggregatesTest(utils.FixturedTestCase): 22class AggregatesTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_auth.py b/novaclient/tests/unit/v2/test_auth.py
index 65715e5..95e96de 100644
--- a/novaclient/tests/unit/v1_1/test_auth.py
+++ b/novaclient/tests/unit/v2/test_auth.py
@@ -20,7 +20,7 @@ import requests
20 20
21from novaclient import exceptions 21from novaclient import exceptions
22from novaclient.tests.unit import utils 22from novaclient.tests.unit import utils
23from novaclient.v1_1 import client 23from novaclient.v2 import client
24 24
25 25
26class AuthenticateAgainstKeystoneTests(utils.TestCase): 26class AuthenticateAgainstKeystoneTests(utils.TestCase):
diff --git a/novaclient/tests/unit/v1_1/test_availability_zone.py b/novaclient/tests/unit/v2/test_availability_zone.py
index fda4764..a7d6d82 100644
--- a/novaclient/tests/unit/v1_1/test_availability_zone.py
+++ b/novaclient/tests/unit/v2/test_availability_zone.py
@@ -19,13 +19,13 @@ import six
19from novaclient.tests.unit.fixture_data import availability_zones as data 19from novaclient.tests.unit.fixture_data import availability_zones as data
20from novaclient.tests.unit.fixture_data import client 20from novaclient.tests.unit.fixture_data import client
21from novaclient.tests.unit import utils 21from novaclient.tests.unit import utils
22from novaclient.v1_1 import availability_zones 22from novaclient.v2 import availability_zones
23 23
24 24
25class AvailabilityZoneTest(utils.FixturedTestCase): 25class AvailabilityZoneTest(utils.FixturedTestCase):
26 # NOTE(cyeoh): import shell here so the V3 version of 26 # NOTE(cyeoh): import shell here so the V3 version of
27 # this class can inherit off the v3 version of shell 27 # this class can inherit off the v3 version of shell
28 from novaclient.v1_1 import shell # noqa 28 from novaclient.v2 import shell # noqa
29 29
30 data_fixture_class = data.V1 30 data_fixture_class = data.V1
31 31
diff --git a/novaclient/tests/unit/v1_1/test_certs.py b/novaclient/tests/unit/v2/test_certs.py
index 39eac06..6ec2258 100644
--- a/novaclient/tests/unit/v1_1/test_certs.py
+++ b/novaclient/tests/unit/v2/test_certs.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import certs as data 14from novaclient.tests.unit.fixture_data import certs as data
15from novaclient.tests.unit.fixture_data import client 15from novaclient.tests.unit.fixture_data import client
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import certs 17from novaclient.v2 import certs
18 18
19 19
20class CertsTest(utils.FixturedTestCase): 20class CertsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_client.py b/novaclient/tests/unit/v2/test_client.py
index fbc98f7..b4c59ce 100644
--- a/novaclient/tests/unit/v1_1/test_client.py
+++ b/novaclient/tests/unit/v2/test_client.py
@@ -15,7 +15,7 @@ import uuid
15from keystoneclient import session 15from keystoneclient import session
16 16
17from novaclient.tests.unit import utils 17from novaclient.tests.unit import utils
18from novaclient.v1_1 import client 18from novaclient.v2 import client
19 19
20 20
21class ClientTest(utils.TestCase): 21class ClientTest(utils.TestCase):
diff --git a/novaclient/tests/unit/v1_1/test_cloudpipe.py b/novaclient/tests/unit/v2/test_cloudpipe.py
index 0a40db6..3ef9533 100644
--- a/novaclient/tests/unit/v1_1/test_cloudpipe.py
+++ b/novaclient/tests/unit/v2/test_cloudpipe.py
@@ -16,7 +16,7 @@ import six
16from novaclient.tests.unit.fixture_data import client 16from novaclient.tests.unit.fixture_data import client
17from novaclient.tests.unit.fixture_data import cloudpipe as data 17from novaclient.tests.unit.fixture_data import cloudpipe as data
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.v1_1 import cloudpipe 19from novaclient.v2 import cloudpipe
20 20
21 21
22class CloudpipeTest(utils.FixturedTestCase): 22class CloudpipeTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_fixed_ips.py b/novaclient/tests/unit/v2/test_fixed_ips.py
index 02ba39b..02ba39b 100644
--- a/novaclient/tests/unit/v1_1/test_fixed_ips.py
+++ b/novaclient/tests/unit/v2/test_fixed_ips.py
diff --git a/novaclient/tests/unit/v1_1/test_flavor_access.py b/novaclient/tests/unit/v2/test_flavor_access.py
index 08677ad..109f177 100644
--- a/novaclient/tests/unit/v1_1/test_flavor_access.py
+++ b/novaclient/tests/unit/v2/test_flavor_access.py
@@ -14,8 +14,8 @@
14# under the License. 14# under the License.
15 15
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v1_1 import fakes 17from novaclient.tests.unit.v2 import fakes
18from novaclient.v1_1 import flavor_access 18from novaclient.v2 import flavor_access
19 19
20 20
21cs = fakes.FakeClient() 21cs = fakes.FakeClient()
diff --git a/novaclient/tests/unit/v1_1/test_flavors.py b/novaclient/tests/unit/v2/test_flavors.py
index 90f7eb1..27b77c0 100644
--- a/novaclient/tests/unit/v1_1/test_flavors.py
+++ b/novaclient/tests/unit/v2/test_flavors.py
@@ -17,8 +17,8 @@ import mock
17 17
18from novaclient import exceptions 18from novaclient import exceptions
19from novaclient.tests.unit import utils 19from novaclient.tests.unit import utils
20from novaclient.tests.unit.v1_1 import fakes 20from novaclient.tests.unit.v2 import fakes
21from novaclient.v1_1 import flavors 21from novaclient.v2 import flavors
22 22
23 23
24class FlavorsTest(utils.TestCase): 24class FlavorsTest(utils.TestCase):
diff --git a/novaclient/tests/unit/v1_1/test_floating_ip_dns.py b/novaclient/tests/unit/v2/test_floating_ip_dns.py
index 36f900c..ec20e56 100644
--- a/novaclient/tests/unit/v1_1/test_floating_ip_dns.py
+++ b/novaclient/tests/unit/v2/test_floating_ip_dns.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import floatingips as data 15from novaclient.tests.unit.fixture_data import floatingips as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import floating_ip_dns 17from novaclient.v2 import floating_ip_dns
18 18
19 19
20class FloatingIPDNSDomainTest(utils.FixturedTestCase): 20class FloatingIPDNSDomainTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_floating_ip_pools.py b/novaclient/tests/unit/v2/test_floating_ip_pools.py
index 55470da..a138fc2 100644
--- a/novaclient/tests/unit/v1_1/test_floating_ip_pools.py
+++ b/novaclient/tests/unit/v2/test_floating_ip_pools.py
@@ -17,7 +17,7 @@
17from novaclient.tests.unit.fixture_data import client 17from novaclient.tests.unit.fixture_data import client
18from novaclient.tests.unit.fixture_data import floatingips as data 18from novaclient.tests.unit.fixture_data import floatingips as data
19from novaclient.tests.unit import utils 19from novaclient.tests.unit import utils
20from novaclient.v1_1 import floating_ip_pools 20from novaclient.v2 import floating_ip_pools
21 21
22 22
23class TestFloatingIPPools(utils.FixturedTestCase): 23class TestFloatingIPPools(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_floating_ips.py b/novaclient/tests/unit/v2/test_floating_ips.py
index 7deb2b6..2b091a5 100644
--- a/novaclient/tests/unit/v1_1/test_floating_ips.py
+++ b/novaclient/tests/unit/v2/test_floating_ips.py
@@ -17,7 +17,7 @@
17from novaclient.tests.unit.fixture_data import client 17from novaclient.tests.unit.fixture_data import client
18from novaclient.tests.unit.fixture_data import floatingips as data 18from novaclient.tests.unit.fixture_data import floatingips as data
19from novaclient.tests.unit import utils 19from novaclient.tests.unit import utils
20from novaclient.v1_1 import floating_ips 20from novaclient.v2 import floating_ips
21 21
22 22
23class FloatingIPsTest(utils.FixturedTestCase): 23class FloatingIPsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_floating_ips_bulk.py b/novaclient/tests/unit/v2/test_floating_ips_bulk.py
index c53e453..69b553f 100644
--- a/novaclient/tests/unit/v1_1/test_floating_ips_bulk.py
+++ b/novaclient/tests/unit/v2/test_floating_ips_bulk.py
@@ -16,7 +16,7 @@
16from novaclient.tests.unit.fixture_data import client 16from novaclient.tests.unit.fixture_data import client
17from novaclient.tests.unit.fixture_data import floatingips as data 17from novaclient.tests.unit.fixture_data import floatingips as data
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.v1_1 import floating_ips_bulk 19from novaclient.v2 import floating_ips_bulk
20 20
21 21
22class FloatingIPsBulkTest(utils.FixturedTestCase): 22class FloatingIPsBulkTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_fping.py b/novaclient/tests/unit/v2/test_fping.py
index 7fe54bc..b9ecc39 100644
--- a/novaclient/tests/unit/v1_1/test_fping.py
+++ b/novaclient/tests/unit/v2/test_fping.py
@@ -16,7 +16,7 @@
16from novaclient.tests.unit.fixture_data import client 16from novaclient.tests.unit.fixture_data import client
17from novaclient.tests.unit.fixture_data import fping as data 17from novaclient.tests.unit.fixture_data import fping as data
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.v1_1 import fping 19from novaclient.v2 import fping
20 20
21 21
22class FpingTest(utils.FixturedTestCase): 22class FpingTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_hosts.py b/novaclient/tests/unit/v2/test_hosts.py
index b51ab07..029964b 100644
--- a/novaclient/tests/unit/v1_1/test_hosts.py
+++ b/novaclient/tests/unit/v2/test_hosts.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import hosts as data 15from novaclient.tests.unit.fixture_data import hosts as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import hosts 17from novaclient.v2 import hosts
18 18
19 19
20class HostsTest(utils.FixturedTestCase): 20class HostsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_hypervisors.py b/novaclient/tests/unit/v2/test_hypervisors.py
index b297c12..b297c12 100644
--- a/novaclient/tests/unit/v1_1/test_hypervisors.py
+++ b/novaclient/tests/unit/v2/test_hypervisors.py
diff --git a/novaclient/tests/unit/v1_1/test_images.py b/novaclient/tests/unit/v2/test_images.py
index 4f7d553..1f8104e 100644
--- a/novaclient/tests/unit/v1_1/test_images.py
+++ b/novaclient/tests/unit/v2/test_images.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import images as data 15from novaclient.tests.unit.fixture_data import images as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import images 17from novaclient.v2 import images
18 18
19 19
20class ImagesTest(utils.FixturedTestCase): 20class ImagesTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_keypairs.py b/novaclient/tests/unit/v2/test_keypairs.py
index a5cf259..91c249f 100644
--- a/novaclient/tests/unit/v1_1/test_keypairs.py
+++ b/novaclient/tests/unit/v2/test_keypairs.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import keypairs as data 15from novaclient.tests.unit.fixture_data import keypairs as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import keypairs 17from novaclient.v2 import keypairs
18 18
19 19
20class KeypairsTest(utils.FixturedTestCase): 20class KeypairsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_limits.py b/novaclient/tests/unit/v2/test_limits.py
index 598c38a..94a62c5 100644
--- a/novaclient/tests/unit/v1_1/test_limits.py
+++ b/novaclient/tests/unit/v2/test_limits.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import limits as data 15from novaclient.tests.unit.fixture_data import limits as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import limits 17from novaclient.v2 import limits
18 18
19 19
20class LimitsTest(utils.FixturedTestCase): 20class LimitsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_networks.py b/novaclient/tests/unit/v2/test_networks.py
index 4e57c2b..a45ba80 100644
--- a/novaclient/tests/unit/v1_1/test_networks.py
+++ b/novaclient/tests/unit/v2/test_networks.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import networks as data 15from novaclient.tests.unit.fixture_data import networks as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import networks 17from novaclient.v2 import networks
18 18
19 19
20class NetworksTest(utils.FixturedTestCase): 20class NetworksTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_quota_classes.py b/novaclient/tests/unit/v2/test_quota_classes.py
index 8e651ba..467ff83 100644
--- a/novaclient/tests/unit/v1_1/test_quota_classes.py
+++ b/novaclient/tests/unit/v2/test_quota_classes.py
@@ -14,7 +14,7 @@
14# under the License. 14# under the License.
15 15
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v1_1 import fakes 17from novaclient.tests.unit.v2 import fakes
18 18
19 19
20cs = fakes.FakeClient() 20cs = fakes.FakeClient()
diff --git a/novaclient/tests/unit/v1_1/test_quotas.py b/novaclient/tests/unit/v2/test_quotas.py
index 43f8ce1..43f8ce1 100644
--- a/novaclient/tests/unit/v1_1/test_quotas.py
+++ b/novaclient/tests/unit/v2/test_quotas.py
diff --git a/novaclient/tests/unit/v1_1/test_security_group_rules.py b/novaclient/tests/unit/v2/test_security_group_rules.py
index af5b81d..8375198 100644
--- a/novaclient/tests/unit/v1_1/test_security_group_rules.py
+++ b/novaclient/tests/unit/v2/test_security_group_rules.py
@@ -15,7 +15,7 @@ from novaclient import exceptions
15from novaclient.tests.unit.fixture_data import client 15from novaclient.tests.unit.fixture_data import client
16from novaclient.tests.unit.fixture_data import security_group_rules as data 16from novaclient.tests.unit.fixture_data import security_group_rules as data
17from novaclient.tests.unit import utils 17from novaclient.tests.unit import utils
18from novaclient.v1_1 import security_group_rules 18from novaclient.v2 import security_group_rules
19 19
20 20
21class SecurityGroupRulesTest(utils.FixturedTestCase): 21class SecurityGroupRulesTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_security_groups.py b/novaclient/tests/unit/v2/test_security_groups.py
index 91c9ef3..9aeb8dd 100644
--- a/novaclient/tests/unit/v1_1/test_security_groups.py
+++ b/novaclient/tests/unit/v2/test_security_groups.py
@@ -14,7 +14,7 @@
14from novaclient.tests.unit.fixture_data import client 14from novaclient.tests.unit.fixture_data import client
15from novaclient.tests.unit.fixture_data import security_groups as data 15from novaclient.tests.unit.fixture_data import security_groups as data
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.v1_1 import security_groups 17from novaclient.v2 import security_groups
18 18
19 19
20class SecurityGroupsTest(utils.FixturedTestCase): 20class SecurityGroupsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_server_groups.py b/novaclient/tests/unit/v2/test_server_groups.py
index eecd71d..fcda2de 100644
--- a/novaclient/tests/unit/v1_1/test_server_groups.py
+++ b/novaclient/tests/unit/v2/test_server_groups.py
@@ -16,7 +16,7 @@
16from novaclient.tests.unit.fixture_data import client 16from novaclient.tests.unit.fixture_data import client
17from novaclient.tests.unit.fixture_data import server_groups as data 17from novaclient.tests.unit.fixture_data import server_groups as data
18from novaclient.tests.unit import utils 18from novaclient.tests.unit import utils
19from novaclient.v1_1 import server_groups 19from novaclient.v2 import server_groups
20 20
21 21
22class ServerGroupsTest(utils.FixturedTestCase): 22class ServerGroupsTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_servers.py b/novaclient/tests/unit/v2/test_servers.py
index 214f394..c9b15f3 100644
--- a/novaclient/tests/unit/v1_1/test_servers.py
+++ b/novaclient/tests/unit/v2/test_servers.py
@@ -21,7 +21,7 @@ from novaclient.tests.unit.fixture_data import client
21from novaclient.tests.unit.fixture_data import floatingips 21from novaclient.tests.unit.fixture_data import floatingips
22from novaclient.tests.unit.fixture_data import servers as data 22from novaclient.tests.unit.fixture_data import servers as data
23from novaclient.tests.unit import utils 23from novaclient.tests.unit import utils
24from novaclient.v1_1 import servers 24from novaclient.v2 import servers
25 25
26 26
27class ServersTest(utils.FixturedTestCase): 27class ServersTest(utils.FixturedTestCase):
diff --git a/novaclient/tests/unit/v1_1/test_services.py b/novaclient/tests/unit/v2/test_services.py
index 61cbd67..2724342 100644
--- a/novaclient/tests/unit/v1_1/test_services.py
+++ b/novaclient/tests/unit/v2/test_services.py
@@ -14,8 +14,8 @@
14# under the License. 14# under the License.
15 15
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v1_1 import fakes 17from novaclient.tests.unit.v2 import fakes
18from novaclient.v1_1 import services 18from novaclient.v2 import services
19 19
20 20
21class ServicesTest(utils.TestCase): 21class ServicesTest(utils.TestCase):
diff --git a/novaclient/tests/unit/v1_1/test_shell.py b/novaclient/tests/unit/v2/test_shell.py
index cca5d66..49e1581 100644
--- a/novaclient/tests/unit/v1_1/test_shell.py
+++ b/novaclient/tests/unit/v2/test_shell.py
@@ -30,8 +30,8 @@ import novaclient.client
30from novaclient import exceptions 30from novaclient import exceptions
31import novaclient.shell 31import novaclient.shell
32from novaclient.tests.unit import utils 32from novaclient.tests.unit import utils
33from novaclient.tests.unit.v1_1 import fakes 33from novaclient.tests.unit.v2 import fakes
34import novaclient.v1_1.shell 34import novaclient.v2.shell
35 35
36 36
37class ShellFixture(fixtures.Fixture): 37class ShellFixture(fixtures.Fixture):
@@ -54,7 +54,7 @@ class ShellTest(utils.TestCase):
54 'NOVA_USERNAME': 'username', 54 'NOVA_USERNAME': 'username',
55 'NOVA_PASSWORD': 'password', 55 'NOVA_PASSWORD': 'password',
56 'NOVA_PROJECT_ID': 'project_id', 56 'NOVA_PROJECT_ID': 'project_id',
57 'OS_COMPUTE_API_VERSION': '1.1', 57 'OS_COMPUTE_API_VERSION': '2',
58 'NOVA_URL': 'http://no.where', 58 'NOVA_URL': 'http://no.where',
59 'OS_AUTH_URL': 'http://no.where/v2.0', 59 'OS_AUTH_URL': 'http://no.where/v2.0',
60 } 60 }
@@ -644,7 +644,7 @@ class ShellTest(utils.TestCase):
644 cmd = 'boot --image 1 --flavor 1 --min-count 3 --max-count 1 serv' 644 cmd = 'boot --image 1 --flavor 1 --min-count 3 --max-count 1 serv'
645 self.assertRaises(exceptions.CommandError, self.run_command, cmd) 645 self.assertRaises(exceptions.CommandError, self.run_command, cmd)
646 646
647 @mock.patch('novaclient.v1_1.shell._poll_for_status') 647 @mock.patch('novaclient.v2.shell._poll_for_status')
648 def test_boot_with_poll(self, poll_method): 648 def test_boot_with_poll(self, poll_method):
649 self.run_command('boot --flavor 1 --image 1 some-server --poll') 649 self.run_command('boot --flavor 1 --image 1 some-server --poll')
650 self.assert_called_anytime( 650 self.assert_called_anytime(
@@ -1088,7 +1088,7 @@ class ShellTest(utils.TestCase):
1088 self.assertRaises(exceptions.CommandError, 1088 self.assertRaises(exceptions.CommandError,
1089 self.run_command, 'show xxx') 1089 self.run_command, 'show xxx')
1090 1090
1091 @mock.patch('novaclient.v1_1.shell.utils.print_dict') 1091 @mock.patch('novaclient.v2.shell.utils.print_dict')
1092 def test_print_server(self, mock_print_dict): 1092 def test_print_server(self, mock_print_dict):
1093 self.run_command('show 5678') 1093 self.run_command('show 5678')
1094 args, kwargs = mock_print_dict.call_args 1094 args, kwargs = mock_print_dict.call_args
@@ -2225,7 +2225,7 @@ class ShellTest(utils.TestCase):
2225 '/os-migrations?cell_name=child1&host=host1' 2225 '/os-migrations?cell_name=child1&host=host1'
2226 '&status=finished') 2226 '&status=finished')
2227 2227
2228 @mock.patch('novaclient.v1_1.shell._find_server') 2228 @mock.patch('novaclient.v2.shell._find_server')
2229 @mock.patch('os.system') 2229 @mock.patch('os.system')
2230 def test_ssh(self, mock_system, mock_find_server): 2230 def test_ssh(self, mock_system, mock_find_server):
2231 class FakeResources(object): 2231 class FakeResources(object):
@@ -2273,7 +2273,7 @@ class ShellTest(utils.TestCase):
2273 mock_system.assert_called_with("ssh -6 -p22 " 2273 mock_system.assert_called_with("ssh -6 -p22 "
2274 "root@2607:f0d0:1002::4 -1") 2274 "root@2607:f0d0:1002::4 -1")
2275 2275
2276 @mock.patch('novaclient.v1_1.shell._find_server') 2276 @mock.patch('novaclient.v2.shell._find_server')
2277 @mock.patch('os.system') 2277 @mock.patch('os.system')
2278 def test_ssh_multinet(self, mock_system, mock_find_server): 2278 def test_ssh_multinet(self, mock_system, mock_find_server):
2279 class FakeResources(object): 2279 class FakeResources(object):
@@ -2338,6 +2338,28 @@ class ShellTest(utils.TestCase):
2338 self.assert_called('DELETE', '/os-server-groups/12345', pos=-2) 2338 self.assert_called('DELETE', '/os-server-groups/12345', pos=-2)
2339 2339
2340 2340
2341class ShellTestV11(ShellTest):
2342 FAKE_ENV = {
2343 'NOVA_USERNAME': 'username',
2344 'NOVA_PASSWORD': 'password',
2345 'NOVA_PROJECT_ID': 'project_id',
2346 'OS_COMPUTE_API_VERSION': '1.1',
2347 'NOVA_URL': 'http://no.where',
2348 'OS_AUTH_URL': 'http://no.where/v2.0',
2349 }
2350
2351
2352class ShellTestV3(ShellTest):
2353 FAKE_ENV = {
2354 'NOVA_USERNAME': 'username',
2355 'NOVA_PASSWORD': 'password',
2356 'NOVA_PROJECT_ID': 'project_id',
2357 'OS_COMPUTE_API_VERSION': '3',
2358 'NOVA_URL': 'http://no.where',
2359 'OS_AUTH_URL': 'http://no.where/v2.0',
2360 }
2361
2362
2341class ShellWithSessionClientTest(ShellTest): 2363class ShellWithSessionClientTest(ShellTest):
2342 2364
2343 def setUp(self): 2365 def setUp(self):
@@ -2354,7 +2376,7 @@ class GetSecgroupTest(utils.TestCase):
2354 'security_groups.get.return_value': 'sec_group', 2376 'security_groups.get.return_value': 'sec_group',
2355 'security_groups.list.return_value': [], 2377 'security_groups.list.return_value': [],
2356 }) 2378 })
2357 result = novaclient.v1_1.shell._get_secgroup(cs, '1') 2379 result = novaclient.v2.shell._get_secgroup(cs, '1')
2358 self.assertEqual('sec_group', result) 2380 self.assertEqual('sec_group', result)
2359 cs.security_groups.get.assert_called_once_with('1') 2381 cs.security_groups.get.assert_called_once_with('1')
2360 2382
@@ -2363,7 +2385,7 @@ class GetSecgroupTest(utils.TestCase):
2363 'security_groups.get.return_value': 'sec_group', 2385 'security_groups.get.return_value': 'sec_group',
2364 'security_groups.list.return_value': [], 2386 'security_groups.list.return_value': [],
2365 }) 2387 })
2366 result = novaclient.v1_1.shell._get_secgroup( 2388 result = novaclient.v2.shell._get_secgroup(
2367 cs, 'c0c32459-dc5f-44dc-9a0a-473b28bac831') 2389 cs, 'c0c32459-dc5f-44dc-9a0a-473b28bac831')
2368 self.assertEqual('sec_group', result) 2390 self.assertEqual('sec_group', result)
2369 cs.security_groups.get.assert_called_once_with( 2391 cs.security_groups.get.assert_called_once_with(
@@ -2375,7 +2397,7 @@ class GetSecgroupTest(utils.TestCase):
2375 'security_groups.list.return_value': [], 2397 'security_groups.list.return_value': [],
2376 }) 2398 })
2377 self.assertRaises(exceptions.CommandError, 2399 self.assertRaises(exceptions.CommandError,
2378 novaclient.v1_1.shell._get_secgroup, 2400 novaclient.v2.shell._get_secgroup,
2379 cs, 2401 cs,
2380 'abc') 2402 'abc')
2381 2403
@@ -2387,7 +2409,7 @@ class GetSecgroupTest(utils.TestCase):
2387 'security_groups.list.return_value': [group_one, group_one], 2409 'security_groups.list.return_value': [group_one, group_one],
2388 }) 2410 })
2389 self.assertRaises(exceptions.NoUniqueMatch, 2411 self.assertRaises(exceptions.NoUniqueMatch,
2390 novaclient.v1_1.shell._get_secgroup, 2412 novaclient.v2.shell._get_secgroup,
2391 cs, 2413 cs,
2392 'group_one') 2414 'group_one')
2393 2415
@@ -2396,7 +2418,7 @@ class GetFirstEndpointTest(utils.TestCase):
2396 def test_only_one_endpoint(self): 2418 def test_only_one_endpoint(self):
2397 """If there is only one endpoint, it is returned.""" 2419 """If there is only one endpoint, it is returned."""
2398 endpoint = {"url": "test"} 2420 endpoint = {"url": "test"}
2399 result = novaclient.v1_1.shell._get_first_endpoint([endpoint], "XYZ") 2421 result = novaclient.v2.shell._get_first_endpoint([endpoint], "XYZ")
2400 self.assertEqual(endpoint, result) 2422 self.assertEqual(endpoint, result)
2401 2423
2402 def test_multiple_endpoints(self): 2424 def test_multiple_endpoints(self):
@@ -2409,7 +2431,7 @@ class GetFirstEndpointTest(utils.TestCase):
2409 {"region": "ORD", "number": 1}, 2431 {"region": "ORD", "number": 1},
2410 {"region": "ORD", "number": 2} 2432 {"region": "ORD", "number": 2}
2411 ] 2433 ]
2412 result = novaclient.v1_1.shell._get_first_endpoint(endpoints, "ORD") 2434 result = novaclient.v2.shell._get_first_endpoint(endpoints, "ORD")
2413 self.assertEqual(endpoints[1], result) 2435 self.assertEqual(endpoints[1], result)
2414 2436
2415 def test_multiple_endpoints_but_none_suitable(self): 2437 def test_multiple_endpoints_but_none_suitable(self):
@@ -2423,11 +2445,11 @@ class GetFirstEndpointTest(utils.TestCase):
2423 {"region": "STU"} 2445 {"region": "STU"}
2424 ] 2446 ]
2425 self.assertRaises(LookupError, 2447 self.assertRaises(LookupError,
2426 novaclient.v1_1.shell._get_first_endpoint, 2448 novaclient.v2.shell._get_first_endpoint,
2427 endpoints, "ORD") 2449 endpoints, "ORD")
2428 2450
2429 def test_no_endpoints(self): 2451 def test_no_endpoints(self):
2430 """If there are no endpoints available, an exception is raised.""" 2452 """If there are no endpoints available, an exception is raised."""
2431 self.assertRaises(LookupError, 2453 self.assertRaises(LookupError,
2432 novaclient.v1_1.shell._get_first_endpoint, 2454 novaclient.v2.shell._get_first_endpoint,
2433 [], "ORD") 2455 [], "ORD")
diff --git a/novaclient/tests/unit/v1_1/test_usage.py b/novaclient/tests/unit/v2/test_usage.py
index 2f52706..a92be0e 100644
--- a/novaclient/tests/unit/v1_1/test_usage.py
+++ b/novaclient/tests/unit/v2/test_usage.py
@@ -14,8 +14,8 @@
14import datetime 14import datetime
15 15
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v1_1 import fakes 17from novaclient.tests.unit.v2 import fakes
18from novaclient.v1_1 import usage 18from novaclient.v2 import usage
19 19
20 20
21class UsageTest(utils.TestCase): 21class UsageTest(utils.TestCase):
diff --git a/novaclient/tests/unit/v1_1/test_volumes.py b/novaclient/tests/unit/v2/test_volumes.py
index 432b805..52b81ab 100644
--- a/novaclient/tests/unit/v1_1/test_volumes.py
+++ b/novaclient/tests/unit/v2/test_volumes.py
@@ -14,8 +14,8 @@
14# under the License. 14# under the License.
15 15
16from novaclient.tests.unit import utils 16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v1_1 import fakes 17from novaclient.tests.unit.v2 import fakes
18from novaclient.v1_1 import volumes 18from novaclient.v2 import volumes
19 19
20 20
21cs = fakes.FakeClient() 21cs = fakes.FakeClient()
diff --git a/novaclient/tests/unit/v1_1/testfile.txt b/novaclient/tests/unit/v2/testfile.txt
index e4e860f..e4e860f 100644
--- a/novaclient/tests/unit/v1_1/testfile.txt
+++ b/novaclient/tests/unit/v2/testfile.txt
diff --git a/novaclient/tests/unit/v1_1/utils.py b/novaclient/tests/unit/v2/utils.py
index d28392f..d28392f 100644
--- a/novaclient/tests/unit/v1_1/utils.py
+++ b/novaclient/tests/unit/v2/utils.py
diff --git a/novaclient/v1_1/__init__.py b/novaclient/v1_1/__init__.py
index 1971228..9da7681 100644
--- a/novaclient/v1_1/__init__.py
+++ b/novaclient/v1_1/__init__.py
@@ -1,4 +1,3 @@
1# Copyright (c) 2012 OpenStack Foundation
2# 1#
3# All Rights Reserved. 2# All Rights Reserved.
4# 3#
@@ -14,4 +13,31 @@
14# License for the specific language governing permissions and limitations 13# License for the specific language governing permissions and limitations
15# under the License. 14# under the License.
16 15
17from novaclient.v1_1.client import Client # noqa 16# NOTE(akurilin): This module is left for backward compatibility. Feel free to
17# remove it, when openstack project will use correct way to
18# obtain novaclient object.
19# Known problems:
20# * python-openstackclient -
21# https://bugs.launchpad.net/python-openstackclient/+bug/1418024
22# * neutron - https://bugs.launchpad.net/neutron/+bug/1418017
23
24
25import sys
26import warnings
27
28from novaclient import v2
29
30warnings.warn("Module novaclient.v1_1 is deprecated (taken as a basis for "
31 "novaclient.v2). "
32 "The preferable way to get client class or object you can find "
33 "in novaclient.client module.")
34
35
36class MovedModule(object):
37 def __init__(self, new_module):
38 self.new_module = new_module
39
40 def __getattr__(self, attr):
41 return getattr(self.new_module, attr)
42
43sys.modules["novaclient.v1_1"] = MovedModule(v2)
diff --git a/novaclient/v2/__init__.py b/novaclient/v2/__init__.py
new file mode 100644
index 0000000..21d7c4f
--- /dev/null
+++ b/novaclient/v2/__init__.py
@@ -0,0 +1,16 @@
1#
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from novaclient.v2.client import Client # noqa
diff --git a/novaclient/v1_1/agents.py b/novaclient/v2/agents.py
index b5372cb..b5372cb 100644
--- a/novaclient/v1_1/agents.py
+++ b/novaclient/v2/agents.py
diff --git a/novaclient/v1_1/aggregates.py b/novaclient/v2/aggregates.py
index c2df315..c2df315 100644
--- a/novaclient/v1_1/aggregates.py
+++ b/novaclient/v2/aggregates.py
diff --git a/novaclient/v1_1/availability_zones.py b/novaclient/v2/availability_zones.py
index bf59037..bf59037 100644
--- a/novaclient/v1_1/availability_zones.py
+++ b/novaclient/v2/availability_zones.py
diff --git a/novaclient/v1_1/certs.py b/novaclient/v2/certs.py
index 2c3006c..2c3006c 100644
--- a/novaclient/v1_1/certs.py
+++ b/novaclient/v2/certs.py
diff --git a/novaclient/v1_1/client.py b/novaclient/v2/client.py
index 83789aa..386c649 100644
--- a/novaclient/v1_1/client.py
+++ b/novaclient/v2/client.py
@@ -14,39 +14,39 @@
14# under the License. 14# under the License.
15 15
16from novaclient import client 16from novaclient import client
17from novaclient.v1_1 import agents 17from novaclient.v2 import agents
18from novaclient.v1_1 import aggregates 18from novaclient.v2 import aggregates
19from novaclient.v1_1 import availability_zones 19from novaclient.v2 import availability_zones
20from novaclient.v1_1 import certs 20from novaclient.v2 import certs
21from novaclient.v1_1 import cloudpipe 21from novaclient.v2 import cloudpipe
22from novaclient.v1_1 import fixed_ips 22from novaclient.v2 import fixed_ips
23from novaclient.v1_1 import flavor_access 23from novaclient.v2 import flavor_access
24from novaclient.v1_1 import flavors 24from novaclient.v2 import flavors
25from novaclient.v1_1 import floating_ip_dns 25from novaclient.v2 import floating_ip_dns
26from novaclient.v1_1 import floating_ip_pools 26from novaclient.v2 import floating_ip_pools
27from novaclient.v1_1 import floating_ips 27from novaclient.v2 import floating_ips
28from novaclient.v1_1 import floating_ips_bulk 28from novaclient.v2 import floating_ips_bulk
29from novaclient.v1_1 import fping 29from novaclient.v2 import fping
30from novaclient.v1_1 import hosts 30from novaclient.v2 import hosts
31from novaclient.v1_1 import hypervisors 31from novaclient.v2 import hypervisors
32from novaclient.v1_1 import images 32from novaclient.v2 import images
33from novaclient.v1_1 import keypairs 33from novaclient.v2 import keypairs
34from novaclient.v1_1 import limits 34from novaclient.v2 import limits
35from novaclient.v1_1 import networks 35from novaclient.v2 import networks
36from novaclient.v1_1 import quota_classes 36from novaclient.v2 import quota_classes
37from novaclient.v1_1 import quotas 37from novaclient.v2 import quotas
38from novaclient.v1_1 import security_group_default_rules 38from novaclient.v2 import security_group_default_rules
39from novaclient.v1_1 import security_group_rules 39from novaclient.v2 import security_group_rules
40from novaclient.v1_1 import security_groups 40from novaclient.v2 import security_groups
41from novaclient.v1_1 import server_groups 41from novaclient.v2 import server_groups
42from novaclient.v1_1 import servers 42from novaclient.v2 import servers
43from novaclient.v1_1 import services 43from novaclient.v2 import services
44from novaclient.v1_1 import usage 44from novaclient.v2 import usage
45from novaclient.v1_1 import versions 45from novaclient.v2 import versions
46from novaclient.v1_1 import virtual_interfaces 46from novaclient.v2 import virtual_interfaces
47from novaclient.v1_1 import volume_snapshots 47from novaclient.v2 import volume_snapshots
48from novaclient.v1_1 import volume_types 48from novaclient.v2 import volume_types
49from novaclient.v1_1 import volumes 49from novaclient.v2 import volumes
50 50
51 51
52class Client(object): 52class Client(object):
diff --git a/novaclient/v1_1/cloudpipe.py b/novaclient/v2/cloudpipe.py
index c0926ed..c0926ed 100644
--- a/novaclient/v1_1/cloudpipe.py
+++ b/novaclient/v2/cloudpipe.py
diff --git a/novaclient/v1_1/contrib/__init__.py b/novaclient/v2/contrib/__init__.py
index e69de29..e69de29 100644
--- a/novaclient/v1_1/contrib/__init__.py
+++ b/novaclient/v2/contrib/__init__.py
diff --git a/novaclient/v1_1/contrib/assisted_volume_snapshots.py b/novaclient/v2/contrib/assisted_volume_snapshots.py
index ce1a041..ce1a041 100644
--- a/novaclient/v1_1/contrib/assisted_volume_snapshots.py
+++ b/novaclient/v2/contrib/assisted_volume_snapshots.py
diff --git a/novaclient/v1_1/contrib/baremetal.py b/novaclient/v2/contrib/baremetal.py
index d23a38e..d23a38e 100644
--- a/novaclient/v1_1/contrib/baremetal.py
+++ b/novaclient/v2/contrib/baremetal.py
diff --git a/novaclient/v1_1/contrib/cells.py b/novaclient/v2/contrib/cells.py
index bfc6893..bfc6893 100644
--- a/novaclient/v1_1/contrib/cells.py
+++ b/novaclient/v2/contrib/cells.py
diff --git a/novaclient/v1_1/contrib/deferred_delete.py b/novaclient/v2/contrib/deferred_delete.py
index 5d8d7d9..5d8d7d9 100644
--- a/novaclient/v1_1/contrib/deferred_delete.py
+++ b/novaclient/v2/contrib/deferred_delete.py
diff --git a/novaclient/v1_1/contrib/host_evacuate.py b/novaclient/v2/contrib/host_evacuate.py
index b08e28c..b08e28c 100644
--- a/novaclient/v1_1/contrib/host_evacuate.py
+++ b/novaclient/v2/contrib/host_evacuate.py
diff --git a/novaclient/v1_1/contrib/host_evacuate_live.py b/novaclient/v2/contrib/host_evacuate_live.py
index 276fb2f..276fb2f 100644
--- a/novaclient/v1_1/contrib/host_evacuate_live.py
+++ b/novaclient/v2/contrib/host_evacuate_live.py
diff --git a/novaclient/v1_1/contrib/host_servers_migrate.py b/novaclient/v2/contrib/host_servers_migrate.py
index 470f161..470f161 100644
--- a/novaclient/v1_1/contrib/host_servers_migrate.py
+++ b/novaclient/v2/contrib/host_servers_migrate.py
diff --git a/novaclient/v1_1/contrib/instance_action.py b/novaclient/v2/contrib/instance_action.py
index 10e518e..10e518e 100644
--- a/novaclient/v1_1/contrib/instance_action.py
+++ b/novaclient/v2/contrib/instance_action.py
diff --git a/novaclient/v1_1/contrib/list_extensions.py b/novaclient/v2/contrib/list_extensions.py
index 7eb9f16..7eb9f16 100644
--- a/novaclient/v1_1/contrib/list_extensions.py
+++ b/novaclient/v2/contrib/list_extensions.py
diff --git a/novaclient/v1_1/contrib/metadata_extensions.py b/novaclient/v2/contrib/metadata_extensions.py
index 36bef9a..ad843b7 100644
--- a/novaclient/v1_1/contrib/metadata_extensions.py
+++ b/novaclient/v2/contrib/metadata_extensions.py
@@ -15,7 +15,7 @@
15 15
16from novaclient.i18n import _ 16from novaclient.i18n import _
17from novaclient.openstack.common import cliutils 17from novaclient.openstack.common import cliutils
18from novaclient.v1_1 import shell 18from novaclient.v2 import shell
19 19
20 20
21@cliutils.arg( 21@cliutils.arg(
diff --git a/novaclient/v1_1/contrib/migrations.py b/novaclient/v2/contrib/migrations.py
index 1595981..1595981 100644
--- a/novaclient/v1_1/contrib/migrations.py
+++ b/novaclient/v2/contrib/migrations.py
diff --git a/novaclient/v1_1/contrib/server_external_events.py b/novaclient/v2/contrib/server_external_events.py
index a45914b..a45914b 100644
--- a/novaclient/v1_1/contrib/server_external_events.py
+++ b/novaclient/v2/contrib/server_external_events.py
diff --git a/novaclient/v1_1/contrib/tenant_networks.py b/novaclient/v2/contrib/tenant_networks.py
index 06edeb1..06edeb1 100644
--- a/novaclient/v1_1/contrib/tenant_networks.py
+++ b/novaclient/v2/contrib/tenant_networks.py
diff --git a/novaclient/v1_1/fixed_ips.py b/novaclient/v2/fixed_ips.py
index 4e7c0e9..4e7c0e9 100644
--- a/novaclient/v1_1/fixed_ips.py
+++ b/novaclient/v2/fixed_ips.py
diff --git a/novaclient/v1_1/flavor_access.py b/novaclient/v2/flavor_access.py
index ca78bdf..ca78bdf 100644
--- a/novaclient/v1_1/flavor_access.py
+++ b/novaclient/v2/flavor_access.py
diff --git a/novaclient/v1_1/flavors.py b/novaclient/v2/flavors.py
index 0545ad6..0545ad6 100644
--- a/novaclient/v1_1/flavors.py
+++ b/novaclient/v2/flavors.py
diff --git a/novaclient/v1_1/floating_ip_dns.py b/novaclient/v2/floating_ip_dns.py
index 41df0f6..41df0f6 100644
--- a/novaclient/v1_1/floating_ip_dns.py
+++ b/novaclient/v2/floating_ip_dns.py
diff --git a/novaclient/v1_1/floating_ip_pools.py b/novaclient/v2/floating_ip_pools.py
index 7666bd5..7666bd5 100644
--- a/novaclient/v1_1/floating_ip_pools.py
+++ b/novaclient/v2/floating_ip_pools.py
diff --git a/novaclient/v1_1/floating_ips.py b/novaclient/v2/floating_ips.py
index cce92da..cce92da 100644
--- a/novaclient/v1_1/floating_ips.py
+++ b/novaclient/v2/floating_ips.py
diff --git a/novaclient/v1_1/floating_ips_bulk.py b/novaclient/v2/floating_ips_bulk.py
index fb59a19..fb59a19 100644
--- a/novaclient/v1_1/floating_ips_bulk.py
+++ b/novaclient/v2/floating_ips_bulk.py
diff --git a/novaclient/v1_1/fping.py b/novaclient/v2/fping.py
index ac958d4..ac958d4 100644
--- a/novaclient/v1_1/fping.py
+++ b/novaclient/v2/fping.py
diff --git a/novaclient/v1_1/hosts.py b/novaclient/v2/hosts.py
index af1756a..af1756a 100644
--- a/novaclient/v1_1/hosts.py
+++ b/novaclient/v2/hosts.py
diff --git a/novaclient/v1_1/hypervisors.py b/novaclient/v2/hypervisors.py
index b1bfcb4..b1bfcb4 100644
--- a/novaclient/v1_1/hypervisors.py
+++ b/novaclient/v2/hypervisors.py
diff --git a/novaclient/v1_1/images.py b/novaclient/v2/images.py
index 2d413a6..2d413a6 100644
--- a/novaclient/v1_1/images.py
+++ b/novaclient/v2/images.py
diff --git a/novaclient/v1_1/keypairs.py b/novaclient/v2/keypairs.py
index 96caff6..96caff6 100644
--- a/novaclient/v1_1/keypairs.py
+++ b/novaclient/v2/keypairs.py
diff --git a/novaclient/v1_1/limits.py b/novaclient/v2/limits.py
index 46d77de..46d77de 100644
--- a/novaclient/v1_1/limits.py
+++ b/novaclient/v2/limits.py
diff --git a/novaclient/v1_1/networks.py b/novaclient/v2/networks.py
index 06dee27..06dee27 100644
--- a/novaclient/v1_1/networks.py
+++ b/novaclient/v2/networks.py
diff --git a/novaclient/v1_1/quota_classes.py b/novaclient/v2/quota_classes.py
index 4a38a97..4a38a97 100644
--- a/novaclient/v1_1/quota_classes.py
+++ b/novaclient/v2/quota_classes.py
diff --git a/novaclient/v1_1/quotas.py b/novaclient/v2/quotas.py
index cd16042..cd16042 100644
--- a/novaclient/v1_1/quotas.py
+++ b/novaclient/v2/quotas.py
diff --git a/novaclient/v1_1/security_group_default_rules.py b/novaclient/v2/security_group_default_rules.py
index d82a1d8..d82a1d8 100644
--- a/novaclient/v1_1/security_group_default_rules.py
+++ b/novaclient/v2/security_group_default_rules.py
diff --git a/novaclient/v1_1/security_group_rules.py b/novaclient/v2/security_group_rules.py
index 4cb51b0..4cb51b0 100644
--- a/novaclient/v1_1/security_group_rules.py
+++ b/novaclient/v2/security_group_rules.py
diff --git a/novaclient/v1_1/security_groups.py b/novaclient/v2/security_groups.py
index 40d1e7f..40d1e7f 100644
--- a/novaclient/v1_1/security_groups.py
+++ b/novaclient/v2/security_groups.py
diff --git a/novaclient/v1_1/server_groups.py b/novaclient/v2/server_groups.py
index a5205e7..a5205e7 100644
--- a/novaclient/v1_1/server_groups.py
+++ b/novaclient/v2/server_groups.py
diff --git a/novaclient/v1_1/servers.py b/novaclient/v2/servers.py
index ef3974f..36de45b 100644
--- a/novaclient/v1_1/servers.py
+++ b/novaclient/v2/servers.py
@@ -28,7 +28,7 @@ from six.moves.urllib import parse
28from novaclient import base 28from novaclient import base
29from novaclient import crypto 29from novaclient import crypto
30from novaclient.i18n import _ 30from novaclient.i18n import _
31from novaclient.v1_1 import security_groups 31from novaclient.v2 import security_groups
32 32
33 33
34REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD' 34REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'
diff --git a/novaclient/v1_1/services.py b/novaclient/v2/services.py
index d51fa3e..d51fa3e 100644
--- a/novaclient/v1_1/services.py
+++ b/novaclient/v2/services.py
diff --git a/novaclient/v1_1/shell.py b/novaclient/v2/shell.py
index b6f78d8..190d07f 100644
--- a/novaclient/v1_1/shell.py
+++ b/novaclient/v2/shell.py
@@ -39,9 +39,9 @@ from novaclient.i18n import _
39from novaclient.openstack.common import cliutils 39from novaclient.openstack.common import cliutils
40from novaclient.openstack.common import uuidutils 40from novaclient.openstack.common import uuidutils
41from novaclient import utils 41from novaclient import utils
42from novaclient.v1_1 import availability_zones 42from novaclient.v2 import availability_zones
43from novaclient.v1_1 import quotas 43from novaclient.v2 import quotas
44from novaclient.v1_1 import servers 44from novaclient.v2 import servers
45 45
46 46
47logger = logging.getLogger(__name__) 47logger = logging.getLogger(__name__)
diff --git a/novaclient/v1_1/usage.py b/novaclient/v2/usage.py
index 585ce11..585ce11 100644
--- a/novaclient/v1_1/usage.py
+++ b/novaclient/v2/usage.py
diff --git a/novaclient/v1_1/versions.py b/novaclient/v2/versions.py
index 5ab09a1..5ab09a1 100644
--- a/novaclient/v1_1/versions.py
+++ b/novaclient/v2/versions.py
diff --git a/novaclient/v1_1/virtual_interfaces.py b/novaclient/v2/virtual_interfaces.py
index 9c04e8d..9c04e8d 100644
--- a/novaclient/v1_1/virtual_interfaces.py
+++ b/novaclient/v2/virtual_interfaces.py
diff --git a/novaclient/v1_1/volume_snapshots.py b/novaclient/v2/volume_snapshots.py
index d3bc918..d3bc918 100644
--- a/novaclient/v1_1/volume_snapshots.py
+++ b/novaclient/v2/volume_snapshots.py
diff --git a/novaclient/v1_1/volume_types.py b/novaclient/v2/volume_types.py
index 3d1c7f5..3d1c7f5 100644
--- a/novaclient/v1_1/volume_types.py
+++ b/novaclient/v2/volume_types.py
diff --git a/novaclient/v1_1/volumes.py b/novaclient/v2/volumes.py
index 9b9cf18..9b9cf18 100644
--- a/novaclient/v1_1/volumes.py
+++ b/novaclient/v2/volumes.py