Deal with routers modification and creation RPC message.
167829
def routers_updated(self, context, routers):
        """"""
        LOG.debug('Got routers updated notification :%s', routers)
        if routers:
            # This is needed for backward compatibility
            if isinstance(routers[0], dict):
                routers = [router['id'] for router in routers]
            self._update_updated_routers_cache(routers)
755493
public void handleNewNodePage(ComputerSet computerSet, String name, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        computerSet.checkName(name);
        req.setAttribute("descriptor", this);
        req.getView(computerSet,"_new.jelly").forward(req,rsp);
    }
1262048
def routeMessage(self, sender, target, value, messageID):
        
        router = self._routerForAccount(target)
        if router is not None:
            router.routeMessage(sender, target, value, messageID)
        else:
            reverseRouter = self._routerForAccount(sender)
            reverseRouter.routeAnswer(sender, target,
                                      Value(DELIVERY_ERROR, ERROR_NO_USER),
                                      messageID)
676994
@Override
    public void handleMessage(@Sensitive Message message) throws Fault {

        //if no wsrinfo, we will not override the port address & client prop
        if (wsrInfo != null) {
            customizePortAddress(message);
            customizeClientProperties(message);
        }

        customizeClientSecurity(message);

    }
1343502
def update_router(self, router, name=None, admin_state_up=None, **kwargs):
        '''
        
        '''
        router_id = self._find_router_id(router)
        body = {}

        if 'ext_network' in kwargs:
            if kwargs.get('ext_network') is None:
                body['external_gateway_info'] = None
            else:
                net_id = self._find_network_id(kwargs.get('ext_network'))
                body['external_gateway_info'] = {'network_id': net_id}
        if name is not None:
            body['name'] = name
        if admin_state_up is not None:
            body['admin_state_up'] = admin_state_up
        return self.network_conn.update_router(
            router=router_id, body={'router': body})
443948
def reconfigure_messaging(self, msg_host, msg_port):
        ''''''
        self._messaging.create_external_route(
            'rabbitmq', host=msg_host, port=msg_port)
1076576
def rpc_stop(server_state):
    
    rpc_srv = server_state['rpc']

    if rpc_srv is not None:
        log.info("Shutting down RPC")
        rpc_srv.stop_server()
        rpc_srv.join()
        log.info("RPC joined")

    else:
        log.info("RPC already joined")

    server_state['rpc'] = None
1212860
function RpcNotification(method, params)
{
  if(defineProperty_IE8)
  {
    this.method = method
    this.params = params
  }
  else
  {
    Object.defineProperty(this, 'method', {value: method, enumerable: true});
    Object.defineProperty(this, 'params', {value: params, enumerable: true});
  }
}
324653
def _adjust_router_list_for_global_router(self, routers):
        
        #ToDo(Hareesh): Simplify if possible
        for r in routers:
            if r[ROUTER_ROLE_ATTR] == c_constants.ROUTER_ROLE_GLOBAL:
                LOG.debug("Global router:%s found. Moved to the end of list "
                          "for processing", r['id'])
                routers.remove(r)
                routers.append(r)
919582
def create_router(self, context, router):
        
        if router:
            router_name = self._arista_router_name(router['id'],
                                                   router['name'])

            hashed = hashlib.sha256(router_name.encode('utf-8'))
            rdm = str(int(hashed.hexdigest(), 16) % 65536)

            mlag_peer_failed = False
            for s in self._servers:
                try:
                    self.create_router_on_eos(router_name, rdm, s)
                    mlag_peer_failed = False
                except Exception:
                    if self._mlag_configured and not mlag_peer_failed:
                        # In paied switch, it is OK to fail on one switch
                        mlag_peer_failed = True
                    else:
                        msg = (_('Failed to create router %s on EOS') %
                               router_name)
                        LOG.exception(msg)
                        raise arista_exc.AristaServicePluginRpcError(msg=msg)
