<xc:config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
         <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(ru.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(ru.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 -->
            <!-- TODO support multiple cells over 1 RU -->
{%- if cell.cell_type == 'lte'                                                %}
{%-   set dl_arfcn = cell.dl_earfcn                                           %}
{%-   set ul_arfcn = cell.ul_earfcn                                           %}
{%-   set dl_freq  = int(xearfcn_module.frequency(dl_arfcn) * 1e6)            %}
{%-   set ul_freq  = int(xearfcn_module.frequency(ul_arfcn) * 1e6)            %}
{%- elif cell.cell_type == 'nr'                                               %}
{%-   set dl_arfcn = cell.dl_nr_arfcn                                         %}
{%-   set ul_arfcn = cell.ul_nr_arfcn                                         %}
{%-   set dl_freq  = int(xnrarfcn_module.frequency(dl_arfcn) * 1e6)           %}
{%-   set ul_freq  = int(xnrarfcn_module.frequency(ul_arfcn) * 1e6)           %}
{%- else                                                                      %}
{%-   do bug('unreachable')                                                   %}
{%- endif                                                                     %}
{%- set bw = int(cell.bandwidth * 1e6)                                        %}
            <tx-array-carriers>
               <name>{{ TxCarrier }}</name>
               <absolute-frequency-center>{{ dl_arfcn }}</absolute-frequency-center>
               <center-of-channel-bandwidth>{{ dl_freq }}</center-of-channel-bandwidth>
               <channel-bandwidth>{{ bw }}</channel-bandwidth>
               <active>{{ ru.txrx_active }}</active>
               <rw-type>{{ cell.cell_type | upper }}</rw-type>
               <rw-duplex-scheme>{{ cell.rf_mode | upper }}</rw-duplex-scheme>
               <gain>{{ ru.tx_gain }}</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>{{ ul_arfcn }}</absolute-frequency-center>
               <center-of-channel-bandwidth>{{ ul_freq }}</center-of-channel-bandwidth>
               <channel-bandwidth>{{ bw }}</channel-bandwidth>
               <active>{{ ru.txrx_active }}</active>
               <downlink-radio-frame-offset>0</downlink-radio-frame-offset>
               <downlink-sfn-offset>0</downlink-sfn-offset>
               <!-- <gain>{{ ru.rx_gain }}</gain> -->
               <!-- TODO(lu.xu): clarify with Lopcomm regaring rx gain -->
               <gain-correction>0.0</gain-correction>
               <n-ta-offset>0</n-ta-offset>
            </rx-array-carriers>
         </user-plane-configuration>
</xc:config>
