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

how to use DeploymentQuery, when i met rsp-subtree-include=full-deployment. #133

Open
shoujche opened this issue Feb 2, 2018 · 1 comment

Comments

@shoujche
Copy link

shoujche commented Feb 2, 2018

Hi team,
when i access this rest api:node/mo/uni/phys-Bare-Domain-Chenzli.json?rsp-subtree-include=full-deployment&target-path=ADomPToEthIf
as you see, i must use DeploymentQuery to query it, becasue rsp-subtree-include=full-deployment
the codes:
polUni = cobra.model.pol.Uni('')
physDomP = cobra.model.phys.DomP(polUni, name=self.kwargs['phys_domain'])

    dnQuery = DeploymentQuery(physDomP.dn)
    dnQuery.targetPath ='ADomPToEthIf'
    physDomPs = self.session.query(dnQuery)

but when i put /uni/phys-Bare-Domain-Chenzli DN in DelpoymentQuery.
it still return /uni/phys-Bare-Domain-Chenzli DN
so i cannot get any results , but the request rest api is ok.
i guess this Query is special, right?
i hope you can help me , i'm also cisco employee, thanks.
my ccid: shoujche

@camrossi
Copy link

Not sure if you still need help since was 1y ago but I got this working today in my lab with this code:

print 'Getting all Phys Dom'
q1 = cobra.mit.request.ClassQuery('physDomP')
pDomains = md.query(q1)

#Get the deployment Status for the Physical Domains:
for pDom in pDomains:
    print(pDom.dn)
    #Retruns a PhysDom Deployment object with, as children, the leaves associated to it
    q2 = cobra.mit.request.DeploymentQuery(pDom.dn)
    depStatus = md.query(q2)
    for deployedPhysDom in depStatus:
        for node in deployedPhysDom.children:
            print(node.nodeId)

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

2 participants