Difference between revisions of "Flow/Settings/Global/Integrations"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
Line 1: Line 1:
 
Integrations allow you to call external pages or event scripts from the device interface overview page.
 
Integrations allow you to call external pages or event scripts from the device interface overview page.
By selecting web as the
 
  
 +
There are 2 types if integration targets available
 +
1) Web, where we will call a user selected web page and pass the supplied fields as post params
 +
2) Event Script where you can call on flows event subsystem to run scripts based on the users input
 +
 +
When adding an integration, you can specify which fields to prompt the user for as well as which fields to pass from the current device/index.
 +
The 2 available selection fields are flow_device and flow_ifindex providing the IP address of the device and the ifindex of the selected interface.
 +
Below we are using the "populated" field to tell the software that we want to populate the device field with the ip address and the ifindex field with the ifindex, these fields (device/ifindex) will be passed to the target
 +
We also have "required" fields, which are fields which the user is required to populate
 
Integration Input Fields
 
Integration Input Fields
 
  {
 
  {

Revision as of 13:58, 18 May 2018

Integrations allow you to call external pages or event scripts from the device interface overview page.

There are 2 types if integration targets available 1) Web, where we will call a user selected web page and pass the supplied fields as post params 2) Event Script where you can call on flows event subsystem to run scripts based on the users input

When adding an integration, you can specify which fields to prompt the user for as well as which fields to pass from the current device/index. The 2 available selection fields are flow_device and flow_ifindex providing the IP address of the device and the ifindex of the selected interface. Below we are using the "populated" field to tell the software that we want to populate the device field with the ip address and the ifindex field with the ifindex, these fields (device/ifindex) will be passed to the target We also have "required" fields, which are fields which the user is required to populate Integration Input Fields

{
 'populated':{
 'device':'flow_device',
 'ifindex':'flow_ifindex'
},
'required':[
 {'name':'user','display':,'type':'text','value':},
 {'name':'password','display':'Password','type':'password'},
 {'name':'macro','display':'What Macro?','type':'select','data':['macro1','macro2','macro3','macro4']}
]
} 
var ProcessBuilder = Java.type('java.lang.ProcessBuilder');
var BufferedReader = Java.type('java.io.BufferedReader');
var InputStreamReader= Java.type('java.io.InputStreamReader');
output.append(data);
output.append("Device IP:"+data.get("device")+"
"); output.append("IFIndex:"+data.get("ifindex")+"
"); try { // Use a ProcessBuilder //var pb = new ProcessBuilder("ls","-lrt","/"); //linux var pb = new ProcessBuilder("cmd.exe", "/C", "dir"); //windows output.append("Command Run
"); var p = pb.start(); var is = p.getInputStream(); var br = new BufferedReader(new InputStreamReader(is)); var line = null; while ((line = br.readLine()) != null) { output.append(line+"
"); } var r = p.waitFor(); // Let the process finish. if (r == 0) { // No error // run cmd2. } output.append("All Done
"); } catch ( e) { output.append(e.printStackTrace()); } log.warn("end")