Commit 2df5327a authored by Kirill Smelkov's avatar Kirill Smelkov

X slave_reference cannot be relied when working wrt slapos master

Here is how share instance requested with partition_reference='RU1' looks on slapproxy:

    {'_': {'ru_type': 'lopcomm', 'ru_link_type': 'cpri', 'mac_addr': 'XXX', 'cpri_link': {'sdr_dev': 2, 'sfp_port': 0, 'mult': 8, 'mapping': 'standard', 'rx_delay': 10, 'tx_delay': 11, 'tx_dbm': 50}, 'n_antenna_dl': 2, 'n_antenna_ul': 1, 'tx_gain': -21, 'rx_gain': -22}, 'slap_software_type': 'enb', 'slave_reference': '_RU1', 'slave_title': '_RU1'}

    (note both slave_reference and slave_title relate to partition_reference used in request)

and here is how another shared instance requested the same way looks on slapos master:

    {'_': {'ru_type': 'lopcomm', 'ru_link_type': 'cpri', 'cpri_link': {'sdr_dev': 0, 'sfp_port': 1, 'mult': 4, 'mapping': 'hw', 'rx_delay': 25.11, 'tx_delay': 14.71, 'tx_dbm': 63}, 'n_antenna_dl': 1, 'n_antenna_ul': 1, 'tx_gain': -20, 'rx_gain': -20}, 'connection-parameter-hash': '4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945', 'slap_software_type': 'enb', 'slave_reference': 'SOFTINST-218663', 'slave_title': 'RU1', 'timestamp': 1697712836}

note that slave_reference is now unrelated and is some identifier slapos master picked up automatically.

The trace of the original reference is left only in slave_title.

Rafael confirmed, that for instances requested by user, that slave_title cannot
be duplicate for two different instances (because request with
partition_reference=X will adjust another instance previouslt requested with
same partition_reference=X instead of creating another one).

