Oai Ran Cu K8S
- Canonical Telco
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/edge | 1 | 05 Aug 2024 | |
2.1/edge | 36 | 10 Nov 2024 |
juju deploy oai-ran-cu-k8s --channel edge
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
charms.oai_ran_cu_k8s.v0.oai_ran_cu_k8s
-
- Last updated 09 Aug 2024
- Revision Library version 0.2
Library for the fiveg_f1
relation.
This library contains the Requires and Provides classes for handling the fiveg_f1
interface.
The purpose of this library is to relate two charms claiming to be able to communicate over the F1 interface. In the Telco world this will typically be charms implementing the CU (Central Unit) and the DU (Distributed Unit).
Getting Started
From a charm directory, fetch the library using charmcraft
:
charmcraft fetch-lib charms.oai_ran_cu_k8s.v0.fiveg_f1
Add the following libraries to the charm's requirements.txt
file:
- pydantic
- pytest-interface-tester
Provider charm
The provider charm is the one providing the information about the F1 interface. Typically, this will be the CU charm.
Example:
from ops.charm import CharmBase, RelationJoinedEvent
from ops.main import main
from charms.oai_ran_cu_k8s.v0.fiveg_f1 import F1Provides
class DummyFivegF1ProviderCharm(CharmBase):
IP_ADDRESS = "192.168.70.132"
PORT = 2153
def __init__(self, *args):
super().__init__(*args)
self.f1_provider = F1Provides(self, "fiveg_f1")
self.framework.observe(
self.on.fiveg_f1_relation_joined, self._on_fiveg_f1_relation_joined
)
def _on_fiveg_f1_relation_joined(self, event: RelationJoinedEvent):
if self.unit.is_leader():
self.f1_provider.set_f1_information(
ip_address=self.IP_ADDRESS,
port=self.PORT,
)
if __name__ == "__main__":
main(DummyFivegF1ProviderCharm)
Requirer charm
The requirer charm is the one requiring the F1 information. Typically, this will be the DU charm.
Example:
from ops.charm import CharmBase
from ops.main import main
from charms.oai_ran_cu_k8s.v0.fiveg_f1 import FivegF1ProviderAvailableEvent, F1Requires
logger = logging.getLogger(__name__)
class DummyFivegF1Requires(CharmBase):
PORT = 2153
def __init__(self, *args):
super().__init__(*args)
self.f1_requirer = F1Requires(self, "fiveg_f1")
self.framework.observe(
self.on.fiveg_f1_relation_joined, self._on_fiveg_f1_relation_joined
)
self.framework.observe(
self.f1_requirer.on.fiveg_f1_provider_available, self._on_f1_information_available
)
def _on_fiveg_f1_relation_joined(self, event: RelationJoinedEvent):
if self.unit.is_leader():
self.f1_requirer.set_f1_information(port=self.PORT)
def _on_f1_information_available(self, event: FivegF1ProviderAvailableEvent):
provider_f1_ip_address = event.f1_ip_address
provider_f1_port = event.f1_port
<do something with the IP and port>
if __name__ == "__main__":
main(DummyFivegF1Requires)
Index
class ProviderAppData
Description
Provider app data for fiveg_f1. None
class ProviderSchema
Description
Provider schema for fiveg_f1. None
class RequirerAppData
Description
Requirer app data for fiveg_f1. None
class RequirerSchema
Description
Requirer schema for fiveg_f1. None
def provider_data_is_valid(data: dict)
Return whether the provider data is valid.
Arguments
Data to be validated.
Returns
True if data is valid, False otherwise.
def requirer_data_is_valid(data: dict)
Return whether the requirer data is valid.
Arguments
Data to be validated.
Returns
True if data is valid, False otherwise.
class FivegF1ProviderAvailableEvent
Charm event emitted when the F1 provider info is available.
Description
The event carries the F1 provider's IP address and port.
Methods
FivegF1ProviderAvailableEvent. __init__( self , handle: Handle , f1_ip_address: str , f1_port: int )
Description
Init. None
FivegF1ProviderAvailableEvent. snapshot( self )
Description
Return snapshot. None
FivegF1ProviderAvailableEvent. restore( self , snapshot: dict )
Description
Restores snapshot. None
class FivegF1RequestEvent
Description
Charm event emitted when the F1 requirer joins. None
Methods
FivegF1RequestEvent. __init__( self , handle: Handle , relation_id: int )
Set relation id.
Arguments
Juju framework handle.
ID of the relation.
FivegF1RequestEvent. snapshot( self )
Return event data.
Returns
contains the relation ID.
FivegF1RequestEvent. restore( self , snapshot: dict )
Restore event data.
Arguments
contains the relation ID.
class FivegF1RequirerAvailableEvent
Charm event emitted when the F1 requirer info is available.
Description
The event carries the F1 requirer's port.
Methods
FivegF1RequirerAvailableEvent. __init__( self , handle: Handle , f1_port: int )
Description
Init. None
FivegF1RequirerAvailableEvent. snapshot( self )
Description
Return snapshot. None
FivegF1RequirerAvailableEvent. restore( self , snapshot: dict )
Description
Restores snapshot. None
class FivegF1ProviderCharmEvents
Description
List of events that the F1 provider charm can leverage. None
class FivegF1RequirerCharmEvents
Description
List of events that the F1 requirer charm can leverage. None
class FivegF1Error
Description
Custom error class for the fiveg_f1
library. None
Methods
FivegF1Error. __init__( self , message: str )
class F1Provides
Description
Class to be instantiated by the charm providing relation using the fiveg_f1
interface. None
Methods
F1Provides. __init__( self , charm: CharmBase , relation_name: str )
Description
Init. None
F1Provides. set_f1_information( self , ip_address: str , port: int )
Push the information about the F1 interface in the application relation data.
Arguments
IPv4 address of the network interface used for F1 traffic.
Number of the port used for F1 traffic.
F1Provides. requirer_f1_port( self )
Return the number of the port used for F1 traffic.
Returns
Port number.
class F1Requires
Description
Class to be instantiated by the charm requiring relation using the fiveg_f1
interface. None
Methods
F1Requires. __init__( self , charm: CharmBase , relation_name: str )
Description
Init. None
F1Requires. set_f1_information( self , port: int )
Push the information about the F1 interface in the application relation data.
Arguments
Number of the port used for F1 traffic.
F1Requires. f1_ip_address( self )
Return IPv4 address of the network interface used for F1 traffic.
Returns
IPv4 address.
F1Requires. f1_port( self )
Return the number of the port used for F1 traffic.
Returns
Port number.