Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
MubashirKhan
Explorer

mgmt_cli csv multiple service ports addition

Hello,

I am trying to create access rules using CSV (bulk method). As you all may know, there can be multiple sources, destinations or services in the rule however, the service parameter in CSV only allows one value a time. 

I have tried all combinations to have mgmt_cli parse the CSV column values as list but it doesn't seem to be working. The only way I get it working is by defining multiple columns, like:

layer,source,destination,service.1,service.2,service.3,service.4,service.5,action,name,position,track

Network,dummy-src-1,dummy-dest-1,http,https,ssh,http_proxy,,accept,this-is-a-dummy-rule,2,log

As it can be seen, I had to leave service.5 field Null like ,, for the call to be successful. It is though not very scalable and there are times when it will be required to add maybe 10 services. Yes, a Group can be an option but let's keep at as a last resort.

I have tried:

layer,source,destination,service,action,name,position,track

Network,dummy-src-1,dummy-dest-1,[http,https,ssh,http_proxy],accept,this-is-a-dummy-rule,2,log

Line 2: code: "generic_err_object_not_found"
message: "Requested object [HTTPS, HTTP] not found"

 

layer,source,destination,service,action,name,position,track

Network,dummy-src-1,dummy-dest-1,["http","https","ssh","http_proxy"],accept,this-is-a-dummy-rule,2,log

Error occured during parsing of CSV file.
Line 2 column 6: Unexpected character in csv file. Double-quotes are expected to come in pairs.
Failed to read parameters file [add_rules.csv]: Invalid format

And multiple other combinations that will make this post very long without any luck.

This is a very practical example so does anyone know how to get that working in a scalable fashion?

0 Kudos
1 Reply
PhoneBoy
Admin
Admin

Effectively, you’re specifying name/value pairs in the CSV file.
The header row contains the name, the other rows contain the values.
Unfortunately, there is no way to specify multiple values other than the method you describe (e.g. service.1, service.2) and is consistent with how you’d construct the mgmt_cli call without a CSV file.
Bottom line: this is expected behavior.

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events