Op Scripts for Troubleshooting Services Management RESTful Web Services
The following operations can be performed using the Connectivity Services Director Op Scripts for Troubleshooting Services Management RESTful Web Services. Op scripts are based on the Junos XML management protocol, and the Junos XML API. Op scripts can be written in either the Extensible Stylesheet Language Transformations (XSLT) or Stylesheet Language Alternative Syntax (SLAX) scripting language. Op scripts use XPath to locate the operational objects to be inspected and XSLT constructs to specify the actions to perform on the located operational objects. The actions can change the output or execute additional commands based on the output. The troubleshooting feature provides an easy and unique way to troubleshoot the services. You do not have to manually login to a device to check the status of services in the Connectivity Services Director application, but you can do the same using the functionality of operational scripts. You do have the flexibility of writing your own scripts to view the results.
Get a List of Op Scripts for a VPN Service
This request is used to retrieve the list of operational (op) scripts for a particular service.
URI | serviceui/resteasy/troubleshoot-service/ |
HTTP Method | GET |
Consumes | application/json application/xml |
Produces | Retrieves the op scripts configured for a particular service. |
Output
Sample XML Output
{ "OpScriptUIBean": { "contexts": [ { "name": "/device[name=\"junos-space2\"]/interface[name=\"ge-0/1/4.178\"]", "value": "" }, { "name": "/device[name=\"junos-space3\"]/interface[name=\"ge-0/1/2.178\"]", "value": "" }, { "name": "/device[name=\"junos-space2\"]/configuration/routing-instances/instance[name=\"bgp1\" and instance-type=\"l2vpn\"]/interface[name=\"ge-0/1/4.178\"]", "value": "" }, { "name": "/device[name=\"junos-space3\"]/configuration/routing-instances/instance[name=\"bgp1\" and instance-type=\"l2vpn\"]/interface[name=\"ge-0/1/2.178\"]", "value": "" } ], "scriptBeans": [ { "createdDate": "May 18, 2015 11:55:55 AM IST", "description": "Shows L3VPN Ping results (Data Plane) information", "lastUpdatedDate": "May 18, 2015 11:55:55 AM IST", "name": "local-execution-script2.slax", "parameters": { "description": "Remote UNI IPs.(Multiple ips needs to be comma separated)", "name": "RemoteIPs", "scriptid": 0, "value": "" }, "scriptId": 327688, "type": "Local", "version": 1 }, { "createdDate": "May 18, 2015 16:19:42 PM IST", "description": "Shows L3VPN Ping results (Data Plane) information", "lastUpdatedDate": "May 18, 2015 16:19:42 PM IST", "name": "local-execution-script3.slax", "parameters": { "description": "Remote UNI IPs.(Multiple ips needs to be comma separated)", "name": "RemoteIPs", "scriptid": 0, "value": "" }, "scriptId": 557068, "type": "Local", "version": 1 } ], "serviceId": 1277965 } }
Execute the Op Script for an Endpoint of a VPN Service
This request is used to execute the op script for endpoints of a service for troubleshooting purposes.
URI | serviceui/resteasy/troubleshoot-service/execute- |
HTTP Method | POST |
Consumes | application/json application/xml |
Produces | Executes the op script for endpoints of a particular service. |
Input
Sample XML Input
{ "ScriptUIBeanList":{ "scriptUIBeans":[ { "scriptId":327688, "name":"local-execution-script2.slax", "description":"Shows L3VPN Ping results (Data Plane) information", "version":1, "createdDate":"May 18", "lastUpdatedDate":"May 18, 2015 11:55:55 AM IST", “type”:”Device”, "parameters":[ { "CONTEXT":"context", "name":"CONTEXT", "scriptid":327688, "value":"/device[name=\"junos-space2\"]/configuration/routing-instances/instance[name=\"bgp1\" and instance-type=\"l2vpn\"]/interface[name=\"ge-0/1/4.178\"]", "scriptName":"local-execution-script2.slax" }, { "description":"Remote UNI IPs.(Multiple ips needs to be comma separated)", "name":"RemoteIPs", "scriptid":327688, "value":"", "scriptName":"local-execution-script2.slax" } ] } ] } }
Output
Sample XML Output
{ success:'true', title:'Execute Script Results', contexts:'[/device[name="junos-space2"]/configuration/routing-instances/instance[name="bgp1" and instance-type="l2vpn"]/interface[name="ge-0/1/4.178"]]', serviceId:'1277965', message:'1474654' }
The message field signifies the job ID in the preceding output.
View the Job Results of an Executed Op Script for a VPN Service
This request is used to view the results of the job run to execute the op script.
URI | serviceui/resteasy/troubleshoot-service/ |
HTTP Method | GET |
Consumes | application/json application/xml |
Produces | Displays the results of the job that was run to execute the op script. |
Output
Sample XML Output
{ "OpScriptJobResultUIBean": { "jobId": 1474654, "scriptResultUIBeans": { "deviceId": 131113, "deviceName": "junos-space2", "jobId": 1474654, "scriptId": 327688, "scriptName": "local-execution-script2.slax", "scriptVersion": 1, "status": "Failed" }, "status": "Success" } }
Get a List of Op Scripts for an LSP Service
This request is used to retrieve the list of operational (op) scripts for a particular LSP service.
URI | serviceui/resteasy/troubleshoot-service/ |
HTTP Method | GET |
Consumes | application/json application/xml |
Produces | Retrieves the op scripts configured for a particular LSP service. |
Output
Sample XML Output
{ "OpScriptUIBean": { "contexts": [ { "name": "/device[name=\"960R2_EN_Alok_re\"]/configuration/protocols/mpls/lsp[name=\"FMRSVPBFD Secondary_7R1_960R2_EN_Alok_re_to_128_220_22_115,FMRSVPBFDSecondary_7R1_960R2_ EN_Alok_re_to_128_220_14_166,FMRSVPBFDSecondary_7R1_960R2_EN_Alok_re_to_128_220_18_185,\"]", "value": "" }, { "name": "/device[name=\"960R1_EN_Alok_re\"]/configuration/protocols/mpls/lsp[name=\ "FMRSVPBFDSecondary_7R1_960R1_EN_Alok_re_to_128_220_14_166,FMRSVPBFD Secondary_7R1_960R1_EN_Alok_re_to_128_220_18_185,FMRSVPBFDSecondary_7R1_960R1_EN_Alok_re_to_128_220_22_103,\"]", "value": "" }, { "name": "/device[name=\"480R3_EN_Alok_re\"]/configuration/protocols/mpls/lsp[name= \"FMRSVPBFDSecondary_7R1_480R3_EN_Alok_re_to_128_220_14_166,FMRSVPBFD Secondary_7R1_480R3_EN_Alok_re_to_128_220_22_115,FMRSVPBFDSecondary_7R1_480R3_EN_Alok_re_to_128_220_22_103,\"]", "value": "" }, { "name": "/device[name=\"480R4_EN_Alok_re\"]/configuration/protocols/mpls/lsp[name= \"FMRSVPBFDSecondary_7R1_480R4_EN_Alok_re_to_128_220_18_185,FMRSVPBFD Secondary_7R1_480R4_EN_Alok_re_to_128_220_22_103,FMRSVPBFDSecondary_7R1_480R4_EN_Alok_re_to_128_220_22_115,\"]", "value": "" } ], "scriptBeans": { "createdDate": "May 13, 2016 07:16:54 AM UTC", "description": "RSVP LSP Predefined Script", "lastUpdatedDate": "May 13, 2016 07:16:54 AM UTC", "name": "RSVPLSPPredefinedScript.slax", "scriptId": 229404, "type": "Local", "version": 1 }, "serviceId": 213 } }
Execute the Op Script for an Endpoint of an LSP Service
This request is used to execute the op script for endpoints of an LSP service for troubleshooting purposes.
URI | serviceui/resteasy/troubleshoot-service/TA/execute- |
HTTP Method | POST |
Consumes | application/json application/xml |
Produces | Executes the op script for endpoints of a particular LSP service. |
Input
Sample XML Input
{ "ScriptUIBeanList":{ "scriptUIBeans":[ { "scriptId":229404, "name":"RSVPLSPPredefinedScript.slax", "description":"RSVP LSP Predefined Script", "version":1, "createdDate":"May 13, 2016 07:16:54 AM UTC", "lastUpdatedDate":"May 13, 2016 07:16:54 AM UTC", "type":"Local", "parameters":[ ] } ] } }
Output
Sample XML Output
{ success:'true', title:'Execute Script Results', contexts:'[/device[name="junos-space2"]/configuration/routing-instances/instance[name="bgp1" and instance-type="l2vpn"]/interface[name="ge-0/1/4.178"]]', serviceId:'1277965', message:'1474654' }
The message field signifies the job ID in the preceding output.
View the Job Results of an Executed Op Script for an LSP Service
This request is used to view the results of the job run to execute the op script.
URI | serviceui/resteasy/troubleshoot-service/TA/ |
HTTP Method | GET |
Consumes | application/json application/xml |
Produces | Displays the results of the job that was run to execute the op script for an LSP service. |
Output
Sample XML Output
{ "OpScriptJobResultUIBean": { "jobId": 1474654, "scriptResultUIBeans": { "deviceId": 131113, "deviceName": "junos-space2", "jobId": 1474654, "scriptId": 327688, "scriptName": "local-execution-script2.slax", "scriptVersion": 1, "status": "Failed" }, "status": "Success" } }