def _attach_port(self, context, router_id, port, external_gw=False): LOG.debug("Vyatta vRouter Plugin::Attach port. " "router: %s; port: %s", router_id, port) # Attach interface self.driver.attach_interface(context, router_id, port['id']) def configure_gateway_wrapper(): if external_gw: self.driver.configure_gateway( context, router_id, self._get_interface_infos(context, port)) else: self.driver.configure_interface( context, router_id, self._get_interface_infos(context, port)) vyatta_utils.retry( configure_gateway_wrapper, exceptions=(v_exc.VRouterOperationError,), limit=self.ATTACH_PORT_RETRY_LIMIT, delay=self.ATTACH_PORT_RETRY_DELAY) if external_gw: device_owner = l3_constants.DEVICE_OWNER_ROUTER_GW else: device_owner = l3_constants.DEVICE_OWNER_ROUTER_INTF self._core_plugin.update_port(context.elevated(), port['id'], {'port': {'device_owner': device_owner, 'device_id': router_id}})
def _attach_port(self, context, router_id, port, external_gw=False): LOG.debug( "Vyatta vRouter Plugin::Attach port. " "router: %s; port: %s", router_id, port) # Attach interface self.driver.attach_interface(context, router_id, port['id']) def configure_gateway_wrapper(): if external_gw: self.driver.configure_gateway( context, router_id, self._get_interface_infos(context, port)) else: self.driver.configure_interface( context, router_id, self._get_interface_infos(context, port)) vyatta_utils.retry(configure_gateway_wrapper, exceptions=(v_exc.VRouterOperationError, ), limit=self.ATTACH_PORT_RETRY_LIMIT, delay=self.ATTACH_PORT_RETRY_DELAY) if external_gw: device_owner = l3_constants.DEVICE_OWNER_ROUTER_GW else: device_owner = l3_constants.DEVICE_OWNER_ROUTER_INTF self._core_plugin.update_port( context.elevated(), port['id'], {'port': { 'device_owner': device_owner, 'device_id': router_id }})
def init_router(self, router_name, admin_state_up): """ Configures Router name and Admin State. """ cmd_list = [] self._set_router_name_cmd(cmd_list, router_name) self._set_admin_state_cmd(cmd_list, admin_state_up) vyatta_utils.retry(self.exec_cmd_batch, args=(cmd_list, ), exceptions=(v_exc.VRouterOperationError, ), limit=self.REST_RETRY_LIMIT, delay=self.REST_RETRY_DELAY)
def init_router(self, router_name, admin_state_up): """ Configures Router name and Admin State. """ cmd_list = [] self._set_router_name_cmd(cmd_list, router_name) self._set_admin_state_cmd(cmd_list, admin_state_up) vyatta_utils.retry( self.exec_cmd_batch, args=(cmd_list,), exceptions=(v_exc.VRouterOperationError,), limit=self.REST_RETRY_LIMIT, delay=self.REST_RETRY_DELAY, )