Commit 31b636fe authored by Lu Xu's avatar Lu Xu 👀 Committed by Joanne Hugé

software/ors-amarisoft: add support for lopcomm RRH

parent 7175d973
......@@ -16,19 +16,23 @@
[template]
filename = instance.cfg
md5sum = ed72fb7c36b0bc046df177e4d6f3bf12
md5sum = 3feff73b667736dabb394e415077d226
[amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py
md5sum = 6e0a052bd0ca08cc0c7b4880d3deffcc
[lopcomm-rrh-stats.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-stats.jinja2.py
md5sum = 39e191080722ac13ebc56b1e6350eb8f
[template-lte-enb-epc]
_update_hash_filename_ = instance-enb-epc.jinja2.cfg
md5sum = 833667743c693b8d5f78a2527b275a9e
[template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = c4584b338d26f57d5c9384956be36677
md5sum = 6eba063433bb16942ed592be70eb959d
[template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg
......@@ -60,7 +64,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
md5sum = 1d0bbfa1cd22740db4f1034588c946eb
md5sum = 0b2a37e6902fd5ad3d6b37e11eebec69
[sib23.asn]
filename = config/sib23.asn
......
......@@ -6,6 +6,20 @@
log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,s1ap.level=debug,s1ap.max_size=1,x2ap.level=debug,x2ap.max_size=1,rrc.level=debug,rrc.max_size=1,phy.level=info,file.rotate=1G,file.path=/dev/null",
log_filename: "{{ directory['log'] }}/enb.log",
{% if slapparameter_dict.get('rrh', '') == "Lopcomm ORAN" %}
rf_driver: {
name: "sdr",
args: "dev0=/dev/sdr0@0",
cpri_mapping: "hw",
cpri_mult: 16,
cpri_rx_delay: 0,
cpri_tx_delay: 0,
ifname: "{{ slap_configuration.get('tap-name', '') }}",
cpri_debug: 2,
},
tx_gain: 0,
rx_gain: 0,
{% else %}
rf_driver: {
name: "sdr",
args: "dev0=/dev/sdr0",
......@@ -13,6 +27,7 @@
},
tx_gain: {{ slapparameter_dict.get('tx_gain', slap_configuration['configuration.default_lte_tx_gain']) }},
rx_gain: {{ slapparameter_dict.get('rx_gain', slap_configuration['configuration.default_lte_rx_gain']) }},
{% endif %}
com_addr: "127.0.1.2:9001",
mme_list: [
......@@ -76,10 +91,13 @@
cell_default: {
n_antenna_dl: N_ANTENNA_DL,
n_antenna_ul: N_ANTENNA_UL,
{% if slapparameter_dict.get('rrh', '') == "Lopcomm ORAN" %}
// uldl_config: 2,
// sp_config: 7,
{% else %}
uldl_config: 2,
sp_config: 7,
{% endif %}
n_rb_dl: N_RB_DL,
cyclic_prefix: "normal",
......@@ -134,7 +152,11 @@
pucch_dedicated: {
n1_pucch_sr_count: 11,
cqi_pucch_n_rb: 1,
{% if slapparameter_dict.get('rrh', '') == "Lopcomm ORAN" %}
// tdd_ack_nack_feedback_mode: "multiplexing",
{% else %}
tdd_ack_nack_feedback_mode: "multiplexing",
{% endif %}
},
pusch_dedicated: {
......
......@@ -23,6 +23,16 @@
"type": "boolean"
},
{%- endif %}
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -10,6 +10,10 @@ parts =
rx-saturated-promise
baseband-latency-promise
amarisoft-stats-log-promise
{% if slapparameter_dict.get('rrh', '') == "Lopcomm ORAN" %}
lopcomm-rrh-stats-service
vswr-promise
{% endif %}
{% if not slapparameter_dict.get("sub-instance", False) %}
cpu-temperature-promise
{% endif %}
......@@ -122,7 +126,22 @@ mode = 0775
url = {{ amarisoft_stats_template }}
output = ${directory:bin}/amarisoft-stats.py
### eNodeB (enb)
[lopcomm-rrh-stats-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-stats.log
json-log-output = ${directory:var}/log/lopcomm-rrh-stats.json.log
context =
section directory directory
key slapparameter_dict slap-configuration:configuration
key log_file :log-output
key json_log_file :json-log-output
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
mode = 0775
url = {{ lopcomm_rrh_stats_template }}
output = ${directory:bin}/lopcomm-rrh-stats.py
[amarisoft-stats-service]
recipe = slapos.cookbook:wrapper
command-line = ${amarisoft-stats-template:output}
......@@ -131,6 +150,14 @@ mode = 0775
hash-files =
${amarisoft-stats-template:output}
[lopcomm-rrh-stats-service]
recipe = slapos.cookbook:wrapper
command-line = ${lopcomm-rrh-stats-template:output}
wrapper-path = ${directory:service}/lopcomm-rrh-stats
mode = 0775
hash-files =
${lopcomm-rrh-stats-template:output}
[config-base]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
......@@ -208,6 +235,16 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
config-min-txrx-delay = {{ slapparameter_dict.get("min_txrx_delay", 5) }}
config-avg-txrx-delay = {{ slapparameter_dict.get("avg_txrx_delay", 7) }}
[vswr-promise]
recipe = slapos.cookbook:promise.plugin
eggs =
slapos.core
python-dateutil
file = {{ vswr_promise }}
output = ${directory:plugins}/check-vswr.py
config-testing = {{ slapparameter_dict.get("testing", False) }}
config-lopcomm-stats-log = ${lopcomm-rrh-stats-template:json-log-output}
[amarisoft-stats-log-promise]
recipe = slapos.cookbook:promise.plugin
eggs =
......
......@@ -21,6 +21,16 @@
"description": "Activate iperf3 UDP server",
"type": "boolean"
},
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -3,6 +3,16 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters",
"properties": {
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -21,6 +21,16 @@
"description": "Activate iperf3 UDP server",
"type": "boolean"
},
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -3,6 +3,16 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters",
"properties": {
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -21,6 +21,16 @@
"description": "Activate iperf3 UDP server",
"type": "boolean"
},
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -3,6 +3,16 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters",
"properties": {
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -21,6 +21,16 @@
"description": "Activate iperf3 UDP server",
"type": "boolean"
},
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -3,6 +3,16 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters",
"properties": {
"rrh": {
"title": "RRH",
"description": "RRH",
"type": "string",
"default": "SDR",
"enum": [
"SDR",
"Lopcomm ORAN"
]
},
"tx_gain": {
"title": "Tx gain",
"description": "Tx gain (in dB)",
......
......@@ -32,7 +32,7 @@ context =
recipe = slapos.recipe.build
init =
import os
lte_version = "2021-09-18"
lte_version = "2022-10-27"
path = "/opt/amarisoft/v" + lte_version
options['lte-version'] = lte_version
options['path'] = path
......@@ -110,12 +110,14 @@ extra-context =
raw sib23 ${sib23.asn:target}
raw ltelogs_template ${ltelogs.jinja2.sh:target}
raw amarisoft_stats_template ${amarisoft-stats.jinja2.py:target}
raw lopcomm_rrh_stats_template ${lopcomm-rrh-stats.jinja2.py:target}
raw sdr_busy_promise ${sdr-busy-promise:target}
raw cell_gain_saturated_promise ${cell-gain-saturated-promise:target}
raw rx_saturated_promise ${rx-saturated-promise:target}
raw baseband_latency_promise ${baseband-latency-promise:target}
raw amarisoft_stats_log_promise ${amarisoft-stats-log-promise:target}
raw cpu_temperature_promise ${cpu-temperature-promise:target}
raw vswr_promise ${vswr-promise:target}
raw openssl_location ${openssl:location}
raw default_dl_earfcn ${default-params:default-dl-earfcn}
raw default_lte_dl_freq ${default-params:default-lte-dl-freq}
......
#!{{ python_path }}
import json
import logging
import time
import xmltodict
from logging.handlers import RotatingFileHandler
from ncclient import manager
from ncclient.xml_ import *
from ncclient.devices.default import DefaultDeviceHandler
class LopcommNetconfClient:
def __init__(self):
log_file = "{{ log_file }}"
json_log_file = "{{ json_log_file }}"
self.logger = logging.getLogger('logger')
self.json_logger = logging.getLogger('json_logger')
self.logger.setLevel(logging.DEBUG)
self.json_logger.setLevel(logging.DEBUG)
json_handler = RotatingFileHandler(json_log_file, maxBytes=100000, backupCount=5)
json_formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}')
json_handler.setFormatter(json_formatter)
self.json_logger.addHandler(json_handler)
handler = RotatingFileHandler(log_file, maxBytes=100000, backupCount=5)
self.logger.addHandler(handler)
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(message)s")
handler.setFormatter(formatter)
if {{ testing }}:
return
def connect(self, host, port, user, password):
if {{ testing }}:
return
self.address = (host, port)
self.logger.info('Connecting to %s, user %s...' % (self.address, user))
self.conn = manager.connect(host=host,
port=port,
username=user,
password=password,
timeout=1800,
device_params={
'name': 'huawei'
},
hostkey_verify=False)
self.logger.info('Connection to %s successful' % (self.address,))
def subscribe(self):
# Filter not compatible between ncclient and netconf server
#result = self.conn.create_subscription(filter=('xpath', '/o-ran-fm:*'))
sub = self.conn.create_subscription()
self.logger.info('Subscription to %s successful' % (self.address,))
def get_notification(self):
result = None
while result == None:
self.logger.debug('Waiting for notification from %s...' % (self.address,))
result = self.conn.take_notification(block=True)
if result:
self.logger.debug('Got new notification from %s...' % (self.address,))
result_in_xml = result._raw
data_dict = xmltodict.parse(result_in_xml)
self.json_logger.info('', extra={'data': data_dict})
def close(self):
# Close not compatible between ncclient and netconf server
#self.conn.close()
pass
if __name__ == '__main__':
nc = LopcommNetconfClient()
while True:
try:
nc.connect("192.168.0.210", 830, "oranuser", "oranpassword")
nc.subscribe()
while True:
nc.get_notification()
except Exception as e:
nc.logger.debug('Got exception, waiting 10 seconds before reconnecting...')
nc.logger.debug(e)
time.sleep(10)
finally:
nc.close()
......@@ -40,6 +40,9 @@ url = ${:_profile_base_location_}/${:_update_hash_filename_}
[amarisoft-stats.jinja2.py]
<= download-base
[lopcomm-rrh-stats.jinja2.py]
<= download-base
[template-lte-enb-epc]
<= download-base
......@@ -78,6 +81,8 @@ url = ${:_profile_base_location_}/${:_update_hash_filename_}
<= download-base
[interface-up-promise]
<= download-base
[vswr-promise]
<= download-base
[copy-to-instance]
recipe = slapos.recipe.build:download
......@@ -115,11 +120,29 @@ filename = ue-lte.jinja2.cfg
<= copy-config-to-instance
filename = ue-nr.jinja2.cfg
[pynacl]
recipe = zc.recipe.egg:custom
egg = pynacl
setup-eggs =
cffi
[bcrypt]
recipe = zc.recipe.egg:custom
egg = bcrypt
setup-eggs =
cffi
[eggs]
recipe = zc.recipe.egg
eggs =
websocket-client
${pynacl:egg}
${bcrypt:egg}
xmltodict
ncclient
interpreter = pythonwitheggs
[versions]
websocket-client = 1.4.2
ncclient = 0.6.13
xmltodict = 0.13.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