SD-Core 5G WEBUI K8s

  • Canonical Telco
Channel Revision Published Runs on
latest/beta 6 03 Jan 2024
Ubuntu 22.04
latest/edge 8 16 Jan 2024
Ubuntu 22.04
1.4/beta 86 26 Apr 2024
Ubuntu 22.04
1.4/edge 458 08 Oct 2024
Ubuntu 22.04
1.5/edge 450 06 Oct 2024
Ubuntu 22.04
1.3/beta 6 22 Jan 2024
Ubuntu 22.04
1.3/edge 46 05 Apr 2024
Ubuntu 22.04
juju deploy sdcore-webui-k8s --channel 1.4/beta
Show information

Platform:

charms.sdcore_webui_k8s.v0.sdcore_management

Library for the sdcore_management relation.

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

The purpose of this library is to relate charms claiming to be able to provide or consume the information to access the configuration service in SD-Core.

Getting Started

From a charm directory, fetch the library using charmcraft:

charmcraft fetch-lib charms.sdcore_webui_k8s.v0.sdcore_management

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 address to connect to configuration service.

Example:


from ops.charm import CharmBase
from ops.main import main

from charms.sdcore_webui_k8s.v0.sdcore_management import (
    ManagementUrlAvailable,
    SdcoreManagementRequires,
)

logger = logging.getLogger(__name__)


class DummySdcoreManagementRequiresCharm(CharmBase):

    def __init__(self, *args):
        super().__init__(*args)
        self.sdcore_management = SdcoreManagementRequires(self, "sdcore-management")
        self.framework.observe(
            self.sdcore_management.on.management_url_available,
            self._on_management_url_available,
        )

    def _on_management_url_available(self, event: ManagementUrlAvailable):
        management_url = event.management_url
        <do something with the url>


if __name__ == "__main__":
    main(DummySdcoreManagementRequiresCharm)
Provider charm

The provider charm is the one providing the address to connect to configuration service.

Example:


from ops.charm import CharmBase, RelationJoinedEvent
from ops.main import main

from charms.sdcore_webui_k8s.v0.sdcore_management import (
    SdcoreManagementProvides,
)

class DummySdcoreManagementProvidesCharm(CharmBase):
    management_url = "http://1.2.3.4:1234"

    def __init__(self, *args):
        super().__init__(*args)
        self.sdcore_management = SdcoreManagementProvides(
            self, "sdcore-management"
        )
        self.framework.observe(
            self.on.sdcore_management_relation_joined, self._on_sdcore_management_relation_joined
        )

    def _on_sdcore_management_relation_joined(self, event: RelationJoinedEvent):
        if self.unit.is_leader():
            self.sdcore_management.set_management_url(
                management_url=self.management_url,
            )


if __name__ == "__main__":
    main(DummySdcoreManagementProvidesCharm)

class SdcoreManagementProviderAppData

Description

Provider app data for sdcore_management. None

class ProviderSchema

Description

Provider schema for sdcore_management. None

def data_is_valid(data: dict)

Returns whether data is valid.

Arguments

data (dict)

Data to be validated.

Returns

True if data is valid, False otherwise.

class ManagementUrlAvailable

Description

Charm event emitted when the management url is available. None

Methods

ManagementUrlAvailable. __init__( self , handle: Handle , management_url: str )

Description

Init. None

ManagementUrlAvailable. snapshot( self )

Description

Returns snapshot. None

ManagementUrlAvailable. restore( self , snapshot: dict )

Description

Restores snapshot. None

class SdcoreManagementRequirerCharmEvents

Description

List of events that the SD-Core management requirer charm can leverage. None

class SdcoreManagementRequires

Description

Class to be instantiated by the SD-Core management requirer charm. None

Methods

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

Description

Init. None

SdcoreManagementRequires. management_url( self )

Returns the address of the management endpoint.

Returns

str

Endpoint address.

class SdcoreManagementProvides

Description

Class to be instantiated by the charm providing the SD-Core management url. None

Methods

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

Description

Init. None

SdcoreManagementProvides. set_management_url( self , management_url: str )

Sets the address of the management endpoint.

Arguments

management_url (str)

Configuration service address.

Returns

None