sdcore-gnbsim

SD-Core 5G GNBSIM

Channel Revision Published Runs on
latest/edge 44 03 Dec 2023
Ubuntu 22.04
juju deploy sdcore-gnbsim --channel edge
Show information

Platform:

charms.sdcore_gnbsim.v0.fiveg_gnb_identity

Library for the fiveg_gnb_identity relation.

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

The purpose of this library is to provide a way for gNodeB's to share their identity with the charms which require this information.

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

cd some-charm
charmcraft fetch-lib charms.sdcore_gnbsim.v0.fiveg_gnb_identity

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

  • pydantic
  • pytest-interface-tester

Charms providing the fiveg_gnb_identity relation should use GnbIdentityProvides. Typical usage of this class would look something like:

```python
...
from charms.sdcore_gnbsim.v0.fiveg_gnb_identity import GnbIdentityProvides
...

class SomeProviderCharm(CharmBase):

    def __init__(self, *args):
        ...
        self.gnb_identity_provider = GnbIdentityProvides(charm=self, relation_name="fiveg_gnb_identity")
        ...
        self.framework.observe(self.gnb_identity_provider.on.fiveg_gnb_identity_request, self._on_fiveg_gnb_identity_request)

    def _on_fiveg_gnb_identity_request(self, event):
        ...
        self.gnb_identity_provider.publish_gnb_identity_information(
            relation_id=event.relation_id,
            gnb_name=name,
            tac=tac,
        )
```

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

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

```python
...
from charms.sdcore_gnbsim.v0.fiveg_gnb_identity import GnbIdentityRequires
...

class SomeRequirerCharm(CharmBase):

    def __init__(self, *args):
        ...
        self.fiveg_gnb_identity = GnbIdentityRequires(charm=self, relation_name="fiveg_gnb_identity")
        ...
        self.framework.observe(self.fiveg_gnb_identity.on.fiveg_gnb_identity_available, 
            self._on_fiveg_gnb_identity_available)

    def _on_fiveg_gnb_identity_available(self, event):
        gnb_name = event.gnb_name,
        tac = event.tac,
        # Do something with the gNB's name and TAC.
```

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

class FivegGnbIdentityProviderAppData

Description

Provider app data for fiveg_gnb_identity. None

class ProviderSchema

Description

Provider schema for fiveg_gnb_identity. None

def data_matches_provider_schema(data: dict)

Returns whether data matches provider schema.

Arguments

data (dict)

Data to be validated.

Returns

True if data matches provider schema, False otherwise.

class FivegGnbIdentityRequestEvent

Description

Dataclass for the fiveg_gnb_identity request event. None

Methods

FivegGnbIdentityRequestEvent. __init__( self , handle: Handle , relation_id: int )

Sets relation id.

Arguments

handle (Handle)

Juju framework handle.

relation_id

ID of the relation.

FivegGnbIdentityRequestEvent. snapshot( self )

Returns event data.

Returns

(dict)

contains the relation ID.

FivegGnbIdentityRequestEvent. restore( self , snapshot: dict )

Restores event data.

Arguments

snapshot (dict)

contains the relation ID.

class GnbIdentityProviderCharmEvents

Description

Custom events for the GnbIdentityProvider. None

class GnbIdentityProvides

Description

Class to be instantiated by provider of the fiveg_gnb_identity. None

Methods

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

Observes relation joined event.

Arguments

charm

Juju charm

relation_name (str)

Relation name

GnbIdentityProvides. publish_gnb_identity_information( self , relation_id: int , gnb_name: str , tac: int )

Sets gNodeB's name and TAC in the relation data.

Arguments

relation_id (str)

Relation ID

gnb_name (str)

name of the gNodeB.

tac (int)

Tracking Area Code.

class GnbIdentityAvailableEvent

Description

Dataclass for the fiveg_gnb_identity available event. None

Methods

GnbIdentityAvailableEvent. __init__( self , handle: Handle , gnb_name: str , tac: str )

Description

Sets gNodeB's name and TAC. None

GnbIdentityAvailableEvent. snapshot( self )

Description

Returns event data. None

GnbIdentityAvailableEvent. restore( self , snapshot: dict )

Restores event data.

Arguments

snapshot (dict)

contains information to be restored.

class GnbIdentityRequirerCharmEvents

Description

Custom events for the GnbIdentityRequirer. None

class GnbIdentityRequires

Description

Class to be instantiated by requirer of the fiveg_gnb_identity. None

Methods

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

Observes relation joined and relation changed events.

Arguments

charm

Juju charm

relation_name (str)

Relation name