Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to execute one of the commands in a router, where the command won't display anything, to be more clear, here is the command
router> monitor traffic interface ae10 matching "tcp port 179" size 1500 write-file capture.pcap
when you issue the above command, here is the response from the router
Address resolution is ON. Use <no-resolve> to avoid any reverse lookup delay. Address resolution timeout is 4s. Listening on ae10, capture size 1500 bytes
In the above output for the command " monitor traffic interface ae10 matching "tcp port 179" size 1500 write-file capture.pcap", it will listen for some packet and store in pcap file, the command will/should stop only when we send CTRL_C
I tried one internal command, of our company, here is the following code and error
$rh2->cmd(mode=>'cli', cmd=>"monitor traffic interface ae10 ma +tching \"tcp port 179\" size 1500 write-file capture.pcap"); $rh2->send_control_char(char=>'CTRL_C', timeout=>2400);
the code gives the following error
Feb 17 21:26:35 [INFO ] [sherlock.1] [cmd] monitor traffic interface a +e10 matching "tcp port 179" size 1500 write-file capture.pcap Feb 17 21:27:35 [ERROR] [sherlock.1] JT::Device::_send: No pattern mat +ched during 'monitor traffic interface ae10 matching "tcp port 179" s +ize 1500 write-file capture.pcap' from patterns: [ '-re', '^(?:{(?:ma +ster|backup)(?:.*)}[\r\n]*)?(?:\[edit[^\]]*\]\s+)??JT_53_sherlock:\s* +' ] Feb 17 21:27:35 [ERROR] [sherlock.1] Device did not respond as expecte +d.Please refer the expect file Feb 17 21:27:35 [ERROR] Expected patterns are : -re ^(?:{(?:master|bac +kup)(?:.*)}[\r\n]*)?(?:\[edit[^\]]*\]\s+)??JT_53_sherlock:\s*
Is there a way to solve this using any perl commands
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Send control break in PERL
by kcott (Archbishop) on Feb 18, 2017 at 08:23 UTC |