Commit 11876e0c authored by Joanne Hugé's avatar Joanne Hugé Committed by Joanne Hugé

ors-amarisoft: add UE mode for ORS

parent 6111300d
......@@ -20,11 +20,11 @@ md5sum = 2e30c07c6436895ac0bc6c177cf7013d
[template-ors]
filename = instance-ors.cfg
md5sum = f5c76c3443b75569eb18503dce38e783
md5sum = 55917803505ca1990086e1aa884b39ce
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
md5sum = 871ade334f445e22d6cb473e4d4e3522
md5sum = 30ba34c9ec41dbd687628ff6c4350238
[ru_amarisoft-stats.jinja2.py]
_update_hash_filename_ = ru/amarisoft-stats.jinja2.py
......@@ -94,13 +94,17 @@ md5sum = 7bc8aab138bed0de6f48283e86853cf6
_update_hash_filename_ = instance-ors-enb.jinja2.cfg
md5sum = 315633c8d09b84ef1c699094810c654a
[template-ors-ue]
_update_hash_filename_ = instance-ors-ue.jinja2.cfg
md5sum = f4389a92fb111447e7976e452db78607
[template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = dab992c02a363e00cdc86f102a7ae489
[template-ue]
_update_hash_filename_ = instance-ue.jinja2.cfg
md5sum = 574e525659bd73c5385c78469adadf91
md5sum = 7b9a49e6cab7d865c93148ec57d015ff
[template-obsolete]
_update_hash_filename_ = instance-obsolete.jinja2.cfg
......@@ -108,7 +112,7 @@ md5sum = c5f581ba01654b2aec46000abf8d0e35
[ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg
md5sum = 116843e5d84316ff3821c5fd577ed0be
md5sum = e76164b87c3b51d6eb26acc1f78d80c2
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
......@@ -148,12 +152,16 @@ md5sum = f07c85916bcb7e4002c8edc3d087c1be
[ue.jinja2.cfg]
filename = config/ue.jinja2.cfg
md5sum = 62291a11fd36a42464901cdc81338687
md5sum = acaa1aab5329de4ca25edb9aa570208e
[ru_lopcomm_CreateProcessingEle.jinja2.xml]
_update_hash_filename_ = ru/lopcomm/CreateProcessingEle.jinja2.xml
md5sum = e435990eb0a0d4be41efa9bd16dce09b
[ue-ifup]
_update_hash_filename_ = config/ue-ifup
md5sum = f02fbfd31ba89cf243e2752adcae28d9
[ru_lopcomm_cu_config.jinja2.xml]
_update_hash_filename_ = ru/lopcomm/cu_config.jinja2.xml
md5sum = 346c911e1ac5e5001a39c8926b44c91e
......
#!/bin/bash
ue_id="$1"
pdn_id="$2"
ifname="$3"
ipv4_addr="$4"
ipv4_dns="$5"
ipv6_local_addr="$6"
ipv6_dns="$7"
param="$8"
old_link_local=""
shift; shift; shift; shift; shift; shift; shift; shift;
while [ "$1" != "" ] ; do
case "$1" in
--mtu)
mtu="$2"
shift
;;
*)
echo "Bad parameter: $1" >&2
exit 1
;;
esac
shift
done
if [ "$pdn_id" != "0" ] ; then
echo "We should have only PDN 0, exiting..."
exit 1
fi
echo "Configure $ue_id($param) on pdn $pdn_id, tun=$ifname, ip=$ipv4_addr, dns=$ipv4_dns, ip6=$ipv6_local_addr, ip6_dns=$ipv6_dns"
if [ "$ipv4_dns" != "" ] || [ "$ipv6_dns" != "" ] ; then
if [ "$ipv4_dns" != "" ] ; then
echo "nameserver $ipv4_dns" >> /etc/resolv.conf
fi
if [ "$ipv6_dns" != "" ] ; then
echo "nameserver $ipv6_dns" >> /etc/resolv.conf
fi
fi
if [ "$ipv6_local_addr" != "" ] ; then
echo '0' > /proc/sys/net/ipv6/conf/$ifname/disable_ipv6
echo '1' > /proc/sys/net/ipv6/conf/$ifname/accept_ra
echo '1' > /proc/sys/net/ipv6/conf/$ifname/router_solicitation_delay
echo '1' > /proc/sys/net/ipv6/conf/$ifname/autoconf
else
echo '1' > /proc/sys/net/ipv6/conf/$ifname/disable_ipv6
fi
ifconfig $ifname up
if [ "$ipv4_addr" != "" ] ; then
ifconfig $ifname $ipv4_addr/24
if [ "$mtu" != "" ] ; then
ifconfig $ifname mtu $mtu
fi
fi
if [ "$ipv6_local_addr" != "" ] ; then
old_link_local=`ip addr show dev $ifname | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d'`
if [ "$old_link_local" != "" ] ; then
ifconfig $ifname inet6 del $old_link_local/64
fi
ifconfig $ifname inet6 add $ipv6_local_addr/64
fi
if [ "$ipv4_addr" != "" -a "$ipv6_local_addr" != "" ] ; then
echo "MAC_ADDR="$(ip link show dev $ifname | grep -oP "ether \K[\d:a-f]+")
fi
......@@ -20,8 +20,10 @@
log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1,phy.level=info,file.rotate=1G,file.path=/dev/null",
log_filename: "{{ directory['log'] }}/ue.log",
{%- if not ors %}
rue_bind_addr: "{{ pub_info['rue_bind_addr'] }}",
com_addr: "{{ pub_info['com_addr'] }}",
{%- endif %}
{# instantiate radio units #}
{{ slaplte.ru_config(iru_dict, slapparameter_dict) }}
......@@ -102,7 +104,9 @@
impi: "{{ ue.impi }}",
imsi: "{{ ue.imsi }}",
K: "{{ ue.k }}",
{%- if ue.get('rue_addr', False) %}
rue_addr: "{{ ue.rue_addr }}",
{%- endif %}
{%- if ue.ue_type == 'lte' %}
as_release: 13,
ue_category: 13,
......@@ -112,7 +116,7 @@
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
tun_setup_script: "ue-ifup",
tun_setup_script: "{{ ue_ifup }}",
apn: "internet",
},
{%- endfor %}
......
......@@ -14,18 +14,33 @@ ue_db: [
K: "{{ s.get('k', '') }}",
impu: "{{ s.get('impu', '') }}",
impi: "{{ s.get('impi', '') }}",
{%- if "ip" in s or slapparameter_dict.get('enable_multicast', False) %}
{%- if "ip" in s or s.get('enable_multicast', False) or s.get('enable_ipv6_multicast', False) or s.get('enable_broadcast') or s.get('route_list', False) %}
pdn_list:[{
access_point_name: "internet",
default: true,
{%- if "ip" in s %}
ipv4_addr: "{{ s['ip'] }}"
{%- endif %}
{%- if slapparameter_dict.get('enable_multicast', False) %}
{%- if s.get('enable_multicast', False) %}
multicast: True,
{%- endif %}
{%- if slapparameter_dict.get('enable_broadcast', False) %}
{%- if s.get('enable_ipv6_multicast', False) %}
ipv6_multicast: True,
{%- endif %}
{%- if s.get('enable_broadcast', False) %}
broadcast: True,
{%- endif %}
{%- if s.get('route_list', False) %}
routes: [
{%- for _, route in s.route_list |dictsort %}
[
{
ipv6_remote_addr_prefix: "{{ route['ipv6_remote_addr_prefix'] }}",
prefix_len: {{ route['prefix_len'] }},
}
],
{%- endfor -%}
],
{%- endif %}
}]
{%- endif %}
......
......@@ -45,18 +45,6 @@
"description": "Set to true to use IPv4 for AMF / MME addresses",
"type": "boolean"
},
"enable_multicast": {
"default": false,
"title": "Enable IPv4 multicast",
"description": "Set to true to enable IPv4 multicast",
"type": "boolean"
},
"enable_broadcast": {
"default": false,
"title": "Enable IPv4 broadcast",
"description": "Set to true to enable IPv4 broadcast",
"type": "boolean"
},
"fixed_ips": {
"default": false,
"title": "Fixed IP for the UE",
......
{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters",
"properties": {
"bandwidth": {
"title": "Bandwidth",
"description": "Downlink Bandwidth",
"type": "string",
"enum": [
"1.4 MHz",
"3 MHz",
"5 MHz",
"10 MHz",
"15 MHz",
"20 MHz"
],
"default": "20 MHz"
},
"n_antenna_dl": {
"$ref": "ru/common.json#/properties/n_antenna_dl",
"enum": [
1,
2
],
"default": 2
},
"n_antenna_ul": {
"$ref": "ru/common.json#/properties/n_antenna_ul",
"enum": [
1,
2
],
"default": 2
},
"rf_mode": {
"$ref": "cell/common.json#/properties/rf_mode",
"default": "tdd"
},
"dl_earfcn": {
"$ref": "cell/lte/input-schema.json#/properties/dl_earfcn"
},
"tx_gain": {
"$ref": "ru/common.json#/properties/tx_gain"
},
"rx_gain": {
"$ref": "ru/common.json#/properties/rx_gain"
},
"log_phy_debug": {
"$ref": "instance-enb-input-schema.json#/properties/log_phy_debug"
},
"disable_sdr": {
"default": false,
"title": "Disable SDR",
"description": "Disables radio",
"type": "boolean"
}
}
}
{
"$schema": "http://json-schema.org/draft-04/schema",
"description": "Values returned by ORS UE instantiation (stub)",
"type": "object",
"properties": {}
}
{%- set ors_defaults = {
"bandwidth": "20 MHz",
"n_antenna_dl": 2,
"n_antenna_ul": 1,
"rf_mode": "tdd",
"plmn": "00101",
"disable_sdr": false
} %}
{%- for k,v in ors_defaults|dictsort %}
{%- do slapparameter_dict.setdefault(k, v) %}
{%- endfor %}
{#- make real ru/cell/peer/... shared instances to be rejected in ORS mode #}
{%- set ishared_list = slap_configuration.setdefault('slave-instance-list', []) %}
{%- for ishared in ishared_list %}
{%- set _ = json_module.loads(ishared['_']) %}
{%- if 'ru_type' in _ or 'cell_type' in _ %}
{%- do ishared.update({'_': {'REJECT': 1}|tojson}) %}
{%- endif %}
{%- if 'imsi' in _ %}
{%- do _.update({'ue_type': 'lte'}) %}
{%- endif %}
{%- endfor %}
{#- inject ru+cell synthesized from ORS-specific parameters #}
{%- macro iref(name) %}
{{- '%s.%s' % (slap_configuration['instance-title'], name) -}}
{%- endmacro %}
{%- do ishared_list.append({
'slave_title': iref('RU'),
'slave_reference': False,
'_': {
'ru_type': 'sdr',
'ru_link_type': 'sdr',
'sdr_dev_list': [0],
'n_antenna_dl': slapparameter_dict.n_antenna_dl,
'n_antenna_ul': slapparameter_dict.n_antenna_ul,
'tx_gain': ors_version['current-tx-gain'],
'rx_gain': ors_version['current-rx-gain'],
'txrx_active': 'ACTIVE' if (not slapparameter_dict.disable_sdr) else 'INACTIVE',
} |tojson
})
%}
{%- set cell = {
'cell_type': 'lte',
'dl_earfcn': ors_version['current-earfcn'],
'bandwidth': float(slapparameter_dict.bandwidth.removesuffix(' MHz')),
}
%}
{%- do cell.update({
'cell_kind': 'ue',
'rf_mode': slapparameter_dict.rf_mode,
'ru': { 'ru_type': 'ru_ref',
'ru_ref': iref('RU') }
})
%}
{%- do ishared_list.append({
'slave_title': iref('CELL'),
'slave_reference': False,
'_': cell | tojson
})
%}
# code of generic ue
{% include 'instance-ue-base.jinja2.cfg' %}
# let all templates know we are running in ORS mode
[config-base]
context -=
json ors false
context +=
key ors :ors
raw ue_ifup {{ ue_ifup }}
ors = {{ dumps(ors_version) }}
# add ORS-specific bits to published information
[publish-connection-information]
ors-version = {{ ors_version['ors-version'] }}
frequency-range-rating = {{ ors_version['range'] }}
current-tx-power-estimate = {{ ors_version['power-estimate'] }}
current-tx-gain = {{ ors_version['current-tx-gain'] }}
current-rx-gain = {{ ors_version['current-rx-gain'] }}
current-earfcn = {{ ors_version['current-earfcn'] }}
......@@ -10,7 +10,7 @@ enb-epc = $${:obsolete}
gnb-epc = $${:obsolete}
epc = $${:obsolete}
mme = $${:obsolete}
ue =
ue = dynamic-template-ors-ue:output
[dynamic-template-obsolete]
< = jinja2-template-base
......@@ -33,6 +33,17 @@ extra-context +=
import-list +=
rawfile instance-enb-base.jinja2.cfg ${template-enb:target}
[dynamic-template-ors-ue]
< = dynamic-template-ue
url = ${template-ors-ue:target}
filename = instance-ue.cfg
extra-context +=
section ors ors-version
section ors_version ors-version
raw ue_ifup ${ue-ifup:output}
import-list +=
rawfile instance-ue-base.jinja2.cfg ${template-ue:target}
[ors-version]
recipe = slapos.recipe.build
configuration = $${slap-configuration:configuration}
......
......@@ -66,11 +66,19 @@ inline =
#!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true;
sudo -n /opt/amarisoft/init-sdr;
sudo -n /opt/amarisoft/init-ue;
stat ${:ue-log}/.ue-start-timestamp && mv ${:ue-log}/ue.log ${:ue-log}/ue-$(cat ${:ue-log}/.ue-start-timestamp).log
date +"%Y-%m-%d-%T" > ${:ue-log}/.ue-start-timestamp
(echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting UE software..." && echo) >> ${:ue-log};
tail -c 1M ${:ue-log} > ${:ue-log}.tmp;
mv ${:ue-log}.tmp ${:ue-log};
{%- if ors %}
echo "power_on" | sudo -n {{ ue }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log};
{%- else %}
{{ ue }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log};
{% endif %}
{%- endif %}
{%- endif %}
### User Equipment (UE)
[lte-ue-service]
......
......@@ -60,6 +60,43 @@
"description": "Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string",
"default": ""
},
"enable_multicast": {
"default": false,
"title": "Enable IPv4 multicast",
"description": "Set to true to enable IPv4 multicast",
"type": "boolean"
},
"enable_ipv6_multicast": {
"default": false,
"title": "Enable IPv6 multicast",
"description": "Set to true to enable IPv6 multicast",
"type": "boolean"
},
"enable_broadcast": {
"default": false,
"title": "Enable IPv4 broadcast",
"description": "Set to true to enable IPv4 broadcast",
"type": "boolean"
},
"route_list": {
"title": "Route list",
"patternProperties": {
".*": {
"properties": {
"ipv6_remote_addr_prefix": {
"title": "IPv6 remote address prefix",
"type": "string"
},
"prefix_len": {
"title": "Prefix length",
"type": "number"
}
},
"type": "object"
}
},
"type": "object"
}
}
}
......@@ -422,8 +422,11 @@
{%- for ishared in qshared_instance_list %}
{%- set ref = J(jref_of_shared(ishared)) %}
{%- set _ = ishared['_'] %}
{%- if 'ue_type' in _ %}
{%- if 'ue_type' in _ or (ors and 'imsi' in _) %}
{%- set iue = ishared %}
{%- if ors %}
{%- do _.update({'ue_type': 'lte'}) %}
{%- endif %}
{%- for k, v in defaults['ue'].items() %}
{%- do _.setdefault(k, v) %}
{%- endfor %}
......
......@@ -22,3 +22,15 @@ output = ${buildout:directory}/template.cfg
[template-ors-enb]
<= download-base
[template-ors-ue]
<= download-base
[ue-ifup]
<= download-base
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:_update_hash_filename_}
output= ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
context =
section bash bash
......@@ -19,13 +19,30 @@
"response": "instance-ors-gnb-schema.json",
"index": 2
},
"ue": {
"title": "UE",
"software-type": "ue",
"description": "User Equipment Configuration",
"request": "instance-ors-ue-input-schema.json",
"response": "instance-ors-ue-schema.json",
"index": 3
},
"ue-slave": {
"title": "UE Sim Card",
"software-type": "ue",
"description": "User Equipment Sim Card Configuration",
"request": "sim/input-schema.json",
"response": "sim/schema.json",
"shared": true,
"index": 4
},
"core-network": {
"title": "Core Network",
"software-type": "core-network",
"description": "Core Network Configuration",
"request": "instance-core-network-input-schema.json",
"response": "instance-core-network-schema.json",
"index": 3
"index": 5
},
"core-network-slave": {
"title": "Core Network Sim Card",
......@@ -34,7 +51,7 @@
"request": "sim/input-schema.json",
"response": "sim/schema.json",
"shared": true,
"index": 4
"index": 6
}
}
}
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