864882
def handle_spec(region_name, vpc_id, route_spec, failed_ips, questionable_ips):
    
    if CURRENT_STATE._stop_all:
        logging.debug("handle_spec: Stop requested, abort operation")
        return

    if not route_spec:
        logging.debug("handle_spec: No route spec provided")
        return

    logging.debug("Handle route spec")

    try:
        con      = connect_to_region(region_name)
        vpc_info = get_vpc_overview(con, vpc_id, region_name)
        vpc_info['cluster_node_subnets'] = \
                        make_cluster_node_subnet_list(vpc_info, route_spec)
        process_route_spec_config(con, vpc_info, route_spec,
                                  failed_ips, questionable_ips)
        con.close()
    except boto.exception.StandardError as e:
        logging.warning("vpc-router could not set route: %s - %s" %
                        (e.message, e.args))
        raise

    except boto.exception.NoAuthHandlerFound:
        logging.error("vpc-router could not authenticate")
1226024
def _router_request(router, method, data=None):
    '''
    
    '''
    if router not in ROUTERS:
        return False

    req_data = salt.utils.json.dumps([dict(
        action=router,
        method=method,
        data=data,
        type='rpc',
        tid=1)])

    config = __salt__['config.option']('zenoss')
    log.debug('Making request to router %s with method %s', router, method)
    url = '{0}/zport/dmd/{1}_router'.format(config.get('hostname'), ROUTERS[router])
    response = _session().post(url, data=req_data)

    # The API returns a 200 response code even whe auth is bad.
    # With bad auth, the login page is displayed. Here I search for
    # an element on the login form to determine if auth failed.
    if re.search('name="__ac_name"', response.content):
        log.error('Request failed. Bad username/password.')
        raise Exception('Request failed. Bad username/password.')

    return salt.utils.json.loads(response.content).get('result', None)
129487
def hosting_devices_unassigned_from_cfg_agent(self, context, payload):
        """"""
        try:
            if payload['hosting_device_ids']:
                #TODO(hareeshp): implement unassignment of hosting devices
                pass
        except KeyError as e:
            LOG.error("Invalid payload format for received RPC message "
                      "`hosting_devices_unassigned_from_cfg_agent`. Error "
                      "is %(error)s. Payload is %(payload)s",
                      {'error': e, 'payload': payload})
804497
def _raise_rpc_timeout_error(self, uuid):
        
        requests = []
        for key, value in self._request.items():
            if value == uuid:
                requests.append(key)
        self.remove(uuid)
        message = (
            'rpc requests %s (%s) took too long' %
            (
                uuid,
                ', '.join(requests)
            )
        )
        raise AMQPChannelError(message)
731561
function processRoute(opts) {
    if (routeHandler) {
        routeHandler(opts.request, opts.reply, opts.urlOverride, opts.returnCode);
    }
    else {
        opts.reply.continue();
    }
}
742326
async def _handle_rpc_result(self, message):
        
        rpc_result = message.obj
        state = self._pending_state.pop(rpc_result.req_msg_id, None)
        self._log.debug('Handling RPC result for message %d',
                      rpc_result.req_msg_id)

        if not state:
            # TODO We should not get responses to things we never sent
            # However receiving a File() with empty bytes is "common".
            # See #658, #759 and #958. They seem to happen in a container
            # which contain the real response right after.
            try:
                with BinaryReader(rpc_result.body) as reader:
                    if not isinstance(reader.tgread_object(), upload.File):
                        raise ValueError('Not an upload.File')
            except (TypeNotFoundError, ValueError):
                self._log.info('Received response without parent request: {}'
                               .format(rpc_result.body))
            return

        if rpc_result.error:
            error = rpc_message_to_error(rpc_result.error, state.request)
            self._send_queue.append(
                RequestState(MsgsAck([state.msg_id]), loop=self._loop))

            if not state.future.cancelled():
                state.future.set_exception(error)
        else:
            with BinaryReader(rpc_result.body) as reader:
                result = state.request.read_result(reader)

            if not state.future.cancelled():
                state.future.set_result(result)
730051
def intercept_service(self, continuation, handler_call_details):
        
        rpc_method_handler = self._get_rpc_handler(handler_call_details)
        if rpc_method_handler.response_streaming:
            if self._wrapped.is_streaming:
                # `self._wrapped` is a `StreamServerInterceptor`
                return self._wrapped.intercept_service(
                    continuation, handler_call_details)
        else:
            if not self._wrapped.is_streaming:
                # `self._wrapped` is a `UnaryServerInterceptor`
                return self._wrapped.intercept_service(
                    continuation, handler_call_details)

        # skip the interceptor due to type mismatch
        return continuation(handler_call_details)