FIT YAML General Information

FIT YAML Feature

FIT YAML Assets

FIT Expression and Function

Qualification Properties and Condition

FIT YAML General Information

Action 

Define some common parameters for this FIT, such as name, description etc.

YAML Sample 

name: "General_BGP"

version: "1.1"

source: xxxxxxxx # optional, FIT source

unique_id: cab7a76e-714b-4a64-80dd-02ad2b2be7e1

description: "description......."

tags:

 - BGP

dependencies:

 - Built-in FITs/FIT1

 - Built-in FITs/FIT2

Properties

Property Name

Type

Required

Definition

name

string

Y

Feature name, it is recommended to keep a unique feature name for each feature

version

string

Y

FIT YAML structure version number, default value: 1.1

unique_id

string

Y

A unique ID in the FIT Manager

source

string

N

FIT source. Default value: NetBrain

description

string

N

Feature descriptions

tags

list

N

Tags of feature

dependencies

list

N

Dependent FIT path

FIT YAML Feature

Qualification

The FIT qualification defines what conditions or criteria that a device should meet to apply the FIT on itself. See Qualification Properties and Condition

Regex

The regex defines what match line of the device configuration is true to apply this FIT.

Line Pattern (decode) 

The line pattern is defined to match the config-line by which decodes the device configuration.

Config line matching logic will follow:

oConfig keyword should be exactly matched.

oFor config variable,

If it is a string variable, it will match any word in the configuration file.

If it is another variable, it should exactly match the variable type in the configuration file.

oIf the line pattern supports fuzzy matching, it can match the configuration line longer than the pattern, as long as it exactly starts with the line pattern.

For example:

Line Pattern

Configuration Line

Result

ip address $ip $ip

ip address 10.10.10.10 255.255.255.0

Match.

ip address $str $ip

ip address 10.10.10.10 255.255.255.0

Match.

A $str variable in line pattern can match any word in the configuration line.

ip address $str $ip

ip address some-string 255.255.255.0

Match.

ip address $ip $ip

ip address some-string 255.255.255.0

Not match.

The word in line "some-string" is not $ip variable.

ip address $ip $ip

ip address 10.10.10.10 255.255.255.0 secondary

Fuzzy matching.

The first part of config line matches the line pattern. If the line pattern supports fuzzy matching, it is matched.

ip address $ip $ip

ip address 10.10.10.10

Not match.

The configuration line lacks one variable.

ip address $ip

ip address 10.10.10.10 255.255.255.0

Fuzzy matching.

ip address $ip 255.255.255.0

ip address 10.10.10.10 255.255.255.0

Match.

The variable instance can also be defined in line pattern.

address $ip

ip address 10.10.10.10

Not match.

YAML Sample 

