Пример #1
0
    def load_config(self):
        """
            Parses the parameters received and instantiates the
            apps requested.
        """
        # Get CLI params and call the pcapy loop
        self.cap, self.packet_number, \
            self.load_apps, sanitizer, \
            topo_file, is_to_save = get_params(sys.argv)
        self.sanitizer.process_filters(sanitizer)

        # Load TopologyReader
        self.topo_reader.readfile(topo_file)

        # Save to File
        self.save_to_file = save_to_file(is_to_save)

        # Start Apps
        self.ofp_proxy = OFProxy()

        if 'oess_fvd' in self.load_apps:
            self.oft = OessFvdTracer(self.load_apps['oess_fvd'])

        if 'statistics' in self.load_apps:
            self.stats = OFStats()
            if 'influx' in self.load_apps:
                self.influx = InfluxClient(trigger_event=self.trigger_event)

        if 'notifications' in self.load_apps:
            self.notifications = Notifications(self.load_apps['notifications'])
Пример #2
0
    def _update_tcp_reconnects(self):
        """ Update the number of TCP Reconnects on InfluxDB

        """
        OFStats().num_reconnects
        json_body = [{
            "measurement":
            "OFP_messages",
            "tags": {
                "controllers": "tcp"
            },
            "time":
            "{0}".format(datetime.datetime.utcnow().isoformat('T')),
            "fields": {
                "reconnects": OFStats().num_reconnects
            }
        }]
        self.logger.debug(json_body)
        self.db_client.write_points(json_body)
Пример #3
0
    def _update_per_dpid(self):
        """ This method updates stats per dpid on InfluxDB
            TODO: currently, OFStats().per_dev_packet_type is empty

        """
        dpids = OFStats().per_dev_packet_types.keys()
        self.logger.debug("dpids: {0}".format(dpids))
        for dpid in dpids:
            json_body = [{
                "measurement":
                "OFP_messages",
                "tags": {
                    "dpid": dpid
                },
                "time":
                "{0}".format(datetime.datetime.utcnow().isoformat('T')),
                "fields":
                OFStats().per_dev_packet_types[dpid]
            }]
            self.logger.debug(json_body)
            self.db_client.write_points(json_body)
Пример #4
0
    def _update_packet_types(self):
        """Update OpenFlow version global stats on InfluxDB

        """
        for v, fields in OFStats().packet_types.items():
            json_body = [{
                "measurement":
                "OFP_messages",
                "tags": {
                    "OFP_version": v
                },
                "time":
                "{0}".format(datetime.datetime.utcnow().isoformat('T')),
                "fields":
                fields
            }]
            self.logger.debug(json_body)
            self.db_client.write_points(json_body)
Пример #5
0
    def load_config(self):
        """
            Parses the parameters received and instantiates the
            apps requested.
        """
        # Get CLI params and call the pcapy loop
        self.cap, self.packet_number, \
            self.load_apps, sanitizer, topo_file = get_params(sys.argv)
        self.sanitizer.process_filters(sanitizer)

        # Load TopologyReader
        self.topo_reader.readfile(topo_file)

        # Start Apps
        if 'oess_fvd' in self.load_apps:
            self.oft = OessFvdTracer()

        if 'statistics' in self.load_apps:
            self.stats = OFStats()

        # Load Proxy
        self.ofp_proxy = OFProxy()