Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
6b0114c9
Commit
6b0114c9
authored
Feb 24, 2024
by
Thomas Gambier
🚴🏼
Committed by
Thomas Gambier
Feb 27, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/ors-amarisoft: Add fixed-ips option for core network
This option will give fixed IP to each SIM card.
parent
a6f310ed
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
5 deletions
+53
-5
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+4
-4
software/ors-amarisoft/config/mme.jinja2.cfg
software/ors-amarisoft/config/mme.jinja2.cfg
+0
-1
software/ors-amarisoft/config/ue_db.jinja2.cfg
software/ors-amarisoft/config/ue_db.jinja2.cfg
+7
-0
software/ors-amarisoft/instance-core-network-input-schema.json
...are/ors-amarisoft/instance-core-network-input-schema.json
+6
-0
software/ors-amarisoft/instance-core-network.jinja2.cfg
software/ors-amarisoft/instance-core-network.jinja2.cfg
+35
-0
software/ors-amarisoft/instance.cfg
software/ors-amarisoft/instance.cfg
+1
-0
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
6b0114c9
...
...
@@ -16,7 +16,7 @@
[template]
filename = instance.cfg
md5sum =
9b7ced53c256fa5b60c679c75ed03727
md5sum =
521c6ca69d512b318d48af4ba3271951
[amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py
...
...
@@ -64,7 +64,7 @@ md5sum = 2d7558e4799818a5546850f735fbb399
[template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = 6
60bf81163d726ab51847fca716391b3
md5sum = 6
5751688a664f08765eff74e8b8c1125
[template-ue-lte]
_update_hash_filename_ = instance-ue-lte.jinja2.cfg
...
...
@@ -80,7 +80,7 @@ md5sum = c5f581ba01654b2aec46000abf8d0e35
[ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg
md5sum =
87a273c99ce64192506811d7718c2b36
md5sum =
3b901e8733e6afff8940c6c318da4493
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
...
...
@@ -96,7 +96,7 @@ md5sum = 003bf8098175415c975a10c102df6b8c
[mme.jinja2.cfg]
filename = config/mme.jinja2.cfg
md5sum =
3d7833ddba3242cedcd74c7db52390c6
md5sum =
44bdfa427720b08af3bc721770dabcda
[dnsmasq.jinja2.cfg]
filename = config/dnsmasq.jinja2.cfg
...
...
software/ors-amarisoft/config/mme.jinja2.cfg
View file @
6b0114c9
...
...
@@ -71,7 +71,6 @@
first_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration.get('tun-ipv4-network', '')).first) + 2 }}",
last_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration.get('tun-ipv4-network', '')).last) - 1 }}",
{% endif %}
ip_addr_shift: 2,
p_cscf_addr: ["{{ slap_configuration.get('tun-ipv4-addr', '') }}"],
erabs: [
...
...
software/ors-amarisoft/config/ue_db.jinja2.cfg
View file @
6b0114c9
...
...
@@ -14,6 +14,13 @@ ue_db: [
K: "{{ s.get('k', '') }}",
impu: "{{ s.get('impu', '') }}",
impi: "{{ s.get('impi', '') }}",
{%- if "ip" in s %}
pdn_list:[{
access_point_name: "internet",
default: true,
ipv4_addr: "{{ s['ip'] }}"
}]
{%- endif %}
}
{%- endfor -%}
]
...
...
software/ors-amarisoft/instance-core-network-input-schema.json
View file @
6b0114c9
...
...
@@ -44,6 +44,12 @@
"title"
:
"Use IPv4"
,
"description"
:
"Set to true to use IPv4 for AMF / MME addresses"
,
"type"
:
"boolean"
},
"fixed_ips"
:
{
"default"
:
false
,
"title"
:
"Fixed IP for the UE"
,
"description"
:
"Set to true to force a static IPv4 for each UE. If true, the number of UE is limited."
,
"type"
:
"boolean"
}
}
}
software/ors-amarisoft/instance-core-network.jinja2.cfg
View file @
6b0114c9
{%- set dns_slave_instance_list = [] %}
{%- set sim_slave_instance_list = [] %}
{%- set fixed_ip = slapparameter_dict.get("fixed_ips", False) %}
{%- for slave in slave_instance_list %}
{%- set slave_parameters = json_module.loads(slave['_']) %}
{%- if slave_parameters.get('subdomain', '') != '' %}
...
...
@@ -19,8 +20,38 @@
recipe = slapos.cookbook:publish.serialised
-slave-reference = {{ slave_reference }}
info = Your SIM card with IMSI {{ slave_parameters.get('imsi', '') }} has been attached to service ${slap-configuration:instance-title}.
{%- if fixed_ip %}
ipv4 = ${sim-ip-configuration:{{slave_reference}}}
{%- endif %}
{%- endfor %}
[sim-ip-configuration]
recipe = slapos.recipe.build
sim-slave-instance-list = {{ dumps(sim_slave_instance_list) }}
ipv4-network = {{ slap_configuration.get('tun-ipv4-network', '') }}
init =
import netaddr
import json
network = netaddr.IPNetwork(options['ipv4-network'])
slave_list = options['sim-slave-instance-list']
# if we don't have enough IPv4 addresses in the network, don't force it
# should we make a promise fail ?
if len(slave_list) + 2 > network.size:
for s in slave_list:
options[s['slave_reference']] = "Too many SIM for the IPv4 network"
else:
# calculate the IP addresses of each SIM
sim_list = []
first_addr = netaddr.IPAddress(network.first)
for i, s in enumerate(sorted(slave_list, key=lambda x: json.loads(x['_'])['imsi'])):
ip = str(first_addr + 2 + i)
options[s['slave_reference']] = ip
slave_parameters = json.loads(s['_'])
slave_parameters['ip'] = ip
s['_'] = json.dumps(slave_parameters)
options['sim-with-ip-list'] = slave_list
{%- for slave in dns_slave_instance_list %}
{%- set slave_parameters = json_module.loads(slave['_']) %}
{% set slave_reference = slave.get('slave_reference', '') %}
...
...
@@ -70,7 +101,11 @@ configuration.gtp_addr = 127.0.1.100
configuration.ims_addr = 127.0.0.1
configuration.ims_bind = 127.0.0.2
ue_db_path = ${ue-db-config:output}
{%- if fixed_ip %}
sim_list = ${sim-ip-configuration:sim-with-ip-list}
{%- else %}
sim_list = {{ dumps(sim_slave_instance_list) }}
{%- endif %}
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
...
...
software/ors-amarisoft/instance.cfg
View file @
6b0114c9
...
...
@@ -335,6 +335,7 @@ extra-context =
raw dnsmasq_location ${dnsmasq:location}
key dnsmasq_config_path dnsmasq-config:output
key slave_instance_list slap-configuration:slave-instance-list
section slap_configuration slap-configuration
[dynamic-template-ue-lte]
< = jinja2-template-base
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment