Recently I was tasked to import several thousands of objects, policy and nat rules from R77 xml export files to R80.10 in just couple of days. I wrote a python scripts to generate the api commands but I came over a problem with strings for several parameters value. I had 2 major issues in general.
1) multi word strings
an example:
input: mgmt_cli set host name "h-1.2.3.4" comments "Media-Server 2 London" -s .sid
response: Error: The parameters of set-host command should be provided in pairs (key and value). You have provided an odd number of parameters which suggests that you are probably missing a parameter.
another typical example:
add access-section layer "pol-fw-backend-migrated Network" position bottom name "Stealth rule"
2) reserved word strings
an example:
input: mgmt_cli set host name "h-1.2.3.4" comments "RSA server real IP" -s .sid
output: code: "generic_err_invalid_parameter_name"
message: "Unrecognized parameter [RSA]"
Both issues affects names, layers , sections, comments and maybe some other things.
I was really surprised that simple parameter string is evaluated as a parameter even when properly quoted and the source of the problem was not immediately clear in all cases especially when adding complex rules.
My question is if this is bug or sort of intended behavior or if it's possible to fix it or go around e.g. with some special quotes? I was able to use a workaround (UID instead of name for existing objects and merging multi word strings in python with underscore) but it required additional effort and time and also comments in objects and rules does not look so nice with all words separated by underscores .