Giter Club home page Giter Club logo

nmos-registration's Introduction

NMOS Registry Registration API Service

Provides a service implementing the NMOS Registration API, specified in AMWA IS-04.

The API will present itself at [http://localhost:8235/x-nmos/registration/].

Installing with Python

Before installing this library please make sure you have installed the NMOS Common Library, on which this API depends. The registration API also requires etcd to be installed. For debain distributions this can be installed using apt:

sudo apt-get install etcd

Once all dependencies are satisfied run the following commands to install the API:

pip install setuptools
sudo python setup.py install

Configuration

The Registration API makes use of two configuration files. The first is native to the Registration API and is described below. The second forms part of the NMOS Common Library and is described in that repository. Note that you will likely have to configure items in both files.

The native Registration API configuration should consist of a JSON object in the file /etc/ips-regaggregator/config.json. The following attributes may be set within the object:

  • priority: [integer] Sets a priority value for this Registration API instance between 0 and 255. A value of 100+ indicates a development rather than production instance. Default: 100.
  • https_mode: [string] Switches the API between HTTP and HTTPS operation. "disabled" indicates HTTP mode is in use, "enabled" indicates HTTPS mode is in use. Default: "disabled".
  • enable_mdns: [boolean] Provides a mechanism to disable mDNS announcements in an environment where unicast DNS is preferred. Default: true.
  • oauth_mode: [boolean] Switches the API between being secured using OAuth2 and not using authorization. Default: false.

An example configuration file is shown below:

{
  "priority": "30",
  "https_mode": "enabled",
  "enable_mdns": false,
  "oauth_mode": true
}

Running the Registration API

Non-blocking

Run the following script to start the Registration API in a non-blocking manner, and then stop it again at a later point:

    from nmosregistration.registryaggregatorservice import RegistryAggregatorService

    service = RegistryAggregatorService()
    service.start()

    # Do something else until ready to stop

    service.stop()

Blocking

It is also possible to run Registration API in a blocking manner:

from nmosregistration.registryaggregatorservice import RegistryAggregatorService

service = RegistryAggregatorService()
service.run() # Runs forever

Tests

Unit tests are provided. Currently these have hard-coded dummy/example hostnames, IP addresses and UUIDs. You will need to edit the Python files in the test/ directories to suit your needs and then "make test".

Debian Packaging

Debian packaging files are provided for internal BBC R&D use. These packages depend on packages only available from BBC R&D internal mirrors, and will not build in other environments. For use outside the BBC please use python installation method.

nmos-registration's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

miky001-gz

nmos-registration's Issues

Not registering any node

I am not sure if registration is working properly or not as no nmos node seem to register the services and I get this output:

$ ./nmosregistration 

2020-07-10 12:25:27,018 : utils : DEBUG : Choosing interface from /etc/nmoscommon/config.json file: []
2020-07-10 12:25:27,018 : utils : DEBUG : Could not find ipp-utils, will try using default gateway interface
2020-07-10 12:25:27,019 : utils : DEBUG : Choosing interface using the default gateway: 192.168.2.1
WARNING:mdnsbridge:This class is deprecated. Please use the matching one in nmos-mdns-bridge instead.
Exception loading config: name 'f' is not defined
2020-07-10 12:25:27,204 : utils : DEBUG : Choosing interface from /etc/nmoscommon/config.json file: []
2020-07-10 12:25:27,204 : utils : DEBUG : Could not find ipp-utils, will try using default gateway interface
2020-07-10 12:25:27,204 : utils : DEBUG : Choosing interface using the default gateway: 192.168.2.1
2020-07-10 12:25:27,209 : utils : DEBUG : Choosing interface from /etc/nmoscommon/config.json file: []
2020-07-10 12:25:27,209 : utils : DEBUG : Could not find ipp-utils, will try using default gateway interface
2020-07-10 12:25:27,210 : utils : DEBUG : Choosing interface using the default gateway: 192.168.2.1
Could not open pid file, continuing
DEBUG:mdns-engine:Choosing interface from /etc/nmoscommon/config.json file: []
DEBUG:mdns-engine:Could not find ipp-utils, will try using default gateway interface
DEBUG:mdns-engine:Choosing interface using the default gateway: 192.168.2.1
Waiting for httpserver to start...
HttpServer running
Running on port: 8235
ERROR:cysystemd.daemon:Data could not be sent
DEBUG:garbage_collect:Not collecting - another collector has recently collected
DEBUG:garbage_collect:scheduled...
DEBUG:garbage_collect:Not collecting - another collector has recently collected
DEBUG:garbage_collect:scheduled...

Also on running the nmos-mdns-bridge output:

DEBUG:zeroconf mDNS:mDNS Service add: {'action': 'add', 'type': '_nmos-registration._tcp.local.', 'name': 'registration_192.168.2.1_http_dep._nmos-registration._tcp.local.', 'port': 80, 'hostname': 'registration_192.168.2.1_http_dep._nmos-registration._tcp.local', 'address': '192.168.2.1', 'txt': {b'pri': b'100', b'api_ver': b'v1.0,v1.1,v1.2,v1.3', b'api_proto': b'http', b'api_auth': False}}
DEBUG:zeroconf mDNS:mDNS Service add: {'action': 'add', 'type': '_nmos-register._tcp.local.', 'name': 'registration_192.168.2.1_http._nmos-register._tcp.local.', 'port': 80, 'hostname': 'registration_192.168.2.1_http._nmos-register._tcp.local', 'address': '192.168.2.1', 'txt': {b'pri': b'100', b'api_ver': b'v1.0,v1.1,v1.2,v1.3', b'api_proto': b'http', b'api_auth': False}}

The nmos-registration didn't work on CentOS 7

Hi everyone! I have installed this package on my CentOS 7, but can't launch.
I installed as described in README.md fine.
Also installed https://github.com/bbc/nmos-common
I have this CentOS 7
Did someone test this app on CentOS 7?
[root@localhost BBC]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.6.1810 (Core)
Release: 7.6.1810
Codename: Core
[root@localhost BBC]#
I also have Python 2.7.5 and Python 3.7.1.
I got this error then launched from python3
[root@localhost nmos-registration]# python3 start.py
Traceback (most recent call last):
File "start.py", line 1, in
from nmosregistration.registryaggregatorservice import RegistryAggregatorService
File "/opt/BBC/nmos-registration/nmosregistration/registryaggregatorservice.py", line 63
print "Exception loading config: {}".format(e)
^
SyntaxError: invalid syntax
[root@localhost nmos-registration]#

And this error when i launched from python 2.
[root@localhost nmos-registration]# python start.py
Traceback (most recent call last):
File "start.py", line 1, in
from nmosregistration.registryaggregatorservice import RegistryAggregatorService
File "/opt/BBC/nmos-registration/nmosregistration/registryaggregatorservice.py", line 15, in
from nmoscommon.mdns import MDNSEngine
File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/init.py", line 3, in
from .mdnsEngine import MDNSEngine # noqa: F401
File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/mdnsEngine.py", line 17, in
import zeroconf_monkey as zeroconf
File "/usr/lib/python2.7/site-packages/zeroconf_monkey.py", line 26, in
import zeroconf
File "/usr/lib/python2.7/site-packages/zeroconf.py", line 175
def current_time_millis() -> float:
^
SyntaxError: invalid syntax
[root@localhost nmos-registration]#

Also then launched bin folder got this error.
[root@localhost nmos-registration]# cd bin
[root@localhost bin]# ./nmosregistration
Traceback (most recent call last):
File "./nmosregistration", line 7, in
from nmosregistration.registryaggregatorservice import RegistryAggregatorService
File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import
result = _import(*args, **kwargs)
File "build/bdist.linux-x86_64/egg/nmosregistration/registryaggregatorservice.py", line 15, in
File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import
result = _import(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/init.py", line 3, in
from .mdnsEngine import MDNSEngine # noqa: F401
File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import
result = _import(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/mdnsEngine.py", line 17, in
import zeroconf_monkey as zeroconf
File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import
result = _import(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/zeroconf_monkey.py", line 26, in
import zeroconf
File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import
result = _import(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/zeroconf.py", line 175
def current_time_millis() -> float:
^
SyntaxError: invalid syntax
[root@localhost bin]#

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.