Commit b8872998 authored by Joanne Hugé's avatar Joanne Hugé

.

parent f8addc70
...@@ -28,7 +28,7 @@ md5sum = 4fae7413d143b6c9b1734ffbe5c8e94b ...@@ -28,7 +28,7 @@ md5sum = 4fae7413d143b6c9b1734ffbe5c8e94b
[ru_libinstance.jinja2.cfg] [ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg _update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = 5d7374594283c5b6bcb581f2eadac610 md5sum = 21f2526a5ae062eae5162a026736fbb9
[ru_sdr_libinstance.jinja2.cfg] [ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg _update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
...@@ -80,7 +80,7 @@ md5sum = da233439ca2b4978ea57bf8c6d628965 ...@@ -80,7 +80,7 @@ md5sum = da233439ca2b4978ea57bf8c6d628965
[ru_tapsplit] [ru_tapsplit]
_update_hash_filename_ = ru/tapsplit _update_hash_filename_ = ru/tapsplit
md5sum = b547df6f6efe841466def20531770923 md5sum = 8bc11d6789dc71feb5ffe975769cf2a3
[ru_capdo.c] [ru_capdo.c]
_update_hash_filename_ = ru/capdo.c _update_hash_filename_ = ru/capdo.c
...@@ -88,7 +88,7 @@ md5sum = 4855e1b8dbc6fee88a16cefc39e96693 ...@@ -88,7 +88,7 @@ md5sum = 4855e1b8dbc6fee88a16cefc39e96693
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = e4fa0dc8a8cdc49caf26db52aa1db3c9 md5sum = 248eb6aee0e16b0b0b955daeb1b0868c
[template-gnb] [template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
......
...@@ -355,6 +355,7 @@ output = ${directory:etc}/enb.cfg ...@@ -355,6 +355,7 @@ output = ${directory:etc}/enb.cfg
extra-context = extra-context =
json iru_dict {{ rulib.iru_dict | tojson }} json iru_dict {{ rulib.iru_dict | tojson }}
json icell_dict {{ rulib.icell_dict | tojson }} json icell_dict {{ rulib.icell_dict | tojson }}
json ipeercell_dict {{ ipeercell_dict | tojson }}
import json_module json import json_module json
import-list = import-list =
rawfile amari_lte.jinja2 {{ amari_lte_template }} rawfile amari_lte.jinja2 {{ amari_lte_template }}
......
...@@ -78,11 +78,12 @@ addr = {{ slap_configuration['tap-ipv6-addr'] }} ...@@ -78,11 +78,12 @@ addr = {{ slap_configuration['tap-ipv6-addr'] }}
{%- else %} {%- else %}
{%- for i in range(1,ntap+1) %} {%- for i in range(1,1+ntap) %}
{%- set tap = '%s-%d' % (slaplte.tap, i) %} {%- set tap = '%s-%d' % (slaplte.tap, i) %}
{%- do vtap_list.append(tap) %} {%- do vtap_list.append(tap) %}
[vtap.{{ tap }}] [vtap.{{ tap }}]
recipe = slapos.recipe.build recipe = slapos.recipe.build
depends = ${vtap:recipe}
init = init =
import types import types
def readfile(path): def readfile(path):
...@@ -93,11 +94,15 @@ init = ...@@ -93,11 +94,15 @@ init =
tapsplit = types.ModuleType('tapsplit') tapsplit = types.ModuleType('tapsplit')
exec(readfile('{{ ru_tapsplit }}'), tapsplit.__dict__) exec(readfile('{{ ru_tapsplit }}'), tapsplit.__dict__)
net = tapsplit.ifnet6('{{ tap }}') # simulate what tapsplit would assign to the tap
# ( tap subinterface will be created for real later at install time - when it
# is too late to update section options )
slapnet = tapsplit.ifnet6('{{ slaplte.tap }}')
tapnet = tapsplit.netsplit(slapnet, {{ 1+ntap }}) [{{ i }}]
options['network'] = str(net) options['network'] = str(tapnet)
options['gateway'] = str(net[1]) options['gateway'] = str(tapnet[1])
options['addr'] = str(net[-1]) options['addr'] = str(tapnet[-1])
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
......
...@@ -47,12 +47,9 @@ def main(): ...@@ -47,12 +47,9 @@ def main():
if ifname.startswith('%s-' % tap): if ifname.startswith('%s-' % tap):
run('ip', 'link', 'del', ifname) run('ip', 'link', 'del', ifname)
# see how much prefix bits we need to take to divide by n
n += 1 # also leaving first range for the original tap
ptake = ceil(log2(n))
# do the split # do the split
for i, subnet in enumerate(net.subnet(net.prefixlen + ptake)): # with leaving first range for the original tap
for i, subnet in enumerate(netsplit(net, 1+n)):
if i == 0: if i == 0:
print('preserve %s' % subnet) print('preserve %s' % subnet)
continue # leave this range for original tap continue # leave this range for original tap
...@@ -65,6 +62,12 @@ def main(): ...@@ -65,6 +62,12 @@ def main():
run('ip', 'route', 'add', str(subnet), 'dev', subtap, 'via', str(subnet[1])) run('ip', 'route', 'add', str(subnet), 'dev', subtap, 'via', str(subnet[1]))
# netsplit splits network into n subnetworks.
def netsplit(net, n): # -> []subnet
# see how much prefix bits we need to take to be able to divide by n
ptake = ceil(log2(n))
return list( net.subnet(net.prefixlen + ptake) )[:n]
# ifnet6 returns IPv6 network address associated with given interface. # ifnet6 returns IPv6 network address associated with given interface.
def ifnet6(ifname): def ifnet6(ifname):
addr = None addr = None
......
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