def test_0002_enable_dr(self): """Enable the Distributed routing. Invoke the enable_distributed_routing method for the gateway. """ gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) task = gateway_obj.enable_distributed_routing(True) result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
def enable_distributed_routing(ctx, name, is_enabled=False): """Enable Distributed routing for gateway. \b Examples vcd gateway enable-distributed-routing <gateway-name> --enable/--disable Enable/Disable Distributed routing for gateway. """ try: restore_session(ctx, vdc_required=True) client = ctx.obj['client'] vdc_href = ctx.obj['profiles'].get('vdc_href') vdc = VDC(client, href=vdc_href) gateway = vdc.get_gateway(name) gateway_resource = Gateway(client, href=gateway.get('href')) task = gateway_resource.enable_distributed_routing(is_enabled) stdout(task, ctx) except Exception as e: stderr(e, ctx)
def __enable_gateway_distributed_routing(self, client, gateway, is_enable): gateway_obj = Gateway(client, href=gateway.get('href')) task = gateway_obj.enable_distributed_routing(is_enable) self.__wait_for_success(client, task)