oai-ran-du-k8s

Oai Ran Du K8S

  • Canonical Telco
Channel Revision Published Runs on
latest/edge 1 06 Aug 2024
Ubuntu 22.04
2.2/edge 89 06 Apr 2025
Ubuntu 24.04
2.1/edge 63 19 Jan 2025
Ubuntu 22.04
juju deploy oai-ran-du-k8s --channel edge
Show information

Platform:

charms.oai_ran_du_k8s.v0.fiveg_rfsim

Library for the fiveg_rfsim relation.

This library contains the Requires and Provides classes for handling the fiveg_rfsim interface.

The purpose of this library is to relate two charms to pass the network configuration data required to start the RF simulation. In particular the RF SIM address, Network Slice Type (SST), Slice Differentiator (SD), RF band, downlink frequency, carrier bandwidth, numerology and the number of the first usable subcarrier will be passed through the interface. In the Telco world this will typically be charms implementing the DU (Distributed Unit) and the UE (User equipment).

Getting Started

From a charm directory, fetch the library using charmcraft:

charmcraft fetch-lib charms.oai_ran_du_k8s.v0.fiveg_rfsim

Add the following libraries to the charm's requirements.txt file:

  • pydantic
  • pytest-interface-tester
Provider charm

The provider charm is the one providing the information about RF SIM address, SST, SD, RF band, downlink frequency, carrier bandwidth, numerology and the number of the first usable subcarrier. Typically, this will be the DU charm.

Example:


from ops import main
from ops.charm import CharmBase, RelationChangedEvent

from charms.oai_ran_du_k8s.v0.fiveg_rfsim import RFSIMProvides


class DummyFivegRFSIMProviderCharm(CharmBase):

    RFSIM_ADDRESS = "192.168.70.130"
    SST = 1
    SD = 1
    BAND = 77
    DL_FREQ = 4059090000  # In Hz
    CARRIER_BANDWIDTH = 106  # In PRBs
    NUMEROLOGY = 1
    START_SUBCARRIER = 541

    def __init__(self, *args):
        super().__init__(*args)
        self.rfsim_provider = RFSIMProvides(self, "fiveg_rfsim")
        self.framework.observe(
            self.on.fiveg_rfsim_relation_changed, self._on_fiveg_rfsim_relation_changed
        )

    def _on_fiveg_rfsim_relation_changed(self, event: RelationChangedEvent):
        if self.unit.is_leader():
            self.rfsim_provider.set_rfsim_information(
                version=0,
                rfsim_address=self.RFSIM_ADDRESS,
                sst=self.SST,
                sd=self.SD,
                band=self.BAND,
                dl_freq=self.DL_FREQ,
                carrier_bandwidth=self.CARRIER_BANDWIDTH,
                numerology=self.NUMEROLOGY,
                start_subcarrier=self.START_SUBCARRIER
            )


if __name__ == "__main__":
    main(DummyFivegRFSIMProviderCharm)
Requirer charm

The requirer charm is the one requiring the RF simulator information. Typically, this will be the UE charm.

Example:


from ops import main
from ops.charm import CharmBase, RelationChangedEvent

from charms.oai_ran_du_k8s.v0.fiveg_rfsim import RFSIMRequires

logger = logging.getLogger(__name__)


class DummyFivegRFSIMRequires(CharmBase):

    def __init__(self, *args):
        super().__init__(*args)
        self.rfsim_requirer = RFSIMRequires(self, "fiveg_rfsim")
        self.framework.observe(
            self.on.fiveg_rfsim_relation_changed, self._on_fiveg_rfsim_relation_changed
        )

    def _on_fiveg_rfsim_relation_changed(self, event: RelationChangedEvent):
        provider_rfsim_address = event.rfsim_address
        provider_sst = event.sst
        provider_sd = event.sd
        provider_band = event.band
        provider_dl_freq = event.dl_freq
        provider_carrier_bandwidth = event.carrier_bandwidth
        provider_numerology = event.numerology
        provider_start_subcarrier = event.start_subcarrier
        <do something with the received data>


