Config CLI Commands

Command Definition
add Add a new item for an entity.
apply Apply changes on just the current entity.
changes

View a list of config areas with unapplied changes.

delete Delete an item for an entity.
discard Discard changes on just the current entity
edit Making changes to configuration options without navigating through the hierarchy.
exit

Leave config mode without applying changes.

help / ?

Display the available options for the configuration section.

Can be used in combination with a command or configuration option to access help documentation.

import/export

Copy a config file from a specific network location to the console server and run the file. The import/export commands operate in bash, ie. outside of config CLI. You must exit config to operate the import/export features.

show Display information relevant to the configuration section, highlighting changes.
up/exit/ .. Allows users to traverse the configuration hierarchy.

add

Description

The add command will add a new item for an entity. The add command requires a unique value to identify the record. This will be used for the entity's label field.

The add command can be used:

  • Anywhere within the command structure to begin the process of progressively adding an element.

  • As part of a single line command where an element is added and simple fields are set.

Parameters

entity - the entity to which the new item will be added

label - a unique value to identify the record

field - optional field to set for the item

value - optional value corresponding to the field

Syntax

add <entity> <optional-entity> <label> <optional-field> <optional-value

Example

add user aconsoleuser description "I am a console user"

apply

Description

The apply command allows users to stage configuration changes by allowing proposed changes to be held in memory, separate from active configuration until they are applied.

This may be considered from a user perspective like this:

"When I am adding users and realize that groups are missing, I can take a pause and add the groups without having to discard my work so far."

or

"When I am in the process of creating a new firewall zone but there is required service missing, I can go off and add the service and come back without losing changes."

Users can choose to apply changes in the following manner:

  • Isolated changes that are specific to sections of configuration.

  • Across all configurations.

Parameters

When no parameters are provided, the command will apply the changes in the current item context. For example, if the current context is user consoleuser, any changes to the consoleuseruser will be saved. If the apply command is used outside of an item context, this will result in an error.

apply all – When the ‘all’ parameter is added, the command will apply all changes to all items that have been changed in this session.

 

Syntax

apply [all]

Examples

Apply changes to a single item

These commands change a user. Then the apply command is used while still in the “user myuser” item context so only changes to this user are applied:

config: user myuser
config(user myuser): password secret123 description "This is my user"
config(user myuser): apply

Apply all changes

These commands add a new group and then change a port setting. At the end, the apply all command saves both the group and port items.

config: add group mygroup
config: group mygroup
config(group mygroup): access_rights
config(group mygroup access_rights): add pmshell
config(group mygroup access_rights): up
config(group mygroup): ports
config(group mygroup ports): add port01
config(group mygroup ports): top
config: port port01
config(port port01): label "Port for my group"
config(port port01): top
config: apply all

Apply changes to specific sections of configuration

From within a specific section of hierarchy. For example, if the user is in the

config users johnsmith
apply

This will apply any changes made specifically within the user’s configuration section.

Apply changes from a different section in the hierarchy

For example, if changes have been made in

config users johnsmith

but the user has moved elsewhere in the hierarchy, the command:

apply users johnsmith

will apply any changes made specifically within the user’s configuration section.

Alternatively, a user might choose to apply all changes in the user list using the following command:

apply users

Using apply across all configurations

apply

apply all

changes

Description

The changes command allows users to view a list of config areas with unapplied changes.

This will be a list, ordered alphabetically. Users should be able to copy and paste items from the list and use it in conjunction with the show command to view details.

Parameters

none

Syntax

changes

Examples

The following example shows changes made to multiple users and a port:

config: edit user root description "New description"
config: add user newuser description "New User"
config: edit port port01 baudrate 115200
config: changes
Entity user item root (edit)
 description New description
Entity user item newuser (add)
 description New User
Entity port item port01 (edit)
 baudrate 115200

delete

Description

The delete command is used to delete an item or entity or remove a config section or sub-section. The command requires a unique value to identify the record. This will be used for the entity's label field.

