Пример #1
0
 def __init__(self, interactive=False):
     self.logger = Logger("facade", None)
     if HOST == "":
         self.logger.writeFatal(
             "Unable to start facade due to lack of connectivity")
         sys.exit(1)
     self.running = False
     self.httpServer = None
     self.interface = None
     self.interactive = interactive
     self.registry = None
     self.registry_cleaner = None
     self.node_id = None
     self.mdns = MDNSEngine()
     self.mdnsname_suffix = '_' + str(HOSTNAME) + "_" + str(getpid())
     self.mappings = {
         "device": "ver_dvc",
         "flow": "ver_flw",
         "source": "ver_src",
         "sender": "ver_snd",
         "receiver": "ver_rcv",
         "self": "ver_slf"
     }
     self.mdns_updater = MDNSUpdater(self.mdns,
                                     "_nmos-node._tcp",
                                     "node" + self.mdnsname_suffix,
                                     self.mappings,
                                     PORT,
                                     self.logger,
                                     txt_recs={
                                         "api_ver": "v1.0,v1.1,v1.2",
                                         "api_proto": "http"
                                     })
     self.aggregator = Aggregator(self.logger, self.mdns_updater)
 def __init__(self, logger=None, interactive=False):
     self.config      = {"priority": 0}
     self._load_config()
     self.running     = False
     self.httpServer  = None
     self.interactive = interactive
     self.mdns        = MDNSEngine()
     self.logger      = Logger("aggregation", logger)
Пример #3
0
 def __init__(self, domain=None):
     self.mdns = MDNSEngine()
     self.mdns.start()
     self.services = {}
     self.domain = domain
     for type in VALID_TYPES:
         self.services[type] = []
         self.mdns.callback_on_services("_" + type + "._tcp",
                                        self._mdns_callback,
                                        registerOnly=False,
                                        domain=self.domain)
 def __init__(self, logger=None):
     self.running = False
     self.logger = Logger("regquery")
     self.logger.writeDebug('Running QueryService')
     self.config = {"priority": 0}
     self._load_config()
     self.mdns = MDNSEngine()
     self.httpServer = HttpServer(QueryServiceAPI,
                                  WS_PORT,
                                  '0.0.0.0',
                                  api_args=[self.logger])
Пример #5
0
 def __init__(self, logger=None):
     self.running = False
     self.logger = Logger("regquery")
     self.logger.writeDebug('Running QueryService')
     # HTTPS under test only at present
     # enabled = Use HTTPS only in all URLs and mDNS adverts
     # disabled = Use HTTP only in all URLs and mDNS adverts
     # mixed = Use HTTP in all URLs, but additionally advertise an HTTPS endpoint for discovery of this API only
     self.config = {"priority": 100, "https_mode": "disabled"}
     self._load_config()
     self.mdns = MDNSEngine()
     self.httpServer = HttpServer(QueryServiceAPI, WS_PORT, '0.0.0.0', api_args=[self.logger, self.config])
 def __init__(self, interactive=False):
     self.logger = Logger("facade", None)
     if HOST == "":
         self.logger.writeFatal(
             "Unable to start facade due to lack of connectivity")
         sys.exit(1)
     self.running = False
     self.httpServer = None
     self.interface = None
     self.interactive = interactive
     self.registry = None
     self.registry_cleaner = None
     self.node_id = None
     self.mdns = MDNSEngine()
     self.mappings = {
         "device": "ver_dvc",
         "flow": "ver_flw",
         "source": "ver_src",
         "sender": "ver_snd",
         "receiver": "ver_rcv",
         "self": "ver_slf"
     }
     self.mdns_updater = None
     if HTTPS_MODE == "enabled" and ENABLE_P2P:
         self.mdns_updater = MDNSUpdater(self.mdns,
                                         DNS_SD_TYPE,
                                         DNS_SD_NAME,
                                         self.mappings,
                                         DNS_SD_HTTPS_PORT,
                                         self.logger,
                                         txt_recs={
                                             "api_ver":
                                             ",".join(NODE_APIVERSIONS),
                                             "api_proto":
                                             "https"
                                         })
     elif ENABLE_P2P:
         self.mdns_updater = MDNSUpdater(self.mdns,
                                         DNS_SD_TYPE,
                                         DNS_SD_NAME,
                                         self.mappings,
                                         DNS_SD_HTTP_PORT,
                                         self.logger,
                                         txt_recs={
                                             "api_ver":
                                             ",".join(NODE_APIVERSIONS),
                                             "api_proto":
                                             "http"
                                         })
     self.aggregator = Aggregator(self.logger, self.mdns_updater)
Пример #7
0
    def __init__(self, interactive=False):
        self.logger = Logger("facade", None)
        if HOST == "":
            self.logger.writeFatal(
                "Unable to start facade due to lack of connectivity")
            sys.exit(1)
        self.running = False
        self.httpServer = None
        self.interface = None
        self.interactive = interactive
        self.registry = None
        self.registry_cleaner = None
        self.node_id = None
        self.mdns = MDNSEngine()
        self.mappings = {
            "device": "ver_dvc",
            "flow": "ver_flw",
            "source": "ver_src",
            "sender": "ver_snd",
            "receiver": "ver_rcv",
            "self": "ver_slf"
        }
        self.mdns_updater = None
        self.auth_registry = AuthRegistry(app=None, scope=ALLOWED_SCOPE)

        self.protocol = PROTOCOL
        if PROTOCOL == "https":
            self.dns_sd_port = DNS_SD_HTTPS_PORT
        else:
            self.dns_sd_port = DNS_SD_HTTP_PORT
        if ENABLE_P2P:
            self.mdns_updater = MDNSUpdater(self.mdns,
                                            DNS_SD_TYPE,
                                            DNS_SD_NAME,
                                            self.mappings,
                                            self.dns_sd_port,
                                            self.logger,
                                            txt_recs=self._mdns_txt(
                                                NODE_APIVERSIONS,
                                                self.protocol, OAUTH_MODE))

        self.aggregator = Aggregator(self.logger, self.mdns_updater,
                                     self.auth_registry)
Пример #8
0
 def setUp(self):
     self.dut = MDNSEngine()
     self.dut.registrationController = MagicMock()
     self.name = "192.168.0.1_nmos-node._tcp.local."
     self.type = "_nmos-node._tcp"
     self.port = 8080