Skip to content

Commit

Permalink
chore: Change the interface name from fiveg-nrf to fiveg_nrf (#74)
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici authored Feb 14, 2024
1 parent b5c00fb commit f885155
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions lib/charms/sdcore_nrf_k8s/v0/fiveg_nrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DummyFiveGNRFRequirerCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.nrf_requirer = NRFRequires(self, "fiveg-nrf")
self.nrf_requirer = NRFRequires(self, "fiveg_nrf")
self.framework.observe(self.nrf_requirer.on.nrf_available, self._on_nrf_available)
def _on_nrf_available(self, event: NRFAvailableEvent):
Expand Down Expand Up @@ -67,7 +67,7 @@ class DummyFiveGNRFProviderCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.nrf_provider = NRFProvides(self, "fiveg-nrf")
self.nrf_provider = NRFProvides(self, "fiveg_nrf")
self.framework.observe(
self.on.fiveg_nrf_relation_joined, self._on_fiveg_nrf_relation_joined
)
Expand Down Expand Up @@ -110,7 +110,7 @@ def _on_nrf_url_changed(

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 1
LIBPATCH = 2

PYDEPS = ["pydantic", "pytest-interface-tester"]

Expand Down
2 changes: 1 addition & 1 deletion metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requires:
interface: tls-certificates

provides:
fiveg-nrf:
fiveg_nrf:
interface: fiveg_nrf

assumes:
Expand Down
4 changes: 2 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DATABASE_NAME = "free5gc"
NRF_SBI_PORT = 29510
DATABASE_RELATION_NAME = "database"
NRF_RELATION_NAME = "fiveg-nrf"
NRF_RELATION_NAME = "fiveg_nrf"
CERTS_DIR_PATH = "/support/TLS" # Certificate paths are hardcoded in NRF code
PRIVATE_KEY_NAME = "nrf.key"
CSR_NAME = "nrf.csr"
Expand Down Expand Up @@ -354,7 +354,7 @@ def _config_file_content_matches(self, content: str) -> bool:
return True

def _on_fiveg_nrf_relation_joined(self, event: RelationJoinedEvent) -> None:
"""Handle fiveg-nrf relation joined event.
"""Handle fiveg_nrf relation joined event.
Args:
event: RelationJoinedEvent
Expand Down
2 changes: 1 addition & 1 deletion terraform/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ output "certificates_endpoint" {

output "fiveg_nrf_endpoint" {
description = "Name of the endpoint to provide fiveg_nrf interface."
value = "fiveg-nrf"
value = "fiveg_nrf"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ summary: |
Dummy SD-Core NRF provider charm.
provides:
fiveg-nrf:
interface: fiveg-nrf
fiveg_nrf:
interface: fiveg_nrf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DummyFiveGNRFProviderCharm(CharmBase):
def __init__(self, *args):
"""Init."""
super().__init__(*args)
self.nrf_provider = NRFProvides(self, "fiveg-nrf")
self.nrf_provider = NRFProvides(self, "fiveg_nrf")
self.framework.observe(
self.on.fiveg_nrf_relation_joined, self._on_fiveg_nrf_relation_joined
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ summary: |
Dummy SD-Core NRF requirer charm.
requires:
fiveg-nrf:
interface: fiveg-nrf
fiveg_nrf:
interface: fiveg_nrf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DummyFiveGNRFRequirerCharm(CharmBase):
def __init__(self, *args):
"""Init."""
super().__init__(*args)
self.nrf_requirer = NRFRequires(self, "fiveg-nrf")
self.nrf_requirer = NRFRequires(self, "fiveg_nrf")
self.framework.observe(self.nrf_requirer.on.nrf_available, self._on_nrf_available)
self.framework.observe(self.nrf_requirer.on.nrf_broken, self._on_nrf_broken)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class TestFiveGNRFProvider(unittest.TestCase):
def setUp(self):
self.relation_name = "fiveg-nrf"
self.relation_name = "fiveg_nrf"
self.remote_app_name = "dummy-nrf-requirer"
self.remote_unit_name = f"{self.remote_app_name}/0"
self.harness = testing.Harness(DummyFiveGNRFProviderCharm)
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_given_unit_is_leader_and_fiveg_nrf_relation_is_not_created_when_set_nrf
self.harness.charm.nrf_provider.set_nrf_information(
url="https://nrf.example.com", relation_id=relation_id_for_unexsistant_relation
)
self.assertEqual(str(e.value), "Relation fiveg-nrf not created yet.")
self.assertEqual(str(e.value), "Relation fiveg_nrf not created yet.")

def test_given_unit_is_leader_when_multiple_fiveg_nrf_relation_joined_then_data_in_application_databag( # noqa: E501
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class TestFiveGNRFRequirer(unittest.TestCase):
def setUp(self):
self.relation_name = "fiveg-nrf"
self.relation_name = "fiveg_nrf"
self.remote_app_name = "dummy-nrf-provider"
self.remote_unit_name = f"{self.remote_app_name}/0"
self.harness = testing.Harness(DummyFiveGNRFRequirerCharm)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_given_https_nrf_url_and_service_is_running_when_fiveg_nrf_relation_join
self.harness.container_pebble_ready("nrf")

relation_id = self.harness.add_relation(
relation_name="fiveg-nrf",
relation_name="fiveg_nrf",
remote_app="nrf-requirer",
)
self.harness.add_relation_unit(relation_id=relation_id, remote_unit_name="nrf-requirer/0")
Expand All @@ -364,12 +364,12 @@ def test_service_starts_running_after_nrf_relation_joined_when_fiveg_pebble_read
self.harness.set_can_connect(container="nrf", val=False)

relation_1_id = self.harness.add_relation(
relation_name="fiveg-nrf",
relation_name="fiveg_nrf",
remote_app="nrf-requirer-1",
)

relation_2_id = self.harness.add_relation(
relation_name="fiveg-nrf",
relation_name="fiveg_nrf",
remote_app="nrf-requirer-2",
)
self.harness.add_relation_unit(
Expand Down

0 comments on commit f885155

Please sign in to comment.