SD-Core 5G UPF K8s

  • Canonical Telco
Channel Revision Published Runs on
latest/beta 13 03 Jan 2024
Ubuntu 22.04
latest/edge 21 21 Jan 2024
Ubuntu 22.04
1.4/beta 280 29 May 2024
Ubuntu 22.04
1.4/edge 659 29 Oct 2024
Ubuntu 22.04
1.5/edge 669 17 Nov 2024
Ubuntu 22.04
1.3/beta 13 22 Jan 2024
Ubuntu 22.04
1.3/edge 105 05 Apr 2024
Ubuntu 22.04
juju deploy sdcore-upf-k8s --channel 1.4/beta
Show information

Platform:

charms.sdcore_upf_k8s.v0.fiveg_n4

Library for the fiveg_n4 relation.

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

The purpose of this library is to integrate a charm claiming to be able to provide information required to establish communication over the N4 interface with a charm claiming to be able to consume this information.

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

cd some-charm
charmcraft fetch-lib charms.sdcore_upf_k8s.v0.fiveg_n4

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

  • pydantic
  • pytest-interface-tester

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

```python
...
from charms.sdcore_upf_k8s.v0.fiveg_n4 import N4Provides
...

class SomeProviderCharm(CharmBase):

    def __init__(self, *args):
        ...
        self.fiveg_n4 = N4Provides(charm=self, relation_name="fiveg_n4")
        ...
        self.framework.observe(self.fiveg_n4.on.fiveg_n4_request, self._on_fiveg_n4_request)

    def _on_fiveg_n4_request(self, event):
        ...
        self.fiveg_n4.publish_upf_n4_information(
            relation_id=event.relation_id,
            upf_hostname=hostname,
            upf_port=n4_port,
        )
```

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

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

```python
...
from charms.sdcore_upf_k8s.v0.fiveg_n4 import N4Requires
...

class SomeRequirerCharm(CharmBase):

    def __init__(self, *args):
        ...
        self.fiveg_n4 = N4Requires(charm=self, relation_name="fiveg_n4")
        ...
        self.framework.observe(self.upf.on.fiveg_n4_available, self._on_fiveg_n4_available)

    def _on_fiveg_n4_available(self, event):
        upf_hostname = event.upf_hostname,
        upf_port = event.upf_port,
        # Do something with the UPF's hostname and port
```

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

class FivegN4ProviderAppData

Description

Provider app data for fiveg_n4. None

class ProviderSchema

Description

Provider schema for fiveg_n4. 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 FiveGN4RequestEvent

Description

Dataclass for the fiveg_n4 request event. None

Methods

FiveGN4RequestEvent. __init__( self , handle , relation_id: int )

Description

Set relation id. None

FiveGN4RequestEvent. snapshot( self )

Description

Return event data. None

FiveGN4RequestEvent. restore( self , snapshot )

Description

Restore event data. None

class N4ProviderCharmEvents

Description

Custom events for the N4Provider. None

class N4Provides

Description

Class to be instantiated by provider of the fiveg_n4. None

Methods

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

Observe relation joined event.

Arguments

charm

Juju charm

relation_name (str)

Relation name

N4Provides. publish_upf_n4_information( self , relation_id: int , upf_hostname: str , upf_n4_port: int )

Set UPF's hostname and port in the relation data.

Arguments

relation_id (str)

Relation ID

upf_hostname (str)

UPF's hostname

upf_n4_port (int)

Port on which UPF accepts N4 communication

class N4AvailableEvent

Description

Dataclass for the fiveg_n4 available event. None

Methods

N4AvailableEvent. __init__( self , handle , upf_hostname: str , upf_port: int )

Description

Set UPF's hostname and port. None

N4AvailableEvent. snapshot( self )

Description

Return event data. None

N4AvailableEvent. restore( self , snapshot )

Description

Restores event data. None

class N4RequirerCharmEvents

Description

Custom events for the N4Requirer. None

class N4Requires

Description

Class to be instantiated by requirer of the fiveg_n4. None

Methods

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

Observe relation joined and relation changed events.

Arguments

charm

Juju charm

relation_name (str)

Relation name