Browse Source

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
Andrey Kurilin 4 years ago
parent
commit
0a60aae852
100 changed files with 215 additions and 153 deletions
  1. 2
    2
      README.rst
  2. 1
    2
      doc/source/api.rst
  3. 1
    5
      doc/source/conf.py
  4. 1
    2
      doc/source/index.rst
  5. 1
    1
      doc/source/shell.rst
  6. 3
    3
      novaclient/client.py
  7. 10
    6
      novaclient/shell.py
  8. 6
    6
      novaclient/tests/unit/fixture_data/client.py
  9. 1
    1
      novaclient/tests/unit/test_auth_plugins.py
  10. 2
    2
      novaclient/tests/unit/test_base.py
  11. 19
    19
      novaclient/tests/unit/test_client.py
  12. 0
    0
      novaclient/tests/unit/v2/__init__.py
  13. 0
    0
      novaclient/tests/unit/v2/contrib/__init__.py
  14. 2
    2
      novaclient/tests/unit/v2/contrib/fakes.py
  15. 2
    2
      novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py
  16. 2
    2
      novaclient/tests/unit/v2/contrib/test_baremetal.py
  17. 2
    2
      novaclient/tests/unit/v2/contrib/test_cells.py
  18. 2
    2
      novaclient/tests/unit/v2/contrib/test_instance_actions.py
  19. 2
    2
      novaclient/tests/unit/v2/contrib/test_list_extensions.py
  20. 2
    2
      novaclient/tests/unit/v2/contrib/test_migrations.py
  21. 2
    2
      novaclient/tests/unit/v2/contrib/test_server_external_events.py
  22. 2
    2
      novaclient/tests/unit/v2/contrib/test_tenant_networks.py
  23. 1
    1
      novaclient/tests/unit/v2/fakes.py
  24. 1
    1
      novaclient/tests/unit/v2/test_agents.py
  25. 1
    1
      novaclient/tests/unit/v2/test_aggregates.py
  26. 1
    1
      novaclient/tests/unit/v2/test_auth.py
  27. 2
    2
      novaclient/tests/unit/v2/test_availability_zone.py
  28. 1
    1
      novaclient/tests/unit/v2/test_certs.py
  29. 1
    1
      novaclient/tests/unit/v2/test_client.py
  30. 1
    1
      novaclient/tests/unit/v2/test_cloudpipe.py
  31. 0
    0
      novaclient/tests/unit/v2/test_fixed_ips.py
  32. 2
    2
      novaclient/tests/unit/v2/test_flavor_access.py
  33. 2
    2
      novaclient/tests/unit/v2/test_flavors.py
  34. 1
    1
      novaclient/tests/unit/v2/test_floating_ip_dns.py
  35. 1
    1
      novaclient/tests/unit/v2/test_floating_ip_pools.py
  36. 1
    1
      novaclient/tests/unit/v2/test_floating_ips.py
  37. 1
    1
      novaclient/tests/unit/v2/test_floating_ips_bulk.py
  38. 1
    1
      novaclient/tests/unit/v2/test_fping.py
  39. 1
    1
      novaclient/tests/unit/v2/test_hosts.py
  40. 0
    0
      novaclient/tests/unit/v2/test_hypervisors.py
  41. 1
    1
      novaclient/tests/unit/v2/test_images.py
  42. 1
    1
      novaclient/tests/unit/v2/test_keypairs.py
  43. 1
    1
      novaclient/tests/unit/v2/test_limits.py
  44. 1
    1
      novaclient/tests/unit/v2/test_networks.py
  45. 1
    1
      novaclient/tests/unit/v2/test_quota_classes.py
  46. 0
    0
      novaclient/tests/unit/v2/test_quotas.py
  47. 1
    1
      novaclient/tests/unit/v2/test_security_group_rules.py
  48. 1
    1
      novaclient/tests/unit/v2/test_security_groups.py
  49. 1
    1
      novaclient/tests/unit/v2/test_server_groups.py
  50. 1
    1
      novaclient/tests/unit/v2/test_servers.py
  51. 2
    2
      novaclient/tests/unit/v2/test_services.py
  52. 37
    15
      novaclient/tests/unit/v2/test_shell.py
  53. 2
    2
      novaclient/tests/unit/v2/test_usage.py
  54. 2
    2
      novaclient/tests/unit/v2/test_volumes.py
  55. 0
    0
      novaclient/tests/unit/v2/testfile.txt
  56. 0
    0
      novaclient/tests/unit/v2/utils.py
  57. 28
    2
      novaclient/v1_1/__init__.py
  58. 16
    0
      novaclient/v2/__init__.py
  59. 0
    0
      novaclient/v2/agents.py
  60. 0
    0
      novaclient/v2/aggregates.py
  61. 0
    0
      novaclient/v2/availability_zones.py
  62. 0
    0
      novaclient/v2/certs.py
  63. 33
    33
      novaclient/v2/client.py
  64. 0
    0
      novaclient/v2/cloudpipe.py
  65. 0
    0
      novaclient/v2/contrib/__init__.py
  66. 0
    0
      novaclient/v2/contrib/assisted_volume_snapshots.py
  67. 0
    0
      novaclient/v2/contrib/baremetal.py
  68. 0
    0
      novaclient/v2/contrib/cells.py
  69. 0
    0
      novaclient/v2/contrib/deferred_delete.py
  70. 0
    0
      novaclient/v2/contrib/host_evacuate.py
  71. 0
    0
      novaclient/v2/contrib/host_evacuate_live.py
  72. 0
    0
      novaclient/v2/contrib/host_servers_migrate.py
  73. 0
    0
      novaclient/v2/contrib/instance_action.py
  74. 0
    0
      novaclient/v2/contrib/list_extensions.py
  75. 1
    1
      novaclient/v2/contrib/metadata_extensions.py
  76. 0
    0
      novaclient/v2/contrib/migrations.py
  77. 0
    0
      novaclient/v2/contrib/server_external_events.py
  78. 0
    0
      novaclient/v2/contrib/tenant_networks.py
  79. 0
    0
      novaclient/v2/fixed_ips.py
  80. 0
    0
      novaclient/v2/flavor_access.py
  81. 0
    0
      novaclient/v2/flavors.py
  82. 0
    0
      novaclient/v2/floating_ip_dns.py
  83. 0
    0
      novaclient/v2/floating_ip_pools.py
  84. 0
    0
      novaclient/v2/floating_ips.py
  85. 0
    0
      novaclient/v2/floating_ips_bulk.py
  86. 0
    0
      novaclient/v2/fping.py
  87. 0
    0
      novaclient/v2/hosts.py
  88. 0
    0
      novaclient/v2/hypervisors.py
  89. 0
    0
      novaclient/v2/images.py
  90. 0
    0
      novaclient/v2/keypairs.py
  91. 0
    0
      novaclient/v2/limits.py
  92. 0
    0
      novaclient/v2/networks.py
  93. 0
    0
      novaclient/v2/quota_classes.py
  94. 0
    0
      novaclient/v2/quotas.py
  95. 0
    0
      novaclient/v2/security_group_default_rules.py
  96. 0
    0
      novaclient/v2/security_group_rules.py
  97. 0
    0
      novaclient/v2/security_groups.py
  98. 0
    0
      novaclient/v2/server_groups.py
  99. 1
    1
      novaclient/v2/servers.py
  100. 0
    0
      novaclient/v2/services.py

+ 2
- 2
README.rst View File

@@ -46,7 +46,7 @@ and the version of the API with ``--os-compute-api-version``.  Or set them as
46 46
 an environment variables as well::
47 47
 
48 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
 
51 51
 If you are using Keystone, you need to set the OS_AUTH_URL to the keystone
52 52
 endpoint::
@@ -69,7 +69,7 @@ There's also a complete Python API, but it has not yet been documented.
69 69
 To use with nova, with keystone as the authentication system::
70 70
 
71 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 73
     >>> nt = client.Client(USER, PASS, TENANT, AUTH_URL, service_type="compute")
74 74
     >>> nt.flavors.list()
75 75
     [...]

+ 1
- 2
doc/source/api.rst View File

@@ -60,5 +60,4 @@ For more information, see the reference:
60 60
    :maxdepth: 2
61 61
 
62 62
    ref/index
63
-   ref/v1_1/index
64
-   ref/v3/index
63
+   ref/v2/index

+ 1
- 5
doc/source/conf.py View File

@@ -71,17 +71,13 @@ def gen_ref(ver, title, names):
71 71
                              "pkg": pkg, "name": name})
72 72
 
73 73
 gen_ref(None, "Exceptions", ["exceptions"])
74
-gen_ref("v1_1", "Version 1.1, Version 2 API Reference",
74
+gen_ref("v2", "Version 1.1, Version 2 API Reference, Version 3 API Reference",
75 75
         ["flavors", "images", "servers", "hosts", "agents", "aggregates",
76 76
          "availability_zones", "certs", "fixed_ips", "floating_ip_pools",
77 77
          "floating_ips", "hypervisors", "keypairs", "limits", "networks",
78 78
          "quota_classes", "quotas", "security_group_rules",
79 79
          "security_groups", "services", "virtual_interfaces",
80 80
          "volume_snapshots", "volumes", "volume_types"])
81
-gen_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 82
 # -- General configuration ----------------------------------------------------
87 83
 

+ 1
- 2
doc/source/index.rst View File

@@ -25,8 +25,7 @@ Contents:
25 25
    shell
26 26
    api
27 27
    ref/index
28
-   ref/v1_1/index
29
-   ref/v3/index
28
+   ref/v2/index
30 29
    releases
31 30
 
32 31
 Contributing

+ 1
- 1
doc/source/shell.rst View File

@@ -41,7 +41,7 @@ For example, in Bash you'd use::
41 41
     export OS_PASSWORD=yadayadayada
42 42
     export OS_TENANT_NAME=myproject
43 43
     export OS_AUTH_URL=http://...
44
-    export OS_COMPUTE_API_VERSION=1.1
44
+    export OS_COMPUTE_API_VERSION=2
45 45
     
46 46
 From there, all shell commands take the form::
47 47
     

+ 3
- 3
novaclient/client.py View File

@@ -773,9 +773,9 @@ def _construct_http_client(username=None, password=None, project_id=None,
773 773
 
774 774
 def get_client_class(version):
775 775
     version_map = {
776
-        '1.1': 'novaclient.v1_1.client.Client',
777
-        '2': 'novaclient.v1_1.client.Client',
778
-        '3': 'novaclient.v1_1.client.Client',
776
+        '1.1': 'novaclient.v2.client.Client',
777
+        '2': 'novaclient.v2.client.Client',
778
+        '3': 'novaclient.v2.client.Client',
779 779
     }
780 780
     try:
781 781
         client_path = version_map[str(version)]

+ 10
- 6
novaclient/shell.py View File

@@ -55,9 +55,9 @@ import novaclient.extension
55 55
 from novaclient.i18n import _
56 56
 from novaclient.openstack.common import cliutils
57 57
 from novaclient import utils
58
-from novaclient.v1_1 import shell as shell_v1_1
58
+from novaclient.v2 import shell as shell_v2
59 59
 
60
-DEFAULT_OS_COMPUTE_API_VERSION = "1.1"
60
+DEFAULT_OS_COMPUTE_API_VERSION = "2"
61 61
 DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL'
62 62
 # NOTE(cyeoh): Having the service type dependent on the API version
63 63
 # is pretty ugly, but we have to do this because traditionally the
@@ -446,12 +446,12 @@ class OpenStackComputeShell(object):
446 446
 
447 447
         try:
448 448
             actions_module = {
449
-                '1.1': shell_v1_1,
450
-                '2': shell_v1_1,
451
-                '3': shell_v1_1,
449
+                '1.1': shell_v2,
450
+                '2': shell_v2,
451
+                '3': shell_v2,
452 452
             }[version]
453 453
         except KeyError:
454
-            actions_module = shell_v1_1
454
+            actions_module = shell_v2
455 455
 
456 456
         self._find_actions(subparsers, actions_module)
457 457
         self._find_actions(subparsers, self)
@@ -491,6 +491,10 @@ class OpenStackComputeShell(object):
491 491
     def _discover_via_contrib_path(self, version):
492 492
         module_path = os.path.dirname(os.path.abspath(__file__))
493 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 498
         ext_path = os.path.join(module_path, version_str, 'contrib')
495 499
         ext_glob = os.path.join(ext_path, "*.py")
496 500
 

+ 6
- 6
novaclient/tests/unit/fixture_data/client.py View File

@@ -15,7 +15,7 @@ from keystoneclient.auth.identity import v2
15 15
 from keystoneclient import fixture
16 16
 from keystoneclient import session
17 17
 
18
-from novaclient.v1_1 import client as v1_1client
18
+from novaclient.v2 import client as v2client
19 19
 
20 20
 IDENTITY_URL = 'http://identityserver:5000/v2.0'
21 21
 COMPUTE_URL = 'http://compute.host'
@@ -51,10 +51,10 @@ class V1(fixtures.Fixture):
51 51
         self.client = self.new_client()
52 52
 
53 53
     def new_client(self):
54
-        return v1_1client.Client(username='xx',
55
-                                 api_key='xx',
56
-                                 project_id='xx',
57
-                                 auth_url=self.identity_url)
54
+        return v2client.Client(username='xx',
55
+                               api_key='xx',
56
+                               project_id='xx',
57
+                               auth_url=self.identity_url)
58 58
 
59 59
 
60 60
 class SessionV1(V1):
@@ -62,4 +62,4 @@ class SessionV1(V1):
62 62
     def new_client(self):
63 63
         self.session = session.Session()
64 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)

+ 1
- 1
novaclient/tests/unit/test_auth_plugins.py View File

@@ -28,7 +28,7 @@ except ImportError:
28 28
 from novaclient import auth_plugin
29 29
 from novaclient import exceptions
30 30
 from novaclient.tests.unit import utils
31
-from novaclient.v1_1 import client
31
+from novaclient.v2 import client
32 32
 
33 33
 
34 34
 def mock_http_request(resp=None):

+ 2
- 2
novaclient/tests/unit/test_base.py View File

@@ -14,8 +14,8 @@
14 14
 from novaclient import base
15 15
 from novaclient import exceptions
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.tests.unit.v1_1 import fakes
18
-from novaclient.v1_1 import flavors
17
+from novaclient.tests.unit.v2 import fakes
18
+from novaclient.v2 import flavors
19 19
 
20 20
 
21 21
 cs = fakes.FakeClient()

+ 19
- 19
novaclient/tests/unit/test_client.py View File

@@ -24,7 +24,7 @@ import requests
24 24
 import novaclient.client
25 25
 import novaclient.extension
26 26
 from novaclient.tests.unit import utils
27
-import novaclient.v1_1.client
27
+import novaclient.v2.client
28 28
 
29 29
 
30 30
 class ClientConnectionPoolTest(utils.TestCase):
@@ -138,57 +138,57 @@ class ClientTest(utils.TestCase):
138 138
 
139 139
     def test_get_client_class_v3(self):
140 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 143
     def test_get_client_class_v2(self):
144 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 147
     def test_get_client_class_v2_int(self):
148 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 151
     def test_get_client_class_v1_1(self):
152 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 155
     def test_get_client_class_unknown(self):
156 156
         self.assertRaises(novaclient.exceptions.UnsupportedVersion,
157 157
                           novaclient.client.get_client_class, '0')
158 158
 
159 159
     def test_client_with_os_cache_enabled(self):
160
-        cs = novaclient.v1_1.client.Client("user", "password", "project_id",
161
-                                           auth_url="foo/v2", os_cache=True)
160
+        cs = novaclient.v2.client.Client("user", "password", "project_id",
161
+                                         auth_url="foo/v2", os_cache=True)
162 162
         self.assertEqual(True, cs.os_cache)
163 163
         self.assertEqual(True, cs.client.os_cache)
164 164
 
165 165
     def test_client_with_os_cache_disabled(self):
166
-        cs = novaclient.v1_1.client.Client("user", "password", "project_id",
167
-                                           auth_url="foo/v2", os_cache=False)
166
+        cs = novaclient.v2.client.Client("user", "password", "project_id",
167
+                                         auth_url="foo/v2", os_cache=False)
168 168
         self.assertEqual(False, cs.os_cache)
169 169
         self.assertEqual(False, cs.client.os_cache)
170 170
 
171 171
     def test_client_with_no_cache_enabled(self):
172
-        cs = novaclient.v1_1.client.Client("user", "password", "project_id",
173
-                                           auth_url="foo/v2", no_cache=True)
172
+        cs = novaclient.v2.client.Client("user", "password", "project_id",
173
+                                         auth_url="foo/v2", no_cache=True)
174 174
         self.assertEqual(False, cs.os_cache)
175 175
         self.assertEqual(False, cs.client.os_cache)
176 176
 
177 177
     def test_client_with_no_cache_disabled(self):
178
-        cs = novaclient.v1_1.client.Client("user", "password", "project_id",
179
-                                           auth_url="foo/v2", no_cache=False)
178
+        cs = novaclient.v2.client.Client("user", "password", "project_id",
179
+                                         auth_url="foo/v2", no_cache=False)
180 180
         self.assertEqual(True, cs.os_cache)
181 181
         self.assertEqual(True, cs.client.os_cache)
182 182
 
183 183
     def test_client_set_management_url_v1_1(self):
184
-        cs = novaclient.v1_1.client.Client("user", "password", "project_id",
185
-                                           auth_url="foo/v2")
184
+        cs = novaclient.v2.client.Client("user", "password", "project_id",
185
+                                         auth_url="foo/v2")
186 186
         cs.set_management_url("blabla")
187 187
         self.assertEqual("blabla", cs.client.management_url)
188 188
 
189 189
     def test_client_get_reset_timings_v1_1(self):
190
-        cs = novaclient.v1_1.client.Client("user", "password", "project_id",
191
-                                           auth_url="foo/v2")
190
+        cs = novaclient.v2.client.Client("user", "password", "project_id",
191
+                                         auth_url="foo/v2")
192 192
         self.assertEqual(0, len(cs.get_timings()))
193 193
         cs.client.times.append("somevalue")
194 194
         self.assertEqual(1, len(cs.get_timings()))
@@ -201,8 +201,8 @@ class ClientTest(utils.TestCase):
201 201
     def test_contextmanager_v1_1(self, mock_http_client):
202 202
         fake_client = mock.Mock()
203 203
         mock_http_client.return_value = fake_client
204
-        with novaclient.v1_1.client.Client("user", "password", "project_id",
205
-                                           auth_url="foo/v2"):
204
+        with novaclient.v2.client.Client("user", "password", "project_id",
205
+                                         auth_url="foo/v2"):
206 206
             pass
207 207
         self.assertTrue(fake_client.open_session.called)
208 208
         self.assertTrue(fake_client.close_session.called)

novaclient/tests/unit/v1_1/__init__.py → novaclient/tests/unit/v2/__init__.py View File


novaclient/tests/unit/v1_1/contrib/__init__.py → novaclient/tests/unit/v2/contrib/__init__.py View File


novaclient/tests/unit/v1_1/contrib/fakes.py → novaclient/tests/unit/v2/contrib/fakes.py View File

@@ -12,8 +12,8 @@
12 12
 # See the License for the specific language governing permissions and
13 13
 # limitations under the License.
14 14
 
15
-from novaclient.tests.unit.v1_1 import fakes
16
-from novaclient.v1_1 import client
15
+from novaclient.tests.unit.v2 import fakes
16
+from novaclient.v2 import client
17 17
 
18 18
 
19 19
 class FakeClient(fakes.FakeClient):

novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py → novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py View File

@@ -18,8 +18,8 @@ Assisted volume snapshots - to be used by Cinder and not end users.
18 18
 
19 19
 from novaclient import extension
20 20
 from novaclient.tests.unit import utils
21
-from novaclient.tests.unit.v1_1.contrib import fakes
22
-from novaclient.v1_1.contrib import assisted_volume_snapshots as assisted_snaps
21
+from novaclient.tests.unit.v2.contrib import fakes
22
+from novaclient.v2.contrib import assisted_volume_snapshots as assisted_snaps
23 23
 
24 24
 
25 25
 extensions = [

novaclient/tests/unit/v1_1/contrib/test_baremetal.py → novaclient/tests/unit/v2/contrib/test_baremetal.py View File

@@ -16,8 +16,8 @@
16 16
 
17 17
 from novaclient import extension
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.tests.unit.v1_1.contrib import fakes
20
-from novaclient.v1_1.contrib import baremetal
19
+from novaclient.tests.unit.v2.contrib import fakes
20
+from novaclient.v2.contrib import baremetal
21 21
 
22 22
 
23 23
 extensions = [

novaclient/tests/unit/v1_1/contrib/test_cells.py → novaclient/tests/unit/v2/contrib/test_cells.py View File

@@ -15,8 +15,8 @@
15 15
 
16 16
 from novaclient import extension
17 17
 from novaclient.tests.unit import utils
18
-from novaclient.tests.unit.v1_1.contrib import fakes
19
-from novaclient.v1_1.contrib import cells
18
+from novaclient.tests.unit.v2.contrib import fakes
19
+from novaclient.v2.contrib import cells
20 20
 
21 21
 
22 22
 extensions = [

novaclient/tests/unit/v1_1/contrib/test_instance_actions.py → novaclient/tests/unit/v2/contrib/test_instance_actions.py View File

@@ -15,8 +15,8 @@
15 15
 
16 16
 from novaclient import extension
17 17
 from novaclient.tests.unit import utils
18
-from novaclient.tests.unit.v1_1.contrib import fakes
19
-from novaclient.v1_1.contrib import instance_action
18
+from novaclient.tests.unit.v2.contrib import fakes
19
+from novaclient.v2.contrib import instance_action
20 20
 
21 21
 
22 22
 extensions = [

novaclient/tests/unit/v1_1/contrib/test_list_extensions.py → novaclient/tests/unit/v2/contrib/test_list_extensions.py View File

@@ -13,8 +13,8 @@
13 13
 
14 14
 from novaclient import extension
15 15
 from novaclient.tests.unit import utils
16
-from novaclient.tests.unit.v1_1 import fakes
17
-from novaclient.v1_1.contrib import list_extensions
16
+from novaclient.tests.unit.v2 import fakes
17
+from novaclient.v2.contrib import list_extensions
18 18
 
19 19
 
20 20
 extensions = [

novaclient/tests/unit/v1_1/contrib/test_migrations.py → novaclient/tests/unit/v2/contrib/test_migrations.py View File

@@ -12,8 +12,8 @@
12 12
 
13 13
 from novaclient import extension
14 14
 from novaclient.tests.unit import utils
15
-from novaclient.tests.unit.v1_1 import fakes
16
-from novaclient.v1_1.contrib import migrations
15
+from novaclient.tests.unit.v2 import fakes
16
+from novaclient.v2.contrib import migrations
17 17
 
18 18
 extensions = [
19 19
     extension.Extension(migrations.__name__.split(".")[-1],

novaclient/tests/unit/v1_1/contrib/test_server_external_events.py → novaclient/tests/unit/v2/contrib/test_server_external_events.py View File

@@ -18,8 +18,8 @@ External event triggering for servers, not to be used by users.
18 18
 
19 19
 from novaclient import extension
20 20
 from novaclient.tests.unit import utils
21
-from novaclient.tests.unit.v1_1.contrib import fakes
22
-from novaclient.v1_1.contrib import server_external_events as ext_events
21
+from novaclient.tests.unit.v2.contrib import fakes
22
+from novaclient.v2.contrib import server_external_events as ext_events
23 23
 
24 24
 
25 25
 extensions = [

novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py → novaclient/tests/unit/v2/contrib/test_tenant_networks.py View File

@@ -15,8 +15,8 @@
15 15
 
16 16
 from novaclient import extension
17 17
 from novaclient.tests.unit import utils
18
-from novaclient.tests.unit.v1_1.contrib import fakes
19
-from novaclient.v1_1.contrib import tenant_networks
18
+from novaclient.tests.unit.v2.contrib import fakes
19
+from novaclient.v2.contrib import tenant_networks
20 20
 
21 21
 
22 22
 extensions = [

novaclient/tests/unit/v1_1/fakes.py → novaclient/tests/unit/v2/fakes.py View File

@@ -25,7 +25,7 @@ from novaclient import client as base_client
25 25
 from novaclient import exceptions
26 26
 from novaclient.tests.unit import fakes
27 27
 from novaclient.tests.unit import utils
28
-from novaclient.v1_1 import client
28
+from novaclient.v2 import client
29 29
 
30 30
 
31 31
 class FakeClient(fakes.FakeClient, client.Client):

novaclient/tests/unit/v1_1/test_agents.py → novaclient/tests/unit/v2/test_agents.py View File

@@ -16,7 +16,7 @@
16 16
 from novaclient.tests.unit.fixture_data import agents as data
17 17
 from novaclient.tests.unit.fixture_data import client
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.v1_1 import agents
19
+from novaclient.v2 import agents
20 20
 
21 21
 
22 22
 class AgentsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_aggregates.py → novaclient/tests/unit/v2/test_aggregates.py View File

@@ -16,7 +16,7 @@
16 16
 from novaclient.tests.unit.fixture_data import aggregates as data
17 17
 from novaclient.tests.unit.fixture_data import client
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.v1_1 import aggregates
19
+from novaclient.v2 import aggregates
20 20
 
21 21
 
22 22
 class AggregatesTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_auth.py → novaclient/tests/unit/v2/test_auth.py View File

@@ -20,7 +20,7 @@ import requests
20 20
 
21 21
 from novaclient import exceptions
22 22
 from novaclient.tests.unit import utils
23
-from novaclient.v1_1 import client
23
+from novaclient.v2 import client
24 24
 
25 25
 
26 26
 class AuthenticateAgainstKeystoneTests(utils.TestCase):

novaclient/tests/unit/v1_1/test_availability_zone.py → novaclient/tests/unit/v2/test_availability_zone.py View File

@@ -19,13 +19,13 @@ import six
19 19
 from novaclient.tests.unit.fixture_data import availability_zones as data
20 20
 from novaclient.tests.unit.fixture_data import client
21 21
 from novaclient.tests.unit import utils
22
-from novaclient.v1_1 import availability_zones
22
+from novaclient.v2 import availability_zones
23 23
 
24 24
 
25 25
 class AvailabilityZoneTest(utils.FixturedTestCase):
26 26
     # NOTE(cyeoh): import shell here so the V3 version of
27 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 30
     data_fixture_class = data.V1
31 31
 

novaclient/tests/unit/v1_1/test_certs.py → novaclient/tests/unit/v2/test_certs.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import certs as data
15 15
 from novaclient.tests.unit.fixture_data import client
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import certs
17
+from novaclient.v2 import certs
18 18
 
19 19
 
20 20
 class CertsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_client.py → novaclient/tests/unit/v2/test_client.py View File

@@ -15,7 +15,7 @@ import uuid
15 15
 from keystoneclient import session
16 16
 
17 17
 from novaclient.tests.unit import utils
18
-from novaclient.v1_1 import client
18
+from novaclient.v2 import client
19 19
 
20 20
 
21 21
 class ClientTest(utils.TestCase):

novaclient/tests/unit/v1_1/test_cloudpipe.py → novaclient/tests/unit/v2/test_cloudpipe.py View File

@@ -16,7 +16,7 @@ import six
16 16
 from novaclient.tests.unit.fixture_data import client
17 17
 from novaclient.tests.unit.fixture_data import cloudpipe as data
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.v1_1 import cloudpipe
19
+from novaclient.v2 import cloudpipe
20 20
 
21 21
 
22 22
 class CloudpipeTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_fixed_ips.py → novaclient/tests/unit/v2/test_fixed_ips.py View File


novaclient/tests/unit/v1_1/test_flavor_access.py → novaclient/tests/unit/v2/test_flavor_access.py View File

@@ -14,8 +14,8 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.tests.unit.v1_1 import fakes
18
-from novaclient.v1_1 import flavor_access
17
+from novaclient.tests.unit.v2 import fakes
18
+from novaclient.v2 import flavor_access
19 19
 
20 20
 
21 21
 cs = fakes.FakeClient()

novaclient/tests/unit/v1_1/test_flavors.py → novaclient/tests/unit/v2/test_flavors.py View File

@@ -17,8 +17,8 @@ import mock
17 17
 
18 18
 from novaclient import exceptions
19 19
 from novaclient.tests.unit import utils
20
-from novaclient.tests.unit.v1_1 import fakes
21
-from novaclient.v1_1 import flavors
20
+from novaclient.tests.unit.v2 import fakes
21
+from novaclient.v2 import flavors
22 22
 
23 23
 
24 24
 class FlavorsTest(utils.TestCase):

novaclient/tests/unit/v1_1/test_floating_ip_dns.py → novaclient/tests/unit/v2/test_floating_ip_dns.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import floatingips as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import floating_ip_dns
17
+from novaclient.v2 import floating_ip_dns
18 18
 
19 19
 
20 20
 class FloatingIPDNSDomainTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_floating_ip_pools.py → novaclient/tests/unit/v2/test_floating_ip_pools.py View File

@@ -17,7 +17,7 @@
17 17
 from novaclient.tests.unit.fixture_data import client
18 18
 from novaclient.tests.unit.fixture_data import floatingips as data
19 19
 from novaclient.tests.unit import utils
20
-from novaclient.v1_1 import floating_ip_pools
20
+from novaclient.v2 import floating_ip_pools
21 21
 
22 22
 
23 23
 class TestFloatingIPPools(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_floating_ips.py → novaclient/tests/unit/v2/test_floating_ips.py View File

@@ -17,7 +17,7 @@
17 17
 from novaclient.tests.unit.fixture_data import client
18 18
 from novaclient.tests.unit.fixture_data import floatingips as data
19 19
 from novaclient.tests.unit import utils
20
-from novaclient.v1_1 import floating_ips
20
+from novaclient.v2 import floating_ips
21 21
 
22 22
 
23 23
 class FloatingIPsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_floating_ips_bulk.py → novaclient/tests/unit/v2/test_floating_ips_bulk.py View File

@@ -16,7 +16,7 @@
16 16
 from novaclient.tests.unit.fixture_data import client
17 17
 from novaclient.tests.unit.fixture_data import floatingips as data
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.v1_1 import floating_ips_bulk
19
+from novaclient.v2 import floating_ips_bulk
20 20
 
21 21
 
22 22
 class FloatingIPsBulkTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_fping.py → novaclient/tests/unit/v2/test_fping.py View File

@@ -16,7 +16,7 @@
16 16
 from novaclient.tests.unit.fixture_data import client
17 17
 from novaclient.tests.unit.fixture_data import fping as data
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.v1_1 import fping
19
+from novaclient.v2 import fping
20 20
 
21 21
 
22 22
 class FpingTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_hosts.py → novaclient/tests/unit/v2/test_hosts.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import hosts as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import hosts
17
+from novaclient.v2 import hosts
18 18
 
19 19
 
20 20
 class HostsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_hypervisors.py → novaclient/tests/unit/v2/test_hypervisors.py View File


novaclient/tests/unit/v1_1/test_images.py → novaclient/tests/unit/v2/test_images.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import images as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import images
17
+from novaclient.v2 import images
18 18
 
19 19
 
20 20
 class ImagesTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_keypairs.py → novaclient/tests/unit/v2/test_keypairs.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import keypairs as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import keypairs
17
+from novaclient.v2 import keypairs
18 18
 
19 19
 
20 20
 class KeypairsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_limits.py → novaclient/tests/unit/v2/test_limits.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import limits as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import limits
17
+from novaclient.v2 import limits
18 18
 
19 19
 
20 20
 class LimitsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_networks.py → novaclient/tests/unit/v2/test_networks.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import networks as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import networks
17
+from novaclient.v2 import networks
18 18
 
19 19
 
20 20
 class NetworksTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_quota_classes.py → novaclient/tests/unit/v2/test_quota_classes.py View File

@@ -14,7 +14,7 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.tests.unit.v1_1 import fakes
17
+from novaclient.tests.unit.v2 import fakes
18 18
 
19 19
 
20 20
 cs = fakes.FakeClient()

novaclient/tests/unit/v1_1/test_quotas.py → novaclient/tests/unit/v2/test_quotas.py View File


novaclient/tests/unit/v1_1/test_security_group_rules.py → novaclient/tests/unit/v2/test_security_group_rules.py View File

@@ -15,7 +15,7 @@ from novaclient import exceptions
15 15
 from novaclient.tests.unit.fixture_data import client
16 16
 from novaclient.tests.unit.fixture_data import security_group_rules as data
17 17
 from novaclient.tests.unit import utils
18
-from novaclient.v1_1 import security_group_rules
18
+from novaclient.v2 import security_group_rules
19 19
 
20 20
 
21 21
 class SecurityGroupRulesTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_security_groups.py → novaclient/tests/unit/v2/test_security_groups.py View File

@@ -14,7 +14,7 @@
14 14
 from novaclient.tests.unit.fixture_data import client
15 15
 from novaclient.tests.unit.fixture_data import security_groups as data
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.v1_1 import security_groups
17
+from novaclient.v2 import security_groups
18 18
 
19 19
 
20 20
 class SecurityGroupsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_server_groups.py → novaclient/tests/unit/v2/test_server_groups.py View File

@@ -16,7 +16,7 @@
16 16
 from novaclient.tests.unit.fixture_data import client
17 17
 from novaclient.tests.unit.fixture_data import server_groups as data
18 18
 from novaclient.tests.unit import utils
19
-from novaclient.v1_1 import server_groups
19
+from novaclient.v2 import server_groups
20 20
 
21 21
 
22 22
 class ServerGroupsTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_servers.py → novaclient/tests/unit/v2/test_servers.py View File

@@ -21,7 +21,7 @@ from novaclient.tests.unit.fixture_data import client
21 21
 from novaclient.tests.unit.fixture_data import floatingips
22 22
 from novaclient.tests.unit.fixture_data import servers as data
23 23
 from novaclient.tests.unit import utils
24
-from novaclient.v1_1 import servers
24
+from novaclient.v2 import servers
25 25
 
26 26
 
27 27
 class ServersTest(utils.FixturedTestCase):

novaclient/tests/unit/v1_1/test_services.py → novaclient/tests/unit/v2/test_services.py View File

@@ -14,8 +14,8 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.tests.unit.v1_1 import fakes
18
-from novaclient.v1_1 import services
17
+from novaclient.tests.unit.v2 import fakes
18
+from novaclient.v2 import services
19 19
 
20 20
 
21 21
 class ServicesTest(utils.TestCase):

novaclient/tests/unit/v1_1/test_shell.py → novaclient/tests/unit/v2/test_shell.py View File

@@ -30,8 +30,8 @@ import novaclient.client
30 30
 from novaclient import exceptions
31 31
 import novaclient.shell
32 32
 from novaclient.tests.unit import utils
33
-from novaclient.tests.unit.v1_1 import fakes
34
-import novaclient.v1_1.shell
33
+from novaclient.tests.unit.v2 import fakes
34
+import novaclient.v2.shell
35 35
 
36 36
 
37 37
 class ShellFixture(fixtures.Fixture):
@@ -54,7 +54,7 @@ class ShellTest(utils.TestCase):
54 54
         'NOVA_USERNAME': 'username',
55 55
         'NOVA_PASSWORD': 'password',
56 56
         'NOVA_PROJECT_ID': 'project_id',
57
-        'OS_COMPUTE_API_VERSION': '1.1',
57
+        'OS_COMPUTE_API_VERSION': '2',
58 58
         'NOVA_URL': 'http://no.where',
59 59
         'OS_AUTH_URL': 'http://no.where/v2.0',
60 60
     }
@@ -644,7 +644,7 @@ class ShellTest(utils.TestCase):
644 644
         cmd = 'boot --image 1 --flavor 1 --min-count 3 --max-count 1 serv'
645 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 648
     def test_boot_with_poll(self, poll_method):
649 649
         self.run_command('boot --flavor 1 --image 1 some-server --poll')
650 650
         self.assert_called_anytime(
@@ -1088,7 +1088,7 @@ class ShellTest(utils.TestCase):
1088 1088
         self.assertRaises(exceptions.CommandError,
1089 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 1092
     def test_print_server(self, mock_print_dict):
1093 1093
         self.run_command('show 5678')
1094 1094
         args, kwargs = mock_print_dict.call_args
@@ -2225,7 +2225,7 @@ class ShellTest(utils.TestCase):
2225 2225
                            '/os-migrations?cell_name=child1&host=host1'
2226 2226
                            '&status=finished')
2227 2227
 
2228
-    @mock.patch('novaclient.v1_1.shell._find_server')
2228
+    @mock.patch('novaclient.v2.shell._find_server')
2229 2229
     @mock.patch('os.system')
2230 2230
     def test_ssh(self, mock_system, mock_find_server):
2231 2231
         class FakeResources(object):
@@ -2273,7 +2273,7 @@ class ShellTest(utils.TestCase):
2273 2273
         mock_system.assert_called_with("ssh -6 -p22  "
2274 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 2277
     @mock.patch('os.system')
2278 2278
     def test_ssh_multinet(self, mock_system, mock_find_server):
2279 2279
         class FakeResources(object):
@@ -2338,6 +2338,28 @@ class ShellTest(utils.TestCase):
2338 2338
         self.assert_called('DELETE', '/os-server-groups/12345', pos=-2)
2339 2339
 
2340 2340
 
2341
+class 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
+
2352
+class 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
+
2341 2363
 class ShellWithSessionClientTest(ShellTest):
2342 2364
 
2343 2365
     def setUp(self):
@@ -2354,7 +2376,7 @@ class GetSecgroupTest(utils.TestCase):
2354 2376
             'security_groups.get.return_value': 'sec_group',
2355 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 2380
         self.assertEqual('sec_group', result)
2359 2381
         cs.security_groups.get.assert_called_once_with('1')
2360 2382
 
@@ -2363,7 +2385,7 @@ class GetSecgroupTest(utils.TestCase):
2363 2385
             'security_groups.get.return_value': 'sec_group',
2364 2386
             'security_groups.list.return_value': [],
2365 2387
         })
2366
-        result = novaclient.v1_1.shell._get_secgroup(
2388
+        result = novaclient.v2.shell._get_secgroup(
2367 2389
             cs, 'c0c32459-dc5f-44dc-9a0a-473b28bac831')
2368 2390
         self.assertEqual('sec_group', result)
2369 2391
         cs.security_groups.get.assert_called_once_with(
@@ -2375,7 +2397,7 @@ class GetSecgroupTest(utils.TestCase):
2375 2397
             'security_groups.list.return_value': [],
2376 2398
         })
2377 2399
         self.assertRaises(exceptions.CommandError,
2378
-                          novaclient.v1_1.shell._get_secgroup,
2400
+                          novaclient.v2.shell._get_secgroup,
2379 2401
                           cs,
2380 2402
                           'abc')
2381 2403
 
@@ -2387,7 +2409,7 @@ class GetSecgroupTest(utils.TestCase):
2387 2409
             'security_groups.list.return_value': [group_one, group_one],
2388 2410
         })
2389 2411
         self.assertRaises(exceptions.NoUniqueMatch,
2390
-                          novaclient.v1_1.shell._get_secgroup,
2412
+                          novaclient.v2.shell._get_secgroup,
2391 2413
                           cs,
2392 2414
                           'group_one')
2393 2415
 
@@ -2396,7 +2418,7 @@ class GetFirstEndpointTest(utils.TestCase):
2396 2418
     def test_only_one_endpoint(self):
2397 2419
         """If there is only one endpoint, it is returned."""
2398 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 2422
         self.assertEqual(endpoint, result)
2401 2423
 
2402 2424
     def test_multiple_endpoints(self):
@@ -2409,7 +2431,7 @@ class GetFirstEndpointTest(utils.TestCase):
2409 2431
             {"region": "ORD", "number": 1},
2410 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 2435
         self.assertEqual(endpoints[1], result)
2414 2436
 
2415 2437
     def test_multiple_endpoints_but_none_suitable(self):
@@ -2423,11 +2445,11 @@ class GetFirstEndpointTest(utils.TestCase):
2423 2445
             {"region": "STU"}
2424 2446
         ]
2425 2447
         self.assertRaises(LookupError,
2426
-                          novaclient.v1_1.shell._get_first_endpoint,
2448
+                          novaclient.v2.shell._get_first_endpoint,
2427 2449
                           endpoints, "ORD")
2428 2450
 
2429 2451
     def test_no_endpoints(self):
2430 2452
         """If there are no endpoints available, an exception is raised."""
2431 2453
         self.assertRaises(LookupError,
2432
-                          novaclient.v1_1.shell._get_first_endpoint,
2454
+                          novaclient.v2.shell._get_first_endpoint,
2433 2455
                           [], "ORD")

novaclient/tests/unit/v1_1/test_usage.py → novaclient/tests/unit/v2/test_usage.py View File

@@ -14,8 +14,8 @@
14 14
 import datetime
15 15
 
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.tests.unit.v1_1 import fakes
18
-from novaclient.v1_1 import usage
17
+from novaclient.tests.unit.v2 import fakes
18
+from novaclient.v2 import usage
19 19
 
20 20
 
21 21
 class UsageTest(utils.TestCase):

novaclient/tests/unit/v1_1/test_volumes.py → novaclient/tests/unit/v2/test_volumes.py View File

@@ -14,8 +14,8 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient.tests.unit import utils
17
-from novaclient.tests.unit.v1_1 import fakes
18
-from novaclient.v1_1 import volumes
17
+from novaclient.tests.unit.v2 import fakes
18
+from novaclient.v2 import volumes
19 19
 
20 20
 
21 21
 cs = fakes.FakeClient()

novaclient/tests/unit/v1_1/testfile.txt → novaclient/tests/unit/v2/testfile.txt View File


novaclient/tests/unit/v1_1/utils.py → novaclient/tests/unit/v2/utils.py View File


+ 28
- 2
novaclient/v1_1/__init__.py View File

@@ -1,4 +1,3 @@
1
-# Copyright (c) 2012 OpenStack Foundation
2 1
 #
3 2
 # All Rights Reserved.
4 3
 #
@@ -14,4 +13,31 @@
14 13
 #    License for the specific language governing permissions and limitations
15 14
 #    under the License.
16 15
 
17
-from 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
+
25
+import sys
26
+import warnings
27
+
28
+from novaclient import v2
29
+
30
+warnings.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
+
36
+class 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
+
43
+sys.modules["novaclient.v1_1"] = MovedModule(v2)

+ 16
- 0
novaclient/v2/__init__.py View File

@@ -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
+
16
+from novaclient.v2.client import Client   # noqa

novaclient/v1_1/agents.py → novaclient/v2/agents.py View File


novaclient/v1_1/aggregates.py → novaclient/v2/aggregates.py View File


novaclient/v1_1/availability_zones.py → novaclient/v2/availability_zones.py View File


novaclient/v1_1/certs.py → novaclient/v2/certs.py View File


novaclient/v1_1/client.py → novaclient/v2/client.py View File

@@ -14,39 +14,39 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient import client
17
-from novaclient.v1_1 import agents
18
-from novaclient.v1_1 import aggregates
19
-from novaclient.v1_1 import availability_zones
20
-from novaclient.v1_1 import certs
21
-from novaclient.v1_1 import cloudpipe
22
-from novaclient.v1_1 import fixed_ips
23
-from novaclient.v1_1 import flavor_access
24
-from novaclient.v1_1 import flavors
25
-from novaclient.v1_1 import floating_ip_dns
26
-from novaclient.v1_1 import floating_ip_pools
27
-from novaclient.v1_1 import floating_ips
28
-from novaclient.v1_1 import floating_ips_bulk
29
-from novaclient.v1_1 import fping
30
-from novaclient.v1_1 import hosts
31
-from novaclient.v1_1 import hypervisors
32
-from novaclient.v1_1 import images
33
-from novaclient.v1_1 import keypairs
34
-from novaclient.v1_1 import limits
35
-from novaclient.v1_1 import networks
36
-from novaclient.v1_1 import quota_classes
37
-from novaclient.v1_1 import quotas
38
-from novaclient.v1_1 import security_group_default_rules
39
-from novaclient.v1_1 import security_group_rules
40
-from novaclient.v1_1 import security_groups
41
-from novaclient.v1_1 import server_groups
42
-from novaclient.v1_1 import servers
43
-from novaclient.v1_1 import services
44
-from novaclient.v1_1 import usage
45
-from novaclient.v1_1 import versions
46
-from novaclient.v1_1 import virtual_interfaces
47
-from novaclient.v1_1 import volume_snapshots
48
-from novaclient.v1_1 import volume_types
49
-from novaclient.v1_1 import volumes
17
+from novaclient.v2 import agents
18
+from novaclient.v2 import aggregates
19
+from novaclient.v2 import availability_zones
20
+from novaclient.v2 import certs
21
+from novaclient.v2 import cloudpipe
22
+from novaclient.v2 import fixed_ips
23
+from novaclient.v2 import flavor_access
24
+from novaclient.v2 import flavors
25
+from novaclient.v2 import floating_ip_dns
26
+from novaclient.v2 import floating_ip_pools
27
+from novaclient.v2 import floating_ips
28
+from novaclient.v2 import floating_ips_bulk
29
+from novaclient.v2 import fping
30
+from novaclient.v2 import hosts
31
+from novaclient.v2 import hypervisors
32
+from novaclient.v2 import images
33
+from novaclient.v2 import keypairs
34
+from novaclient.v2 import limits
35
+from novaclient.v2 import networks
36
+from novaclient.v2 import quota_classes
37
+from novaclient.v2 import quotas
38
+from novaclient.v2 import security_group_default_rules
39
+from novaclient.v2 import security_group_rules
40
+from novaclient.v2 import security_groups
41
+from novaclient.v2 import server_groups
42
+from novaclient.v2 import servers
43
+from novaclient.v2 import services
44
+from novaclient.v2 import usage
45
+from novaclient.v2 import versions
46
+from novaclient.v2 import virtual_interfaces
47
+from novaclient.v2 import volume_snapshots
48
+from novaclient.v2 import volume_types
49
+from novaclient.v2 import volumes
50 50
 
51 51
 
52 52
 class Client(object):

novaclient/v1_1/cloudpipe.py → novaclient/v2/cloudpipe.py View File


novaclient/v1_1/contrib/__init__.py → novaclient/v2/contrib/__init__.py View File


novaclient/v1_1/contrib/assisted_volume_snapshots.py → novaclient/v2/contrib/assisted_volume_snapshots.py View File


novaclient/v1_1/contrib/baremetal.py → novaclient/v2/contrib/baremetal.py View File


novaclient/v1_1/contrib/cells.py → novaclient/v2/contrib/cells.py View File


novaclient/v1_1/contrib/deferred_delete.py → novaclient/v2/contrib/deferred_delete.py View File


novaclient/v1_1/contrib/host_evacuate.py → novaclient/v2/contrib/host_evacuate.py View File


novaclient/v1_1/contrib/host_evacuate_live.py → novaclient/v2/contrib/host_evacuate_live.py View File


novaclient/v1_1/contrib/host_servers_migrate.py → novaclient/v2/contrib/host_servers_migrate.py View File


novaclient/v1_1/contrib/instance_action.py → novaclient/v2/contrib/instance_action.py View File


novaclient/v1_1/contrib/list_extensions.py → novaclient/v2/contrib/list_extensions.py View File


novaclient/v1_1/contrib/metadata_extensions.py → novaclient/v2/contrib/metadata_extensions.py View File

@@ -15,7 +15,7 @@
15 15
 
16 16
 from novaclient.i18n import _
17 17
 from novaclient.openstack.common import cliutils
18
-from novaclient.v1_1 import shell
18
+from novaclient.v2 import shell
19 19
 
20 20
 
21 21
 @cliutils.arg(

novaclient/v1_1/contrib/migrations.py → novaclient/v2/contrib/migrations.py View File


novaclient/v1_1/contrib/server_external_events.py → novaclient/v2/contrib/server_external_events.py View File


novaclient/v1_1/contrib/tenant_networks.py → novaclient/v2/contrib/tenant_networks.py View File


novaclient/v1_1/fixed_ips.py → novaclient/v2/fixed_ips.py View File


novaclient/v1_1/flavor_access.py → novaclient/v2/flavor_access.py View File


novaclient/v1_1/flavors.py → novaclient/v2/flavors.py View File


novaclient/v1_1/floating_ip_dns.py → novaclient/v2/floating_ip_dns.py View File


novaclient/v1_1/floating_ip_pools.py → novaclient/v2/floating_ip_pools.py View File


novaclient/v1_1/floating_ips.py → novaclient/v2/floating_ips.py View File


novaclient/v1_1/floating_ips_bulk.py → novaclient/v2/floating_ips_bulk.py View File


novaclient/v1_1/fping.py → novaclient/v2/fping.py View File


novaclient/v1_1/hosts.py → novaclient/v2/hosts.py View File


novaclient/v1_1/hypervisors.py → novaclient/v2/hypervisors.py View File


novaclient/v1_1/images.py → novaclient/v2/images.py View File


novaclient/v1_1/keypairs.py → novaclient/v2/keypairs.py View File


novaclient/v1_1/limits.py → novaclient/v2/limits.py View File


novaclient/v1_1/networks.py → novaclient/v2/networks.py View File


novaclient/v1_1/quota_classes.py → novaclient/v2/quota_classes.py View File


novaclient/v1_1/quotas.py → novaclient/v2/quotas.py View File


novaclient/v1_1/security_group_default_rules.py → novaclient/v2/security_group_default_rules.py View File


novaclient/v1_1/security_group_rules.py → novaclient/v2/security_group_rules.py View File


novaclient/v1_1/security_groups.py → novaclient/v2/security_groups.py View File


novaclient/v1_1/server_groups.py → novaclient/v2/server_groups.py View File


novaclient/v1_1/servers.py → novaclient/v2/servers.py View File

@@ -28,7 +28,7 @@ from six.moves.urllib import parse
28 28
 from novaclient import base
29 29
 from novaclient import crypto
30 30
 from novaclient.i18n import _
31
-from novaclient.v1_1 import security_groups
31
+from novaclient.v2 import security_groups
32 32
 
33 33
 
34 34
 REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'

novaclient/v1_1/services.py → novaclient/v2/services.py View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save