The Generic-Telnet-Driver saves the command output to a text file. A simple and easy way to read a text file is using a GA_Driver.
In particular, by setting the ReadsInputFrom attribute of a GA_Driver as a GA_FileFE object whose fileName attribute is the input file name, the GA_Driver will automatically read the file line by line as input after the driver is started.
driver->ReadsInputFrom = create(“GA_FileFE”, “Read-CLI-LSP-Ping-Output-FE-”.thread())?FAIL; driver->ReadsInputFrom->fileName = outputFile;
The ASL script used to read the CLI output is ReadCLIOutput.asl, which is located in the BASEDIR/smarts/rules/mpls-t directory in the MPLS Management Suite installation area.
For a source Cisco device, here is an example of CLI command output as written to the output text file:
enable Password: dev-VPLS5#terminal length 0 dev-VPLS5#terminal width 512 dev-VPLS5#ping mpls ipv4 10.9.7.9 255.255.255.255 repeat 5 timeout 2 size 100 interval 0 Sending 5, 100-byte MPLS Echos to 10.9.7.9/32, timeout is 2 seconds, send interval is 0 msec: Codes: '!' - success, 'Q' - request not sent, '.' - timeout, 'L' - labeled output interface, 'B' - unlabeled output interface, 'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch, 'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry, 'P' - no rx intf label prot, 'p' - premature termination of LSP, 'R' - transit router, 'I' - unknown upstream index, 'X' - unknown return code, 'x' - return code 0 Type escape sequence to stop. QQQQQ Success rate is 0 percent (0/5) dev-VPLS5#
For a source Juniper device, here is an example of CLI command output as written to the output text file:
set cli screen-length 0 Screen length set to 0 juniper@dev-MPLSp8> set cli screen-width 512 Screen width set to 512 juniper@dev-MPLSp8> ping mpls ldp 192.168.17.1 count 5 !!!!! --- lsping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss juniper@dev-MPLSp8>
The output is carried with the variable “Output” from ReadCLIOutput.asl to pinglsp-ondemand.asl, which can also be obtained from the GA_Parameters object.
This output is passed with the variable “CLIOutput” from pinglsp-ondemand.asl to LSPPing.asl. The output is displayed on the Global Console using the print operation:
print(CLIOutput);