Welcome, Guest. Please login or register.

Author Topic: JunOS cli and collecting configs  (Read 85 times)

wwwdrich

  • Newbie
  • *
  • Posts: 7
    • View Profile
JunOS cli and collecting configs
« on: November 17, 2017, 12:25:37 AM »
I have a Juniper EX2200 running JUNOS 12.3R9.4. This device is "special", as rather than an enable prompt you get dumped in a unix-like shell on login and have to use the "cli" command to get to the configuration interface. I have hacked support for it into libcli.pm, but this will break any other Juniper devices that use enable (like sane devices do).

Is there a better way to handle this? It still reports as JunOS, so I don't see a way to make this a cleaner patch.
Code: [Select]
diff -rub inc/libcli.pm.orig   inc/libcli.pm
--- inc/libcli.pm.orig 2017-11-16 15:21:29.155861226 -0800
+++ inc/libcli.pm 2017-11-16 15:12:37.612511327 -0800
@@ -433,9 +433,11 @@
 $cmd{'FujitsuE10CB'}{'page'} = 'terminal pager disable';

 # JUNIPER
-$cmd{'JunOS'}{'ropr'} = 'GitsDoNid';
+#$cmd{'JunOS'}{'ropr'} = 'GitsDoNid';
+$cmd{'JunOS'}{'ropr'} = '[\w+().-]+%\s?$';;
 $cmd{'JunOS'}{'enpr'} = '[\w+().-]+>\s?$';
-$cmd{'JunOS'}{'enab'} = 'enable';
+#$cmd{'JunOS'}{'enab'} = 'enable';
+$cmd{'JunOS'}{'enab'} = 'cli';
 $cmd{'JunOS'}{'shcf'} = 'show configuration | no-more';
 #$cmd{'JunOS'}{'dfwd'} = 'show ethernet-switching table | no-more'; # Sneuser: for switches only
 $cmd{'JunOS'}{'cfst'} = '^## Last commit';

Hannu Liljemark

  • Full Member
  • ***
  • Posts: 130
  • Here to help
    • View Profile
Re: JunOS cli and collecting configs
« Reply #1 on: November 17, 2017, 09:41:26 AM »
You could create new OS type, call it JunOS-shell or whatever, and choose that for that device in the definition generator. Then you don't have to break the existing JunOS setup in libcli.pm. But of course it might still break the same def file for your other EX2200 devices that give you the normal cli with enable command.