if __name__ == "__main__":
    main(DummyFivegRFSIMRequires)

class ProviderAppData

Description

Provider app data for fiveg_rfsim. None

class ProviderSchema

Description

Provider schema for the fiveg_rfsim interface. None

class RequirerAppData

Description

Requirer app data for fiveg_rfsim. None

class RequirerSchema

Description

Requirer schema for the fiveg_rfsim interface. None

def provider_data_is_valid(data)

Return whether the provider data is valid.

Arguments

data (dict)

Data to be validated.

Returns

True if data is valid, False otherwise.

def requirer_data_is_valid(data)

Return whether the requirer data is valid.

Arguments

data (dict)

Data to be validated.

Returns

True if data is valid, False otherwise.

class FivegRFSIMError

Description

Custom error class for the fiveg_rfsim library. None

Methods

FivegRFSIMError. __init__( self , message: str )

class RFSIMProvides

Description

Class to be instantiated by the charm providing relation using the fiveg_rfsim interface. None

Methods

RFSIMProvides. __init__( self , charm: CharmBase , relation_name: str )

Description

Init. None

RFSIMProvides. set_rfsim_information( self , rfsim_address: str , sst: int , sd , band: int , dl_freq: int , carrier_bandwidth: int , numerology: int , start_subcarrier: int )

Push the information about the RFSIM interface in the application relation data.

Arguments

rfsim_address (str)

rfsim service address which is equal to DU pod ip.

sst (int)

Slice/Service Type

sd (Optional[int])

Slice Differentiator

band (int)

Valid 5G band

dl_freq (int)

Downlink frequency in Hz

carrier_bandwidth (int)

Carrier bandwidth (number of downlink PRBs)

numerology (int)

Numerology

start_subcarrier (int)

First usable subcarrier

RFSIMProvides. interface_version( self )

class RFSIMRequires

Description

Class to be instantiated by the charm requiring relation using the fiveg_rfsim interface. None

Methods

RFSIMRequires. __init__( self , charm: CharmBase , relation_name: str )

Description

Init. None

RFSIMRequires. provider_interface_version( self )

Return interface version used by the provider.

Returns

Optional[int]

The fiveg_rfsim interface version used by the provider.

RFSIMRequires. rfsim_address( self )

Return address of the RFSIM.

Returns

Optional[IPvAnyAddress]

rfsim address which is equal to DU pod ip.

RFSIMRequires. sst( self )

Return the Network Slice Service Type (SST).

Returns

Optional[int]

sst (Network Slice Service Type)

RFSIMRequires. sd( self )

Return the Network Slice Differentiator (SD).

Returns

Optional[int] : sd (Network Slice Differentiator)

RFSIMRequires. band( self )

Return the RF Band number.

Returns

Optional[int] : band (RF Band number)

RFSIMRequires. dl_freq( self )

Return the Downlink frequency.

Returns

Optional[int] : dl_freq (Downlink frequency)

RFSIMRequires. carrier_bandwidth( self )

Return the carrier bandwidth (number of downlink PRBs).

Returns

Optional[int] : carrier_bandwidth (carrier bandwidth)

RFSIMRequires. numerology( self )

Return numerology.

Returns

Optional[int] : numerology

RFSIMRequires. start_subcarrier( self )

Return number of the first usable subcarrier.

Returns

Optional[int] : start_subcarrier

RFSIMRequires. get_provider_rfsim_information( self , relation )

Get relation data for the remote application.

Arguments

relation

Juju relation object (optional).

Returns

ProviderAppData

Relation data for the remote application if data is valid, None otherwise.

RFSIMRequires. set_rfsim_information( self )

Description

Push the information about the fiveg_rfsim interface version used by the Requirer. None