Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
sergey1
Participant

API

Hello.
I have a CSV file with more than 100 policy rules. I import them using command: mgmt_cli add access-rule --batch Policy-Book4.csv. How can I import a file such that there are more than one value in the source, destination, service fields? The method that uses service.1, service.2 does not help in this case.
Postman, but I can't add more than one rule there.

 

7 Replies
HeikoAnkenbrand
Champion Champion
Champion

Here you can find information and examples for the Management API:

Management API Reference 

➜ CCSM Elite, CCME, CCTE
sergey1
Participant

Unfortunately, there is no example suitable for me.

0 Kudos
funkylicious
Advisor

Hi,

You need to add rule by rule using the API, since I had a similar situation a while back. Had to create a script to generate the appropriate format for the API and I just added one by one. Haven't worked on it to do everything automated.

For multiple sources, destinations, services you would have to create a list.

"source" : [ "source1", "source2", "source 3" ],
"destination" : [ "destination 1". "destination2" ],
"service" : [ "svc1" , "svc2"] 

 

0 Kudos
sergey1
Participant

Please explain why you changed the format? And can I have a look at your script?

0 Kudos
FraP
Contributor

Actually the syntax is the same...

If you can test try this example:

 

mgmt_cli -r true add host name "host_1" ipv4-address "10.10.10.10"
mgmt_cli -r true add network name "net_1" subnet  "10.10.10.0" mask-length "29"

lol.csv
layer,name,position,comments,source.1,source.2,destination.1,destination.2,service.1,service.2,action,track
Test Security,"Rule1","1","TEST1","host_1","net_1","net_1","host_1","http","https","Accept","Log"
Test Security,"Rule2","2","TEST2","host_1","net_1","net_1","host_1","http",,"Accept","Log"
Test Security,"Rule3","3","TEST3","host_1","net_1","net_1","host_1","http","https","Accept","Log"
Test Security,"Rule4","4","TEST3","","net_1","net_1","host_1","http","https","Accept","Log"
Test Security,"Rule0","1","TEST0","net_1",,"net_1","host_1","http","https","Accept","Log"

 

Replace Test Security with your access-layer

0 Kudos
sergey1
Participant

It is not convenient to do this when the number of sources / destination / services varies from 1 to 20

0 Kudos
FraP
Contributor

This is another question, different from the first one...
What's convenient for you?

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events