---
title: Charmhub | Deploy Oai Ran Du K8S using Charmhub - The Open Operator Collection
description: Deploy the latest version of Oai Ran Du K8S as a Kubernetes Operator
  on any cloud.
url: https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim
---

# Oai Ran Du K8S

[Canonical Telco](https://charmhub.io/publisher/telco-charmers "View all packages from Canonical Telco")

* [Canonical Telco](https://charmhub.io/publisher/telco-charmers "View all packages from Canonical Telco")

Platform:

edge 1

```
juju deploy oai-ran-du-k8s --channel edge
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#drawer)

## charms.oai\_ran\_du\_k8s.v0.fiveg\_rfsim

* [*Docstrings*Docstrings](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim)
  [*Code*Source code](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.oai_ran_du_k8s.v0.fiveg_rfsim
    ```

    [Download fiveg\_rfsim.py](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim/download)
  + *Last updated* 01 Apr 2025
  + *Revision* Library version 0.2

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)
```

---

Index

* [class ProviderAppData](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#providerappdata)
* [class ProviderSchema](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#providerschema)
* [class RequirerAppData](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#requirerappdata)
* [class RequirerSchema](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#requirerschema)
* [def provider\_data\_is\_valid(
  data
  )](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#provider_data_is_valid)
* [def requirer\_data\_is\_valid(
  data
  )](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#requirer_data_is_valid)
* [class FivegRFSIMError](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#fivegrfsimerror)
* + [def \_\_init\_\_(
    self,
    message)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#fivegrfsimerror-__init__)
* [class RFSIMProvides](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimprovides)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimprovides-__init__)
* + [def set\_rfsim\_information(
    self,
    rfsim\_address,
    sst,
    sd,
    band,
    dl\_freq,
    carrier\_bandwidth,
    numerology,
    start\_subcarrier)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimprovides-set_rfsim_information)
* + [def interface\_version(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimprovides-interface_version)
* [class RFSIMRequires](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-__init__)
* + [def provider\_interface\_version(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-provider_interface_version)
* + [def rfsim\_address(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-rfsim_address)
* + [def sst(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-sst)
* + [def sd(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-sd)
* + [def band(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-band)
* + [def dl\_freq(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-dl_freq)
* + [def carrier\_bandwidth(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-carrier_bandwidth)
* + [def numerology(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-numerology)
* + [def start\_subcarrier(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-start_subcarrier)
* + [def get\_provider\_rfsim\_information(
    self,
    relation)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-get_provider_rfsim_information)
* + [def set\_rfsim\_information(
    self)](https://charmhub.io/oai-ran-du-k8s/libraries/fiveg_rfsim#rfsimrequires-set_rfsim_information)

#### 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
