SD-CORE 5G UPF

  • Canonical Telco
Channel Revision Published Runs on
latest/edge 68 07 Dec 2023
Ubuntu 22.04
1.4/edge 277 17 Nov 2024
Ubuntu 24.04 Ubuntu 22.04
1.4/edge 221 11 Jul 2024
Ubuntu 24.04 Ubuntu 22.04
1.3/edge 96 04 Apr 2024
Ubuntu 22.04
juju deploy sdcore-upf --channel edge
Show information

Platform:

charms.sdcore_upf.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.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.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.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)

Returns 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

Sets relation id. None

FiveGN4RequestEvent. snapshot( self )

Description

Returns event data. None

FiveGN4RequestEvent. restore( self , snapshot )

Description

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

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

Sets 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

Sets UPF's hostname and port. None

N4AvailableEvent. snapshot( self )

Description

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

Observes relation joined and relation changed events.

Arguments

charm

Juju charm

relation_name (str)

Relation name