datacenter / pyaci

Python Bindings for Cisco ACI REST API
Apache License 2.0
43 stars 30 forks source link

Unable to get ACL permits/drops in pyaci #45

Open the-modern-leo opened 4 years ago

the-modern-leo commented 4 years ago

I have attempted to use all the solutions provided above for getting packets, and my query is returning an empty list. result = apic.methods.ResolveClass('acllogPermitL3Pkt').GET() result2 = apic.mit.polUni().fvTenant(tenant).GET(**options.subtreeClass('acllogPermitL3Pkt')) result3 = apic.methods.ResolveClass('acllogPermitL3Pkt').GET(**options.filter( filters.Wcard('acllogDropL3Pkt.dn', f"ndbgs/acllog/tn-{tenant}") & filters.Wcard('acllogDropL3Pkt.srcIp', "10.71.0.164"))) test = apic.mit.polUni().fvTenant(tenant).GET() Originally posted by @the-modern-leo in https://github.com/datacenter/pyaci/issues/44#issuecomment-591674636

the-modern-leo commented 4 years ago

Is there any progress on this issue? The University of Utah is waiting for this to complete one of our tools.

kprav33n commented 4 years ago

I just tried this with the first query that you pointed out on a local setup here.

➜ python
Python 3.8.1 (default, Jan 17 2020, 15:05:28)
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyaci import Node
>>> apic = Node('*****')
>>> apic.methods.Login('admin', '*****').POST()
<Response [200]>
>>> result = apic.methods.ResolveClass('acllogPermitL3Pkt').GET()
>>> len(result)
2400

There is no issue with PyACI. The query rightly returns results.

I suspect that you have not enabled the logging feature on your APIC. Can you please check your configuration. Please refer to the official documentation of APIC on how to enable this feature. Here is an instruction that says on how to do this for a new contract. For an existing contract, just follow step 11 alone.

https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/4-x/security/b-Cisco-APIC-Security-Configuration-Guide-421/b-Cisco-APIC-Security-Configuration-Guide-421_chapter_01011.html#id_29992