Difference between revisions of "Using Management CLI"

 
(8 intermediate revisions by one user not shown)
Line 1: Line 1:
# start cli
+
* start cli
cd cli
+
    cd cli
./mgtcli.py
+
    ./mgtcli.py
# add network element
+
* show help
<cli> add element --host=192.168.50.5 --
+
    Usage: help [COMMAND]
name=TexasUSA --user=me --password=foo
+
    Print help page
# list directory
+
    Example:
<cli> ls
+
      <cli> help
192.168.30.4:  NewEnglandRouter
+
      <cli> help connect
X.y.z.a:             HoChiMinhCity.
+
* add network element
Vietnam
+
    Usage: add element [OPTION]
192.168.50.5:  TexasUSA
+
    Add a network element into the system
DOWN!
+
    Mandatory arguments to long options
<cli> ls /TexasUSA/ethernet/interfaces
+
      --name=        name of netconf server
<cli> ls /*/ethernet/interfaces
+
      --host=        address of netconf server
<cli> ls /TexasUSA/ethernet/interfaces[name=eth0]
+
      --port=        port to connect to netconf server
<cli> ls /TexasUSA/ethernet/interfaces[name=eth*]
+
      --user=        username to connect to netconf server
<cli> ls /[TexasUSA,*.VN]/ethernet/interfaces
+
      --password=    password to connect to netconf server
#change directory
+
    Example:
<cli> cd /TexasUSA/ethernet/interfaces
+
      <cli> add element --host=192.168.50.5 --name=TexasUSA --user=me --password=foo
<cli> cd /[TexasUSA,*.VN]/ethernet/interfaces
+
* list directory
# set value
+
    Usage: ls [OBJECT_PATH]
<cli> set /[TexasUSA,*.VN]/ethernet/interfaces/status UP
+
    List information about the management objects (the current object by default).
# load user plugin
+
    Example:
<cli> load testplugin.py
+
      <cli> ls
# run commands define in the plugin
+
      192.168.30.4:  NewEnglandRouter
<cli> show_by_name eth0
+
      X.y.z.a:       HoChiMinhCity.Vietnam
<cli> show_by_path /TexasUSA/ethernet/interfaces
+
      192.168.50.5:  TexasUSA   DOWN!
[name=eth0]
+
      <cli> ls /TexasUSA/ethernet/interfaces
# demo notification when network disconnect
+
      <cli> ls /TexasUSA/ethernet/interfaces[name=eth0]
<model deployment machine>./etc/init.d/asp stop
+
    Example with wildcards & grouping:
<cli>typing something
+
      <cli> ls /*/ethernet/interfaces
Disconnected to server TexasUSA!
+
      <cli> ls /TexasUSA/ethernet/interfaces[name=eth*]
<cli>typing something
+
      <cli> ls /[TexasUSA,*.VN]/ethernet/interfaces
# reconnect server
+
* change directory
connect TexasUSA
+
    Usage: cd [OBJECT_PATH]
 +
    Change the current management object based on the OBJECT_PATH (the current object by default).
 +
    Example:
 +
      <cli> cd /TexasUSA/ethernet/interfaces  
 +
      <cli> cd /[TexasUSA,*.VN]/ethernet/interfaces
 +
* get data
 +
    Usage: get
 +
    Get data from a netconf server.
 +
* get config data
 +
    Usage: get_config
 +
    Get config data from a netconf server.
 +
* set value
 +
    Usage: set [XPATH] VALUE
 +
    Set value to a leaf
 +
    Example:
 +
      <cli> set ethernet/interfaces[name=eth0]/adminStatus 1
 +
      <cli/ethernet/interfaces[name=eth0]/adminStatus> set 1
 +
* load a user plugin
 +
    Usage: load [PLUGIN]
 +
    Load a user python plugin
 +
    Example:
 +
      <cli> load testplugin
 +
      <cli> load testplugin.py
 +
* run commands define in the plugin
 +
    Example:
 +
      <cli> show_by_name eth0
 +
      <cli> show_by_path /TexasUSA/ethernet/interfaces[name=eth0]
 +
* demo notification when network disconnect
 +
    Example:
 +
      <model deployment machine>./etc/init.d/asp stop
 +
      <cli>typing something  
 +
      Disconnected to server TexasUSA!
 +
      <cli>typing something
 +
* reconnect server
 +
    Usage: connect [SERVER]
 +
    Connect to netconf servers.
 +
    Example:
 +
      <cli> connect
 +
      <cli> connect TexasUSA
 +
* execute shell command
 +
    Usage: shell <unix-command> or
 +
          ! <unix-command>
 +
    Execute the argument(s) in a Unix shell and print the results
 +
    Examples:
 +
      <cli> ! pwd
 +
      <cli> ! killall bugs

Latest revision as of 02:33, 24 January 2013

  • start cli
   cd cli
   ./mgtcli.py
  • show help
   Usage: help [COMMAND]
   Print help page
   Example:
     <cli> help
     <cli> help connect
  • add network element
   Usage: add element [OPTION]
   Add a network element into the system
   Mandatory arguments to long options
     --name=        name of netconf server
     --host=        address of netconf server
     --port=        port to connect to netconf server
     --user=        username to connect to netconf server
     --password=    password to connect to netconf server
   Example:
     <cli> add element --host=192.168.50.5 --name=TexasUSA --user=me --password=foo
  • list directory
   Usage: ls [OBJECT_PATH]
   List information about the management objects (the current object by default).
   Example:
     <cli> ls
     192.168.30.4:   NewEnglandRouter
     X.y.z.a:        HoChiMinhCity.Vietnam
     192.168.50.5:  TexasUSA   DOWN!
     <cli> ls /TexasUSA/ethernet/interfaces
     <cli> ls /TexasUSA/ethernet/interfaces[name=eth0]
   Example with wildcards & grouping:
     <cli> ls /*/ethernet/interfaces
     <cli> ls /TexasUSA/ethernet/interfaces[name=eth*]
     <cli> ls /[TexasUSA,*.VN]/ethernet/interfaces
  • change directory
   Usage: cd [OBJECT_PATH]
   Change the current management object based on the OBJECT_PATH (the current object by default).
   Example:
     <cli> cd /TexasUSA/ethernet/interfaces    
     <cli> cd /[TexasUSA,*.VN]/ethernet/interfaces
  • get data
   Usage: get
   Get data from a netconf server.
  • get config data
   Usage: get_config
   Get config data from a netconf server.
  • set value
   Usage: set [XPATH] VALUE
   Set value to a leaf
   Example:
     <cli> set ethernet/interfaces[name=eth0]/adminStatus 1
     <cli/ethernet/interfaces[name=eth0]/adminStatus> set 1
  • load a user plugin
   Usage: load [PLUGIN]
   Load a user python plugin
   Example:
     <cli> load testplugin
     <cli> load testplugin.py
  • run commands define in the plugin
   Example:
     <cli> show_by_name eth0
     <cli> show_by_path /TexasUSA/ethernet/interfaces[name=eth0]
  • demo notification when network disconnect
   Example:
     <model deployment machine>./etc/init.d/asp stop
     <cli>typing something    
     Disconnected to server TexasUSA!
     <cli>typing something
  • reconnect server
   Usage: connect [SERVER]
   Connect to netconf servers.
   Example:
     <cli> connect
     <cli> connect TexasUSA
  • execute shell command
   Usage: shell <unix-command> or
          ! <unix-command>
   Execute the argument(s) in a Unix shell and print the results
   Examples:
     <cli> ! pwd
     <cli> ! killall bugs