Skip to content

Policy Definition Files New Format

2 mins V7 Pro V6 Core

The new format for Policy and CIC Definitions in rConfig has been simplified for ease of use and readability. This replaces the old verbose JSON format with a more streamlined approach. This documentation will guide you through the new format, its benefits, and usage tips.

Benefits

  • Simplified Format: The new format is less verbose and easier to write and understand.
  • Efficiency: Reduces the complexity of writing policy definitions and CIC definitions.
  • Ease of Use: Includes auto-complete features in the editor, making it easier to use predefined methods.

Format Description

The new format uses a combination of comments and method annotations to define policies. Each policy is described with a comment followed by a method annotation and the command it applies to.

How to write a policy definition:

  1. Blocks must be seperated by a line blank line i.e. // Some described policy followed by a method annotation
  2. Each block must start with a comment describing the policy followed by a method annotation
  3. The method annotation must be enclosed in square brackets prefaced by a # symbol i.e. #[method_annotation]
  4. The text following the method annotation is the command the policy applies to or will be evaluated
  5. Blocks that have a STRING (#[must_match_single_string]) method annotation must have a single string value following the method annotation i.e. #[method_annotation] single_string_value
  6. Blocks that have a ARRAY (#[must_match_all_from_array]) method annotation must have a list of strings following the method annotation i.e. #[method_annotation] string1, string2, string3
  7. Blocks that have a REGEX (#[must_match_regex]) method annotation must have one of many regex patterns following the method annotation i.e. #[method_annotation] /regex_pattern/
// Description: must_match_single_string SNMP Policy
#[must_match_single_string]
snmp-server host 1.1.1.1 TESTCOMMUNITY
// Description: must_match_single_string Disable CDP
#[must_match_single_string]
no cdp run
// Description: must_match_single_string Disable HTTP Server
#[must_match_single_string]
no ip http server
// Description: must_match_all_from_array AAA Authentication
#[must_match_all_from_array]
aaa authentication login default local
aaa authentication enable default none
// Description: must_match_all_from_array Auxiliary Line Configuration
#[must_match_regex]
/.* vty 0 4.*/

Usage Tips

  • Ctrl+S to Save: Use Ctrl+S to save the definition file in the editor.
  • Auto-complete: The editor provides auto-complete for method annotations when typing #.
  • Detailed Instructions: For detailed instructions on methods, refer to the UI under the respective Create form for each feature in rConfig.