def test_0010_edit_gateway(self): """Edit the gateway name. Invokes the edit_gateway of the gateway. """ gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) task = gateway_obj.edit_gateway(newname='gateway2') result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value) '''resetting back to original gateway name''' task = gateway_obj.edit_gateway(TestGateway._name) result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
def update_gw(self): response = dict() response['changed'] = False gateway_name = self.params.get('gateway_name') new_gateway_name = self.params.get('new_gateway_name') description = self.params.get('description') ha_enabled = self.params.get('ha_enabled') edge_gateway_href = None try: gateway = self.get_gateway(gateway_name) for key, value in gateway.items(): if key == "href": edge_gateway_href = value break gateway = Gateway( self.client, name=gateway_name, href=edge_gateway_href) update_task = gateway.edit_gateway(newname=new_gateway_name, desc=description, ha=ha_enabled) self.execute_task(update_task) msg = "Edge Gateway {0} has been updated with {1}" response['msg'] = msg.format(gateway_name, new_gateway_name) response['changed'] = True except EntityNotFoundException: msg = 'Edge Gateway {0} is not present' response['warnings'] = msg.format(gateway_name) return response
def test_0030_edit_gateway(self): """Edit the gateway name. Invokes the edit_gateway of the gateway. """ gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) task = gateway_obj.edit_gateway(newname='gateway2') result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value) '''resetting back to original gateway name''' task = gateway_obj.edit_gateway(TestGateway._name) result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)