You can convert a classic expression to the default expression syntax by using the nspepi conversion tool. You can also use the tool to convert all the classic expressions in the NetScaler configuration to the default syntax (with the exception of NetScaler entities that currently support only classic expressions).
add policy expression ne_c1 "METHOD == GET" add policy expression ne_c2 "ne_c1 || URL == /*.htm " add filter policy pol1 -rule "ne_c2" -reqAction YES add cmp policy pol2 -rule "REQ.HTTP.HEADER Accept CONTAINS \'text/html\'" -resAction COMPRESS add cmp policy pol3 -rule "ne_c1 || ne_c2" -resAction GZIP
In the commands that create the classic named expressions ne_c1 and ne_c2, the tool replaces the names of the expressions with actual default syntax expressions. This action, which corresponds to Step 1 described earlier, results in the following commands:
add policy expression ne_c2 "HTTP.REQ.METHOD.EQ(\"GET\")"
add policy expression ne_c1 "HTTP.REQ.URL.SUFFIX.EQ(\"htm\")"
The filter policy command supports only the classic syntax. Therefore, the conversion tool replaces the classic named expression ne_c1 with the actual classic expression it represents. Note that the tool replaces ne_c1 in the expression for ne_c2, and then replaces ne_c2 in the filter policy with the classic expression. This action, which corresponds to Step 2 described earlier, results in the following command:
add filter policy pol1 -rule "METHOD == GET || URL == /*.htm" -reqAction YES
The compression feature supports both classic and default syntax expressions. Therefore, in the command that creates the compression policy pol2, the conversion tool replaces the expression with a default syntax expression. This action, which corresponds to Step 3 described earlier, results in the following command:
add cmp policy pol2 -rule "HTTP.REQ.HEADER(\"Accept\").AFTER_STR(\"text/html\").LENGTH.GT(0)" -resAction COMPRESS
The command that creates the compression policy pol3 is unaffected by the conversion process because, after the conversion process is complete, ne_c1 and ne_c2 reference the default syntax expressions that result from Step 1.
After performing the conversion, the tool saves the changes in a new configuration file. The new configuration file is created in the directory in which the input file exists. The name of the new configuration file is the same as the name of the input configuration file except for the string new_ used as a prefix. Conversion warnings are reported in a warning line at the end of the screen output. Additionally, a warning file is created in the directory in which the input configuration file resides. For more information about the warning file and the types of warnings that are reported, see "Conversion Warnings."
You can use the nspepi tool to convert a single classic expression to the default syntax. The nspepi tool must be run from the shell prompt on the NetScaler appliance.
At the shell prompt, type:
root@NS# nspepi -e "REQ.HTTP.URL == /*.htm" "HTTP.REQ.URL.REGEX_MATCH(re#/(.*)\.htm#)"
You can use the nspepi tool to convert all the classic expressions in a NetScaler configuration file to the default syntax (except for those commands that do not support the default syntax). The nspepi tool must be run from the shell prompt on the NetScaler appliance.
At the shell prompt, type:
root@NS# nspepi -f ns.conf OUTPUT: New configuration file created: new_ns.conf OUTPUT: New warning file created: warn_ns.conf WARNINGS: Total number of warnings due to bind commands: 18 WARNINGS: Line numbers which has bind command issues: 305, 306, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 767, 768, 774, 775, 776, 777 root@NS#
When classic expressions that are included in CLI commands are upgraded to the default syntax, the number of characters in the expression might exceed the 1499-character limit. The commands that include expressions longer than 1499 characters fail when the configuration is being applied. You must manually update these commands.
In addition, multiple classic policies can be bound to a given bind point with priority 0 or with equal priority, but the default syntax policy infrastructure does not support a priority value of 0 or policies with the same priority at a given bind point. These commands fail when the configuration is being applied. The commands must be updated manually with the correct priority values.
The line numbers of lines that threw a warning during conversion are listed at the end of the output in a warning line. In addition, a warning file is created in the same directory as the one in which the old and new configuration files reside. The name of the warning file is the same as the name of the input configuration file except that the string warn_ is added as a prefix.