---
title: Charmhub | Deploy SD-Core NMS K8s using Charmhub - The Open Operator Collection
description: Deploy the latest version of SD-Core NMS K8s as a Kubernetes Operator
  on any cloud.
url: https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb
---

# SD-Core NMS 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:

1.5/stable 819

```
juju deploy sdcore-nms-k8s --channel 1.5/stable
```

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

[Toggle side navigation](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#drawer)

## charms.sdcore\_nms\_k8s.v0.fiveg\_core\_gnb

* [*Docstrings*Docstrings](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb)
  [*Code*Source code](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.sdcore_nms_k8s.v0.fiveg_core_gnb
    ```

    [Download fiveg\_core\_gnb.py](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb/download)
  + *Last updated* 13 Apr 2025
  + *Revision* Library version 0.2

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

---

Index

* [class PLMNConfig](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#plmnconfig)
* + [def \_\_init\_\_(
    self,
    mcc,
    mnc,
    sst,
    sd)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#plmnconfig-__init__)
* + [def asdict(
    self)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#plmnconfig-asdict)
* [class FivegCoreGnbProviderAppData](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbproviderappdata)
* [class ProviderSchema](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#providerschema)
* [def data\_matches\_provider\_schema(
  data
  )](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#data_matches_provider_schema)
* [class FivegCoreGnbProvides](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbprovides)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbprovides-__init__)
* + [def publish\_gnb\_config\_information(
    self,
    relation\_id,
    tac,
    plmns)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbprovides-publish_gnb_config_information)
* + [def get\_gnb\_name(
    self,
    relation\_id)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbprovides-get_gnb_name)
* [class FivegCoreGnbRequirerAppData](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbrequirerappdata)
* [class RequirerSchema](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#requirerschema)
* [def data\_matches\_requirer\_schema(
  data
  )](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#data_matches_requirer_schema)
* [class FivegCoreGnbRequires](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbrequires)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbrequires-__init__)
* + [def publish\_gnb\_information(
    self,
    gnb\_name)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbrequires-publish_gnb_information)
* + [def tac(
    self)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbrequires-tac)
* + [def plmns(
    self)](https://charmhub.io/sdcore-nms-k8s/libraries/fiveg_core_gnb#fivegcoregnbrequires-plmns)

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