Osm Ro

  • Charmed Distribution of OSM
Channel Revision Published Runs on
latest/stable 4 09 Aug 2022
Ubuntu 20.04
latest/candidate 1 11 Mar 2022
Ubuntu 20.04
latest/beta 358 29 Aug 2023
Ubuntu 22.04 Ubuntu 20.04
latest/beta 170 04 Apr 2023
Ubuntu 22.04 Ubuntu 20.04
latest/edge 294 30 Jun 2023
Ubuntu 22.04 Ubuntu 20.04
latest/edge 4 09 Aug 2022
Ubuntu 22.04 Ubuntu 20.04
14.0/stable 308 20 Jul 2023
Ubuntu 22.04
14.0/candidate 308 12 Jul 2023
Ubuntu 22.04
14.0/beta 308 12 Jul 2023
Ubuntu 22.04
13.0/stable 455 15 Jan 2024
Ubuntu 20.04
13.0/candidate 103 09 Dec 2022
Ubuntu 20.04
13.0/beta 455 05 Dec 2023
Ubuntu 20.04
12.0/stable 4 13 Dec 2022
Ubuntu 20.04
10.0/stable 1 09 Dec 2022
Ubuntu 20.04
juju deploy osm-ro
Show information

Platform:

charms.osm_ro.v0.ro

Ro library.

This library implements both sides of the ro interface.

The provider side of this interface is implemented by the osm-ro Charmed Operator.

Any Charmed Operator that requires RO for providing its service should implement the requirer side of this interface.

In a nutshell using this library to implement a Charmed Operator requiring RO would look like

$ charmcraft fetch-lib charms.osm_ro.v0.ro

metadata.yaml:

requires:
  ro:
    interface: ro
    limit: 1

src/charm.py:

from charms.osm_ro.v0.ro import RoRequires
from ops.charm import CharmBase


class MyCharm(CharmBase):

    def __init__(self, *args):
        super().__init__(*args)
        self.ro = RoRequires(self)
        self.framework.observe(
            self.on["ro"].relation_changed,
            self._on_ro_relation_changed,
        )
        self.framework.observe(
            self.on["ro"].relation_broken,
            self._on_ro_relation_broken,
        )
        self.framework.observe(
            self.on["ro"].relation_broken,
            self._on_ro_broken,
        )

    def _on_ro_relation_broken(self, event):
        # Get RO host and port
        host: str = self.ro.host
        port: int = self.ro.port
        # host => "osm-ro"
        # port => 9999

    def _on_ro_broken(self, event):
        # Stop service
        # ...
        self.unit.status = BlockedStatus("need ro relation")

You can file bugs here, selecting the devops module!


class RoRequires

Description

Requires-side of the Ro relation. None

Methods

RoRequires. __init__( self , charm: CharmBase , endpoint_name: str )

RoRequires. host( self )

Description

Get ro hostname. None

RoRequires. port( self )

Description

Get ro port number. None

class RoProvides

Description

Provides-side of the Ro relation. None

Methods

RoProvides. __init__( self , charm: CharmBase , endpoint_name: str )

RoProvides. set_host_info( self , host: str , port: int , relation )

Set Ro host and port.

Arguments

host (str)

Ro hostname or IP address.

port (int)

Ro port.

relation (Optional[Relation])

Relation to update. If not specified, all relations will be updated.

Description

This function writes in the application data of the relation, therefore, only the unit leader can call it.