You are here: Using the CLI > Working in the CLI > CLI Contexts and Objects

CLI Contexts and Objects

The FortiADC CLI is a context oriented command interface. This means that the commands available at any time (and the objects they affect) depend on the current context. The current command context is always indicated in the CLI prompt. When you start the CLI, the command prompt looks like this:

eqcli >

This indicates that you are in the global context -- all commands available in the CLI for all objects can be executed from this context, and you can also set parameters for global services (such as NTP, DNS, etc.). You can also change to other contexts, whose scope is limited to a specific object. For example, you can enter the cluster specific context for a cluster named cl01 by typing:

eqcli > cluster cl01

eqcli cl-cl01>

The prompt above indicates that the cluster specific context for cl01 is the current context. In this context, the only commands available are those that affect cluster cl01.

Note that only the first 4 characters of an object name appear in the eqcli prompt. For example, if you have a cluster named mycluster, then you would enter the cluster specific context for this cluster by typing:

eqcli > cluster mycluster

eqcli cl-myc*>

The asterisk (*) in the prompt indicates that there are more than 4 characters in the cluster name. To display the complete object name in any context, use the context command:

eqcli cl-myc*> context

The current context is: ‘mycluster’

eqcli cl-myc*>

In each context, you can perform operations on the objects and parameters that exist in that context (e.g., create, delete, modify, display, set). When you change to another context, the eqcli prompt changes to include the suffix indicated in the chart above for each context. For example, when you change to the server context, the eqcli prompt changes from “eqcli >” to “eqcli sv>”.

Within each context shown above, you can also type in the name of an object (existing or new) to enter an object specific context that will allow you to edit only that object’s settings.

So, for example, you can start eqcli and type server to change to the server context -- as indicated by the prompt, which changes to “eqcli sv>”. Now, you can use the list command to list all the existing servers. If you then type in the name of one of the existing servers while in the server context, you will enter the server specific context for that existing server -- the prompt changes to “eqcli sv-server_name>” to indicate that you are in the server specific context for the server with the name server_name. You could also do this directly from the global context by typing:

eqcli > show server

eqcli > sv-server_name show

Note that the eqcli prompt reserves only four characters for object names. So, for example, if you have a server named sv02, the entire server name will be displayed in the prompt, as shown in this example:

eqcli > server sv02

eqcli sv-sv02>

If the object name is longer than four characters, eqcli displays the first three characters and an asterisk (*) to show that the name is longer than four characters. For example, if you have a server named Server2, the prompt will look as follows when you change to the Server2 specific context:

eqcli > server Server2

eqcli sv-Ser*>

The complete current context can always be displayed using the context command, as in this example:

eqcli > server Server2

eqcli sv-Ser*> context

The current context is: Server2

eqcli sv-Ser*>

Related Topics IconRelated Topics