|
1
|
|
|
|
|
2
|
1 |
|
import os.path |
|
3
|
|
|
|
|
4
|
1 |
|
import opcua |
|
5
|
|
|
|
|
6
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part3 import create_standard_address_space_Part3 |
|
7
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part4 import create_standard_address_space_Part4 |
|
8
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part5 import create_standard_address_space_Part5 |
|
9
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part8 import create_standard_address_space_Part8 |
|
10
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part9 import create_standard_address_space_Part9 |
|
11
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part10 import create_standard_address_space_Part10 |
|
12
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part11 import create_standard_address_space_Part11 |
|
13
|
1 |
|
from opcua.server.standard_address_space.standard_address_space_part13 import create_standard_address_space_Part13 |
|
14
|
|
|
|
|
15
|
1 |
|
class PostponeReferences(object): |
|
16
|
1 |
|
def __init__(self, server): |
|
17
|
1 |
|
self.server = server |
|
18
|
1 |
|
self.postponed = None |
|
19
|
1 |
|
self.add_nodes = self.server.add_nodes |
|
20
|
|
|
|
|
21
|
1 |
|
def add_references(self, refs): |
|
22
|
1 |
|
self.postponed.extend(self.server.try_add_references(refs)) |
|
23
|
|
|
# no return |
|
24
|
|
|
|
|
25
|
1 |
|
def __enter__(self): |
|
26
|
1 |
|
self.postponed = [] |
|
27
|
1 |
|
return self |
|
28
|
|
|
|
|
29
|
1 |
|
def __exit__(self, exc_type, exc_val, exc_tb): |
|
30
|
1 |
|
if exc_type is None and exc_val is None: |
|
31
|
1 |
|
remaining = list(self.server.try_add_references(self.postponed)) |
|
32
|
1 |
|
assert len(remaining) == 0, remaining |
|
33
|
|
|
|
|
34
|
1 |
|
def fill_address_space(nodeservice): |
|
35
|
1 |
|
with PostponeReferences(nodeservice) as server: |
|
36
|
1 |
|
create_standard_address_space_Part3(server) |
|
37
|
1 |
|
create_standard_address_space_Part4(server) |
|
38
|
1 |
|
create_standard_address_space_Part5(server) |
|
39
|
1 |
|
create_standard_address_space_Part8(server) |
|
40
|
1 |
|
create_standard_address_space_Part9(server) |
|
41
|
1 |
|
create_standard_address_space_Part10(server) |
|
42
|
1 |
|
create_standard_address_space_Part11(server) |
|
43
|
1 |
|
create_standard_address_space_Part13(server) |
|
44
|
|
|
assert len(server.postponed) == 1370, len(server.postponed) |
|
45
|
|
|
|