diff --git a/README.md b/README.md index b32f964..c760177 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# SD-Core PCF Operator (k8s) +# Aether SD-Core PCF Operator (k8s) [![CharmHub Badge](https://charmhub.io/sdcore-pcf-k8s/badge.svg)](https://charmhub.io/sdcore-pcf-k8s) -A Charmed Operator for SD-Core's Policy Control Function (PCF) component for K8s. +A Charmed Operator for Aether SD-Core's Policy Control Function (PCF) component for K8s. ## Usage @@ -9,16 +9,16 @@ A Charmed Operator for SD-Core's Policy Control Function (PCF) component for K8s juju deploy mongodb-k8s --channel=6/beta --trust juju deploy sdcore-nrf-k8s --channel=1.5/edge juju deploy sdcore-pcf-k8s --channel=1.5/edge -juju deploy sdcore-webui-k8s --channel=1.5/edge +juju deploy sdcore-nms-k8s --channel=1.5/edge juju deploy self-signed-certificates --channel=stable -juju integrate sdcore-webui-k8s:common_database mongodb-k8s:database -juju integrate sdcore-webui-k8s:auth_database mongodb-k8s:database +juju integrate sdcore-nms-k8s:common_database mongodb-k8s:database +juju integrate sdcore-nms-k8s:auth_database mongodb-k8s:database juju integrate sdcore-nrf-k8s self-signed-certificates:certificates juju integrate sdcore-nrf-k8s:database mongodb-k8s juju integrate sdcore-pcf-k8s:fiveg_nrf sdcore-nrf-k8s:fiveg_nrf juju integrate sdcore-pcf-k8s:certificates self-signed-certificates:certificates -juju integrate sdcore-pcf-k8s:sdcore_config sdcore-webui-k8s:sdcore-config +juju integrate sdcore-pcf-k8s:sdcore-config sdcore-nms-k8s:sdcore-config ``` ## Image diff --git a/charmcraft.yaml b/charmcraft.yaml index c5e4f69..087f43a 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -41,7 +41,7 @@ requires: interface: tls-certificates logging: interface: loki_push_api - sdcore_config: + sdcore-config: interface: sdcore_config provides: diff --git a/lib/charms/sdcore_webui_k8s/v0/sdcore_config.py b/lib/charms/sdcore_nms_k8s/v0/sdcore_config.py similarity index 99% rename from lib/charms/sdcore_webui_k8s/v0/sdcore_config.py rename to lib/charms/sdcore_nms_k8s/v0/sdcore_config.py index 6a049e0..ebc7816 100644 --- a/lib/charms/sdcore_webui_k8s/v0/sdcore_config.py +++ b/lib/charms/sdcore_nms_k8s/v0/sdcore_config.py @@ -113,7 +113,7 @@ def _on_sdcore_config_relation_joined(self, event: RelationJoinedEvent): from pydantic import BaseModel, Field, ValidationError # The unique Charmhub library identifier, never change it -LIBID = "e2f454cc121f449bbaa8fb0fd5a9867b" +LIBID = "87b8ff625f5544ad9985552df3fb6b6b" # Increment this major API version when introducing breaking changes LIBAPI = 0 diff --git a/src/charm.py b/src/charm.py index 611b865..c358065 100755 --- a/src/charm.py +++ b/src/charm.py @@ -13,10 +13,10 @@ from charms.prometheus_k8s.v0.prometheus_scrape import ( # type: ignore[import] MetricsEndpointProvider, ) -from charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFRequires # type: ignore[import] -from charms.sdcore_webui_k8s.v0.sdcore_config import ( # type: ignore[import] +from charms.sdcore_nms_k8s.v0.sdcore_config import ( # type: ignore[import] SdcoreConfigRequires, ) +from charms.sdcore_nrf_k8s.v0.fiveg_nrf import NRFRequires # type: ignore[import] from charms.tls_certificates_interface.v3.tls_certificates import ( # type: ignore[import] CertificateExpiringEvent, TLSCertificatesRequiresV3, @@ -51,7 +51,7 @@ CERTIFICATE_NAME = "pcf.pem" CERTIFICATE_COMMON_NAME = "pcf.sdcore" LOGGING_RELATION_NAME = "logging" -SDCORE_CONFIG_RELATION_NAME = "sdcore_config" +SDCORE_CONFIG_RELATION_NAME = "sdcore-config" WORKLOAD_VERSION_FILE_NAME = "/etc/workload-version" diff --git a/terraform/outputs.tf b/terraform/outputs.tf index f092089..90ddbba 100644 --- a/terraform/outputs.tf +++ b/terraform/outputs.tf @@ -24,8 +24,8 @@ output "logging_endpoint" { } output "sdcore_config_endpoint" { - description = "Name of the endpoint used to integrate with the Webui." - value = "sdcore_config" + description = "Name of the endpoint used to integrate with the NMS." + value = "sdcore-config" } # Provided integration endpoints diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index e727211..40124fc 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -16,8 +16,8 @@ APPLICATION_NAME = METADATA["name"] NRF_CHARM_NAME = "sdcore-nrf-k8s" NRF_CHARM_CHANNEL = "1.5/edge" -WEBUI_CHARM_NAME = "sdcore-webui-k8s" -WEBUI_CHARM_CHANNEL = "1.5/edge" +NMS_CHARM_NAME = "sdcore-nms-k8s" +NMS_CHARM_CHANNEL = "1.5/edge" DATABASE_CHARM_NAME = "mongodb-k8s" DATABASE_CHARM_CHANNEL = "6/beta" TLS_CHARM_NAME = "self-signed-certificates" @@ -43,7 +43,7 @@ async def deploy(ops_test: OpsTest, request): await _deploy_database(ops_test) await _deploy_tls_provider(ops_test) await _deploy_grafana_agent(ops_test) - await _deploy_webui(ops_test) + await _deploy_nms(ops_test) await _deploy_nrf(ops_test) @@ -66,8 +66,8 @@ async def test_relate_and_wait_for_active_status(ops_test: OpsTest, deploy): ) await ops_test.model.integrate(relation1=APPLICATION_NAME, relation2=TLS_CHARM_NAME) await ops_test.model.integrate( - relation1=f"{APPLICATION_NAME}:sdcore_config", - relation2=f"{WEBUI_CHARM_NAME}:sdcore-config", + relation1=f"{APPLICATION_NAME}:sdcore-config", + relation2=f"{NMS_CHARM_NAME}:sdcore-config", ) await ops_test.model.integrate( relation1=f"{APPLICATION_NAME}:logging", @@ -99,19 +99,19 @@ async def test_restore_nrf_and_wait_for_active_status(ops_test: OpsTest, deploy) await ops_test.model.wait_for_idle(apps=[APPLICATION_NAME], status="active", timeout=1000) @pytest.mark.abort_on_fail -async def test_remove_webui_and_wait_for_blocked_status(ops_test: OpsTest, deploy): +async def test_remove_nms_and_wait_for_blocked_status(ops_test: OpsTest, deploy): assert ops_test.model - await ops_test.model.remove_application(WEBUI_CHARM_NAME, block_until_done=True) + await ops_test.model.remove_application(NMS_CHARM_NAME, block_until_done=True) await ops_test.model.wait_for_idle(apps=[APPLICATION_NAME], status="blocked", timeout=1000) @pytest.mark.abort_on_fail -async def test_restore_webui_and_wait_for_active_status(ops_test: OpsTest, deploy): +async def test_restore_nms_and_wait_for_active_status(ops_test: OpsTest, deploy): assert ops_test.model - await _deploy_webui(ops_test) + await _deploy_nms(ops_test) await ops_test.model.integrate( - relation1=f"{APPLICATION_NAME}:sdcore_config", - relation2=f"{WEBUI_CHARM_NAME}:sdcore-config", + relation1=f"{APPLICATION_NAME}:sdcore-config", + relation2=f"{NMS_CHARM_NAME}:sdcore-config", ) await ops_test.model.wait_for_idle(apps=[APPLICATION_NAME], status="active", timeout=1000) @@ -142,18 +142,18 @@ async def _deploy_database(ops_test: OpsTest): ) -async def _deploy_webui(ops_test: OpsTest): +async def _deploy_nms(ops_test: OpsTest): assert ops_test.model await ops_test.model.deploy( - WEBUI_CHARM_NAME, - application_name=WEBUI_CHARM_NAME, - channel=WEBUI_CHARM_CHANNEL, + NMS_CHARM_NAME, + application_name=NMS_CHARM_NAME, + channel=NMS_CHARM_CHANNEL, ) await ops_test.model.integrate( - relation1=f"{WEBUI_CHARM_NAME}:common_database", relation2=f"{DATABASE_CHARM_NAME}" + relation1=f"{NMS_CHARM_NAME}:common_database", relation2=f"{DATABASE_CHARM_NAME}" ) await ops_test.model.integrate( - relation1=f"{WEBUI_CHARM_NAME}:auth_database", relation2=f"{DATABASE_CHARM_NAME}" + relation1=f"{NMS_CHARM_NAME}:auth_database", relation2=f"{DATABASE_CHARM_NAME}" ) @@ -167,7 +167,7 @@ async def _deploy_nrf(ops_test: OpsTest): ) await ops_test.model.integrate(relation1=NRF_CHARM_NAME, relation2=DATABASE_CHARM_NAME) await ops_test.model.integrate(relation1=NRF_CHARM_NAME, relation2=TLS_CHARM_NAME) - await ops_test.model.integrate(relation1=NRF_CHARM_NAME, relation2=WEBUI_CHARM_NAME) + await ops_test.model.integrate(relation1=NRF_CHARM_NAME, relation2=NMS_CHARM_NAME) async def _deploy_tls_provider(ops_test: OpsTest): diff --git a/tests/unit/fixtures.py b/tests/unit/fixtures.py index 05d8e1e..4334ad0 100644 --- a/tests/unit/fixtures.py +++ b/tests/unit/fixtures.py @@ -31,8 +31,8 @@ PRIVATE_KEY_PATH = "support/TLS/pcf.key" VALID_NRF_URL = "https://nrf:443" WEBUI_URL = "sdcore-webui:9876" -SDCORE_CONFIG_RELATION_NAME = "sdcore_config" -WEBUI_APPLICATION_NAME = "sdcore-webui-operator" +SDCORE_CONFIG_RELATION_NAME = "sdcore-config" +NMS_APPLICATION_NAME = "sdcore-nms-operator" class PCFUnitTestFixtures: @@ -44,7 +44,7 @@ class PCFUnitTestFixtures: patcher_request_certificate = patch(f"{CERTIFICATES_LIB}.request_certificate_creation") patcher_restart_container = patch("ops.model.Container.restart") patcher_webui_url = patch( - "charms.sdcore_webui_k8s.v0.sdcore_config.SdcoreConfigRequires.webui_url", + "charms.sdcore_nms_k8s.v0.sdcore_config.SdcoreConfigRequires.webui_url", new_callable=PropertyMock ) @@ -114,14 +114,14 @@ def _get_metadata() -> dict: def sdcore_config_relation_id(self) -> Generator[int, None, None]: sdcore_config_relation_id = self.harness.add_relation( # type:ignore relation_name=SDCORE_CONFIG_RELATION_NAME, - remote_app=WEBUI_APPLICATION_NAME, + remote_app=NMS_APPLICATION_NAME, ) self.harness.add_relation_unit( # type:ignore - relation_id=sdcore_config_relation_id, remote_unit_name=f"{WEBUI_APPLICATION_NAME}/0" + relation_id=sdcore_config_relation_id, remote_unit_name=f"{NMS_APPLICATION_NAME}/0" ) self.harness.update_relation_data( # type:ignore relation_id=sdcore_config_relation_id, - app_or_unit=WEBUI_APPLICATION_NAME, + app_or_unit=NMS_APPLICATION_NAME, key_values={ "webui_url": WEBUI_URL, }, diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index ca2e689..1da3023 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -31,8 +31,7 @@ PRIVATE_KEY_PATH = "support/TLS/pcf.key" VALID_NRF_URL = "https://nrf:443" WEBUI_URL = "sdcore-webui:9876" -SDCORE_CONFIG_RELATION_NAME = "sdcore_config" -WEBUI_APPLICATION_NAME = "sdcore-webui-operator" +SDCORE_CONFIG_RELATION_NAME = "sdcore-config" class TestCharm(PCFUnitTestFixtures): @@ -86,7 +85,7 @@ def test_given_container_can_connect_and_sdcore_config_relation_is_not_created_w self.harness.evaluate_status() assert self.harness.model.unit.status == BlockedStatus( - "Waiting for sdcore_config relation(s)" + "Waiting for sdcore-config relation(s)" ) def test_given_pcf_charm_in_active_state_when_nrf_relation_breaks_then_status_is_blocked( @@ -116,7 +115,7 @@ def test_given_pcf_charm_in_active_state_when_sdcore_config_relation_breaks_then self.harness.evaluate_status() assert self.harness.model.unit.status == BlockedStatus( - "Waiting for sdcore_config relation(s)" + "Waiting for sdcore-config relation(s)" ) def test_given_container_can_connect_and_fiveg_nrf_relation_is_not_available_when_collect_status_then_status_is_waiting( # noqa: E501