CLI Roadmap

Chuck Anderson cra at WPI.EDU
Mon Oct 15 19:23:50 UTC 2012


On Sun, Oct 14, 2012 at 07:41:01PM +0200, Kasper Adel wrote:
> I have never used any CLI other than Cisco so i am curious what useful and
> creative knobs and bolts are available for other network appliance Vendors.

Junos OS has:

- Multi-level hierarchical configuration with absolute or relative
  configuration editing, comments (annotations), and XML support.

Hierarchical configuration:

[edit]
user at device# show | find interfaces
interfaces {
    ge-0/0/0 {
        description "foo";
        flexible-vlan-tagging;
        encapsulation flexible-ethernet-services;
        unit 10 {
            description "bar";
            vlan-id 10;
            family inet {
                address 10.1.2.3/24;
            }                           
        }                               
    }
}


Absolute (from the root of the configuration tree) editing:

[edit]
user at device# set interfaces ge-0/0/0 description "foo"

[edit]
user at device# set interfaces ge-0/0/0 flexible-vlan-tagging

[edit]
user at device# set interfaces ge-0/0/0 encapsulation flexible-ethernet-services

[edit]
user at device# set interfaces ge-0/0/0 unit 10 description "bar"

[edit]
user at device# set interfaces ge-0/0/0 unit 10 vlan-id 10

[edit]
user at device# set interfaces ge-0/0/0 unit 10 family inet address 10.1.2.3/24


Relative (from any level in the configuration tree) editing:

[edit]
user at device# edit interfaces

[edit interfaces]
user at device# edit ge-0/0/0 unit 10

[edit interfaces ge-0/0/0 unit 10]
user at device# show 
description "foo";
vlan-id 10;
family inet {
    address 10.1.2.3/24;
}

[edit interfaces ge-0/0/0 unit 10]
user at device# set vlan-id 20

[edit interfaces ge-0/0/0 unit 10]
user at device# show | match vlan-id
vlan-id 20;


- Non-immediate configuration editing with commit/rollback
  functionality.

- The ability to pre-configure hardware that isn't installed yet.

- Configuration diff (compare), patch, merge, replace, etc.

[edit interfaces ge-0/0/0 unit 10]
user at device# set family inet mtu 9000    

[edit interfaces ge-0/0/0 unit 10]
user at device# show | compare 
[edit interfaces ge-0/0/0 unit 10 family inet]
-    mtu 1500;
+    mtu 9000;

- Template & derived configurations (configuration groups,
  apply-groups, apply-path, interface-ranges which support
  GLOBs/regular expressions, etc.)

- Scripting with Op Scripts (create CLI command extensions), Event
  Scripts (react to device events), and Configuration Scripts (modify
  the to-be-committed configuration in various ways).

- Piping ala UNIX:

user at device> show configuration | ?
Possible completions:
  compare              Compare configuration changes with prior version
  count                Count occurrences
  display              Show additional kinds of information
  except               Show only text that does not match a pattern
  find                 Search for first occurrence of pattern
  hold                 Hold text without exiting the --More-- prompt
  last                 Display end of output only
  match                Show only text that matches a pattern
  no-more              Don't paginate output
  request              Make system-level requests
  resolve              Resolve IP addresses
  save                 Save output text to file
  trim                 Trim specified number of columns from start of line

user at device> show configuration | display ?
Possible completions:
  changed              Tag changes with junos:changed attribute (XML only)
  commit-scripts       Show data after commit scripts have been applied
  detail               Show configuration data detail
  inheritance          Show inherited configuration data and source group
  omit                 Emit configuration statements with the 'omit' option
  set                  Show 'set' commands that create configuration
  xml                  Show output as XML tags


> I guess what makes *NIX CLI/Shell so superior is that you can advanced
> stuff from the CLI using sed, awk and all the great tools there so maybe
> this is also one thing missing.

and if you really need the UNIX shell, Junos OS has that too with sed,
awk, etc.:

user at device> start shell
%




More information about the NANOG mailing list