# Chapter 3: Configuration

This chapter introduces you to basic configuration concepts, and then walks you through one configuration scenario:

  • Basic system configuration tasks

This chapter presents the following topics:

  • Configuration Basics
  • Scenario: Basic System Configuration

# Configuration Basics

This section presents the following topics

  • Configuration Hierarchy
  • Adding and Modifying Configuration
  • Deleting Configuration
  • Committing Configuration Changes
  • Discarding Configuration Changes
  • Saving Configuration

# Configuration Hierarchy

From the system’s point of view, a configuration node is different from a simple configuration attribute statement. A configuration attribute statement takes the form of attribute value, as in the following example.

rule 1 action test

A configuration node always has an enclosing pair of braces:

rule 2 {
    description test
}

# Adding and Modifying Configuration

Add new configuration by creating a configuration node, using the set command in configuration mode. Modify existing configuration also by using the set command in configuration mode.

Example 3-1 Add configuration

[d0a09d] conf $ set rule-engine rule 1 action test start-electrolyser device AAAA
[d0a09d] conf $

Now use diff command to see the addition.

[d0a09d] conf $ diff
  rule-engine {
    devices {
      electrolyser AAAA {
        enabled true
      }
    }
+   rule 1 {
+     description test
    }
  }

Note the “+” in front of the new statement. This shows that this statement has been added to the configuration but the change is not yet committed. The change does not take effect until configuration is committed using the commit command.

# Modifying Configuration

For the most part, modifying configuration is the same as adding configuration by using the set command. This works for identifiers of nodes containing a single instance.

# Deleting Configuration

You can delete configuration statements or complete configuration nodes using the delete command.

[d0a09d] conf $ delete rule-engine rule 2
[d0a09d] conf $ diff
-   rule 2 {
-     description test
-   }

Note that the deleted parts of configuration have "-" in front of the statement.

# Run Command

You can execute operational mode commands from configuration mode using run command.

[d0a09d] conf $ run show configuration commands
set rule-engine devices electrolyser AAAA enabled "true"
set rule-engine devices electrolyser AAAA power "40"  

Note that you can also use bash commands with run command.

# Discard All Uncommitted Changes

To discard all uncommitted changes use discard command. It's faster than delete all changes you don't want to have.

Note that show command or diff command won't display any "-" or "+" as diff compares current configuration with committed one.

# Saving Configuration

To prevent your configuration from deleting with reboot, you need to save it.

[d0a09d] conf $ save
[d0a09d] conf $

# List of Current Operational Mode Commands

Command Description
run Run an operational-mode command
exit Exit configuration mode
commit Commit the current set of changes
discard Discard uncommitted changes
edit Edit node value in editor
cd Step into node
rollback Rollback to a prior config revision
save Save current configuration
diff Show state diff
show Show state value
set Set value
delete Delete value