diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2019-03-04 15:13:39 +0800 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2019-03-04 15:14:31 +0800 |
commit | 4ab0077dd79bcfdee910cdc1e98537c7b05a4bbe (patch) | |
tree | c7a9086170824f4d720fa85d7b371b5b5c5b0955 /vio | |
parent | 17e11f301b70b55fdd4e0e7f47496ba0819d9751 (diff) |
Add basic function to update servers in AAI
Add basic function for heatbridge
Change-Id: I2016b2d755ad088999bd7e5ef29792a315679302
Issue-ID: MULTICLOUD-507
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/pub/utils/restcall.py | 16 | ||||
-rw-r--r-- | vio/vio/pub/vim/drivers/vimsdk/heat.py | 4 | ||||
-rw-r--r-- | vio/vio/pub/vim/vimapi/heat/OperateStack.py | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/vio/vio/pub/utils/restcall.py b/vio/vio/pub/utils/restcall.py index 12986be..33f10cd 100644 --- a/vio/vio/pub/utils/restcall.py +++ b/vio/vio/pub/utils/restcall.py @@ -222,6 +222,22 @@ class AAIClient(object): content=json.dumps(body), headers=self.default_headers) + def add_vservers(self, content): + for server in content['servers']: + resource = ("/vservers/vserver/%s" % server['id']) + body = { + 'vserver-name': server['name'], + 'vserver-name2': server['name'], + "vserver-id": server['id'], + "vserver-selflink": server['link'], + "prov-status": server['status'] + } + logger.debug("Add server to cloud region: %s" % body) + call_req(self.base_url, self.username, self.password, + rest_no_auth, resource, "PUT", + content=json.dumps(body), + headers=self.default_headers) + def add_flavors(self, content): for flavor in content['flavors']: resource = ("/cloud-infrastructure/cloud-regions/cloud-region/" diff --git a/vio/vio/pub/vim/drivers/vimsdk/heat.py b/vio/vio/pub/vim/drivers/vimsdk/heat.py index 0dad830..efb88d4 100644 --- a/vio/vio/pub/vim/drivers/vimsdk/heat.py +++ b/vio/vio/pub/vim/drivers/vimsdk/heat.py @@ -48,6 +48,10 @@ class HeatClient(base.DriverBase): ignore_missing) @sdk.translate_exception + def stack_resources(self, stack_id): + return self.conn.orchestration.resources(stack_id) + + @sdk.translate_exception def wait_for_stack(self, stack_id, status, failures=None, interval=2, timeout=None): if failures is None: diff --git a/vio/vio/pub/vim/vimapi/heat/OperateStack.py b/vio/vio/pub/vim/vimapi/heat/OperateStack.py index 60b39fa..1824aa4 100644 --- a/vio/vio/pub/vim/vimapi/heat/OperateStack.py +++ b/vio/vio/pub/vim/vimapi/heat/OperateStack.py @@ -53,3 +53,7 @@ class OperateStack(baseclient): def delete_vim_stack(self, stack_id): stack = self.heat(self.param).stack_delete(stack_id) return stack + + def get_stack_resources(self, stack_id): + resources = self.heat(self.param).stack_resources(stack_id) + return [res for res in resources] |