The article contains information about the nspepi tool used to convert classic expressions to advanced expressions.
The nspepi tool must be used from the shell prompt of the NetScaler appliance to convert classic policy expressions to advanced policy expressions. You can either use expressions or the complete ns.conf configuration file as an input to this tool.
A classic expression can be converted to the advanced expression syntax by using the nspepi conversion tool. In addition, the tool can be used to convert all the classic expressions in the NetScaler appliance configuration to the advanced syntax with the exception of NetScaler entities that currently support only classic expressions.
nspepi (-e “classic expression” | -f “ns config file”) (-v)
Max expression length = 1499
Output format of the syntax
<Converted advanced expression> | <Convertered ns config>
A new configuration file is created with the name new_<input file name>. A new warning file is created with the name warn_<input file name>. New files are created in the same directory as the input file. Only the warnings are printed while executing without –v (verbose) option.
When you use the –v option, the modified configuration file is printed in standard output in addition with the new files.
Run the following command at the shell prompt of the appliance:
nspepi -e “<classic expression>”
root@NS-150# nspepi -e "REQ.HTTP.URLQUERY CONTAINS content=StoreSearchServices""HTTP.REQ.URL.QUERY.AFTER_STR("content=StoreSearchServices").LENGTH.GT(0)"
Converting a NetScaler Configuration File
Run the following command to convert the ns.conf file to advanced policy expressions:
nspepi -f “<ns config file>” -v
root@NS-150# nspepi -f /nsconfig/ns.confOUTPUT: New configuration file created: /nsconfig/new_ns.confOUTPUT: New warning file created: /nsconfig/warn_ns.confWARNINGS: Total number of warnings due to bind commands: 2WARNINGS: Line numbers which has bind command issues: 237, 290root@NS-150#
The tool does not optimize the configuration, rather it creates equivalent files only. For better performance and to take full advantage of advanced syntax, you have to manually optimize after converting the file into advanced expressions.