[buildout]
parts =
  directory
  lte-gnb-request
  lte-epc-request
  publish-connection-information

extends = {{ monitor_template }}

eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
computer = {{ slap_connection['computer-id'] }}
partition = {{ slap_connection['partition-id'] }}
url = {{ slap_connection['server-url'] }}
key = {{ slap_connection['key-file'] }}
cert = {{ slap_connection['cert-file'] }}

[directory]
recipe = slapos.cookbook:mkdirectory
software = {{ buildout_directory }}
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
etc = ${:home}/etc
bin = ${:home}/bin
run = ${:var}/run
script = ${:etc}/run
service = ${:etc}/service
promise = ${:etc}/promise
log = ${:var}/log

[request-common-base]
recipe = slapos.cookbook:request
software-url = {{ slap_connection['software-release-url'] }}
server-url = {{ slap_connection['server-url'] }}
computer-id = {{ slap_connection['computer-id'] }}
partition-id = {{ slap_connection['partition-id'] }}
key-file = {{ slap_connection['key-file'] }}
cert-file = {{ slap_connection['cert-file'] }}

sla-computer_guid = {{ slap_connection['computer-id'] }}

config-monitor-password = ${monitor-htpasswd:passwd}
return = monitor-base-url

[lte-epc-request]
<= request-common-base
name = EPC
software-type = epc
config-name = epc
{% if slapparameter_dict.get("mme_config_link", None) %}
config-mme_config_link = {{ dumps(slapparameter_dict["mme_config_link"]) }}
{% endif %}
{% if slapparameter_dict.get("mme_config_version", None) %}
config-mme_config_version = {{ dumps(slapparameter_dict["mme_config_version"]) }}
{% endif %}

[lte-gnb-request]
<= request-common-base
name = gNB
software-type = gnb
config-name = gnb
{% if slapparameter_dict.get("tx_gain", None) %}
config-tx_gain = {{ dumps(slapparameter_dict["tx_gain"]) }}
{% endif %}
{% if slapparameter_dict.get("rx_gain", None) %}
config-rx_gain = {{ dumps(slapparameter_dict["rx_gain"]) }}
{% endif %}
{% if slapparameter_dict.get("dl_nr_arfcn", None) %}
config-dl_nr_arfcn = {{ dumps(slapparameter_dict["dl_nr_arfcn"]) }}
{% endif %}
{% if slapparameter_dict.get("nr_band", None) %}
config-nr_band = {{ dumps(slapparameter_dict["nr_band"]) }}
{% endif %}
{% if slapparameter_dict.get("nr_bandwidth", None) %}
config-nr_bandwidth = {{ dumps(slapparameter_dict["nr_bandwidth"]) }}
{% endif %}
{% if slapparameter_dict.get("amf_addr", None) %}
config-amf_addr = {{ dumps(slapparameter_dict["amf_addr"]) }}
{% endif %}
{% if slapparameter_dict.get("gnb_id", None) %}
config-gnb_id = {{ dumps(slapparameter_dict["gnb_id"]) }}
{% endif %}
{% if slapparameter_dict.get("gnb_config_link", None) %}
config-gnb_config_link = {{ dumps(slapparameter_dict["gnb_config_link"]) }}
{% endif %}
{% if slapparameter_dict.get("gnb_config_version", None) %}
config-gnb_config_version = {{ dumps(slapparameter_dict["gnb_config_version"]) }}
{% endif %}
{% if slapparameter_dict.get("ssb_pos_bitmap", None) %}
config-ssb_pos_bitmap = {{ dumps(slapparameter_dict["ssb_pos_bitmap"]) }}
{% endif %}

[monitor-base-url-dict]
lte-epc-request =  ${lte-epc-request:connection-monitor-base-url}
lte-gnb-request =  ${lte-gnb-request:connection-monitor-base-url}

[publish-connection-information]
recipe = slapos.cookbook:publish
<= monitor-publish
