Ejemplo n.º 1
0
from urlparse import urljoin
import requests
import json
import time

import gevent
import gevent.queue

from nmoscommon.logger import Logger
from nmoscommon.mdnsbridge import IppmDNSBridge

from nmoscommon import nmoscommonconfig
from nmoscommon import config as _config
import traceback

AGGREGATOR_APIVERSION = _config.get('nodefacade',
                                    {}).get('NODE_REGVERSION', 'v1.2')
AGGREGATOR_APINAMESPACE = "x-nmos"
AGGREGATOR_APINAME = "registration"

REGISTRATION_MDNSTYPE = "nmos-registration"


class NoAggregator(Exception):
    def __init__(self, mdns_updater=None):
        if mdns_updater is not None:
            mdns_updater.inc_P2P_enable_count()
        pass


class InvalidRequest(Exception):
    def __init__(self, status_code=400, mdns_updater=None):
Ejemplo n.º 2
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from nmoscommon.webapi import *
from urlparse import urlparse, urljoin
import httplib
import requests
from nmoscommon.utils import getLocalIP
from socket import gethostname
from flask import stream_with_context

from nmoscommon import config as _config

NODE_APIVERSIONS = _config.get('nodefacade', {}).get('NODE_APIVERSIONS',
                                                     ["v1.0", "v1.1", "v1.2"])
NODE_REGVERSION = _config.get('nodefacade', {}).get('NODE_REGVERSION', 'v1.2')
NODE_APINAMESPACE = "x-nmos"
NODE_APINAME = "node"
HOSTNAME = gethostname().split(".", 1)[0]


class FacadeAPI(WebAPI):
    def __init__(self, registry):
        self.registry = registry
        self.node_id = registry.node_id
        super(FacadeAPI, self).__init__()

    @route('/')
    def root(self):
        return [NODE_APINAMESPACE + "/"]
from gevent import monkey
monkey.patch_all()

import gevent
import json
import requests
import websocket
import itertools

from nmoscommon.logger import Logger

from nmoscommon import nmoscommonconfig
from nmoscommon import config as _config

QUERY_APIVERSION = _config.get('nodefacade', {}).get('NODE_REGVERSION', 'v1.1')
QUERY_APINAMESPACE = "x-nmos"
QUERY_APINAME = "query"
QUERY_MDNSTYPE = "nmos-query"


class BadSubscriptionError(Exception):
    pass


class QueryNotFoundError(Exception):
    pass


class QueryService(object):
    def __init__(self,