Hello,
I try to use the script mx_firewall_control.py to update rulesets L3 but I've got a error message with the commands to add a ruleset.
PS C:\Meraki Python Scripts> python mxfirewallcontrol.py -o "XXXXX" -f "type:network, name: Template site MX67" -c append-file:update_input.txt
2023-07-20 18:43:07 -- Retrieving organization info...
GET https://api.meraki.com/api/v1/organizations
200
2023-07-20 18:43:07 -- Selecting networks and templates according to filters... GET https://api.meraki.com/api/v1/organizations/YYYYY/networks
200
2023-07-20 18:43:08 -- SIMULATION MODE. CHANGES WILL NOT BE SAVED. USE "-m commit" TO OVERRIDE
2023-07-20 18:43:08 -- ERROR 28: Invalid input file format "update_input.txt" 2023-07-20 18:43:08 -- ERROR: Unable to load source ruleset
But I think to follow and apply correctly the format for the file as explained on the README (to be honest, it's just a test so I don't modify a lot the template txt file provided). Also the txt file is in the same folder than the .PY.
Below the extract of the txt file (1 line per rule):
{"protocol":"any", "srcPort":"Any", "srcCidr":"10.1.1.1", "destPort":"Any","destCidr":"any", "policy":"deny", "syslogEnabled":false, "comment":"Line 1"}
{"protocol":"any", "srcPort":"Any", "srcCidr":"10.2.2.2", "destPort":"Any","destCidr":"any", "policy":"deny", "syslogEnabled":false, "comment":"Line 2"}
Also I tried to use the direct command, and I've the same type of error with an invalid format.
PS C:\Meraki Python Scripts> python mxfirewallcontrol.py -o "XXXXX" -f"type:network, name:Template site MX67" -c insert:1:"[{""protocol"":""any"", ""srcPort"":""Any"", ""srcCidr"":""10.6.0.1"", ""destPort"":""Any"", ""destCidr"":""any"", ""policy"":""deny"", ""syslogEnabled"":false, ""comment"":""Line 3""}]" -m commit
2023-07-20 18:59:43 -- Retrieving organization info...
GET https://api.meraki.com/api/v1/organizations
200
2023-07-20 18:59:44 -- Selecting networks and templates according to filters... GET https://api.meraki.com/api/v1/organizations/YYYYY/networks
200
2023-07-20 18:59:44 -- SIMULATION MODE. CHANGES WILL NOT BE SAVED. USE "-m commit" TO OVERRIDE
2023-07-20 18:59:44 -- ERROR: ERROR 50: Ruleset to be added must be given in JSON format
What I'm doing wrong ?
Here the source code: GITHUB Automation Meraki
PS1: I don't have any issue for the "print" command
PS2: I use Windows10/Visual Studio Code to launch the script.
In advance, thank you very much