Similar to the add command, delete makes the change in a temporary state and will affect configuration only once applied.

The delete command can be used on:

  • Existing configuration

  • Unapplied changes

When used on unapplied changes, this will behave in the same way as the discard command.

Parameters

entity - the entity from which to delete the item.

Item-label - the label identifying the item to delete.

Syntax

delete <entity> <optional-entity> <item-label>

Example

delete user aconsoleuser
config:

Removing an element

From the users context:

delete "username"

Single line command

delete user "username"
apply

Either of the above examples will result in exiting the context of an item being deleted.

Refer to the apply command for how this will behave.

 

discard

Description

The discard command is used to remove unapplied changes.

This can be used to discard specific or configuration wide changes including:

  • Updates to configuration items

  • Unapplied additions

  • Items designated for deletion

Parameters

discard - when used on its own discard the current item when in an item context, otherwise it will be an error.

discard all - when used with the ‘all’ command, then any changes staged in the current session will be dropped.

Syntax

discard [all]

Examples

The following commands create a user and then discard the user (it is never saved).

Note:The context changes to exit the ‘myuser’ item since it no longer exists.

config: add user myuser

config: user myuser

config(user myuser): discard

Discard changes

config(user):

The following commands discard changes to an existing item. The item isn’t removed in this case since it has been applied previously. The description field will revert back to whatever it was before.

config: user root
config(user root): description "Root user"
config(user root): discard

The following commands discard changes to multiple entities, the group and port entities. Both will be reverted:

config: edit group admin description "New group description"
config: edit port port01 label "New label"
config: discard all

Discard all changes

discard *

This will result in a confirmation being displayed.

Discard groups of changes

discard auth user “username”

  • If “username” is an addition that has not been applied, it will result in the added user being discarded. In this case the user will be prompted to confirm before the command is implemented.

  • If “username” is an existing user with unapplied configuration changes, this will result in any changes there being discarded. A confirmation will be required.

  • If “username” is an existing user but with no changes, the user will be informed that there are no configuration changes to discard.

Discarding specific changes

port port01
discard

  • If the entity has unapplied changes it will be discarded.

  • If there are no unapplied changes an information message is displayed.

Confirmation

Discarding changes at a section, or configuration wide level will give a warning that multiple changes will be discarded.

 

edit

Description

The edit command is used when making changes to configuration options without navigating through the hierarchy.

Parameters

entity - the entity to be edited.

item-label - unique value that identifies the item.

record field - the field to set for the item.

value- the value corresponding to the field.

Syntax

edit <entity> <optional-entity> <item-label> <field>

<value>

Examples

Consider the following change to a port label:

config
port
port_01
label "Office-switch"

Alternatively, consider making the change from the root of configuration mode.

config
edit port port_01 label "Office-switch"

exit

Description

The exit command can be run at any level in the configuration structure and will allow you to leave config mode. If there are unapplied changes, you are informed and asked to confirm it you wish to proceed.

Parameters

There are no parameters applicable to the exit command.

Syntax

exit

Example

exit

 

help (or ?)

Description

Note:Config mode will accept either help or a question mark ? input.

Can be used in the following ways:

  • A standalone command to view available options for the configuration section.

  • In combination with a command to access help documentation.

  • In combination with a configuration option to access help documentation and examples.

Parameters

The help command shows help for the current context.

command - shows help for the command.

field - shows help for the field.

Syntax

help <command or field>

<command or field> ?

Examples

The following will print help for the “port port01” context:

config(port port01): help

or

config(port port01): ?

The following will print help for the baudrate field when in the “port port01” context:

config(port port01): help baudrate

or

config(port port01): baudrate ?

Help command used standalone

When used by itself, help or ? returns a list of available commands or configuration options.

Help used in conjunction with a command

apply ?

When used in conjunction with a command, help displays available sub-options.

