Basic Requirements of Operational Scripts
For operational (op) scripts, the context is a required argument because a context is transmitted to the script, when the script is run from troubleshooting operation. The format of the argument to be pushed to the script is as follows:
var $arguments = { <argument> { <name> "CONTEXT"; <description> "The CONTEXT."; } } var $CONTEXT;
The context has parameters based on the service type, which needs to be parsed to use the parameters.
The following is an example of an E-Line LDP service context:
Context: /device[name=”deviceName”]/configuration/protocols/l2circuit/neighbor[name=”neighbor IP”]/interface[name=”interfaceName.unitID”]
The code in op script to parse the context is as follows:
var $tempContext = str:replace(str:replace($CONTEXT, "/device[name=\"", ""), "\"]/configuration/protocols/l2circuit/neighbor[name=\"", "|"); var $finalContext = str:replace(str:replace($tempContext, "\"]/interface[name=\"", "|"), "\"]", ""); var $variables = jcs:split( "\\|", $finalContext ); var $deviceName = $variables[1]; var $neighborIp = $variables[2]; var $interfaceName = $variables[3];
The following is an example of an E-Line BGP service context:
Context: /device[name=”device name”]/configuration/routing-instances/instance[name=”Service name” and instance-type=”l2vpn”]/bgp/interface[name=”interfaceName.unitID”]
The code in op script to parse the context is as follows:
var $tempContext1 = str:replace(str:replace($CONTEXT, "/device[name=\"", ""), "\"]/configuration/routing-instances/instance[name=\"", "|"); var $tempContext2 = str:replace($tempContext1, "\" and instance-type=\"l2vpn\"]", ""); var $finalContext = str:replace(str:replace($tempContext2, "/bgp/interface[name=\"", "|"), "\"]", ""); var $variables = jcs:split( "\\|", $finalContext ); var $deviceName = $variables[1]; var $instanceName = $variables[2]; var $interfaceName = $variables[3];
The following is an example of an E-Line E-LAN service context:
Context: /device[name=”device name”]/configuration/routing-instances/instance[name=”Service name” and instance-type=”vpls”]/vpls/interface[name=”interfaceName.unitID”]
The code in op script to parse the context is as follows:
var $tempContext1 = str:replace(str:replace($CONTEXT, "/device[name=\"", ""), "\"]/configuration/routing-instances/instance[name=\"", "|"); var $tempContext2 = str:replace($tempContext1, "\" and instance-type=\"vpls\"]", ""); var $finalContext = str:replace(str:replace($tempContext2, "/vpls/interface[name=\"", "|"), "\"]", ""); var $variables = jcs:split( "\\|", $finalContext ); var $deviceName = $variables[1]; var $instanceName = $variables[2]; var $interfaceName = $variables[3];
The following is an example of an E-Line IP service context:
Context: /device[name=”device name”]/configuration/routing-instances/instance[name=”Service name” and instance-type=”vrf”]/vrf/interface[name=”interfaceName.unitID”]
The code in op script to parse the context:
var $tempContext1 = str:replace(str:replace($CONTEXT, "/device[name=\"", ""), "\"]/configuration/routing-instances/instance[name=\"", "|"); var $tempContext2 = str:replace($tempContext1, "\" and instance-type=\"vrf\"]", ""); var $finalContext = str:replace(str:replace($tempContext2, "/vrf/interface[name=\"", "|"), "\"]", ""); var $variables = jcs:split( "\\|", $finalContext ); var $deviceName = $variables[1]; var $instanceName = $variables[2]; var $interfaceName = $variables[3];
Predefined Scripts for Troubleshooting
Predefined troubleshooting scripts are included by default, during the installation of Connectivity Services Director. The following are the script names for each service and the commands supported for them.
E-Line LDP Service
P2PLDPPredefinedScript.slax is the predefined script that is uploaded.
The following are the supported commands:
get-l2ckt-connection-information
get-interface-information
get-ldp-session-information
get-ldp-neighbor-information
E-Line BGP Service
P2PBGPPredefinedScript.slax is the predefined script that is uploaded.
The following are the supported commands:
get-l2vpn-connection-information
get-interface-information
get-bgp-summary-information
get-interface-statistics
E-LAN Service
VPLSPredefinedScript.slax is the predefined script that is uploaded.
The following are the supported commands:
get-vpls-connection-information
get-interface-information
get-interface-statistics
IP Service
L3VPNPredefinedScript.slax is the predefined script that is uploaded.
The following are the supported commands:
get-vrrp-connection-information
get-interface-information
get-interface-statistics
RSVP LSP Service
RSVPLSPPredefinedScript.slax is the predefined script that is uploaded.
The following are the supported commands:
get-mpls-connection-information
get-mpls-lsp-information