nuagenetworks / vspk-python

A Python library for managing Nuage through its API
http://www.nuagenetworks.net
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

Is Quickstart example of fetching entities by ID outdated? #10

Closed hellt closed 5 years ago

hellt commented 7 years ago

As of 4.0.R8 Quickstart section of VSPK doc says the following in the Fetching objects section:

my_subnet = NUSubnet(id="123e4567-e89b-12d3-a456-426655440000")
my_subnet.get()

# Now, the attributes of the object are populated with data from VSD. We
# can for instance print the subnet's name:
logging.info("Fetched subnet %s!" % my_subnet.name)

I suppose this was true for 3.2, in 4.0 NURest object has no get() method defined:

l3dom = vspk.NUDomain(id='a9748cd5-23ee-40e9-abbc-782331a89c58')
l3dom.get()
# Results in --> AttributeError: 'NUDomain' object has no attribute 'get'

fetch() method should be used instead:

l3dom = vspk.NUDomain(id='a9748cd5-23ee-40e9-abbc-782331a89c58')
l3dom.fetch()
print(l3dom.name)  # prints l3domain name by the supplied id
little-dude commented 7 years ago

Indeed. Thanks for pointing this out!

pdellaert commented 7 years ago

@little-dude, seems like it is still the case? Can you fix this?

pdellaert commented 5 years ago

Will be fixed in 6.0 (finally...)