For example, when running the apply command from the root config level, the help command notifies you that changes will traverse the configuration structure, however, when running the help command from within a configuration section, changes will apply to configuration options contained within.

add user ?

Displays help content including syntax and config items (mandatory and optional).

Help used with a configuration option

In the context of this example, the user is running the command from within the port configuration section and is wanting to get information on the available options.

pinout ?

This will display a list of available options.

label ?

This will display expected format and a sample.

 

import/export

Description

Note:The import / export and associated commands operate in bash, ie. outside of config CLI. You must exit config to operate the import/export features.

The Import / Export feature allows you to export the current configuration to a file and import or restore the configuration from that file. An import will add configuration to the current configuration and restore will replace the current configuration with the contents of the configuration file.

Import

Running the import command (within bash, not in config:) will allow you to import a configuration script from an external source file. You should point the console server to a config file on specific network location. The file will be copied to the console server and run. Depending on how it has been set up, the changes can be automatically applied after the config file is run.

Export

Running the export command (within bash, not in config:) will allow you to generate a configuration script based on the existing configuration on the console server.

This command can be run at any level in the hierarchy and used to export either:

  • The configuration across the node

  • Configuration specific to the users’s location in the hierarchy.

export all current config

Will display all config on the console server before it has been applied for copying.

export all saved config

Will display all saved config on the console server for copying.

export current config

Will display the config from the users’s current position in the navigation hierarchy.

Parameters

Import and export are run from outside of the config shell. The config command is invoked from bash with different parameters to cause it to import or export the configuration without entering the config shell.

filename – The name of the file to be imported from or exported to. If omitted then stdin or stdout will be used.

Syntax

config export <optional filename>

config import <optional filename>

Examples

config export /tmp/console_server.config

config import /tmp/console_server.config

 

 

Positional arguments

{export,import,restore,merge,replace,get}

Positional Argument Description
export Export the current configuration.
import Import config from a file.
restore Restore config from a file.
merge Merge a provided list with existing config.
replace Replace a list or item.
get Display an entity's associated values
Options
-h, --help Show this help message and exit.
--show-config Display the entire configuration and exit.
-d Increase debugging (up to 3 times).
-j Export in json format.
--entities

Display entities and exit.

Exporting to a file

Note:The import/export and associated commands operate in bash, ie. outside of config CLI. You must exit config to operate the import/export features.

show

Description

The show command displays information relevant to the configuration section, including the highlighting of changes. The context in which the command is run will determine what is displayed.

At config root, the show command will display system information.

Within a config section, for example from config > auth > user, this will display a flat list of available users.

Parameters

   
show Used on its own, will display the fields of the current context. When used in the top context, it shows the list of all entities. When used in an entity context, it shows the list of items in that entity. When used in an item context, it shows the fields and values of the current item.
entity The entity to display, or to show details of.
item The item to display or show details of.
field The field to show the value of.

Syntax

show <optional entity> <optional item> <optional field>

Context

Examples using context

The following examples show how the output of the show command changes in accordance with context as it may be used at the config, physif, net1 contexts:

show - at the config context:

show - at the physif context:

show - at the net1 context:

Examples using parameters

The following examples show the output of the show command when used with different parameters:

 

 

 

Config

You can view the content of all configuration in JSON format.

You can also view the config of a specific section of the hierarchy you are in.

show-config

Directed Usage

You will also be able to look into a config sections using the show command. For example:

show auth user

Will display a flat list of users.

show auth user “username”

Will display the configuration for the user specified.

 

up / exit / ..

Description

These commands allow users to traverse the configuration hierarchy.

up

The position will move one level up in the hierarchy.

If used at the root configuration level, it should point trigger the exit command.

Parameters

No parameters.

Syntax

up

exit

Examples

If, as in this example, the context is a specific port, then the ports entity can be accessed by using the up command then moving into another port:

config: port port01
config(port port01): up
config(port): port02
config(port port02):