feature:

 # qualification: All

 qualification: # support All

   device_scope: # the default is null, null means all

     type: DeviceGroup # Site or DeviceGroup

     groups: ["Shared Device Groups/Group1", "Shared Device Groups/folder1"]

   dynamic_search:

     conditions:

       - property: mainTypeName

         values: [Router, L3 Switch, LAN Switch]

       - property: subTypeName

         values: [Cisco IOS Switch]

       - property: hasEIGRPConfig

         # support types:

         #   string: Matches(default), Does not match, Contains, Does not contain

         #   bool: Is/is(default)

         #   number: Matches(default), Does not match

         #   array: Matches/Matches any(default), Does not match/Does not match any

         operator: Matches

         values: false

       - property: name

         operator: Contains

         values: ["l2", "3550"]

     boolean_expression: A and B and C and D

 configlet: # configlet

   sample: |- #configlet sample, optional

     D1:

     interface Loopback0

      ip address 10.10.10.10 255.255.255.255

     router bgp 1

      bgp log-neighbor-changes

      neighbor 20.20.20.20 remote-as 2

      neighbor 20.20.20.20 update-source Loopback0

 

     D2:

     interface Loopback0

      ip address 20.20.20.20 255.255.255.255

     router bgp 2

      bgp log-neighbor-changes

      neighbor 10.10.10.10 remote-as 1

      neighbor 10.10.10.10 update-source Loopback1

      neighbor 10.10.20.10 remote-as 2

      neighbor 10.10.20.10 update-source Loopback2

   match_rules: # Match Rules, if this FIT is for multiple devices and the rule are different, here can define multi rules.

     - regexes: # the first rule is the main Match Rule

         condition1: # match condition name, use "or" between multiple conditions, use "and" between multi regex line in one condition

           - regex: standby # regex means is used for single-line matching.

           - mregex: ^interface1 .+\n\s+standby # mregex is used for multi-line matching.

           - mregex: ^interface2 .+\n\s+standby

           - mregex: ^interface3 .+\n\s+standby

         condition2:

           - mregex: ^interface .+\n\s+standby

           - mregex: ^interface .+\n\s+standby

       patterns: # line patterns to match&decode, optional

         group1: |- # line pattern group name, must be unique.

           interface $str:intfName1

           ip address $ip:ip1 $ip:mask1

         # line pattern format:'flag[flag]+: linePattern', support flags: O:Optional, M:Must to have, F:Fuzzy match, E:Exact match.

         # M and O are mutually exclusive, M is the default, no M and O means Must, both means M.

         # F and E are mutually exclusive, F is the default, no F and E means Fuzzy, both means F.

         # $valueType:varName means a variable, supported value types: str, num, bool, ip, ipv6, mac, time.

         # $varName means a variable, string is the default type.

         # The variable name must be unique in one configlet.

         # $? means a variable that don't need to use.

         group2: |-

           M F: router bgp $num:bgp

             O: bgp log-neighbor-changes

             F: neighbor $ip:ip2 remote-as $num:remoteBGP

           OE: neighbor $ip:ip3 update-source $str:intfName2

       split_keys: # variable signature concept, optional

         group1: [$fi.intfName1]

         group2: [$fi.bgp, $fi.ip2]

       merge_groups: ["group1"]

       relation: equals($fi.intfName1, $fi.intfName2) && equals($fi.ip2, $fi.ip3)

     - regexes: {} # The following items are other rules, if any.

       patterns: {}

       split_keys: {}

       relation: ""

       merge_groups: []

   eigen_variables:

     - name: crossRelationKey

       expression: combine($fi.ip1, $fi.ip2, $fi.bgp, $fi.remoteBGP)

     - name: ip1Subnet

       expression: ($fi.ip1)

     - name: subFIDesc

       expression: $device.name + $fi.intfName1 + subnet($fi.ip2)

   commands:

     - show ip route

     - show ip bgp

     - show ip bgp summary

     - show interface {$fi.intfName1}

 cross_relation:

   group_by: $fi.crossRelationKey # only support to use one eigen variable

   fi_qualification: $fi.bgp!=null # optional, The expression used to filter Sub FI

   # fig_qualification: $fig.fiCount>1 # not support in v10.0a, will support next version, the expression used to filter FIG

   group_type: Contains # Contains or ExactMatch, the default is ExactMatch

Properties

Property Name

Type

Required

Definition

qualification

object

Y

The FIT qualification defines what conditions or criteria that a device should meet to apply the FIT on itself.

qualification.device_scope

object

N

The device scope. The default value is null, which means to include all devices.

qualification.device_scope.type

string

N

Two values to choose from:

Site

DeviceGroup

qualification.device_scope.groups

list

N

The site or device group path

qualification.dynamic_search

object

N

Dynamic search tags. It will use pre-qualify logic here.

qualification.dynamic_search.conditions

list

N

Qualification condition, see Qualification Properties and Condition

qualification.dynamic_search.conditions.property

enum

N

Qualification condition properties include:

Device Type

Config File

etc.

see Qualification Properties and Condition

qualification.dynamic_search.conditions.operator

enum

N

Qualification condition operator enum includes:

Is

Matches

Does not match

Matches any

Does not match any

Contains

Does not contain

qualification.dynamic_search.conditions.values

string

N

Qualification condition value

qualification.dynamic_search.boolean_expression

string

N

Qualification bool expressions such as A AND B OR C

configlet

object

Y

The array of configlet where each configlet object belongs to one device.

