datacenter / acitoolkit

A basic toolkit for accessing the Cisco APIC
Other
350 stars 266 forks source link

Unable to use epg.get_all_consumed() or epg.get_all_provided() to get the contract information of a epg #214

Closed nick00783 closed 8 years ago

nick00783 commented 8 years ago

Hey guys: I find that I can't use get_all_consumed or get_all_provided to get the contract of EPG,it returns {} every time,do anyone know how to use it or is there any other way around to meet my need ? Thanks for your helping..

michsmit99 commented 8 years ago

The get_all_consumed and get_all_provided functions are meant to be called after the configuration has been created locally or pulled from the APIC using a call to Tenant class get_deep function. How are you using them ?

Here's a small example of creating config locally:

from acitoolkit import *
tenant = Tenant('mytenant')
app = AppProfile('myapp', tenant)
epg = EPG('myepg', app)
contract = Contract('mycontract', tenant)
epg.provide(contract)
print len(epg.get_all_provided())
richardstrnad commented 8 years ago

You can find a example with get_deep here https://github.com/datacenter/acitoolkit/issues/146

nick00783 commented 8 years ago

thank you very much...looks like this is the solution