Commit 0668293d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6807a950
......@@ -6,44 +6,35 @@
{# XXX macro return json -> start from j #}
{%- set J = json_module.loads %}
{# jref_of_shared returns original reference used to request shared instance.
it is extracted from slave_reference which is composed as <partition_id>_<reference>. #}
{%- macro jref_of_shared(slave) %}
{%- set ref = slave['slave_reference'] %}
{%- set partition_id %}{{partition_id}}{%- endset %}
{%- if ref.startswith(partition_id) %}
{%- set ref = ref[len(partition_id):] %}
{%- endif %}
{%- if ref.startswith('_') %}
{%- set ref = ref[1:] %}
{%- endif %}
{{ ref | tojson }}
{%- endmacro %}
{# XXX error(slave, msg) #}
{# cell_dict keeps cell slave instances: reference -> cell #}
{# ru_dict keeps RU slave instances: reference -> RU #}
{% set cell_dict = {} %}
{% set ru_dict = {} %}
{%- for slave in slave_instance_list %}
{%- set ref = J(jref_of_shared(slave)) %}
{%- set _ = J(slave['_']) %}
{%- if 'cell_type' in _ %}
{%- do cell_dict[ref] = slave %}
{%- elif 'ru_type' in _ %}
{% do ru_dict[ref] = slave %}
{% else %}
{% do error(slave, "unknown shared instance type") %}
{%- endif %}
{%- endfor %}
{# ru_dict keeps RU slave instances + RU instances embedded into cell definitions: reference -> RU #}
{% set cell_dict = {} %}
{% set ru_dict = {} %}
{%- for slave in slave_instance_list %}
{%- set ref = J(jref_of_shared(slave)) %}
{%- set _ = J(slave['_']) %}
{%- if 'ru_type' in _ %}
{% do ru_dict[ref] = slave %}
{%- elif 'cell_type' in _ %}
{%- do cell_dict[ref] = slave %}
{%- set ru = cell['ru'] %}
{%- if ru['ru_type'] not in ('ru_ref', 'ruincell_ref') %}
{# embedded ru definition -> expose it as `_<cell_ref>_ru` #}
{%- do ru_dict['_%s_ru' % ref] = ru %}
{%- endif %}
{% else %}
{% do error(slave, "unknown shared instance type") %}
{%- endif %}
{%- endfor %}
{# verify that there is no dangling ru_ref and ruincell_ref #} XXX + resolve those ru*_ref
{# jcell_ru_ref returns RU reference linked from a cell.
if the cell embeds RU definition, its reference comes as `_<cell_ref>_ru`. #}
# XXX cycle protection
{%- macro jcell_ru_ref(cell) %}
{{ _jcell_ru_ref(cell, []) | tojson }}
{%- endmacro %}
......@@ -68,6 +59,19 @@
{%- endif %}
{%- endmacro %}
{# jref_of_shared returns original reference used to request shared instance.
it is extracted from slave_reference which is composed as <partition_id>_<reference>. #}
{%- macro jref_of_shared(slave) %}
{%- set ref = slave['slave_reference'] %}
{%- set partition_id %}{{partition_id}}{%- endset %}
{%- if ref.startswith(partition_id) %}
{%- set ref = ref[len(partition_id):] %}
{%- endif %}
{%- if ref.startswith('_') %}
{%- set ref = ref[1:] %}
{%- endif %}
{{ ref | tojson }}
{%- endmacro %}
......@@ -190,9 +194,10 @@
cell_list: [
{%- for cell_ref, cell in cell_dict|dictsort %}
{%- if cell['cell_type'] == 'lte' %}
XXX set ru = cell.ru + dereference if needed
{%- set ru_ref = J(jcell_ru_ref(cell)) %}
{%- set ru = ru_dict[ru_ref] %}
{
rf_port: XXX get from ru,
rf_port: {{ ru['.rf_port'] }},
n_antenna_dl: {{ ru['n_antenna_dl' }},
n_antenna_ul: {{ ru['n_antenna_ul' }},
......
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