However for instances requested by partitions - it is possible to have two
sepearate shared instances requested with the same partition_reference=X and
having the same slave_title=X. Those instances will live in different instance
trees though.
parent 4f0f1bd2
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
{#- qshared_instance_list queues not yet loaded shared instances. {#- qshared_instance_list queues not yet loaded shared instances.
load_* routines process this queue and move loaded instances to i<type>_dict registries. #} load_* routines process this queue and move loaded instances to i<type>_dict registries. #}
{%- set qshared_instance_list = slap_configuration.get('slave-instance-list', []) %} {%- set qshared_instance_list = slap_configuration.get('slave-instance-list', []) %}
{#- XXX add protection wrt duplicate slave_title -- see jref_of_shared for details #}
{#- check_loaded_everything verifies that all shared instances were handling during the load. #} {#- check_loaded_everything verifies that all shared instances were handling during the load. #}
{%- macro check_loaded_everything() %} {%- macro check_loaded_everything() %}
...@@ -244,10 +245,15 @@ ...@@ -244,10 +245,15 @@
{%- endmacro %} {%- endmacro %}
{#- jref_of_shared returns original reference used to request shared instance. {#- jref_of_shared returns original reference used to request shared instance.
it is extracted from slave_reference which is composed as <partition_id>_<reference>. #}
slapproxy puts the reference into slave_reference and slave_title as <partition_id>_<reference>.
slapos master puts the reference into slave_title as-is and assigns to slave_reference SOFTINST-XXX.
-> we extract the reference from slave_title.
#}
{%- macro jref_of_shared(ishared) %} {%- macro jref_of_shared(ishared) %}
{#- do print('jref_of_shared %r' % (ishared,)) #} {#- do print('jref_of_shared %r' % (ishared,)) #}
{%- set ref = ishared['slave_reference'] %} {%- set ref = ishared['slave_title'] %}
{%- set partition_id = slap_configuration['slap-computer-partition-id'] %} {%- set partition_id = slap_configuration['slap-computer-partition-id'] %}
{%- if ref.startswith(partition_id) %} {%- if ref.startswith(partition_id) %}
{%- set ref = ref[len(partition_id):] %} {%- set ref = ref[len(partition_id):] %}
......
...@@ -54,10 +54,12 @@ class Instance: ...@@ -54,10 +54,12 @@ class Instance:
self.slap_software_type = slap_software_type self.slap_software_type = slap_software_type
# ishared appends new shared instance with specified configuration to .shared_instance_list . # ishared appends new shared instance with specified configuration to .shared_instance_list .
def ishared(self, title, slave_reference, cfg): def ishared(self, slave_reference, cfg):
ishared = { ishared = {
'slave_title': title, # see comments in jref_of_shared about where and how slapproxy and
'slave_reference': slave_reference, # slapos master put partition_reference of a shared instance.
'slave_title': '_%s' % slave_reference,
'slave_reference': 'SOFTINST-%03d' % (len(self.shared_instance_list)+1),
'slap_software_type': self.slap_software_type, 'slap_software_type': self.slap_software_type,
'_': json.dumps(cfg) '_': json.dumps(cfg)
} }
...@@ -80,7 +82,7 @@ def iRU1_SDR_tLTE2_tNR(ienb): ...@@ -80,7 +82,7 @@ def iRU1_SDR_tLTE2_tNR(ienb):
'rx_gain': 52, 'rx_gain': 52,
} }
ienb.ishared('Cell 1a', '_CELL1_a', { ienb.ishared('CELL1_a', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'tdd', 'rf_mode': 'tdd',
'bandwidth': '5 MHz', 'bandwidth': '5 MHz',
...@@ -90,7 +92,7 @@ def iRU1_SDR_tLTE2_tNR(ienb): ...@@ -90,7 +92,7 @@ def iRU1_SDR_tLTE2_tNR(ienb):
'ru': RU1, # RU definition embedded into CELL 'ru': RU1, # RU definition embedded into CELL
}) })
ienb.ishared('Cell 1b', '_CELL1_b', { ienb.ishared('CELL1_b', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'tdd', 'rf_mode': 'tdd',
'bandwidth': '5 MHz', 'bandwidth': '5 MHz',
...@@ -103,7 +105,7 @@ def iRU1_SDR_tLTE2_tNR(ienb): ...@@ -103,7 +105,7 @@ def iRU1_SDR_tLTE2_tNR(ienb):
} }
}) })
ienb.ishared('Cell 1c', '_CELL1_c', { ienb.ishared('CELL1_c', {
'cell_type': 'nr', 'cell_type': 'nr',
'rf_mode': 'tdd', 'rf_mode': 'tdd',
'bandwidth': 5, 'bandwidth': 5,
...@@ -146,10 +148,10 @@ def iRU2_LOPCOMM_fLTE_fNR(ienb): ...@@ -146,10 +148,10 @@ def iRU2_LOPCOMM_fLTE_fNR(ienb):
RU2_b['tx_gain'] += 10 RU2_b['tx_gain'] += 10
RU2_b['rx_gain'] += 10 RU2_b['rx_gain'] += 10
ienb.ishared('Radio Unit 2a', '_RU2_a', RU2_a) ienb.ishared('RU2_a', RU2_a)
ienb.ishared('Radio Unit 2b', '_RU2_b', RU2_b) ienb.ishared('RU2_b', RU2_b)
ienb.ishared('Cell 2a', '_CELL2_a', { ienb.ishared('CELL2_a', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': '5 MHz', 'bandwidth': '5 MHz',
...@@ -162,7 +164,7 @@ def iRU2_LOPCOMM_fLTE_fNR(ienb): ...@@ -162,7 +164,7 @@ def iRU2_LOPCOMM_fLTE_fNR(ienb):
} }
}) })
ienb.ishared('Cell 2b', '_CELL2_b', { ienb.ishared('CELL2_b', {
'cell_type': 'nr', 'cell_type': 'nr',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': 5, 'bandwidth': 5,
...@@ -191,7 +193,7 @@ def iRU3_SDR1_fLTE2(ienb): ...@@ -191,7 +193,7 @@ def iRU3_SDR1_fLTE2(ienb):
'rx_gain': 61, 'rx_gain': 61,
} }
ienb.ishared('Cell 3a', '_CELL3_a', { ienb.ishared('CELL3_a', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': '5 MHz', 'bandwidth': '5 MHz',
...@@ -201,7 +203,7 @@ def iRU3_SDR1_fLTE2(ienb): ...@@ -201,7 +203,7 @@ def iRU3_SDR1_fLTE2(ienb):
'ru': RU, 'ru': RU,
}) })
ienb.ishared('Cell 3b', '_CELL3_b', { ienb.ishared('CELL3_b', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': '5 MHz', 'bandwidth': '5 MHz',
...@@ -241,8 +243,8 @@ def iRU2_LOPCOMM_fLTE2(ienb): ...@@ -241,8 +243,8 @@ def iRU2_LOPCOMM_fLTE2(ienb):
RU_0004['cpri_link']['sfp_port'] = 1 RU_0004['cpri_link']['sfp_port'] = 1
if 1: if 1:
ienb.ishared('Radio Unit 2a', '_RU_0002', RU_0002) ienb.ishared('RU_0002', RU_0002)
ienb.ishared('Cell 2', '_CELL2', { ienb.ishared('CELL2', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': '20 MHz', 'bandwidth': '20 MHz',
...@@ -256,8 +258,8 @@ def iRU2_LOPCOMM_fLTE2(ienb): ...@@ -256,8 +258,8 @@ def iRU2_LOPCOMM_fLTE2(ienb):
}) })
if 1: if 1:
ienb.ishared('Radio Unit 2b', '_RU_0004', RU_0004) ienb.ishared('RU_0004', RU_0004)
ienb.ishared('Cell 4', '_CELL4', { ienb.ishared('CELL4', {
'cell_type': 'lte', 'cell_type': 'lte',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': '20 MHz', 'bandwidth': '20 MHz',
...@@ -303,7 +305,7 @@ def do_enb(): ...@@ -303,7 +305,7 @@ def do_enb():
def do_ue(): def do_ue():
iue = Instance('ue') iue = Instance('ue')
iue.ishared('Cell 1', '_UCELL1', { iue.ishared('UCELL1', {
'ue_cell_type': 'lte', 'ue_cell_type': 'lte',
'rf_mode': 'tdd', 'rf_mode': 'tdd',
'bandwidth': '5 MHz', 'bandwidth': '5 MHz',
...@@ -318,7 +320,7 @@ def do_ue(): ...@@ -318,7 +320,7 @@ def do_ue():
'rx_gain': 42, 'rx_gain': 42,
} }
}) })
iue.ishared('Cell 2b', '_UCELL2', { iue.ishared('UCELL2', {
'ue_cell_type': 'nr', 'ue_cell_type': 'nr',
'rf_mode': 'fdd', 'rf_mode': 'fdd',
'bandwidth': 5, 'bandwidth': 5,
...@@ -335,11 +337,11 @@ def do_ue(): ...@@ -335,11 +337,11 @@ def do_ue():
} }
}) })
iue.ishared('UE 1', '_UE1', { iue.ishared('UE1', {
'ue_type': 'lte', 'ue_type': 'lte',
'rue_addr': 'host1' 'rue_addr': 'host1'
}) })
iue.ishared('UE 2', '_UE2', { iue.ishared('UE2', {
'ue_type': 'nr', 'ue_type': 'nr',
'rue_addr': 'host2' 'rue_addr': 'host2'
}) })
......
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