cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1141
Views
0
Helpful
7
Replies

Script to export Access Control rules and Objects from FMC

Can someone help me with python scripts to export access control policy and objects to CSV format. I tried the below script but it is giving me error.

 

My FMC version is 7.4.2

GitHub - mapp-john/fmc-api

 

Thanks and Regards

Shabeeb

7 Replies 7

@SHABEEB KUNHIPOCKER what is the error?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hi,

 

Thanks a lot for the response. Please find the error below

 

File "C:\Users\shabeeb\fmc-api-master\fmc-api-master\fmc_api_tools.py", line 2307, in <module>
export_acp_rules(server,headers,api_uuid)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\shabeeb\fmc-api-master\fmc-api-master\fmc_api_tools.py", line 1476, in export_acp_rules
temp_list = parse_rule(fmc_name,rule)
^^^^^^^^
NameError: name 'fmc_name' is not defined

So its saying the variable fmc_name is being referenced in the export_acp_rules function but hasn't been defined in the scope of that function, this typically arises when a variable is used before it has been assigned a value.
 
It could be a couple of things, check the export_acp_rules function and the  fmc_name is defined before it's used, check if fmc_ name iss supposed to be a parameter or a variable that holds a specific value (like the name of the FMC), make sure thats defined. There could be more, without seeing your code its hard to say. Can you share the entire script?
 
Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hello,

 

I did not create the code. I found the code in the below link

GitHub - mapp-john/fmc-api

@SHABEEB KUNHIPOCKER i understand this, but you are running your code locally to an FMC, and it is failing. I am asking to show me the code you are running which is getting you the error message please.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Any update guys?

tryingtofixit
Level 1
Level 1

try this one it can export your ACP's

https://github.com/rnwolfe/fmc-tools

Review Cisco Networking for a $25 gift card