<xc:config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
{%- set n_antenna_dl = slapparameter_dict.get('n_antenna_dl', int(slap_configuration['configuration.default_n_antenna_dl'])) %}
{%- set n_antenna_ul = slapparameter_dict.get('n_antenna_ul', int(slap_configuration['configuration.default_n_antenna_ul'])) %}
         <user-plane-configuration xc:operation="replace" xmlns="urn:o-ran:uplane-conf-option8:1.0">
            <!-- TX path: eaxcid → TxEndpoint
                                             ↘
                                               mod  → static TxEndpoint → TxArray
                                             ↗
                                   TxCarrier

                 (static TxEndpoint, TxArray and their association are defined by RU itself)
            -->
{%- set TxCarrier = 'TXA0CC00'  %}
{%- for ant in range(n_antenna_dl)  %}
{%-   set port = ant // 2  %}
{%-   set chan = ant %  2  %}
{%-   set txep = 'TXA0P%02dC%02d' % (port, chan)  %}

            <!-- TxAntenna{{ ant }} -->
            <tx-endpoints>
               <name>{{ txep }}</name>
               <e-axcid>
                  <o-du-port-bitmask>61440</o-du-port-bitmask>
                  <band-sector-bitmask>3968</band-sector-bitmask>
                  <ccid-bitmask>112</ccid-bitmask>
                  <ru-port-bitmask>15</ru-port-bitmask>
                  <eaxc-id>{{ ant }}</eaxc-id>
               </e-axcid>
            </tx-endpoints>
            <tx-links>
              <name>{{ txep }}</name>
               <processing-element>PE0</processing-element>
               <tx-array-carrier>{{ TxCarrier }}</tx-array-carrier>
               <tx-endpoint>{{ txep }}</tx-endpoint>
            </tx-links>
{%- endfor %}


            <!--
                  RX path: eaxcid ← RxEndpoint
                                  (data ∪ prach)
                                             ↖
                                               demod  ← static RxEndpoint ← RxArray
                                             ↗
                                   RxCarrier

                 (static RxEndpoint, RxArray and their association are defined by RU itself)
            -->
{%- set RxCarrier = 'RXA0CC00'  %}
{%- for ant in range(n_antenna_ul)  %}
{%-   set port = ant // 2  %}
{%-   set chan = ant %  2  %}
{%-   set rxep    = 'RXA0P%02dC%02d'   % (port, chan)  %}
{%-   set prachep = 'PRACH0P%02dC%02d' % (port, chan)  %}

            <!-- RxAntenna{{ ant }} -->
            <rx-endpoints>
               <name>{{ rxep }}</name>
               <e-axcid>
                  <o-du-port-bitmask>61440</o-du-port-bitmask>
                  <band-sector-bitmask>3968</band-sector-bitmask>
                  <ccid-bitmask>112</ccid-bitmask>
                  <ru-port-bitmask>15</ru-port-bitmask>
                  <eaxc-id>{{ ant }}</eaxc-id>
               </e-axcid>
            </rx-endpoints>
            <rx-endpoints>
               <name>{{ prachep }}</name>
               <e-axcid>
                  <o-du-port-bitmask>61440</o-du-port-bitmask>
                  <band-sector-bitmask>3968</band-sector-bitmask>
                  <ccid-bitmask>112</ccid-bitmask>
                  <ru-port-bitmask>15</ru-port-bitmask>
                  <eaxc-id>{{ 16*chan + 8 + port }}</eaxc-id>
               </e-axcid>
            </rx-endpoints>
            <rx-links>
               <name>{{ rxep }}</name>
               <processing-element>PE0</processing-element>
               <rx-array-carrier>{{ RxCarrier }}</rx-array-carrier>
               <rx-endpoint>{{ rxep }}</rx-endpoint>
            </rx-links>
            <rx-links>
               <name>{{ prachep }}</name>
               <processing-element>PE0</processing-element>
               <rx-array-carrier>{{ RxCarrier }}</rx-array-carrier>
               <rx-endpoint>{{ prachep }}</rx-endpoint>
            </rx-links>
{%- endfor %}


            <!-- TX/RX carriers -->
            <tx-array-carriers>
               <name>{{ TxCarrier }}</name>
	           <absolute-frequency-center>{{ slapparameter_dict.get('dl_earfcn', 300) }}</absolute-frequency-center>
               <center-of-channel-bandwidth>{{ 1000000*slapparameter_dict.get('txa0cc00_center_frequency', 2140) }}</center-of-channel-bandwidth>
               <channel-bandwidth>{{ {'1.4 MHz': 1400000, '3 MHz': 3000000, '5 MHz': 5000000, '10 MHz': 10000000, '15 MHz': 15000000, '20 MHz': 20000000}.get(slapparameter_dict.get('bandwidth'), '20 MHz') }}</channel-bandwidth>	
               <active>{{ slapparameter_dict.get('txa0cc00_active', 'INACTIVE') }}</active>
               <rw-type>LTE</rw-type>
               <rw-duplex-scheme>FDD</rw-duplex-scheme>
               <gain>{{ slapparameter_dict.get('txa0cc00_gain', '-20') }}</gain>
               <downlink-radio-frame-offset>0</downlink-radio-frame-offset>
               <downlink-sfn-offset>0</downlink-sfn-offset>
            </tx-array-carriers>
            <rx-array-carriers>
               <name>{{ RxCarrier }}</name>
               <absolute-frequency-center>{{ slapparameter_dict.get('rxa0cc00_center_frequency_earfcn', 18300) }}</absolute-frequency-center>	
               <center-of-channel-bandwidth>{{ 1000000*slapparameter_dict.get('rxa0cc00_center_frequency', 1950) }}</center-of-channel-bandwidth>	
               <channel-bandwidth>{{ {'1.4 MHz': 1400000, '3 MHz': 3000000, '5 MHz': 5000000, '10 MHz': 10000000, '15 MHz': 15000000, '20 MHz': 20000000}.get(slapparameter_dict.get('bandwidth'), '20 MHz') }}</channel-bandwidth>	
               <active>{{ slapparameter_dict.get('rxa0cc00_active', 'INACTIVE') }}</active>
               <downlink-radio-frame-offset>0</downlink-radio-frame-offset>
               <downlink-sfn-offset>0</downlink-sfn-offset>
               <gain-correction>0.0</gain-correction>
               <n-ta-offset>0</n-ta-offset>
            </rx-array-carriers>
         </user-plane-configuration>
</xc:config>
