Blogs

Scripting How-To: Print flow details for Cloud Analytics Engine using Python

By ksator posted 11-25-2015 15:14

  

This Python script (dle_rest_calls_get_differentPath.py) is for CAE (Cloud Analytics Engine). You can use it to get the list of probes that changed paths from the DLE (Data Learning Engine).

 

This script uses the DLE REST APIs to get all the flows that have been analyzed with the CAE. And then, for each flow, it gets all the probes. If a probe is not using the same network path as the previous probe, it prints the flows details (ip@, ports, …) and the time/date for this event.

 

For each flow analyzed with CAE, if a probe is not using the same network path as the previous one, this script prints the flows details and the time/date when the event occurred.

 

It’s a small script (20 lines of code. Two “for” loop and one “if” test). The code is commented and should be very easy to understand.

 

Note: You need to change the IP address of the DLE inside this program to get it to work. If the DLE database has no probe that uses a different network path as the previous probe, you won't get any interesting output.

 

Here’s an example:

 

python dle_rest_calls_get_differentPath.py

this flow (src ip, dst ip, src port, dst port, protocol) changed path at this time:
2015-05-05 19:53:29 172.28.102.11 172.28.103.10 41501 5001 UDP
this flow (src ip, dst ip, src port, dst port, protocol) changed path at this time:
2015-05-05 19:51:08 172.28.102.11 172.28.103.10 41501 5001 UDP
this flow (src ip, dst ip, src port, dst port, protocol) changed path at this time:
2015-06-19 21:32:58 172.28.102.11 172.28.103.10 46954 5001 TCP
number of flows analyzed with DLE:
38
number of REST calls to DLE:
2631

 

 

 



Attachments

dle_rest_call_get_differentPath.zip
#How-To