def __init__(self): self.logger = logging.getLogger(__name__) self.endpoints = [] self._channel_id_counter = 5 self.allow_remote_admin = True self.aspace = AddressSpace() self.attribute_service = AttributeService(self.aspace) self.view_service = ViewService(self.aspace) self.method_service = MethodService(self.aspace) self.node_mgt_service = NodeManagementService(self.aspace) standard_address_space.fill_address_space(self.node_mgt_service) #standard_address_space.fill_address_space_from_disk(self.aspace) self.loop = utils.ThreadLoop() self.subscription_service = SubscriptionService(self.loop, self.aspace) # create a session to use on server side self.isession = InternalSession(self, self.aspace, self.subscription_service, "Internal", user=User.Admin) self.current_time_node = Node( self.isession, ua.NodeId(ua.ObjectIds.Server_ServerStatus_CurrentTime)) uries = ["http://opcfoundation.org/UA/"] ns_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_NamespaceArray)) ns_node.set_value(uries)
def __init__(self): self.logger = logging.getLogger(__name__) self.endpoints = [] self._channel_id_counter = 5 self.allow_remote_admin = True self.disabled_clock = False # for debugging we may want to disable clock that writes too much in log self._known_servers = {} # used if we are a discovery server self.aspace = AddressSpace() self.attribute_service = AttributeService(self.aspace) self.view_service = ViewService(self.aspace) self.method_service = MethodService(self.aspace) self.node_mgt_service = NodeManagementService(self.aspace) # import address space from code generated from xml standard_address_space.fill_address_space(self.node_mgt_service) # import address space from save db to disc #standard_address_space.fill_address_space_from_disk(self.aspace) # import address space directly from xml, this has preformance impact so disabled #importer = xmlimporter.XmlImporter(self.node_mgt_service) #importer.import_xml("/home/olivier/python-opcua/schemas/Opc.Ua.NodeSet2.xml") self.loop = utils.ThreadLoop() self.subscription_service = SubscriptionService(self.loop, self.aspace) # create a session to use on server side self.isession = InternalSession(self, self.aspace, self.subscription_service, "Internal", user=User.Admin) self.current_time_node = Node( self.isession, ua.NodeId(ua.ObjectIds.Server_ServerStatus_CurrentTime)) uries = ["http://opcfoundation.org/UA/"] ns_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_NamespaceArray)) ns_node.set_value(uries)