Commit 3a8f56b6 authored by Joanne Hugé's avatar Joanne Hugé

wip: split tuns

parent 67fbb6c2
......@@ -66,7 +66,7 @@
pdn_type: "ipv4",
dns_addr: "8.8.8.8",
{% endif %}
tun_ifname: "{{ slap_configuration.get('tun-name', '') }}",
tun_ifname: "{{ slap_configuration.get('tun-name', '') }}-1",
access_point_name: ["default", "internet", "sos"],
{% if slap_configuration.get('tun-name', '') %}
first_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration.get('tun-ipv4-network', '')).first) + 2 }}",
......
......@@ -147,6 +147,49 @@ init =
options['{{tap}}'] = json.dumps(tap)
{%- endfor %}
{#- split slapos tun interface #}
{%- set vtun_list = [] %}
[vtun]
recipe = plone.recipe.command
command = {{ netcapdo }} {{ pythonwitheggs }} {{ ru_tunsplit }} {{ slaplte.tun }} 2
update-command = ${:command}
stop-on-error = true
{%- if testing %}
# StandaloneSlapOS does not provide slaptun
command = :
{%- endif %}
{%- for i in range(1,3) %}
{%- set tun = '%s-%d' % (slaplte.tun, i) %}
{%- do vtun_list.append(tun) %}
[vtun.{{ tun }}]
recipe = slapos.recipe.build
depends = ${vtun:recipe}
init =
import types
def readfile(path):
with open(path) as f:
return f.read()
import netaddr
# ~ import tunsplit
tunsplit = types.ModuleType('tunsplit')
exec(readfile('{{ ru_tunsplit }}'), tunsplit.__dict__)
# simulate what tunsplit would assign to the tun
# ( tun subinterface will be created for real later at install time - when it
# is too late to update section options )
if {{ testing }}:
slapnet = netaddr.IPNetwork('{{ str(test_slapnet) }}')
else:
slapnet = tunsplit.ifnet6('{{ slaplte.tun }}')
tunnet = tunsplit.netsplit(slapnet, {{ 1+ntun }}) [{{ i }}]
options['network'] = str(tunnet)
options['gateway'] = str(tunnet[1])
options['addr'] = str(tunnet[-1])
{%- endfor %}
{#- provide CPRI-based RUs IP address via DHCP #}
{%- if ntap > 0 %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment