Ejemplo n.º 1
0
def save_aspace_to_disk():
    path = BASE_DIR / 'asyncua' / 'binary_address_space.pickle'
    print('Saving standard address space to:', path)
    sys.path.append('..')
    from asyncua.server.standard_address_space import standard_address_space
    from asyncua.server.address_space import NodeManagementService, AddressSpace
    a_space = AddressSpace()
    standard_address_space.fill_address_space(NodeManagementService(a_space))
    a_space.dump(path)
def test_std_address_space_references():
    aspace = AddressSpace()
    node_mgt_service = NodeManagementService(aspace)
    standard_address_space.fill_address_space(node_mgt_service)
    std_nodes = read_nodes(
        os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'schemas', 'Opc.Ua.NodeSet2.xml'))
    )
    for k in aspace.keys():
        refs = set(
            (r.ReferenceTypeId.to_string(), r.NodeId.to_string(), r.IsForward) for r in aspace[k].references
        )
        xml_refs = set(
            (r.attrib['ReferenceType'], r.text, r.attrib.get('IsForward', 'true') == 'true') for r in
                       find_elem(std_nodes[k.to_string()], 'References')
        )
        assert 0 == len(xml_refs - refs)
Ejemplo n.º 3
0
def get_nodeid_list(aspace: AddressSpace):
    aspace_list = [a.to_string() for a in aspace.keys()]
    return aspace_list