Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions nspepi/check_invalid_config
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (!($python_module_list =~ m/\bply==/)) {


my $number_args = $#ARGV + 1;
if ($number_args > 3) {
if ($number_args > 3 or $number_args < 1) {
tool_usage();
exit;
}
Expand Down Expand Up @@ -74,10 +74,10 @@ my $deprecated_config_file = $dir_path."deprecated_".$filename;

# Checks whether any command is present in the file
if (!(-z $invalid_config_file)) {
print "\nThe following configuration lines will get errors in ".$buildVersion." and both they and dependent configuration will be removed from the configuration:\n";
system("cat $invalid_config_file");
print "\nThe nspepi upgrade tool can be useful in converting your configuration - see the documentation at https://docs.citrix.com/en-us/citrix-adc/current-release/appexpert/policies-and-expressions/introduction-to-policies-and-exp/converting-policy-expressions-nspepi-tool.html.\n";
print "\nNOTE: the nspepi tool doesn't convert the following configurations:\n\t1. SureConnect commands\n\t2. PriorityQueuing commands\n\t3. HTTP Denial of Service Protection commands\n\t4. Classic SSL commands\n\t5. HTMLInjection commands.\n";
print "\nThe following configuration lines will get errors in ".$buildVersion." and both they and dependent configuration will be removed from the configuration:\n";
system("cat $invalid_config_file");
print "\nThe nspepi upgrade tool can be useful in converting your configuration - see the documentation at https://docs.citrix.com/en-us/citrix-adc/current-release/appexpert/policies-and-expressions/introduction-to-policies-and-exp/converting-policy-expressions-nspepi-tool.html.\n";
print "\nNOTE: the nspepi tool doesn't convert the following configurations:\n\t1. SureConnect commands\n\t2. PriorityQueuing commands\n\t3. HTTP Denial of Service Protection commands\n\t4. Classic SSL commands\n\t5. HTMLInjection commands.\n";
if (!(-z $deprecated_config_file)) {
print "\nNOTE: some deprecated commands have also been detected in the config file, please check ".$deprecated_config_file." file for the deprecated commands.\n";
} else {
Expand Down
15 changes: 8 additions & 7 deletions nspepi/nspepi2/check_classic_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ def check_vpn_url(self, commandParseTree):
"""
if commandParseTree.keyword_exists('ssotype'):
sso_type = commandParseTree.keyword_value("ssotype")[0].value.lower()
if sso_type is "selfauth":
if sso_type == "selfauth":
logging.warning("Selfauth type has been deprecated"
" in command [{}]".format(str(commandParseTree).strip()))
return []
Expand All @@ -993,8 +993,8 @@ def check_vpn_portaltheme(self, commandParseTree):
"""
if commandParseTree.keyword_exists('basetheme'):
base_theme = commandParseTree.keyword_value("basetheme")[0].value
if base_theme is "Default" or base_theme is "X1" \
or base_theme is "Greenbubble":
if base_theme == "Default" or base_theme == "X1" \
or base_theme == "Greenbubble":
logging.warning(("Default, GreenBubble and X1 themes"
" have been deprecated in command [{}],"
" please use RfWebUI theme or RfWebUI based custom theme")
Expand All @@ -1010,8 +1010,8 @@ def check_vpn_commands(self, commandParseTree):
"""
if commandParseTree.keyword_exists('portaltheme'):
base_theme = commandParseTree.keyword_value("portaltheme")[0].value
if base_theme is "Default" or base_theme is "X1" \
or base_theme is "Greenbubble":
if base_theme == "Default" or base_theme == "X1" \
or base_theme == "Greenbubble":
logging.warning(("Default, GreenBubble and X1 themes"
" have been deprecated in command [{}],"
" please use RfWebUI theme or RfWebUI based custom theme")
Expand All @@ -1025,12 +1025,12 @@ def check_dns_action(self, commandParseTree):
deprecated.
"""
action_type = commandParseTree.positional_value(1).value.lower()
if action_type is "rewrite_response":
if action_type == "rewrite_response":
logging.warning(("Rewrite_Response action type is deprecated in"
" command [{}], please use the replace_dns_answer_section"
" action type under Rewrite feature.")
.format(str(commandParseTree).strip()))
elif action_type is "drop":
elif action_type == "drop":
logging.warning(("Drop action type is deprecated in"
" command [{}], please use the Drop"
" action type under Responder feature.")
Expand Down Expand Up @@ -1090,6 +1090,7 @@ def check_deprecated_pacingcommands(self, commandParseTree):
@common.register_for_cmd("bind", "lsn", "client")
@common.register_for_cmd("bind", "lsn", "group")
@common.register_for_cmd("bind", "lsn", "pool")
@common.register_for_cmd("set", "lsn", "parameter")
def check_lsn_commands(self, commandParseTree):
"""
Check the Authentication commands which have been deprecated
Expand Down
12 changes: 9 additions & 3 deletions nspepi/nspepi2/convert_classic_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
r'(S\.CACHE_CONTROL)|(S\.TXID)|(S\.MEDIA))\b',
re.IGNORECASE)

def convert_classic_expr(classic_expr):
def convert_classic_expr(classic_expr, ignore_csec_expr = False):
tree_obj = CLIParseTreeNode()
info_msg = 'INFO: Expression is not converted' + \
' - most likely it is a valid advanced expression'
Expand All @@ -62,8 +62,14 @@ def convert_classic_expr(classic_expr):
if nspepi_tool_output.startswith('ERROR:'):
"""Handles the error returned by old
nspepi tool"""
logging.error(nspepi_tool_output)
return None
csec_error_msg = 'Conversion of client ' + \
'security expression is not supported'
if (ignore_csec_expr and (csec_error_msg in \
nspepi_tool_output)):
return "Ignoring Client security Expression"
else:
logging.error(nspepi_tool_output)
return None
elif nspepi_tool_output.endswith(info_msg):
"""old nspepi tool didn't convert the expression,
so return input expression"""
Expand Down
Loading