Python neutron_lib.context.get_admin_context_without_session() Examples
The following are 6
code examples of neutron_lib.context.get_admin_context_without_session().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
neutron_lib.context
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: ipsec.py From neutron-vpnaas with Apache License 2.0 | 6 votes |
def __init__(self, vpn_service, host): # TODO(pc_m) Replace vpn_service with config arg, once all driver # implementations no longer need vpn_service. self.conf = vpn_service.conf self.host = host self.conn = n_rpc.Connection() self.context = context.get_admin_context_without_session() self.topic = topics.IPSEC_AGENT_TOPIC node_topic = '%s.%s' % (self.topic, self.host) self.processes = {} self.routers = {} self.process_status_cache = {} self.endpoints = [self] self.conn.create_consumer(node_topic, self.endpoints, fanout=False) self.conn.consume_in_threads() self.agent_rpc = IPsecVpnDriverApi(topics.IPSEC_DRIVER_TOPIC) self.process_status_cache_check = loopingcall.FixedIntervalLoopingCall( self.report_status, self.context) self.process_status_cache_check.start( interval=self.conf.ipsec.ipsec_status_check_interval)
Example #2
Source File: bgp_dragent.py From neutron-dynamic-routing with Apache License 2.0 | 6 votes |
def _report_state(self): LOG.debug("Report state task started") try: self.agent_state.get('configurations').update( self.cache.get_state()) ctx = context.get_admin_context_without_session() agent_status = self.state_rpc.report_state(ctx, self.agent_state, True) if agent_status == agent_consts.AGENT_REVIVED: LOG.info(_LI("Agent has just been revived. " "Scheduling full sync")) self.schedule_full_resync( reason=_("Agent has just been revived")) except AttributeError: # This means the server does not support report_state LOG.warning(_LW("Neutron server does not support state report. " "State report for this agent will be disabled.")) self.heartbeat.stop() self.run() return except Exception: LOG.exception(_LE("Failed reporting state!")) return if self.agent_state.pop('start_flag', None): self.run()
Example #3
Source File: driver.py From networking-sfc with Apache License 2.0 | 5 votes |
def initialize(self): super(OVSSfcDriver, self).initialize() self.ovs_driver_rpc = ovs_sfc_rpc.SfcAgentRpcClient( sfc_topics.SFC_AGENT ) self.rpc_ctx = n_context.get_admin_context_without_session() self._setup_rpc()
Example #4
Source File: bgp_dragent.py From neutron-dynamic-routing with Apache License 2.0 | 5 votes |
def __init__(self, host, conf=None): super(BgpDrAgent, self).__init__() self.initialize_driver(conf) self.needs_resync_reasons = collections.defaultdict(list) self.needs_full_sync_reason = None self.cache = BgpSpeakerCache() self.context = context.get_admin_context_without_session() self.plugin_rpc = BgpDrPluginApi(bgp_consts.BGP_PLUGIN, self.context, host)
Example #5
Source File: base_agent_manager.py From networking-l2gw with Apache License 2.0 | 5 votes |
def _report_state(self): try: ctx = context.get_admin_context_without_session() self.state_rpc.report_state(ctx, self.agent_state, True) self.agent_state['start_flag'] = False except Exception: LOG.exception("Failed reporting state!") self.handle_report_state_failure()
Example #6
Source File: test_context.py From neutron-lib with Apache License 2.0 | 5 votes |
def test_neutron_context_admin_without_session_to_dict(self): ctx = context.get_admin_context_without_session() ctx_dict = ctx.to_dict() self.assertIsNone(ctx_dict['user_id']) self.assertIsNone(ctx_dict['tenant_id']) self.assertIsNone(ctx_dict['auth_token']) self.assertFalse(hasattr(ctx, 'session'))