configlet.sample

string

N

Feature decode configlet sample

configlet.match_rules

list of object

N

Multiple match rules can be defined here if different devices' rules are different.

The first rule is the main rule, and the following rule will be applied only if its previous one does not match.

If no rule is defined here, you can still use GDR variables to generate eigen variables and commands.

configlet.match_rules.regexes.{condition_name}

list of string

N

Several conditions can be defined here, separated by different condition names. Multiple regexes can be defined in a condition.

The relation within a condition is "OR", while the relation between these conditions are "AND".

The key of each condition is regarded as a condition name, and thus it should be unique under one configlet.

Under each condition, there are two types of matching:

1.regex: single-line matching

2.mregex: multi-line matching

configlet.match_rules.patterns

object

N

Config line patterns can be defined here.

configlet.match_rules.patterns.{group_name}

string

N

Line pattern provides a more specific way to match config lines in the config file, and can also extract variables from these config lines. A sample line pattern will be: M: standby $str:standbyName ip $ip:ip

Variables can be defined in line pattern as"$<variable type>:<variable name>".

There are 7 types of supported variables: str, num, bool, ip, ipv6, mac, time. If not specified, the default variable type is str.

The variable name should be unique within one configlet.

$? means a variable that doesn't need to use. Its type will be str.

Line patterns can be assigned to different groups to distinguish line pattern scope. For instance, group1 may contain HSRP feature defined under an interface, while group2 may contain OSPF global configuration. "group1" and "group2" are group names that should be defined uniquely within a configlet.

configlet.match_rules.split_keys

object

N

A line pattern could match multiple config line instances in the configuration file, and thus some line pattern variables may have multiple possible values. Defining variable here will make sure that the variable only has one instance value in the subFI.

configlet.match_rules.split_keys.{group_name}

list of string

N

List of variables' names in their corresponding pattern group that should be unique in subFI.

configlet.match_rules.generate_merge_groups

list of string

N

List of group names.

Opposite to split_keys, some pattern groups could match multiple group instances, but they do not need to be distinguished from each other, such as access-list. In such a case, that pattern group can be defined here to ensure that the pattern group only has one instance across all matched subFI.

configlet.match_rules.relation

string

N

Variable relations can be defined here. All line pattern variables and device GDR can be used here for relation expression, as well as the global functions. Please refer to FIT Expression and Functionfor detailed usage of expression.

The output value type of relation expression must be boolean.

eigen_variables

object

N

Eigen variables defined here can further be used in cross_relation and automations.

eigen_variables.name

string

N

Name of eigen variable. It should not be the same as line pattern variables or Expression built-in functions. It should also be unique in all eigen variables defined here.

eigen_variables.expression

string

N

An expression string.

All line pattern variables and device GDR can be used here to generate eigen variables, which can further be used in automations.

Please refer to FIT Expression and Functionfor detailed usage of expression.

commands

list of string

N

The commands used to troubleshoot this feature.

Show commands to troubleshooting this feature. The command can use variables defined in line patterns of the same configlet, which starts with "$". The format follows string Interpolation, e.g.  "show standby { $standbyName1 }". See https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated for more about string Interpolation.

If a variable inline pattern matched multiple instances in the config file, each variable value will construct a command. For example, "show standby { $standbyName1 } "uses "standbyName1" defined in line patterns. If "standbyName1" matches value 22, 23 in the config file, the corresponding commands will be "show standby 22" and "show standby 23".

If a device config matches more than one configlet in the same FIT, all the commands from these configlets will be merged together.

cross_relation

object

N

The cross relation can be defined here to correlate several devices if they share the same feature needed to be grouped together for troubleshooting.

cross_relation.group_by

string

N

group_by needs to be eigen variable name.

The cross relation logic will use eigen variable defined here to group subFIs from different devices if they are the same value.

cross_relation.qualification

string

N

An expression string.

The qualification used to filter subFI.

see FIT Expression and Function

cross_relation.group_type

enum

N

There are three supported group types:

ExactMatch: default.

Match

Contains: Will merge all the subFIs, either from the same device or different devices, if eigen variable in group_by has multiple values.