Osm Nbi

  • Charmed Distribution of OSM
Channel Revision Published Runs on
latest/stable 1 09 Aug 2022
Ubuntu 20.04
latest/candidate 1 11 Mar 2022
Ubuntu 20.04
latest/beta 600 30 Sep 2023
Ubuntu 22.04 Ubuntu 20.04
latest/beta 191 04 Apr 2023
Ubuntu 22.04 Ubuntu 20.04
latest/edge 408 30 Jun 2023
Ubuntu 22.04 Ubuntu 20.04
latest/edge 1 31 Jan 2022
Ubuntu 22.04 Ubuntu 20.04
14.0/stable 442 20 Jul 2023
Ubuntu 22.04
14.0/candidate 442 12 Jul 2023
Ubuntu 22.04
14.0/beta 442 12 Jul 2023
Ubuntu 22.04
13.0/stable 731 15 Jan 2024
Ubuntu 20.04
13.0/candidate 102 09 Dec 2022
Ubuntu 20.04
13.0/beta 731 05 Dec 2023
Ubuntu 20.04
12.0/stable 222 11 Apr 2023
Ubuntu 20.04
12.0/beta 730 05 Dec 2023
Ubuntu 20.04
10.0/stable 1 09 Dec 2022
Ubuntu 20.04
juju deploy osm-nbi
Show information

Platform:

charms.osm_nbi.v0.nbi

Nbi library.

This library implements both sides of the nbi interface.

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

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

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

$ charmcraft fetch-lib charms.osm_nbi.v0.nbi

metadata.yaml:

requires:
  nbi:
    interface: nbi
    limit: 1

src/charm.py:

from charms.osm_nbi.v0.nbi import NbiRequires
from ops.charm import CharmBase


class MyCharm(CharmBase):

    def __init__(self, *args):
        super().__init__(*args)
        self.nbi = NbiRequires(self)
        self.framework.observe(
            self.on["nbi"].relation_changed,
            self._on_nbi_relation_changed,
        )
        self.framework.observe(
            self.on["nbi"].relation_broken,
            self._on_nbi_relation_broken,
        )
        self.framework.observe(
            self.on["nbi"].relation_broken,
            self._on_nbi_broken,
        )

    def _on_nbi_relation_broken(self, event):
        # Get NBI host and port
        host: str = self.nbi.host
        port: int = self.nbi.port
        # host => "osm-nbi"
        # port => 9999

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

You can file bugs here, selecting the devops module!


class NbiRequires

Description

Requires-side of the Nbi relation. None

Methods

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

NbiRequires. host( self )

Description

Get nbi hostname. None

NbiRequires. port( self )

Description

Get nbi port number. None

class NbiProvides

Description

Provides-side of the Nbi relation. None

Methods

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

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

Set Nbi host and port.

Arguments

host (str)

Nbi hostname or IP address.

port (int)

Nbi 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.