def run(self): logging.info("Starting RHEV-Agent daemon") config = ConfigParser.ConfigParser() config.read(RHEV_AGENT_CONFIG) self.agent = LinuxVdsAgent(config) utils.createDaemon(True) file(RHEV_AGENT_PIDFILE, "w").write("%s\n" % (os.getpid())) os.chmod(RHEV_AGENT_PIDFILE, 0x1b4) # rw-rw-r-- (664) self.register_signal_handler() self.agent.run() logging.info("RHEV-Agent daemon is down.")
store = ModbusSlaveContext(di=di, co=co, hr=hr, ir=ir) context = ModbusServerContext(slaves=store, single=True) return context #---------------------------------------------------------------------------# # initialize the server information #---------------------------------------------------------------------------# # If you don't set this or any fields, they are defaulted to empty strings. #---------------------------------------------------------------------------# identity = ModbusDeviceIdentification() identity.VendorName = 'VOLTTRON' identity.ProductCode = 'VT' identity.VendorUrl = 'http://github.com/VOLTTRON/volttron' identity.ProductName = 'VOLTTRON Modbus Test Device' identity.ModelName = 'VOLTTRON Modbus Test Device' identity.MajorMinorRevision = '1.0' abstraction = DeviceAbstraction(args.config) #Create the deamon as soon as we've loaded the device configuration. createDaemon() context = abstraction.get_server_context() #---------------------------------------------------------------------------# # run the server you want #---------------------------------------------------------------------------# StartTcpServer(context, identity=identity, address=(args.interface, args.port))
# this is a ReadPropertyMultiple ack if not resp: resp = ReadPropertyMultipleACK(context=apdu) resp.listOfReadAccessResults = read_access_result_list if _debug: ReadPropertyMultipleApplication._debug(" - resp: %r", resp) # return the result self.response(resp) # # __main__ # try: abstraction = DeviceAbstraction(args.interface, args.config) #Create the deamon as soon as we've loaded the device configuration. if not args.no_daemon: createDaemon() application = abstraction.get_server_application() _log.debug("running") run() except Exception, e: _log.exception("an error has occurred: %s", e) finally: _log.debug("finally")