Skip to content

Commit 19f141d

Browse files
authored
Add minimal SIG topology entry support (#374)
Previously we've had even more minimal support for SIG topology entries only in User ASes. Add support for an explicit SIG Service object, to allow configuring the same thing in the SCIONLab infrastructure ASes. As before, this is only concerned with adding a topology entry so that the routers are able to resolve the SIG service address -- actually configuring the SIG itself is still out of scope and is done manually on each host.
1 parent 585abd5 commit 19f141d

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

scionlab/fixtures/testdata.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3640,7 +3640,7 @@
36403640
ssh_host: 172.31.0.110
36413641
uid: 9b2eedd0a1bd41d59a6c3a37a0317024
36423642
secret: e563ae76441a44b3b225cb26e569dc72
3643-
config_version: 9
3643+
config_version: 10
36443644
config_version_deployed: 0
36453645
config_queried_at: null
36463646
- model: scionlab.host
@@ -4772,6 +4772,12 @@
47724772
AS: 20
47734773
host: 20
47744774
type: CS
4775+
- model: scionlab.service
4776+
pk: 23
4777+
fields:
4778+
AS: 5
4779+
host: 5
4780+
type: SIG
47754781
- model: scionlab.vpn
47764782
pk: 1
47774783
fields:

scionlab/fixtures/testtopo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def makeLinkDef(type, as_id_tail_a, as_id_tail_b):
107107
extra_services = [
108108
(_expand_as_id(0x1107), Service.BW),
109109
(_expand_as_id(0x1406), Service.BW),
110+
(_expand_as_id(0x1301), Service.SIG),
110111
]
111112

112113
# VPNs for APs, except 1303

scionlab/models/core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
BR_METRICS_PORT_BASE,
4444
CS_PORT,
4545
CS_METRICS_PORT,
46+
SIG_CTRL_PORT,
4647
BW_PORT,
4748
PP_PORT,
4849
DEFAULT_HOST_INTERNAL_IP,
@@ -1071,10 +1072,12 @@ class Service(models.Model):
10711072
and for any other service that communicates using SCION.
10721073
"""
10731074
CS = 'CS'
1075+
SIG = 'SIG'
10741076
BW = 'BW'
10751077
PP = 'PP'
10761078
SERVICE_TYPES = (
10771079
(CS, 'Control Service'), # monolithic control plane service
1080+
(SIG, 'SCION IP Gateway'),
10781081
(BW, 'Bandwidth tester server'),
10791082
(PP, 'Pingpong server'),
10801083
)
@@ -1087,6 +1090,7 @@ class Service(models.Model):
10871090
)
10881091
SERVICE_PORTS = {
10891092
CS: CS_PORT,
1093+
SIG: SIG_CTRL_PORT,
10901094
BW: BW_PORT,
10911095
PP: PP_PORT,
10921096
}

scionlab/scion/topology.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ def _make_topo(self, with_sig_dummy_entry):
4747
self.routers = _fetch_routers(self.AS)
4848
self.services = _fetch_services(self.AS)
4949

50+
# add a dummy SIG entry (for user ASes).
51+
if with_sig_dummy_entry and not any(s.type == Service.SIG for s in self.services):
52+
sig = Service(AS=self.AS,
53+
host=self.AS.hosts.first(),
54+
type=Service.SIG)
55+
sig.__dict__['instance_id'] = 1
56+
self.services.append(sig)
57+
5058
# AS wide entries
5159
self.topo = {}
5260
self.topo["isd_as"] = self.AS.isd_as_str()
@@ -55,9 +63,7 @@ def _make_topo(self, with_sig_dummy_entry):
5563

5664
_topo_add_routers(self.topo, self.routers)
5765
_topo_add_control_services(self.topo, self.services)
58-
59-
if with_sig_dummy_entry:
60-
_topo_add_sig_dummy_entry(self.topo, self.AS.hosts.first())
66+
_topo_add_sigs(self.topo, self.services)
6167

6268

6369
def _fetch_routers(as_):
@@ -143,23 +149,23 @@ def _topo_add_control_services(topo_dict, services):
143149
ds_entry[instance_name] = service_instance_entry
144150

145151

146-
def _topo_add_sig_dummy_entry(topo_dict, host):
152+
def _topo_add_sigs(topo_dict, services):
147153
"""
148-
Add a "dummy" entry for the SIG in the topology.json, with localhost address and default
149-
port.
154+
Add SIG entries to the topology, with default ports.
150155
Note that we do not actually include any configuration for the SIG (out of scope).
151156
This is added to reduce the number of files that a scionlab user needs to modify when
152157
configuring the SIG.
153158
Note: this entry allows the border router to resolve SIG service address; this changes the
154159
error behaviour slighly when receiving packets addressed to the SIG without the SIG running.
155160
"""
156-
topo_dict["sigs"] = {
157-
"sig-1": { # id is irrelevant, not used for anything
158-
"ctrl_addr": _join_host_port(host.internal_ip, SIG_CTRL_PORT),
159-
"data_addr": _join_host_port(host.internal_ip, SIG_DATA_PORT),
160-
# 'allow_interfaces': [...], unused for now, not setting anything
161+
sigs = (s for s in services if s.type == Service.SIG)
162+
for sig in sigs:
163+
topo_dict["sigs"] = {
164+
sig.instance_name: {
165+
"ctrl_addr": _join_host_port(sig.host.internal_ip, SIG_CTRL_PORT),
166+
"data_addr": _join_host_port(sig.host.internal_ip, SIG_DATA_PORT),
167+
}
161168
}
162-
}
163169

164170

165171
def _join_host_port(host, port):

0 commit comments

Comments
 (0)