def __init__(self, db, discovery, args=None): self._args = args self._db = db module = Module.SVC_MONITOR node_type = Module2NodeType[module] self._module_name = ModuleNames[module] self._node_type_name = NodeTypeNames[node_type] self._instance_id = INSTANCE_ID_DEFAULT self._hostname = socket.gethostname() #sandesh init self._sandesh = self._sandesh_init(discovery) # connection state init ConnectionState.init( self._sandesh, self._hostname, self._module_name, self._instance_id, staticmethod(ConnectionState.get_process_state_cb), NodeStatusUVE, NodeStatus) #create cpu_info object to send periodic updates sysinfo_req = False cpu_info = vnc_cpu_info.CpuInfo(self._module_name, self._instance_id, sysinfo_req, self._sandesh, 60) self._cpu_info = cpu_info
def __init__(self, vnc_lib, args=None): self._args = args # api server and cassandra init self._vnc_lib = vnc_lib self._cassandra_init() # dictionary for nova self._nova = {} #initialize discovery client self._disc = None if self._args.disc_server_ip and self._args.disc_server_port: self._disc = client.DiscoveryClient(self._args.disc_server_ip, self._args.disc_server_port, client_type='Service Monitor') #sandesh init self._sandesh = Sandesh() sandesh.ServiceInstanceList.handle_request =\ self.sandesh_si_handle_request module = Module.SVC_MONITOR module_name = ModuleNames[module] node_type = Module2NodeType[module] node_type_name = NodeTypeNames[node_type] instance_id = INSTANCE_ID_DEFAULT self._sandesh.init_generator(module_name, socket.gethostname(), node_type_name, instance_id, self._args.collectors, 'svc_monitor_context', int(self._args.http_server_port), ['cfgm_common', 'sandesh'], self._disc) self._sandesh.set_logging_params(enable_local_log=self._args.log_local, category=self._args.log_category, level=self._args.log_level, file=self._args.log_file) #create default analyzer template self._create_default_template('analyzer-template', 'analyzer', 'analyzer') self._create_default_template('nat-template', 'nat-service', 'firewall', 'in-network-nat') #create cpu_info object to send periodic updates sysinfo_req = False cpu_info = vnc_cpu_info.CpuInfo(module_name, instance_id, sysinfo_req, self._sandesh, 60) self._cpu_info = cpu_info # logging self._err_file = '/var/log/contrail/svc-monitor.err' self._tmp_file = '/var/log/contrail/svc-monitor.tmp' self._svc_err_logger = logging.getLogger('SvcErrLogger') self._svc_err_logger.setLevel(logging.ERROR) handler = logging.handlers.RotatingFileHandler(self._err_file, maxBytes=64 * 1024, backupCount=2) self._svc_err_logger.addHandler(handler)
def __init__(self, args=None): self._args = args self._fabric_rt_inst_obj = None # Initialize discovery client self._disc = None if self._args.disc_server_ip and self._args.disc_server_port: self._disc = client.DiscoveryClient( self._args.disc_server_ip, self._args.disc_server_port, ModuleNames[Module.SCHEMA_TRANSFORMER]) self._sandesh = Sandesh() # Reset the sandesh send rate limit value if args.sandesh_send_rate_limit is not None: SandeshSystem.set_sandesh_send_rate_limit( args.sandesh_send_rate_limit) sandesh.VnList.handle_request = self.sandesh_vn_handle_request sandesh.RoutintInstanceList.handle_request = \ self.sandesh_ri_handle_request sandesh.ServiceChainList.handle_request = \ self.sandesh_sc_handle_request sandesh.StObjectReq.handle_request = \ self.sandesh_st_object_handle_request module = Module.SCHEMA_TRANSFORMER module_name = ModuleNames[module] node_type = Module2NodeType[module] node_type_name = NodeTypeNames[node_type] instance_id = INSTANCE_ID_DEFAULT hostname = socket.gethostname() self._sandesh.init_generator( module_name, hostname, node_type_name, instance_id, self._args.collectors, 'to_bgp_context', int(args.http_server_port), ['cfgm_common', 'schema_transformer.sandesh'], self._disc, logger_class=args.logger_class, logger_config_file=args.logging_conf) self._sandesh.set_logging_params(enable_local_log=args.log_local, category=args.log_category, level=args.log_level, file=args.log_file, enable_syslog=args.use_syslog, syslog_facility=args.syslog_facility) ConnectionState.init( self._sandesh, hostname, module_name, instance_id, staticmethod(ConnectionState.get_process_state_cb), NodeStatusUVE, NodeStatus) self._sandesh.trace_buffer_create(name="MessageBusNotifyTraceBuf", size=1000) rabbit_servers = self._args.rabbit_server rabbit_port = self._args.rabbit_port rabbit_user = self._args.rabbit_user rabbit_password = self._args.rabbit_password rabbit_vhost = self._args.rabbit_vhost rabbit_ha_mode = self._args.rabbit_ha_mode self._db_resync_done = gevent.event.Event() q_name = 'schema_transformer.%s' % (socket.gethostname()) self._vnc_kombu = VncKombuClient(rabbit_servers, rabbit_port, rabbit_user, rabbit_password, rabbit_vhost, rabbit_ha_mode, q_name, self._vnc_subscribe_callback, self.config_log) self._cassandra = SchemaTransformerDB(self, _zookeeper_client) DBBaseST.init(self, self._sandesh.logger(), self._cassandra) DBBaseST._sandesh = self._sandesh DBBaseST._vnc_lib = _vnc_lib ServiceChain.init() self.reinit() # create cpu_info object to send periodic updates sysinfo_req = False cpu_info = vnc_cpu_info.CpuInfo(module_name, instance_id, sysinfo_req, self._sandesh, 60) self._cpu_info = cpu_info self._db_resync_done.set()