23
23
# Create records for all the test objects to create, so that they can be
24
24
# inspected during tests as ground truth.
25
25
ISDdef = namedtuple ('ISDdef' , ['isd_id' , 'label' ])
26
- ASdef = namedtuple ('ASdef' , ['isd_id' , 'as_id' , 'label' , 'public_ip' , 'is_core' , 'is_ap' ])
26
+ ASdef = namedtuple ('ASdef' , ['isd_id' , 'as_id' , 'label' , 'public_ip' , 'is_core' , 'is_ap' ,
27
+ 'internal_ip' ])
27
28
LinkDef = namedtuple ('LinkDef' , ['type' , 'as_id_a' , 'as_id_b' ])
28
29
VPNDef = namedtuple ('VPNDef' , ['as_id' , 'vpn_ip' , 'vpn_port' , 'subnet' ])
29
30
@@ -33,9 +34,9 @@ def _expand_as_id(as_id_tail):
33
34
return 'ffaa:0:%x' % as_id_tail
34
35
35
36
36
- def makeASdef (isd_id , as_id_tail , label , public_ip , is_core = False , is_ap = False ):
37
+ def makeASdef (isd_id , as_id_tail , label , public_ip , is_core = False , is_ap = False , internal_ip = None ):
37
38
""" Helper for readable ASdef declaration """
38
- return ASdef (isd_id , _expand_as_id (as_id_tail ), label , public_ip , is_core , is_ap )
39
+ return ASdef (isd_id , _expand_as_id (as_id_tail ), label , public_ip , is_core , is_ap , internal_ip )
39
40
40
41
41
42
def makeLinkDef (type , as_id_tail_a , as_id_tail_b ):
@@ -76,6 +77,9 @@ def makeLinkDef(type, as_id_tail_a, as_id_tail_b):
76
77
makeASdef (20 , 0x1404 , 'K_AP1' , '192.0.2.44' , is_ap = True ),
77
78
makeASdef (20 , 0x1405 , 'K_AP2' , '172.31.0.114' , is_ap = True ),
78
79
makeASdef (20 , 0x1406 , 'K_L3' , '192.0.2.46' ),
80
+ # IPv6 only, e.g. FITI.
81
+ makeASdef (25 , 0x2101 , 'FITI-1 Beijing' , '240a:a097:100:1::11' , is_core = True ,
82
+ internal_ip = '240a:a097:100:1::11' ),
79
83
]
80
84
81
85
# Links
@@ -185,14 +189,15 @@ def name_hosts():
185
189
host .save ()
186
190
187
191
188
- def _create_as (isd_id , as_id , label , public_ip , is_core = False , is_ap = False ):
192
+ def _create_as (isd_id , as_id , label , public_ip , is_core = False , is_ap = False , internal_ip = None ):
189
193
isd = ISD .objects .get (isd_id = isd_id )
190
194
as_ = AS .objects .create_with_default_services (
191
195
isd = isd ,
192
196
as_id = as_id ,
193
197
label = label ,
194
198
is_core = is_core ,
195
199
public_ip = public_ip ,
200
+ internal_ip = internal_ip ,
196
201
init_certificates = False # Defer certificates generation
197
202
)
198
203
0 commit comments