---
title: Charmhub | Deploy SD-Core NMS K8s using Charmhub - The Open Operator Collection
description: Deploy the latest version of SD-Core NMS K8s as a Kubernetes Operator
  on any cloud.
url: https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui
---

# SD-Core NMS K8s

[Canonical Telco](https://charmhub.io/publisher/telco-charmers "View all packages from Canonical Telco")

* [Canonical Telco](https://charmhub.io/publisher/telco-charmers "View all packages from Canonical Telco")

Platform:

1.5/stable 819

```
juju deploy sdcore-nms-k8s --channel 1.5/stable
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#drawer)

## charms.sdcore\_nms\_k8s.v0.sdcore\_webui

* [*Docstrings*Docstrings](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui)
  [*Code*Source code](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.sdcore_nms_k8s.v0.sdcore_webui
    ```

    [Download sdcore\_webui.py](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui/download)
  + *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](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigproviderappdata)
* [class ProviderSchema](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#providerschema)
* [def data\_is\_valid(
  data
  )](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#data_is_valid)
* [class WebuiUrlAvailable](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#webuiurlavailable)
* + [def \_\_init\_\_(
    self,
    handle,
    webui\_url)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#webuiurlavailable-__init__)
* + [def snapshot(
    self)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#webuiurlavailable-snapshot)
* + [def restore(
    self,
    snapshot)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#webuiurlavailable-restore)
* [class WebuiBroken](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#webuibroken)
* + [def \_\_init\_\_(
    self,
    handle)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#webuibroken-__init__)
* [class SdcoreConfigRequirerCharmEvents](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigrequirercharmevents)
* [class SdcoreConfigRequires](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigrequires)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigrequires-__init__)
* + [def webui\_url(
    self)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigrequires-webui_url)
* [class SdcoreConfigProvides](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigprovides)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigprovides-__init__)
* + [def set\_webui\_url(
    self,
    webui\_url,
    relation\_id)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigprovides-set_webui_url)
* + [def set\_webui\_url\_in\_all\_relations(
    self,
    webui\_url)](https://charmhub.io/sdcore-nms-k8s/libraries/sdcore_webui#sdcoreconfigprovides-set_webui_url_in_all_relations)

#### 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
(dict)

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

str

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\_url
(str)

Webui GRPC service address.

relation\_id
(int)

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\_url
(str)

Webui GRPC service address

Returns

None
