In FIT YAML, there are several sections where variables can be defined and further used in expression and string interpolation.
GDR variables are also supported.
Variables can be defined in line pattern and eigen variables.
•Variable names are case-sensitive.
•Variable names must begin with a letter of the alphabet or an underscore( _ ).
•Variable names can contain letters and numbers.
•No spaces or special characters are allowed.
•The variable names should not have any duplicates.
•Variable names should not be identical to the names of built-in functions or built-in keywords.
If the variable name being defined is not valid, the current decode process will be terminated.
Variable Definition Type |
Variable Level |
Definition |
Line Pattern Variable |
SubFI/Device Level |
Defined in feature.configlet.match_rules.patterns . |
Eigen Variable |
SubFI/Device Level |
Defined in feature.configlet.eigen_variables . |
Device GDR Variable |
Device Level |
All device GDR variables. |
Interface GDR Variable |
Interface Level |
All interface GDR variables. Physical interfaces only. |
FIG Variable |
FIG Level |
A unique hash value for FIG groupby eigen variable |
There are seven data types can be defined in line pattern or eigen variables. Besides that, device/interface GDR variables can also be utilized.
•Device
•String
•Number
•Bool
•IP
•IPv6
•Mac
•Time
Function |
Definition |
Example |
OrderIndex(string: deviceVarName, bool:asc=true): int |
Get the order of current device in the feature intent group. Can only be used in network_intents.ni_inputs.devices.[R1].device_condition. |
OrderIndex("$priority")==0 OrderIndex("$device.priority")==0 |
Combine(paras any[] values): string |
Combine multiple values into a sorted string. Can only be used in feature.configlet. |
Combine($ip1, $ip2, $bgp, $remoteBGP) |
IP(string: ipString, string: maskString): ip |
Create IPv4 object. |
IP($ip,$mask) IP($ipWithMask,"") |
IPv6(string: ipString, string: maskString): ipv6 |
Create IPv6 object. |
IPv6($ip,$mask) IPv6$ipWithMask,"") |
Ternary(bool: condition, any: value1WhenTrue, any: value2WhenFalse): any |
Ternary. |
|
SameSubnet(ip ip1, ip ip2): bool |
Check whether the given ipv4 subnets are the same. The mask length should be the same. |
|
SameSubnet(ipv6 ip1, ipv6 ip2): bool |
Check whether the given ipv6 subnets are the same. The mask length should be the same. |
|
Num(string: str1): number |
Create a number object. |
Num("90") |
Str(any: obj) |
Create a string object. |
Str("SampleString") |
The expression here is a statement written using a subset of C# language specifications.
There are several sections in FIT YAML that support the usage of string interpolation.
FIT YAML Tag |
Type |
Variables Level |
Multiple Variable Values |
feature.configlet.match_rules.relation |
Feature Decode |
Device level variables |
Will generate commands for all possible values combinations. |
feature.configlet.eigen_variables.expression |
Feature Decode |
Device level variables |
Will generate commands for all possible values combinations. |
feature.cross_relation.qualification |
Feature Decode |
Device level variables |
Will generate commands for all possible values combinations. |
network_intents.ni_inputs.devices.[R1].device_condition |
NI |
Device level variables |
Will generate commands for all possible values combinations. |
network_intents.ni_inputs.devices.[R1].parameters.[xx] |
NI |
Device level variables |
Only the first value will be used if multiple values are available. |
flash_probes.qualification |
Flash Probe |
Device / Interface level variables |
Will generate commands for all possible values combinations. |
flash_probes.generate_condition.variables.parameters.[xx] |
Flash Probe |
Device / Interface level variables |
Only the first value will be used if multiple values are available. |
•https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
•The expression is supported in "{ }".
•To include a brace, "{" or "}", in the text produced by an interpolated string, use two braces, "{{" or "}}".
If string interpolation is not valid, current decode process will be terminated.
There are several sections in FIT YAML that support the usage of string interpolation.
FIT YAML Tag |
Type |
Variables Level |
Multiple Variable Values |
Examples |
feature.configlet.commands |
Feature Decode |
Device level variables |
Will generate commands for all possible values combinations. |
show standby interface {$intfName1} {$standbyName1} |
network_intents.path |
NI |
FIG level variables |
Only the first value will be used if multiple values are available. |
xxxx/xxxx/General_BGP_{ $crossRelationHash } |
flash_probes.name |
Flash Probe |
Device / Interface level variables |
Only the first value will be used if multiple values are available. |
BGP_Flapping_{ $intfName } |