datacenter / cobra

Cobra - Python bindings for the ACI REST API
Other
88 stars 41 forks source link

Cobra generates malformed XML #106

Closed mtimm closed 9 years ago

mtimm commented 9 years ago

Similar to #105, Cobra will generate malformed XML if the root MO being created has no attributes. For example:

>>> from cobra.mit.access import MoDirectory
>>> from cobra.mit.session import LoginSession
>>> from cobra.internal.codec.jsoncodec import toJSONStr
>>> from cobra.model.fvns import VlanInstP, EncapBlk
>>> vlan_range_from = 10
>>> vlan_range_to = 11
>>> ls = LoginSession('http://10.10.10.175', 'admin', 'p@ssword')
>>> modir = MoDirectory(ls)
>>> modir.login()
>>> infra_infra = modir.lookupByDn('uni/infra')
>>> print toXMLStr(infra_infra)
<?xml version="1.0" encoding="UTF-8"?>

>>>

infra_infra at this point should be something like:

<?xml version="1.0" encoding="UTF-8"?>
<infraInfra></infraInfra>