def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'port', 502, config, int) set_attribute(self, 'debug', 0, config, int) self.udp_port = self.port self.port = self #intercept any calls to the port return
def configure(self, config): self.debug_print(1, 'RznetNode: configure()') CompositeNode.configure(self, config) #set_attribute(self, 'discover', 0, config, as_boolean) config_dir = _properties.properties.CONFIGURATION_DIR self.x_points_file_path = config_dir + '/xpoints_' + self.parent.name + '.net' # HARDCODED - rmv from nodedefs! self.debug_print(1, self.x_points_file_path) self.xml_file_path = config_dir + '/rznp_' + self.parent.name + '.xml' # HARDCODED - rmv from nodedefs! set_attribute( self, 'rzhost_slave_port', 6005, config, int) # potl conn to PhWin, via skt; points file datum overrides set_attribute( self, 'rzhost_master_path', '', config) # potl RZHostMaster conn to Ext Modem Server, via COMx set_attribute( self, 'QA', 0, config, as_boolean) # 1: disables Int Modem Server, enables pass-through set_attribute(self, 'rznet_addr', 100000, config, int) # rznet addr; '0' = let ldisc determine it set_attribute(self, 'def_max_dev_subscrs', 256, config, int) # max subscrs allowed per device set_attribute( self, '__node_id__', '120077', config ) # allows dyn node creation; not presently used for RznetNode set_attribute(self, 'debug_lvl', 0, config, int) self.com_port_path = self.parent.as_node_url() return
def configure(self, config): CompositeNode.configure(self, config) # Deal with UDI voodoo. Basically, if use param is a dict, # then use the DM to assign an instance. If it's a UDI, don't. self.device_manger = self.parent.device_manger # UDI configuration is a bit magical. If this node is dynamically # instanciated, then the UDI exists AND we could be being called by # the DeviceManager in a manner that is not conducive to reentrancy... udi = config.get('udi', None) if udi is not None and self.udi is None: if isinstance(udi, UniqueDeviceIdentifier): # Implies dynamic configuration, the UDI exists. # @note Dynamic Monitor creation occurs in the DeviceManager # and the implementation is not conducive reentering # the DeviceManager (think deadlock). self.udi = udi else: # Implies static configuration. *The* UDI should not exist, or # at least it should not reference a monitor yet. Create *the* # UDI and associate it with this monitor. assert isinstance(udi, dict) self.udi = udi self.device_manger.register_monitor(self) self.udi = self.device_manger.udi_from_udi(udi) return
def configure(self, config_dict): CompositeNode.configure(self, config_dict) set_attribute(self, 'debug', 0, config_dict, int) # Default the period (between tickling our children) to 15 # seconds. Note: This may be overriden for specific # applications. set_attribute(self, 'period', 15, config_dict, int)
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, 'source',self.source, cd, str) set_attribute(self, 'device_link', None, cd, str) #url of Devices node set_attribute(self, 'discover_mode', self.discover_mode, cd, str) set_attribute(self, '__node_id__',self._node_id, cd, str) set_attribute(self, 'bacnet_datatype', 'real', cd, str)
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'debug', debug, config, as_boolean) set_attribute(self,'device_name',REQUIRED,config, str) set_attribute(self,'unit_number',REQUIRED, config, int) set_attribute(self,'controller_type',None, config, str) set_attribute(self,'controller_version',None, config, str)
def test_configure_sequence(self): p = PeriodicLog() p.configure({'name':'log','parent':None, 'period':1}) h = CompositeNode() h.configure({'name':'columns','parent':p}) c = PeriodicAverageColumn() c.configure({'position':0, 'name':'2', 'parent':h, 'function':self._next}) p.start() try: l = [] v = [] for i in range(0,100): l.append(c._evaluate()) v.append(i-0.5) if l.pop(0) != None: raise 'First delta not None.' v.pop(0) for i in l: j = v.pop(0) if i != j: raise 'Incorrect average of %s should be %s.' % (i, j) finally: p.stop() return
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'address', REQUIRED, config, int) set_attribute(self, 'line_handler', self.parent, config, as_node) for key in _register_map: node = _register_map[key][0]() node.configure({'parent':self,'register':key,'name':_register_map[key][1],'multiplier':_register_map[key][2]})
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, 'source', self.source, cd, str) set_attribute(self, 'device_link', None, cd, str) #url of Devices node set_attribute(self, 'discover_mode', self.discover_mode, cd, str) set_attribute(self, '__node_id__', self._node_id, cd, str) set_attribute(self, 'bacnet_datatype', 'real', cd, str)
def test_configure_sequence(self): p = PeriodicLog() p.configure({'name': 'log', 'parent': None, 'period': 1}) h = CompositeNode() h.configure({'name': 'columns', 'parent': p}) c = PeriodicAverageColumn() c.configure({ 'position': 0, 'name': '2', 'parent': h, 'function': self._next }) p.start() try: l = [] v = [] for i in range(0, 100): l.append(c._evaluate()) v.append(i - 0.5) if l.pop(0) != None: raise 'First delta not None.' v.pop(0) for i in l: j = v.pop(0) if i != j: raise 'Incorrect average of %s should be %s.' % (i, j) finally: p.stop() return
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'url', '', config, str) set_attribute(self, 'user', '', config, str) set_attribute(self, 'password', '', config, str) set_attribute(self, 'spreadsheet', self.name, config, str) #spreadsheet name set_attribute(self, 'worksheet', '', config, str)
def configure(self, config_dict): CompositeNode.configure(self, config_dict) set_attribute(self, "debug", 0, config_dict, int) # Default the period (between tickling our children) to 15 # seconds. Note: This may be overriden for specific # applications. set_attribute(self, "period", 15, config_dict, int)
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, "debug", 0, config, as_boolean) set_attribute(self, "discover", "never", config, str) set_attribute(self, "discover_start", 0, config, int) set_attribute(self, "discover_stop", 255, config, int) debug = self.debug
def test_configure_sequence_get(self): p = PeriodicLog() p.configure({'name': 'log', 'parent': None, 'period': 1}) h = CompositeNode() h.configure({'name': 'columns', 'parent': p}) c = PeriodicDeltaColumn() c.configure({ 'position': 0, 'name': '2', 'parent': h, 'function': self._next }) p.start() try: l = [] if c.get() != None: raise 'Get didn\'t return None on first get' if c.get() != None: raise 'Get didn\'t return None on second get' self.seq.value = 0 c.function() self._next() self._next() self._next() if c.get() != self.seq.value - 1: raise 'Got incorrect value after incrementing' finally: p.stop() return
def configure(self,config): if self.debug: msglog.log('EnergywiseManager:', msglog.types.INFO, 'Inside configure' ) CompositeNode.configure(self, config) set_attribute(self, 'debug', 0, config, int) return
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'debug', 0, config, as_boolean) set_attribute(self, 'discover', 'never', config, str) set_attribute(self, 'discover_start', 0, config, int) set_attribute(self, 'discover_stop', 255, config, int) debug = self.debug
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self,'debug', debug, config, as_boolean) set_attribute(self,'post',REQUIRED,config, str) set_attribute(self,'server',REQUIRED, config, str) set_attribute(self,'action',REQUIRED, config, str) set_attribute(self,'ttl',1.0, config, float)
def configure(self,config): CompositeNode.configure(self,config) set_attribute(self, 'port', 502, config, int) set_attribute(self, 'debug', 0, config, int) self.udp_port = self.port self.port = self #intercept any calls to the port return
def configure(self, config): CompositeNode.configure(self,config) set_attribute(self, 'id', 0, config, str) set_attribute(self,'cache_life',30,config,float) set_attribute(self,'timeout',10,config,float) set_attribute(self,'patience',1,config,float) self.port = self.parent
def configure(self, config): CompositeNode.configure(self, config) # get handle to ARM in arm.py. # self.coprocessor is the surrogate parent this child. # set_attributes(self, (('id',REQUIRED),('coprocessor',REQUIRED)), config) self._coprocessor = self.coprocessor._coprocessor # the moab megatron ARM object
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'ion', self.parent, config, as_node) if not self.ion: self.ion = self.parent if hasattr(self, '_mutate'): self._mutate()
def _setup_alarm_nodes(self): services = as_node('/services') if not services.has_child('External Alarms'): alarms_node = CompositeNode() alarms_node.configure({ 'name': 'External Alarms', 'parent': services }) alarms_node = as_node('/services/External Alarms') alarm_node = alarms.Manager() alarm_node.configure({'name': 'CPC Alarm', 'parent': alarms_node}) cpc_client_node = cpc_client.CpcClient(self._cpc_uhp_node) cpc_client_node.configure({ 'name': 'CPC Client', 'parent': alarm_node, 'node': '' }) ewebconnect_client_node = ewebconnect.EWebConnectAlarmClient() ewebconnect_client_node.configure({ 'name': 'eWebConnect Alarm Client', 'parent': alarm_node, 'host': '10.0.1.88', #'mother.envenergy.com', 'port': 16161, 'enabled': 1, }) alarms_node.start() return
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, "timeout", 1.0, config, float) set_attribute(self, "debug", 0, config, int) self.port = self.parent if not self.port.is_open(): self.port.open()
def configure(self, config): if self.debug: msglog.log('EnergywiseManager:', msglog.types.INFO, 'Inside configure') CompositeNode.configure(self, config) set_attribute(self, 'debug', 0, config, int) return
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'timeout', 1.0, config, float) set_attribute(self, 'debug', 0, config, int) self.port = self.parent if not self.port.is_open(): self.port.open()
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'ion', self.parent, config, as_node) if not self.ion: self.ion = self.parent if hasattr(self, '_mutate'): self._mutate()
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'debug', debug, config, as_boolean) set_attribute(self, 'post', REQUIRED, config, str) set_attribute(self, 'server', REQUIRED, config, str) set_attribute(self, 'action', REQUIRED, config, str) set_attribute(self, 'ttl', 1.0, config, float)
def test_configure_sequence_get(self): p = PeriodicLog() p.configure({'name':'log','parent':None, 'period':1}) h = CompositeNode() h.configure({'name':'columns','parent':p}) c = PeriodicDeltaColumn() c.configure({'position':0, 'name':'2', 'parent':h, 'function':self._next}) p.start() try: l = [] if c.get() != None: raise 'Get didn\'t return None on first get' if c.get() != None: raise 'Get didn\'t return None on second get' self.seq.value = 0 c.function() self._next() self._next() self._next() if c.get() != self.seq.value - 1: raise 'Got incorrect value after incrementing' finally: p.stop() return
def test_configure_sequence(self): p = PeriodicLog() p.configure({'name': 'log', 'parent': None, 'period': 1}) h = CompositeNode() h.configure({'name': 'columns', 'parent': p}) c = PeriodicDeltaColumn() c.configure({ 'position': 0, 'name': '2', 'parent': h, 'function': self._next }) p.start() try: l = [] for i in range(0, 100): l.append(c.function()) if l.pop(0) != None: raise 'First delta not None.' for i in l: if i != 1: raise 'Incoreect delta of %s should be %s.' % (i, 1) finally: p.stop() return
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'PID', REQUIRED, config, str) set_attribute(self, 'description', self.description, config, str) set_attribute(self, 'format', REQUIRED, config, str) set_attribute(self, 'properties', self.properties, config, str) set_attribute(self, 'ttl', self.ttl, config, float) set_attribute(self, 'scale', self.scale, config, float)
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, 'discovered', self.discovered, cd, int) set_attribute(self, '__node_id__','569', cd) set_attribute(self, 'instance',self.instance, cd, int) set_attribute(self, 'debug', self.debug, cd, int) if self.debug > 0: set_attribute(self, 'test_resp', 0, cd, int)
def configure(self, config): CompositeNode.configure(self, config) try: bin_config = self.parent.parent.get_child('Configuration') if bin_config._get_persistent_configuration().carrier is None: bin_config.change_hardware_settings('IP', 'eth0', '1', '47808') except: msglog.exception()
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, '__node_id__', self._node_id, cd, str) set_attribute(self, 'source', self.parent.source, cd, str) #set_attribute(self, 'default',None, cd, str) set_attribute(self, 'link', self.link, cd, str) set_attribute(self, 'bacnet_datatype', 'auto', cd, str) set_attribute(self, 'force', False, cd, bool)
def configure(self, config): CompositeNode.configure(self, config) self.soapurl = config.get('soapurl') self.prefixnamespaces = config.get('prefixnamespaces', False) if isinstance(self.prefixnamespaces, str): self.prefixnamespaces = eval(self.prefixnamespaces) self.soapaction = config.get('soapaction') self.namespace = config.get('namespace')
def configure(self, config): CompositeNode.configure(self, config) self.soapurl = config.get('soapurl') self.prefixnamespaces = config.get('prefixnamespaces', False) if isinstance(self.prefixnamespaces, str): self.prefixnamespaces = eval(self.prefixnamespaces) self.soapaction = config.get('soapaction') self.namespace = config.get('namespace')
def configure(self,config): CompositeNode.configure(self,config) set_attribute(self,'points',REQUIRED,config) # self._points will later be built in same order. # this needs to be done here so that parent's start # doesn't have to happend before my start is called. for point in self.points: self.meta['names'].append(point['name'])
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'PID', REQUIRED, config, str) set_attribute(self, 'description', self.description, config, str) set_attribute(self, 'format', REQUIRED, config, str) set_attribute(self, 'properties', self.properties, config, str) set_attribute(self, 'ttl', self.ttl, config, float) set_attribute(self, 'scale', self.scale, config, float)
def configure(self, config): self._pdo = PersistentDataObject(self) self._pdo.stats_dict = {} #used to detect changes to xml files based on timestamp. Tuple (modify time, pickle string) self._pdo.load() # write_priority can be set for the entire control service, though # it may be specialized at the individual application node level. set_attribute(self, 'write_priority', 9, config, int) CompositeNode.configure(self, config)
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, '__node_id__',self._node_id, cd, str) set_attribute(self, 'source',self.parent.source, cd, str) #set_attribute(self, 'default',None, cd, str) set_attribute(self, 'link', self.link, cd, str) set_attribute(self, 'bacnet_datatype', 'auto', cd, str) set_attribute(self, 'force', False, cd, bool)
def configure(self, config): CompositeNode.configure(self, config) # get handle to ARM in arm.py. # self.coprocessor is the surrogate parent this child. # set_attributes(self, (('id', REQUIRED), ('coprocessor', REQUIRED)), config) self._coprocessor = self.coprocessor._coprocessor # the moab megatron ARM object
def _helper_test_interfaces(self, name): F = 'mpx.ion.host.mediator_%s' % name host = factory(F) n = CompositeNode() n.configure({'name':name, 'parent':None}) host.configure({'name':'interfaces', 'parent':n}) _dump_cd(n) # Compare this... return
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, 'discovered', self.discovered, cd, int) set_attribute(self, 'debug', self.debug, cd, int) set_attribute(self, '__node_id__',self.__node_id__, cd, str) set_attribute(self, 'instance',self.instance, cd, int) self._parent_device = self.parent if self.is_proxy(): ProxyAbstractClass.configure(self, cd)
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, "enabled", 1, config, int) set_attribute(self, "bbmd_table", [], config) set_attribute(self, "allow_external_table_editor", 1, config, int) self.debug = 0 if self.debug: print "configure bbmd" print str(config)
def configure(self, config): if self.debug: print 'Server Device Configure start ' CompositeNode.configure(self, config) #skip our parents configure to delay building the register map set_attribute(self, 'address', REQUIRED, config, int) set_attribute(self, 'line_handler', self.parent, config, as_node) set_attribute(self, 'debug', 0, config, int) set_attribute(self, 'proxy', 0, config, int) if debug: self.debug = debug #override individual debug with module debug if present if self.debug: print 'Server Device Configured ', self.name
def configure(self, config): self._pdo = PersistentDataObject(self) self._pdo.stats_dict = { } #used to detect changes to xml files based on timestamp. Tuple (modify time, pickle string) self._pdo.load() # write_priority can be set for the entire control service, though # it may be specialized at the individual application node level. set_attribute(self, 'write_priority', 9, config, int) CompositeNode.configure(self, config)
def configure(self, cd): CompositeNode.configure(self, cd) set_attribute(self, 'discovered', self.discovered, cd, int) set_attribute(self, 'debug', self.debug, cd, int) set_attribute(self, '__node_id__', self.__node_id__, cd, str) set_attribute(self, 'instance', self.instance, cd, int) self._parent_device = self.parent if self.is_proxy(): ProxyAbstractClass.configure(self, cd)
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'enabled', 1, config, int) set_attribute(self, 'bbmd_table', [], config) set_attribute(self, 'allow_external_table_editor', 1, config, int) self.debug = 0 if self.debug: print 'configure bbmd' print str(config)
def configure(self, config): CompositeNode.configure(self, config) set_attribute(self, 'dev', REQUIRED, config) set_attribute(self, 'parity', parity_to_int('none'), config, parity_to_int) set_attribute(self, 'baud', 9600, config, str) if self.baud == 'Custom': self.baud = -1 # flag for later processing of custom_baud else: self.baud = int(self.baud) # normal path set_attributes(self, (('bits', 8), ('stop_bits', 1), ('debug', 0), ('dump_cpl', 16)), config, int) set_attribute(self, 'custom_baud', 76800, config, int) set_attribute(self, 'flow_control', flowctl_to_int('none'), config, flowctl_to_int) set_attribute(self, 'lock_directory', properties.get('VAR_LOCK'), config, str) set_attribute(self, 'VINTR', '\x03', config, str) set_attribute(self, 'VQUIT', '\x1c', config, str) set_attribute(self, 'VERASE', '\x7f', config, str) set_attribute(self, 'VKILL', '\x15', config, str) set_attribute(self, 'VEOF', '\x04', config, str) set_attribute(self, 'VTIME', 0, config, int) set_attribute(self, 'VMIN', 1, config, int) set_attribute(self, 'VSWTC', '\x00', config, str) set_attribute(self, 'VSTART', '\x11', config, str) set_attribute(self, 'VSTOP', '\x13', config, str) set_attribute(self, 'VSUSP', '\x1a', config, str) set_attribute(self, 'VEOL', '\x00', config, str) set_attribute(self, 'VREPRINT', '\x12', config, str) set_attribute(self, 'VDISCARD', '\x0f', config, str) set_attribute(self, 'VWERASE', '\x17', config, str) set_attribute(self, 'VLNEXT', '\x16', config, str) set_attribute(self, 'VEOL2', '\x00', config, str) set_attribute(self, 'cc17', '\x00', config, str) set_attribute(self, 'cc18', '/', config, str) set_attribute(self, 'cc19', '\x00', config, str) set_attribute(self, 'cc20', '\x00', config, str) set_attribute(self, 'cc21', '\x00', config, str) set_attribute(self, 'cc22', '\x00', config, str) set_attribute(self, 'cc23', '\x00', config, str) set_attribute(self, 'cc24', '\x00', config, str) set_attribute(self, 'cc25', '\x00', config, str) set_attribute(self, 'cc26', '\x00', config, str) set_attribute(self, 'cc27', '\x00', config, str) set_attribute(self, 'cc28', '\x00', config, str) set_attribute(self, 'cc29', '\x00', config, str) set_attribute(self, 'cc30', '\x00', config, str) set_attribute(self, 'cc31', '\x00', config, str) self._devlock = DeviceLock(self.dev, self.lock_directory) if self.is_open(): self._set_serial() return
def configure(self, config): if self.debug: print 'Configure modbus point' CompositeNode.configure(self, config) set_attribute(self, 'register', REQUIRED, config, int) self.offset = self.register - self.base_register() set_attribute(self, 'read_only', 1, config, int) set_attribute(self, 'debug', 1, config, int) set_attribute(self, 'length', 1, config, int) ProxyAbstractClass.configure(self, config) if self.debug: print 'Configured modbus point', self
def configure(self,config): # # log_error_value and log_error_type are used by logs that invoke # functions to there value and may throw an exception. This provides # a default for all columns. # set_attribute(self, 'log_error_value', 'None', config) set_attribute(self, 'log_error_type', 'eval', config) CompositeNode.configure(self,config) return
def configure(self, config): if self.debug: print 'Configure modbus point' CompositeNode.configure(self, config) set_attribute(self, 'register', REQUIRED, config, int) self.offset = self.register - self.base_register() set_attribute(self, 'read_only', 1, config, int) set_attribute(self, 'debug', 1, config, int) set_attribute(self, 'length', 1, config, int) ProxyAbstractClass.configure(self, config) if self.debug: print 'Configured modbus point', self
def configure(self,config): CompositeNode.configure(self,config) set_attribute(self, 'debug', debug, config, int) # # if debug: self.debug = debug # # self.port = self #intercept any calls to the port return