Skip to content

Commit 96ced59

Browse files
authored
Fix IPv6 in dispatcher toml (#470)
* Add to fixtures a host with IPv6 and IPv6 test for those hosts. * Fix bug in dispatcher.toml with IPv6. * Recreate test data. * Lint.
1 parent 0e3d659 commit 96ced59

File tree

16 files changed

+6351
-4554
lines changed

16 files changed

+6351
-4554
lines changed

scionlab/fixtures/testdata.yaml

Lines changed: 2004 additions & 1407 deletions
Large diffs are not rendered by default.

scionlab/fixtures/testtopo.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
# Create records for all the test objects to create, so that they can be
2424
# inspected during tests as ground truth.
2525
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'])
2728
LinkDef = namedtuple('LinkDef', ['type', 'as_id_a', 'as_id_b'])
2829
VPNDef = namedtuple('VPNDef', ['as_id', 'vpn_ip', 'vpn_port', 'subnet'])
2930

@@ -33,9 +34,9 @@ def _expand_as_id(as_id_tail):
3334
return 'ffaa:0:%x' % as_id_tail
3435

3536

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):
3738
""" 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)
3940

4041

4142
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):
7677
makeASdef(20, 0x1404, 'K_AP1', '192.0.2.44', is_ap=True),
7778
makeASdef(20, 0x1405, 'K_AP2', '172.31.0.114', is_ap=True),
7879
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'),
7983
]
8084

8185
# Links
@@ -185,14 +189,15 @@ def name_hosts():
185189
host.save()
186190

187191

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):
189193
isd = ISD.objects.get(isd_id=isd_id)
190194
as_ = AS.objects.create_with_default_services(
191195
isd=isd,
192196
as_id=as_id,
193197
label=label,
194198
is_core=is_core,
195199
public_ip=public_ip,
200+
internal_ip=internal_ip,
196201
init_certificates=False # Defer certificates generation
197202
)
198203

scionlab/scion/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,10 @@ def build_disp_conf(self, host):
288288
conf['dispatcher'].update({
289289
'service_addresses': {
290290
# One line with all addresses for CS, another for DS.
291-
f'{ia_str},CS': f'{host.internal_ip}:{Service.SERVICE_PORTS[Service.CS]}',
292-
f'{ia_str},DS': f'{host.internal_ip}:{Service.SERVICE_PORTS[Service.CS]}',
291+
f'{ia_str},CS':
292+
f'{_join_host_port(host.internal_ip, Service.SERVICE_PORTS[Service.CS])}',
293+
f'{ia_str},DS':
294+
f'{_join_host_port(host.internal_ip, Service.SERVICE_PORTS[Service.CS])}',
293295
},
294296
})
295297
return conf

scionlab/tests/data/test_config_tar/host_1.yml

Lines changed: 419 additions & 350 deletions
Large diffs are not rendered by default.

scionlab/tests/data/test_config_tar/host_16.yml

Lines changed: 527 additions & 337 deletions
Large diffs are not rendered by default.

scionlab/tests/data/test_config_tar/host_17.yml

Lines changed: 387 additions & 462 deletions
Large diffs are not rendered by default.

scionlab/tests/data/test_config_tar/host_18.yml

Lines changed: 483 additions & 315 deletions
Large diffs are not rendered by default.

scionlab/tests/data/test_config_tar/host_19.yml

Lines changed: 560 additions & 0 deletions
Large diffs are not rendered by default.

scionlab/tests/data/test_config_tar/host_4.yml

Lines changed: 390 additions & 321 deletions
Large diffs are not rendered by default.

scionlab/tests/data/test_config_tar/user_as_16.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)