SD-Core NMS K8s

  • Canonical Telco
Channel Revision Published Runs on
latest/beta 9 03 Jan 2024
Ubuntu 22.04
latest/edge 14 21 Jan 2024
Ubuntu 22.04
1.5/stable 811 20 Dec 2024
Ubuntu 24.04
1.5/candidate 811 20 Dec 2024
Ubuntu 24.04
1.5/beta 811 20 Dec 2024
Ubuntu 24.04
1.5/edge 811 18 Dec 2024
Ubuntu 24.04 Ubuntu 22.04
1.5/edge 721 21 Nov 2024
Ubuntu 24.04 Ubuntu 22.04
1.6/edge 813 Today
Ubuntu 24.04
1.4/beta 163 01 May 2024
Ubuntu 22.04
1.4/edge 684 29 Oct 2024
Ubuntu 22.04
1.3/beta 9 22 Jan 2024
Ubuntu 22.04
1.3/edge 75 12 Apr 2024
Ubuntu 22.04
0.2/edge 108 23 Apr 2024
Ubuntu 22.04
juju deploy sdcore-nms-k8s --channel 1.5/stable
Show information

Platform:

charms.sdcore_nms_k8s.v0.fiveg_core_gnb

Library for the fiveg_core_gnb relation.

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

The purpose of this library is to provide a way for a 5G Core to provide network information and configuration to CUs/gNodeBs.

To get started using the library, you need to fetch the library using charmcraft.

cd some-charm
charmcraft fetch-lib charms.sdcore_nms_k8s.v0.fiveg_core_gnb

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

  • pydantic
  • pytest-interface-tester

Charms providing the fiveg_core_gnb relation should use FivegCoreGnbProvides. The class PLMNConfig represents the configuration of a PLMN for the CU/gNodeB. It is composed by the Mobile Country Code (MCC), the Mobile Network Code (MNC), the Slice Service Type (SST) and the Slice Differentiator (SD). Each CU can be configured with a single Tracking Area Code (TAC) and multiple PLMNs.

Typical usage of this class would look something like:

```python
...
from charms.sdcore_gnbsim_k8s.v0.fiveg_core_gnb import FivegCoreGnbProvides, PLMNConfig
...

class SomeProviderCharm(CharmBase):

    def __init__(self, *args):
        ...
        self.fiveg_core_gnb_provider = FivegCoreGnbProvides(
            charm=self,
            relation_name="fiveg_core_gnb"
            )
        ...
        self.framework.observe(
            self.on.config_changed_event,
            self._on_config_changed_event
        )

    def _on_config_changed_event(self, event):
        ...
        # implement the logic to populate the list of PLMNs.
        plmns = [PLMNConfig(mcc=..., mnc=..., sst=..., sd=...)
        self.fiveg_core_gnb_provider.publish_gnb_config_information(
            relation_id=event.relation_id,
            tac=tac,
            plmns=plmns,
        )
```

And a corresponding section in charm's `charmcraft.yaml`:
```
provides:
    fiveg_core_gnb:  # Relation name
        interface: fiveg_core_gnb  # Relation interface
```

Charms that require the fiveg_core_gnb relation should use FivegCoreGnbRequires. Typical usage of this class would look something like:

```python
...
from charms.sdcore_nms_k8s.v0.fiveg_core_gnb import FivegCoreGnbRequires
...

class SomeRequirerCharm(CharmBase):

    GNB_NAME = "gnb001"

    def __init__(self, *args):
        ...
        self.fiveg_core_gnb = FivegCoreGnbRequires(
            charm=self,
            relation_name="fiveg_core_gnb"
        )
        ...
        # on relation-joined the charm shall publish the CU/gNodeB name to the databag
        self.framework.observe(
            self.on.fiveg_core_gnb_relation_joined, self._on_fiveg_core_gnb_relation_joined
        )
        self.framework.observe(self.on.fiveg_core_gnb_relation_changed,
            self._on_fiveg_core_gnb_relation_changed)

    def _on_fiveg_core_gnb_relation_joined(self, event: RelationJoinedEvent):
        self.fiveg_core_gnb.publish_gnb_information(
            gnb_name=self.GNB_NAME,
        )

    def _on_fiveg_core_gnb_relation_changed(self, event: RelationChangedEvent):
        tac = self.fiveg_core_gnb.tac,
        plmns = self.fiveg_core_gnb.plmns,
        # Do something with the TAC and PLMNs.
```

And a corresponding section in charm's `charmcraft.yaml`:
```
requires:
    fiveg_core_gnb:  # Relation name
        interface: fiveg_core_gnb  # Relation interface
```

class PLMNConfig

Description

Dataclass representing the configuration for a PLMN. None

Methods

PLMNConfig. __init__( self , mcc: str , mnc: str , sst: int , sd )

PLMNConfig. asdict( self )

Description

Convert the dataclass into a dictionary. None

class FivegCoreGnbProviderAppData

Description

Provider application data for fiveg_core_gnb. None

class ProviderSchema

Description

Provider schema for fiveg_core_gnb. None

def data_matches_provider_schema(data: dict)

Return whether data matches provider schema.

Arguments

data (dict)

Data to be validated.

Returns

True if data matches provider schema, False otherwise.

class FivegCoreGnbProvides

Description

Class to be instantiated by provider of the fiveg_core_gnb. None

Methods

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

Create a new instance of the FivegCoreGnbProvides class.

Arguments

charm

Juju charm

relation_name (str)

Relation name

FivegCoreGnbProvides. publish_gnb_config_information( self , relation_id: int , tac: int , plmns )

Set TAC and PLMNs in the relation data.

Arguments

relation_id (int)

Relation ID.

tac (int)

Tracking Area Code.

plmns (list[PLMNConfig])

Configured PLMNs.

FivegCoreGnbProvides. get_gnb_name( self , relation_id: int )

Return the name of the CU/gNodeB for the given relation.

Arguments

relation_id (int)

Relation ID.

Returns

str

gNodeB name.

class FivegCoreGnbRequirerAppData

Description

Requirer application data for fiveg_core_gnb. None

class RequirerSchema

Description

Requirer schema for fiveg_core_gnb. None

def data_matches_requirer_schema(data: dict)

Return whether data matches requirer schema.

Arguments

data (dict)

Data to be validated.

Returns

True if data matches requirer schema, False otherwise.

class FivegCoreGnbRequires

Description

Class to be instantiated by requirer of the fiveg_core_gnb. None

Methods

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

Create a new instance of the FivegCoreGnbRequires class.

Arguments

charm

Juju charm

relation_name (str)

Relation name

FivegCoreGnbRequires. publish_gnb_information( self , gnb_name: str )

Set CU/gNB identifier in the relation data.

Arguments

gnb_name (str)

CU/gNB unique identifier.

FivegCoreGnbRequires. tac( self )

Return the configured TAC for the CU/gNodeB.

Returns

int

TAC.

FivegCoreGnbRequires. plmns( self )

Return the configured PLMNs for the CU/gNodeB.

Returns

list

PLMNs.