Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Arya converstion problem #2

@coopsart

Description

@coopsart

I am trying to generate a python script that upgrades the APIC cluster. I am using Arya to build the script from the following JSON code from the API inspector:

{"ctrlrInst":{"attributes":{"dn":"uni/controller","status":"modified"},"children":[{"firmwareCtrlrFwP":{"attributes":{"dn":"uni/controller/ctrlrfwpol","version":"apic-1.1(1j)"},"children":[]}},{"maintCtrlrMaintP":{"attributes":{"dn":"uni/controller/ctrlrmaintpol","adminSt":"triggered"},"children":[]}},{"trigSchedP":{"attributes":{"dn":"uni/controller/schedp-ConstSchedP","status":"modified"},"children":[{"trigAbsWindowP":{"attributes":{"dn":"uni/controller/schedp-ConstSchedP/abswinp-ConstAbsWindowP","date":"2015-06-23T02:16:16.402+00:00"},"children":[]}}]}}]}}

Arya built this:

import cobra.mit.access
import cobra.mit.request
import cobra.mit.session
import cobra.model.ctrlr
import cobra.model.firmware
import cobra.model.maint
import cobra.model.pol
import cobra.model.trig
from cobra.internal.codec.xmlcodec import toXMLStr

log into an APIC and create a directory object

ls = cobra.mit.session.LoginSession('https://10.221.79.101', 'admin', 'C!sco123')
md = cobra.mit.access.MoDirectory(ls)
md.login()

the top level object on which operations will be made

topMo = cobra.model.pol.Uni('')

build the request using cobra syntax

ctrlrInst = cobra.model.ctrlr.Inst(topMo)
firmwareCtrlrFwP = cobra.model.firmware.CtrlrFwP(ctrlrInst, version=u'apic-1.1(1j)')
maintCtrlrMaintP = cobra.model.maint.CtrlrMaintP(ctrlrInst, adminSt=u'triggered')
trigSchedP = cobra.model.trig.SchedP(ctrlrInst)
trigAbsWindowP = cobra.model.trig.AbsWindowP(trigSchedP, date=u'2015-06-23T02:16:16.402+00:00')

commit the generated code to APIC

print toXMLStr(topMo)
c = cobra.mit.request.ConfigRequest()
c.addMo(topMo)
md.commit(c)

When I try and run the script I get the following error:

Traceback (most recent call last):
File "upgrade_apic.py", line 24, in
trigSchedP = cobra.model.trig.SchedP(ctrlrInst)
TypeError: init() takes at least 3 arguments (2 given)

Thanks
Ben

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions