Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame^] | 1 | import tempest.config |
| 2 | from tempest.services.image import service as image_service |
Daryl Walleck | ed8bef3 | 2011-12-05 23:02:08 -0600 | [diff] [blame] | 3 | from tempest.services.nova.json.images_client import ImagesClient |
| 4 | from tempest.services.nova.json.flavors_client import FlavorsClient |
| 5 | from tempest.services.nova.json.servers_client import ServersClient |
| 6 | from tempest.services.nova.json.limits_client import LimitsClient |
donald-ngo | 20b6bca | 2011-12-15 13:35:12 -0800 | [diff] [blame] | 7 | from tempest.services.nova.json.extensions_client import ExtensionsClient |
Ravikumar Venkatesan | af7ab1c | 2012-01-17 12:54:22 -0800 | [diff] [blame] | 8 | from tempest.services.nova.json.security_groups_client \ |
| 9 | import SecurityGroupsClient |
Ravikumar Venkatesan | eeb9caa | 2012-01-12 16:42:36 -0800 | [diff] [blame] | 10 | |
Daryl Walleck | ed8bef3 | 2011-12-05 23:02:08 -0600 | [diff] [blame] | 11 | import tempest.config |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 12 | |
| 13 | |
| 14 | class Manager(object): |
| 15 | |
| 16 | def __init__(self): |
| 17 | """ |
| 18 | Top level manager for all Openstack APIs |
| 19 | """ |
Brian Waldon | 738cd63 | 2011-12-12 18:45:09 -0500 | [diff] [blame] | 20 | self.config = tempest.config.TempestConfig() |
Rohit Karajgi | e1b050d | 2011-12-02 16:13:18 -0800 | [diff] [blame] | 21 | |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 22 | if self.config.env.authentication == 'keystone_v2': |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 23 | self.servers_client = ServersClient(self.config, |
| 24 | self.config.nova.username, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 25 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 26 | self.config.nova.auth_url, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 27 | self.config.nova.tenant_name) |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 28 | self.flavors_client = FlavorsClient(self.config, |
| 29 | self.config.nova.username, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 30 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 31 | self.config.nova.auth_url, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 32 | self.config.nova.tenant_name) |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 33 | self.images_client = ImagesClient(self.config, |
| 34 | self.config.nova.username, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 35 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 36 | self.config.nova.auth_url, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 37 | self.config.nova.tenant_name) |
Daryl Walleck | ed8bef3 | 2011-12-05 23:02:08 -0600 | [diff] [blame] | 38 | self.limits_client = LimitsClient(self.config, |
| 39 | self.config.nova.username, |
| 40 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 41 | self.config.nova.auth_url, |
Daryl Walleck | ed8bef3 | 2011-12-05 23:02:08 -0600 | [diff] [blame] | 42 | self.config.nova.tenant_name) |
donald-ngo | 20b6bca | 2011-12-15 13:35:12 -0800 | [diff] [blame] | 43 | self.extensions_client = ExtensionsClient(self.config, |
| 44 | self.config.nova.username, |
| 45 | self.config.nova.api_key, |
| 46 | self.config.nova.auth_url, |
| 47 | self.config.nova.tenant_name) |
Ravikumar Venkatesan | eeb9caa | 2012-01-12 16:42:36 -0800 | [diff] [blame] | 48 | self.security_groups_client = SecurityGroupsClient(self.config, |
| 49 | self.config.nova.username, |
| 50 | self.config.nova.api_key, |
| 51 | self.config.nova.auth_url, |
| 52 | self.config.nova.tenant_name) |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 53 | else: |
| 54 | #Assuming basic/native authentication |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 55 | self.servers_client = ServersClient(self.config, |
| 56 | self.config.nova.username, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 57 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 58 | self.config.nova.auth_url) |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 59 | self.flavors_client = FlavorsClient(self.config, |
| 60 | self.config.nova.username, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 61 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 62 | self.config.nova.auth_url) |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 63 | self.images_client = ImagesClient(self.config, |
| 64 | self.config.nova.username, |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 65 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 66 | self.config.nova.auth_url) |
Daryl Walleck | ed8bef3 | 2011-12-05 23:02:08 -0600 | [diff] [blame] | 67 | self.limits_client = LimitsClient(self.config, |
| 68 | self.config.nova.username, |
Daryl Walleck | ed8bef3 | 2011-12-05 23:02:08 -0600 | [diff] [blame] | 69 | self.config.nova.api_key, |
kavan-patil | 4ea2efb | 2011-12-09 08:58:50 +0000 | [diff] [blame] | 70 | self.config.nova.auth_url) |
donald-ngo | 20b6bca | 2011-12-15 13:35:12 -0800 | [diff] [blame] | 71 | self.extensions_client = ExtensionsClient(self.config, |
| 72 | self.config.nova.username, |
| 73 | self.config.nova.api_key, |
| 74 | self.config.nova.auth_url) |
Ravikumar Venkatesan | eeb9caa | 2012-01-12 16:42:36 -0800 | [diff] [blame] | 75 | self.security_groups_client = SecurityGroupsClient(self.config, |
| 76 | self.config.nova.username, |
| 77 | self.config.nova.api_key, |
| 78 | self.config.nova.auth_url) |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame^] | 79 | |
| 80 | |
| 81 | class ServiceManager(object): |
| 82 | |
| 83 | """ |
| 84 | Top-level object housing clients for OpenStack APIs |
| 85 | """ |
| 86 | |
| 87 | def __init__(self): |
| 88 | self.config = tempest.config.TempestConfig() |
| 89 | self.services = {} |
| 90 | self.services['image'] = image_service.Service(self.config) |
| 91 | self.images = self.services['image'] |