Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fault in Cisco ACI Python SDK Object fvnsEncapBlk attribute named "from" --> Reserved keyword in Python #146

Open
briantilburgs opened this issue Jul 16, 2021 · 0 comments

Comments

@briantilburgs
Copy link

There is a problem with requesting the vlans from a Vlan Encap Block:
"cobra.model.fvns.EncapBlk"

When configuring it can be done with an attribute "from_":

cobra.model.fvns.EncapBlk(
        fvnsVlanInstP,
        from_=u'vlan-123',
        name=u'',
        descr=u'',
        to=u'vlan-124',
        nameAlias=u'',
        allocMode=u'static'
    )

But when requesting, that doesn't work:

from cobra.mit.request import DnQuery, ClassQuery
import cobra.mit.access
import cobra.mit.session
import cobra.model.pol

apic="10.1.1.1"
username="admin"
password="admin123"

ls = cobra.mit.session.LoginSession(f'https://{apic}', username, password, secure=False)
aci = cobra.mit.access.MoDirectory(ls)
aci.login()
objtype = "fvnsEncapBlk"
qry = ClassQuery(objtype)
qry.orderBy = '{}.dn'.format(objtype)
objects = aci.query(qry)
vlencapblk = objects[0]

print(f" VLAN block Name: {vlencapblk.name}")
print(f" VLAN block DN: {vlencapblk.dn}")
print(f" To VLAN: {vlencapblk.to}")

# Problem:
print(f" From VLAN: {vlencapblk.from}")
# Workarround:
print(f' from VLAN: {getattr(vlencapblk, "from")}')

the "vlencapblk.from" uses the reserved keyword "from" would it be possible to change this to "from_"

Thanks very much,
Brian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant