Configurations in different views may be identical. To simplify the configurations, create a configuration template, define configurations that are duplicate in different views in it, and apply the configuration template to specified views.
Configurations in different views may be identical. To simplify the configurations, create a configuration template, define configurations that are duplicate in different views in it, and apply the configuration template to specified views.
The system view is displayed.
A configuration template is created, and the configuration template view is displayed.
The configuration template is associated with Loopback interfaces.
Run service view instance commands using regular expressions in the configuration template view. For example, run the interface <Loopback.> command to associate loopback interfaces on the device with the current configuration template.
Special Character |
Function |
Example |
---|---|---|
\ |
Defines an escape character, which is used to mark the next character (common or special) as a common character. |
\* matches *. |
^ |
Matches the start position of the string. |
^10 matches 10.10.10.1 not 2.2.2.2. |
$ |
Matches the end position of the string. |
1$ matches 10.10.10.1 not 10.10.10.2. |
* |
Matches the preceding element zero or more times. |
10* matches 1, 10, 100, 1000, and so on. (10)* matches null, 10, 1010, 101010, and so on. |
+ |
Matches the preceding element once or more times |
10+ matches 10, 100, 1000, and so on. (10)+ matches 10, 1010, 101010, and so on. |
? |
Matches the preceding element zero times or once. NOTE:
Huawei datacom devices do not support regular expressions with ?. When regular expressions with ? are entered on Huawei datacom devices, helpful information is provided. |
10? matches 1 or 10. (10)? matches null or 10. |
. |
Matches any single character. |
a.b matches any string that starts with a, ends with b, and contains three characters. 0.0 matches 0x0, 020, and so on. .oo matches book, look, tool, and so on. |
() |
Matches and obtains a string within the parentheses. If the parentheses are empty, the string is equivalent to a null string. If a pattern string has only (), it can match any string. If the right parenthesis in a pattern string has no matching left parenthesis, the right parenthesis is used as a common character. If the left parenthesis in a pattern string has no matching right parenthesis, the pattern string is invalid. |
100(200)+ matches 100200, 100200200, and so on. (ab) matches abcab. () can match any string. a()b matches 12ab12. a)b matches za)bc. a(b is an invalid pattern string. |
_ |
Matches regular expressions with a sign, such as a comma (,), left brace ({), right brace (}), left parenthesis ((), right parenthesis ()), or space. The underscore (_) can be used at the beginning of a regular expression with the same function as the caret (^) or at the end of a regular expression with the same function as the dollar sign ($). |
_65001_ matches 20 65001 30, 20 65001, 65001 30, 65001, and so on. |
x|y |
Matches x or y. |
100|200 matches 100 or 200. 1(2|3)4 matches 124 or 134 not 1234, 14, 1224, or 1334. |
[xyz] |
Matches any character in the regular expression. It cannot simultaneously match multiple characters or match the same character for multiple times. |
[123] matches 2 in 255. [abc] matches characters a, b, and c. |
[^xyz] |
Matches characters excluding x, y, and z in a character string. That is, it matches any string with at least one character that is not x, y, or z. |
[^123] matches any character except 1, 2, and 3. [^abc] matches any character except a, b, and c. |
[a-z] |
Matches any character within a specified range. It cannot simultaneously match multiple characters or match the same character for multiple times. |
[0-9] matches any character within the specified range. [a-z] matches any character within the specified range. [z-a] is an invalid pattern string. |
[^a-z] |
Matches characters except a, b, c, and d in a character string. That is, it matches any string with at least one character that is beyond the range of a to d. |
[^0-9] matches all non-digit characters. [^a-z] matches all non-letter characters. [^z-a] is an invalid pattern string. |
Unless otherwise specified, all characters in the preceding table are displayed on the screen.
IPv6 is enabled.
Changed configurations in the configuration template are displayed.
The configuration is committed, and the system view is displayed.
If the existing configuration template is not needed, run the abort command to discard the existing configuration template and exit the configuration template view.
Loopback interfaces are created.
The configuration template is applied to the view.
If a service view instance does not need configurations in a configuration template, run the undo command-string command in the configuration template view to delete the specified service view instance.
The command specified in the undo command-string command can only be a service view instance that is associated with the configuration template or the command that has been run in that service view instance. If a service view instance is deleted, all configurations in the configuration template that applies to the instance are also deleted.