Esempio n. 1
0
    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)
Esempio n. 2
0
 def load_standard_address_space(self, cacheFile=None):
     if cacheFile and path.isfile(cacheFile):
         # import address space from shelve
         self.aspace.load(cacheFile)
     else:
         # import address space from code generated from xml
         standard_address_space.fill_address_space(self.node_mgt_service)
Esempio n. 3
0
 def load_standard_address_space(self, cacheFile=None):
     if cacheFile and path.isfile(cacheFile):
         # import address space from shelve
         self.aspace.load(cacheFile)
     else:
         # import address space from code generated from xml
         standard_address_space.fill_address_space(self.node_mgt_service)
def save_aspace_to_disk():
    path = os.path.join(BASE_DIR, 'opcua', 'binary_address_space.pickle')
    print('Saving standard address space to:', path)
    sys.path.append('..')
    from opcua.server.standard_address_space import standard_address_space
    from opcua.server.address_space import NodeManagementService, AddressSpace
    aspace = AddressSpace()
    standard_address_space.fill_address_space(NodeManagementService(aspace))
    aspace.dump(path)
def save_aspace_to_disk():
    import os.path
    path = os.path.join("..", "opcua", "binary_address_space.pickle")
    print("Savind standard address space to:", path)
    sys.path.append("..")
    from opcua.server.standard_address_space import standard_address_space
    from opcua.server.address_space import NodeManagementService, AddressSpace
    aspace = AddressSpace()
    standard_address_space.fill_address_space(NodeManagementService(aspace))
    aspace.dump(path)
def save_aspace_to_disk():
    import os.path
    path = os.path.join("..", "opcua", "binary_address_space.pickle")
    print("Savind standard address space to:", path)
    sys.path.append("..")
    from opcua.server.standard_address_space import standard_address_space
    from opcua.server.address_space import NodeManagementService, AddressSpace
    aspace = AddressSpace()
    standard_address_space.fill_address_space(NodeManagementService(aspace))
    aspace.dump(path)
Esempio n. 7
0
    def load_standard_address_space(self, shelffile=None):
        if (shelffile is not None) and (os.path.isfile(shelffile) or os.path.isfile(shelffile+".db")):
            # import address space from shelf
            self.aspace.load_aspace_shelf(shelffile)
        else:
            # import address space from code generated from xml
            standard_address_space.fill_address_space(self.node_mgt_service)
            # import address space directly from xml, this has performance impact so disabled
            # importer = xmlimporter.XmlImporter(self.node_mgt_service)
            # importer.import_xml("/path/to/python-opcua/schemas/Opc.Ua.NodeSet2.xml", self)

            # if a cache file was supplied a shelve of the standard address space can now be built for next start up
            if shelffile:
                self.aspace.make_aspace_shelf(shelffile)
    def load_standard_address_space(self, shelffile=None):
        if (shelffile is not None) and (os.path.isfile(shelffile) or os.path.isfile(shelffile+".db")):
            # import address space from shelf
            self.aspace.load_aspace_shelf(shelffile)
        else:
            # import address space from code generated from xml
            standard_address_space.fill_address_space(self.node_mgt_service)
            # import address space directly from xml, this has performance impact so disabled
            # importer = xmlimporter.XmlImporter(self.node_mgt_service)
            # importer.import_xml("/path/to/python-opcua/schemas/Opc.Ua.NodeSet2.xml", self)

            # if a cache file was supplied a shelve of the standard address space can now be built for next start up
            if shelffile:
                self.aspace.make_aspace_shelf(shelffile)
Esempio n. 9
0
    def load_standard_address_space(self, shelffile=None):
        # check for a python shelf file, in windows the file extension is also needed for the check
        shelffile_win = shelffile
        if shelffile_win:
            shelffile_win += ".dat"

        if shelffile and (path.isfile(shelffile) or path.isfile(shelffile_win)):
            # import address space from shelf
            self.aspace.load_aspace_shelf(shelffile)
        else:
            # import address space from code generated from xml
            standard_address_space.fill_address_space(self.node_mgt_service)
            # import address space directly from xml, this has performance impact so disabled
            # importer = xmlimporter.XmlImporter(self.node_mgt_service)
            # importer.import_xml("/path/to/python-opcua/schemas/Opc.Ua.NodeSet2.xml", self)

            # if a cache file was supplied a shelve of the standard address space can now be built for next start up
            if shelffile:
                self.aspace.make_aspace_shelf(shelffile)
Esempio n. 10
0
    def load_standard_address_space(self, shelffile=None):
        # check for a python shelf file, in windows the file extension is also needed for the check
        shelffile_win = shelffile
        if shelffile_win:
            shelffile_win += ".dat"

        if shelffile and (path.isfile(shelffile)
                          or path.isfile(shelffile_win)):
            # import address space from shelf
            self.aspace.load_aspace_shelf(shelffile)
        else:
            # import address space from code generated from xml
            standard_address_space.fill_address_space(self.node_mgt_service)
            # import address space directly from xml, this has performance impact so disabled
            # importer = xmlimporter.XmlImporter(self.node_mgt_service)
            # importer.import_xml("/path/to/python-opcua/schemas/Opc.Ua.NodeSet2.xml", self)

            # if a cache file was supplied a shelve of the standard address space can now be built for next start up
            if shelffile:
                self.aspace.make_aspace_shelf(shelffile)
Esempio n. 11
0
 def setUp(self):
     self.aspace = AddressSpace()
     self.node_mgt_service = NodeManagementService(self.aspace)
     standard_address_space.fill_address_space(self.node_mgt_service)
 def setUp(self):
     self.aspace = AddressSpace()
     self.node_mgt_service = NodeManagementService(self.aspace)
     standard_address_space.fill_address_space(self.node_mgt_service)