SD-Core NMS K8s
- Canonical Telco
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/beta | 9 | 03 Jan 2024 | |
latest/edge | 14 | 21 Jan 2024 | |
1.4/beta | 163 | 01 May 2024 | |
1.4/edge | 684 | 29 Oct 2024 | |
1.5/edge | 713 | Yesterday | |
1.3/beta | 9 | 22 Jan 2024 | |
1.3/edge | 75 | 12 Apr 2024 | |
0.2/edge | 108 | 23 Apr 2024 |
juju deploy sdcore-nms-k8s --channel 1.4/beta
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.sdcore_nms_k8s.v0.sdcore_config
-
- Last updated 16 Jul 2024
- Revision Library version 0.1
Library for the sdcore_config
relation.
This library contains the Requires and Provides classes for handling the sdcore_config
interface.
The purpose of this library is to relate charms claiming to be able to provide or consume the information to access the webui GRPC address for configuration purposes in SD-Core.
Getting Started
From a charm directory, fetch the library using charmcraft
:
charmcraft fetch-lib charms.sdcore_webui_k8s.v0.sdcore_config
Add the following libraries to the charm's requirements.txt
file:
- pydantic
- pytest-interface-tester
Requirer charm
The requirer charm is the one requiring the Webui information.
Example:
import logging
from ops.charm import CharmBase
from ops.main import main
from lib.charms.sdcore_webui_k8s.v0.sdcore_config import (
SdcoreConfigRequires,
WebuiBroken,
WebuiUrlAvailable,
)
logger = logging.getLogger(__name__)
class DummySdcoreConfigRequirerCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.webui_requirer = SdcoreConfigRequires(
self, "sdcore_config"
)
self.framework.observe(
self.webui_requirer.on.webui_url_available,
self._on_webui_url_available
)
self.framework.observe(self.webui_requirer.on.webui_broken, self._on_webui_broken)
def _on_webui_url_available(self, event: WebuiUrlAvailable):
logging.info(f"Webui URL from the event: {event.webui_url}")
logging.info(f"Webui URL from the property: {self.webui_requirer.webui_url}")
def _on_webui_broken(self, event: WebuiBroken) -> None:
logging.info(f"Received {event}")
if __name__ == "__main__":
main(DummySdcoreConfigRequirerCharm)
Provider charm
The provider charm is the one providing the information about the Webui.
Example:
from ops.charm import CharmBase, RelationJoinedEvent
from ops.main import main
from lib.charms.sdcore_webui_k8s.v0.sdcore_config import SdcoreConfigProvides
class DummySdcoreConfigProviderCharm(CharmBase):
WEBUI_URL = "sdcore-webui-k8s:9876"
def __init__(self, *args):
super().__init__(*args)
self.webui_url_provider = SdcoreConfigProvides(self, "sdcore_config")
self.framework.observe(
self.on.sdcore_config_relation_joined, self._on_sdcore_config_relation_joined
)
def _on_sdcore_config_relation_joined(self, event: RelationJoinedEvent):
relation_id = event.relation.id
self.webui_url_provider.set_webui_url(
webui_url=self.WEBUI_URL,
relation_id=relation_id,
)
if __name__ == "__main__":
main(DummySdcoreConfigProviderCharm)
Index
class SdcoreConfigProviderAppData
Description
Provider application data for sdcore_config. None
class ProviderSchema
Description
The schema for the provider side of the sdcore-config interface. None
def data_is_valid(data: dict)
Return whether data is valid.
Arguments
Data to be validated.
Returns
True if data is valid, False otherwise.
class WebuiUrlAvailable
Description
Charm event emitted when the Webui URL is available. None
Methods
WebuiUrlAvailable. __init__( self , handle: Handle , webui_url: str )
Description
Init. None
WebuiUrlAvailable. snapshot( self )
Description
Return snapshot. None
WebuiUrlAvailable. restore( self , snapshot: dict )
Description
Restore snapshot. None
class WebuiBroken
Description
Charm event emitted when the Webui goes down. None
Methods
WebuiBroken. __init__( self , handle: Handle )
Description
Init. None
class SdcoreConfigRequirerCharmEvents
Description
List of events that the SD-Core config requirer charm can leverage. None
class SdcoreConfigRequires
Description
Class to be instantiated by the SD-Core config requirer charm. None
Methods
SdcoreConfigRequires. __init__( self , charm: CharmBase , relation_name: str )
Description
Init. None
SdcoreConfigRequires. webui_url( self )
Return the address of the webui GRPC endpoint.
Returns
Endpoint address.
class SdcoreConfigProvides
Description
Class to be instantiated by the charm providing the SD-Core Webui URL. None
Methods
SdcoreConfigProvides. __init__( self , charm: CharmBase , relation_name: str )
Description
Init. None
SdcoreConfigProvides. set_webui_url( self , webui_url: str , relation_id: int )
Set the address of the Webui GRPC endpoint.
Arguments
Webui GRPC service address.
Relation ID.
Returns
None
SdcoreConfigProvides. set_webui_url_in_all_relations( self , webui_url: str )
Set Webui URL in applications for all applications.
Arguments
Webui GRPC service address
Returns
None