Exemple #1
0

class NCQMHandler(MapsHandler):
    pass


class NCQMWorker(MapsWorker):

    MODULE_NAME = "ncqm"
    MODULE_HANDLER = NCQMHandler
    MODULE_TYPE = NCQM

    POLLER_REQ_MSG_TYPE = 0x27
    POLLER_RESP_MSG_TYPE = 0x28


bind_module(NCQMWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = NCQMWorker(rest_server)
    lvap_server.register_message(worker.POLLER_RESP_MSG_TYPE, POLLER_RESP_MSG,
                                 worker.handle_poller_response)

    return worker
                    break

        return out


class PacketsCounterHandler(ModuleHandler):
    pass


class PacketsCounterWorker(CounterWorker):

    MODULE_NAME = "packets_counter"
    MODULE_HANDLER = PacketsCounterHandler
    MODULE_TYPE = PacketsCounter


bind_module(PacketsCounterWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = PacketsCounterWorker(rest_server)
    lvap_server.register_message(PT_STATS_RESPONSE, STATS_RESPONSE,
                                 worker.handle_stats_response)

    return worker
Exemple #3
0
        """

        for event in self.modules.values():

            if event.tenant_id not in RUNTIME.tenants:
                return

            lvaps = RUNTIME.tenants[event.tenant_id].lvaps

            if lvap.addr not in lvaps:
                return

            LOG.info("Event: LVAP Join %s", lvap.addr)

            handle_callback(lvap, event)


bind_module(LVAPJoinWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVAPJoinWorker(rest_server)
    lvap_server.register_message(PT_LVAP_JOIN, None, worker.on_lvap_join)

    return worker
        # update this object
        if handler_response['retcode'] != 200:
            error = handler_response['samples']
            LOG.error("Error while polling %s: %s", handler.handler, error)
            self.remove_module(handler.module_id)
            return

        handler.retcode = handler_response['retcode']
        handler.samples = handler_response['samples']

        # handle callback
        handle_callback(handler, handler)


bind_module(ReadHandlerWorker)


def launch():
    """Initialize the module."""

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = ReadHandlerWorker(rest_server)
    lvnf_server.register_message(PT_READ_HANDLER_RESPONSE,
                                 None,
                                 worker.handle_read_handler_response)

    return worker
Exemple #5
0
        """

        for event in self.modules.values():

            if event.tenant_id not in RUNTIME.tenants:
                return

            lvaps = RUNTIME.tenants[event.tenant_id].lvaps

            if lvap.addr not in lvaps:
                return

            LOG.info("Event: LVAP Join %s", lvap.addr)

            handle_callback(lvap, event)


bind_module(LVAPJoinWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVAPJoinWorker(rest_server)
    lvap_server.register_message(PT_LVAP_JOIN, None, worker.on_lvap_join)

    return worker
Exemple #6
0
        for event in list(self.modules.values()):

            if event.tenant_id not in RUNTIME.tenants:
                return

            addr = EtherAddress(register['addr'])
            cpps = RUNTIME.tenants[event.tenant_id].cpps

            if addr not in cpps:
                return

            LOG.info("Event: CPP Up %s", addr)

            handle_callback(cpps[addr], event)


bind_module(CPPUpWorker)


def launch():
    """ Initialize the module. """

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = CPPUpWorker(rest_server)
    lvnf_server.register_message(PT_REGISTER, None, worker.on_cpp_up)

    return worker
        # update this object
        if handler_response['retcode'] != 200:
            error = handler_response['samples']
            LOG.error("Error while polling %s: %s" % (handler.handler, error))
            self.remove_module(handler.module_id)
            return

        handler.retcode = handler_response['retcode']
        handler.samples = handler_response['samples']

        # handle callback
        handle_callback(handler, handler)


bind_module(WriteHandlerWorker)


def launch():
    """Initialize the module."""

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = WriteHandlerWorker(rest_server)
    lvnf_server.register_message(PT_WRITE_HANDLER_RESPONSE,
                                 None,
                                 worker.handle_write_handler_response)

    return worker
Exemple #8
0
        """

        for event in self.modules.values():

            if event.tenant_id not in RUNTIME.tenants:
                return

            lvaps = RUNTIME.tenants[event.tenant_id].lvaps

            if lvap.addr not in lvaps:
                return

            LOG.info("Event: LVAP Leave %s", lvap.addr)

            handle_callback(lvap, event)


bind_module(LVAPLeaveWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVAPLeaveWorker(rest_server)
    lvap_server.register_message(PT_LVAP_LEAVE, None, worker.on_lvap_leave)

    return worker
Exemple #9
0
        Returns:
            None
        """

        for event in list(self.modules.values()):

            tenant = RUNTIME.tenants[event.tenant_id]

            if lvnf.lvnf_id not in tenant.lvnfs:
                continue

            LOG.info("Event: LVNF Join %s", lvnf.lvnf_id)

            handle_callback(lvnf, event)


bind_module(LVNFJoinWorker)


def launch():
    """ Initialize the module. """

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVNFJoinWorker(rest_server)
    lvnf_server.register_message(PT_LVNF_JOIN, None, worker.on_lvnf_join)

    return worker
        return out


class BytesCounterHandler(ModuleHandler):
    pass


class BytesCounterWorker(CounterWorker):

    MODULE_NAME = "bytes_counter"
    MODULE_HANDLER = BytesCounterHandler
    MODULE_TYPE = BytesCounter


bind_module(BytesCounterWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = BytesCounterWorker(rest_server)
    lvap_server.register_message(PT_STATS_RESPONSE,
                                 STATS_RESPONSE,
                                 worker.handle_stats_response)

    return worker
            return

        # update this object
        if handler_response['retcode'] != 200:
            error = handler_response['samples']
            LOG.error("Error while polling %s: %s" % (handler.handler, error))
            self.remove_module(handler.module_id)
            return

        handler.retcode = handler_response['retcode']
        handler.samples = handler_response['samples']

        # handle callback
        handle_callback(handler, handler)


bind_module(WriteHandlerWorker)


def launch():
    """Initialize the module."""

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = WriteHandlerWorker(rest_server)
    lvnf_server.register_message(PT_WRITE_HANDLER_RESPONSE, None,
                                 worker.handle_write_handler_response)

    return worker
Exemple #12
0
        if rates.rates_id not in self.modules:
            return

        counter = self.modules[rates.rates_id]

        # update cache
        lvap = RUNTIME.lvaps[counter.lvap]
        lvap.rates = {x[0]: x[1] for x in rates.rates}

        # update this object
        counter.rates = {x[0]: x[1] for x in rates.rates}

        # call callback
        handle_callback(counter, counter)


bind_module(LinkStatsWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LinkStatsWorker(rest_server)
    lvap_server.register_message(PT_RATES_RESPONSE, RATES_RESPONSE,
                                 worker.handle_rates_response)

    return worker
Exemple #13
0
        Returns:
            None
        """

        for event in list(self.modules.values()):

            tenant = RUNTIME.tenants[event.tenant_id]

            if lvnf.lvnf_id not in tenant.lvnfs:
                continue

            LOG.info("Event: LVNF Leave %s", lvnf.lvnf_id)

            handle_callback(lvnf, event)


bind_module(LVNFLeaveWorker)


def launch():
    """ Initialize the module. """

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVNFLeaveWorker(rest_server)
    lvnf_server.register_message(PT_LVNF_LEAVE, None, worker.on_lvnf_leave)

    return worker
Exemple #14
0
        tenant_id = UUID(stats_response['tenant_id'])
        lvnf_id = UUID(stats_response['lvnf_id'])

        tenant = RUNTIME.tenants[tenant_id]

        if lvnf_id not in tenant.lvnfs:
            return

        stats.stats = stats_response['stats']

        # handle callback
        handle_callback(stats, stats)


bind_module(LVNFStatsWorker)


def launch():
    """Initialize the module."""

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVNFStatsWorker(rest_server)
    lvnf_server.register_message(PT_LVNF_STATS_RESPONSE,
                                 None,
                                 worker.handle_lvnf_stats_response)

    return worker
Exemple #15
0
        """

        for event in self.modules.values():

            if event.tenant_id not in RUNTIME.tenants:
                return

            lvaps = RUNTIME.tenants[event.tenant_id].lvaps

            if lvap.addr not in lvaps:
                return

            LOG.info("Event: LVAP Leave %s", lvap.addr)

            handle_callback(lvap, event)


bind_module(LVAPLeaveWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVAPLeaveWorker(rest_server)
    lvap_server.register_message(PT_LVAP_LEAVE, None, worker.on_lvap_leave)

    return worker
Exemple #16
0
        for event in list(self.modules.values()):

            if event.tenant_id not in RUNTIME.tenants:
                return

            addr = EtherAddress(register['addr'])
            cpps = RUNTIME.tenants[event.tenant_id].cpps

            if addr not in cpps:
                return

            LOG.info("Event: CPP Up %s", addr)

            handle_callback(cpps[addr], event)


bind_module(CPPUpWorker)


def launch():
    """ Initialize the module. """

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = CPPUpWorker(rest_server)
    lvnf_server.register_message(PT_REGISTER, None, worker.on_cpp_up)

    return worker
                    break

        return out


class BytesCounterHandler(ModuleHandler):
    pass


class BytesCounterWorker(CounterWorker):

    MODULE_NAME = "bytes_counter"
    MODULE_HANDLER = BytesCounterHandler
    MODULE_TYPE = BytesCounter


bind_module(BytesCounterWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = BytesCounterWorker(rest_server)
    lvap_server.register_message(PT_STATS_RESPONSE, STATS_RESPONSE,
                                 worker.handle_stats_response)

    return worker
Exemple #18
0
        """

        for event in self.modules.values():

            if event.tenant_id not in RUNTIME.tenants:
                return

            wtps = RUNTIME.tenants[event.tenant_id].wtps

            if wtp.addr not in wtps:
                return

            LOG.info("Event: WTP Down %s", wtp.addr)

            handle_callback(wtp, event)


bind_module(WTPDownWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = WTPDownWorker(rest_server)
    lvap_server.register_message(PT_BYE, None, worker.on_wtp_down)

    return worker
Exemple #19
0
            if event.tenant_id not in RUNTIME.tenants:
                return

            addr = caps_response.wtp
            wtps = RUNTIME.tenants[event.tenant_id].wtps

            if addr not in wtps:
                return

            wtp = wtps[addr]

            LOG.info("Event: WTP Up %s", wtp.addr)

            handle_callback(wtp, event)


bind_module(WTPUpWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = WTPUpWorker(rest_server)
    lvap_server.register_message(PT_CAPS_RESPONSE, None, worker.on_wtp_up)

    return worker
Exemple #20
0
        Returns:
            None
        """

        for event in list(self.modules.values()):

            tenant = RUNTIME.tenants[event.tenant_id]

            if lvnf.lvnf_id not in tenant.lvnfs:
                continue

            LOG.info("Event: LVNF Join %s", lvnf.lvnf_id)

            handle_callback(lvnf, event)


bind_module(LVNFJoinWorker)


def launch():
    """ Initialize the module. """

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LVNFJoinWorker(rest_server)
    lvnf_server.register_message(PT_LVNF_JOIN, None, worker.on_lvnf_join)

    return worker
Exemple #21
0
                                length=20,
                                seq=wtp.seq,
                                trigger_id=trigger.module_id,
                                sta=lvap.addr.to_raw(),
                                relation=RELATIONS[trigger.relation],
                                value=trigger.value)

        LOG.info("Deleting trigger for sta %s: RSSI @ %s %s %s (id=%u)",
                 lvap.addr, wtp.addr, trigger.relation, trigger.value,
                 trigger.module_id)

        msg = DEL_RSSI_TRIGGER.build(del_trigger)
        wtp.connection.stream.write(msg)


bind_module(RSSIWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = RSSIWorker(rest_server)

    lvap_server.register_message(PT_HELLO, None, worker.handle_hello)
    lvap_server.register_message(PT_LVAP_JOIN, None, worker.handle_lvap_join)
    lvap_server.register_message(PT_LVAP_LEAVE, None, worker.handle_lvap_leave)
    lvap_server.register_message(PT_BYE, None, worker.handle_bye)
    lvap_server.register_message(PT_RSSI, RSSI_TRIGGER, worker.handle_trigger)
Exemple #22
0
            if event.tenant_id not in RUNTIME.tenants:
                return

            addr = EtherAddress(bye['addr'])
            cpps = RUNTIME.tenants[event.tenant_id].cpps

            if addr not in cpps:
                return

            cpp = cpps[addr]

            LOG.info("Event: CPP Down %s", cpp.addr)

            handle_callback(cpp, event)


bind_module(CPPDownWorker)


def launch():
    """ Initialize the module. """

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = CPPDownWorker(rest_server)
    lvnf_server.register_message(PT_BYE, None, worker.on_cpp_down)

    return worker
Exemple #23
0

class UCQMHandler(MapsHandler):
    pass


class UCQMWorker(MapsWorker):

    MODULE_NAME = "ucqm"
    MODULE_HANDLER = UCQMHandler
    MODULE_TYPE = UCQM

    POLLER_REQ_MSG_TYPE = 0x25
    POLLER_RESP_MSG_TYPE = 0x26

bind_module(UCQMWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = UCQMWorker(rest_server)
    lvap_server.register_message(worker.POLLER_RESP_MSG_TYPE,
                                 POLLER_RESP_MSG,
                                 worker.handle_poller_response)

    return worker
Exemple #24
0
                                seq=wtp.get_next_seq(),
                                trigger_id=trigger.module_id,
                                limit=trigger.limit,
                                every=trigger.every,
                                sta=lvap.addr.to_raw())

        LOG.info("Deleting summary for sta %s @ %s (id=%u)",
                 lvap.addr,
                 wtp.addr,
                 trigger.module_id)

        msg = DEL_SUMMARY.build(del_trigger)
        wtp.connection.stream.write(msg)


bind_module(SummaryWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = SummaryWorker(rest_server)

    lvap_server.register_message(PT_HELLO, None, worker.handle_hello)
    lvap_server.register_message(PT_LVAP_JOIN, None, worker.handle_lvap_join)
    lvap_server.register_message(PT_LVAP_LEAVE, None, worker.handle_lvap_leave)
    lvap_server.register_message(PT_BYE, None, worker.handle_bye)
    lvap_server.register_message(PT_SUMMARY,
Exemple #25
0
            return

        counter = self.modules[rates.rates_id]

        # update cache
        lvap = RUNTIME.lvaps[counter.lvap]
        lvap.rates = {x[0]: x[1] for x in rates.rates}

        # update this object
        counter.rates = {x[0]: x[1] for x in rates.rates}

        # call callback
        handle_callback(counter, counter)


bind_module(LinkStatsWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = LinkStatsWorker(rest_server)
    lvap_server.register_message(PT_RATES_RESPONSE,
                                 RATES_RESPONSE,
                                 worker.handle_rates_response)

    return worker
            return

        # update this object
        if handler_response['retcode'] != 200:
            error = handler_response['samples']
            LOG.error("Error while polling %s: %s", handler.handler, error)
            self.remove_module(handler.module_id)
            return

        handler.retcode = handler_response['retcode']
        handler.samples = handler_response['samples']

        # handle callback
        handle_callback(handler, handler)


bind_module(ReadHandlerWorker)


def launch():
    """Initialize the module."""

    lvnf_server = RUNTIME.components[LVNFPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = ReadHandlerWorker(rest_server)
    lvnf_server.register_message(PT_READ_HANDLER_RESPONSE, None,
                                 worker.handle_read_handler_response)

    return worker
Exemple #27
0
                                sta=lvap.addr.to_raw(),
                                relation=RELATIONS[trigger.relation],
                                value=trigger.value)

        LOG.info("Deleting trigger for sta %s: RSSI @ %s %s %s (id=%u)",
                 lvap.addr,
                 wtp.addr,
                 trigger.relation,
                 trigger.value,
                 trigger.module_id)

        msg = DEL_RSSI_TRIGGER.build(del_trigger)
        wtp.connection.stream.write(msg)


bind_module(RSSIWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = RSSIWorker(rest_server)

    lvap_server.register_message(PT_HELLO, None, worker.handle_hello)
    lvap_server.register_message(PT_LVAP_JOIN, None, worker.handle_lvap_join)
    lvap_server.register_message(PT_LVAP_LEAVE, None, worker.handle_lvap_leave)
    lvap_server.register_message(PT_BYE, None, worker.handle_bye)
    lvap_server.register_message(PT_RSSI, RSSI_TRIGGER, worker.handle_trigger)
Exemple #28
0
        """

        for event in self.modules.values():

            if event.tenant_id not in RUNTIME.tenants:
                return

            wtps = RUNTIME.tenants[event.tenant_id].wtps

            if wtp.addr not in wtps:
                return

            LOG.info("Event: WTP Down %s", wtp.addr)

            handle_callback(wtp, event)


bind_module(WTPDownWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = WTPDownWorker(rest_server)
    lvap_server.register_message(PT_BYE, None, worker.on_wtp_down)

    return worker
Exemple #29
0
                                type=PT_DEL_SUMMARY,
                                length=22,
                                seq=wtp.get_next_seq(),
                                trigger_id=trigger.module_id,
                                limit=trigger.limit,
                                every=trigger.every,
                                sta=lvap.addr.to_raw())

        LOG.info("Deleting summary for sta %s @ %s (id=%u)", lvap.addr,
                 wtp.addr, trigger.module_id)

        msg = DEL_SUMMARY.build(del_trigger)
        wtp.connection.stream.write(msg)


bind_module(SummaryWorker)


def launch():
    """ Initialize the module. """

    lvap_server = RUNTIME.components[LVAPPServer.__module__]
    rest_server = RUNTIME.components[RESTServer.__module__]

    worker = SummaryWorker(rest_server)

    lvap_server.register_message(PT_HELLO, None, worker.handle_hello)
    lvap_server.register_message(PT_LVAP_JOIN, None, worker.handle_lvap_join)
    lvap_server.register_message(PT_LVAP_LEAVE, None, worker.handle_lvap_leave)
    lvap_server.register_message(PT_BYE, None, worker.handle_bye)
    lvap_server.register_message(PT_SUMMARY, SUMMARY_TRIGGER,