コード例 #1
0
    def send_df_updates(self):
        """Callback that is called when the client connects to the analyzer

        As the client is working asynchronously, this is where our work is
        actually being done.
        We now start sending the updates to skydive periodically.
        """
        df_objects = self._get_df_objects()
        LOG.debug('Sending to skydive: %s', df_objects)
        for node in df_objects["Nodes"]:
            node_add_msg = skydive_client.WSMessage(
                "Graph",
                skydive_client.NodeAddedMsgType,
                node
            )
            self.sendWSMessage(node_add_msg)

        for edge in df_objects["Edges"]:
            edge_add_msg = skydive_client.WSMessage(
                "Graph",
                skydive_client.EdgeAddedMsgType,
                edge
            )
            self.sendWSMessage(edge_add_msg)

        self.reschedule_send()
コード例 #2
0
 def clear_dragonflow_items(self):
     """Delete all the items created by DragonFlow"""
     restclient = RESTClient(cfg.CONF.df_skydive.analyzer_endpoint,
                             username=cfg.CONF.df_skydive.user,
                             password=cfg.CONF.df_skydive.password)
     items = restclient.lookup_edges("G.E().Has('source', 'dragonflow')")
     for edge in items:
         edge_del_msg = skydive_client.WSMessage(
             "Graph", skydive_client.EdgeDeletedMsgType, edge)
         self.protocol.sendWSMessage(edge_del_msg)
     items = restclient.lookup_nodes("G.V().Has('source', 'dragonflow')")
     for node in items:
         node_del_msg = skydive_client.WSMessage(
             "Graph", skydive_client.NodeDeletedMsgType, node)
         self.protocol.sendWSMessage(node_del_msg)