vmware / vmware/pyvmomi

How to extract cdp neibourghs from sdk

Open
#672 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Hi all, if somewhere could help me. I just began to work with pyVmomi so sorry for maybe fool questions. So I tried to use such a part of vim., https://github.com/vmware/pyvmomi/blob/master/docs/vim/host/PhysicalNic/CdpInfo.rst
But when I tryied to create ViewType for access to the thread, in such a way

    # Create a view
     viewType_hyper = [vim.host]

    recursive = True  # whether we should look into it recursively
   

    # Loop through all obhects to return name and VMware tools version
    containerView_hyper = content.viewManager.CreateContainerView(
        container, viewType_hyper, recursive)
    children_hyper=(containerView_hyper.view)
    print (children_hyper)

I got an error -> containerView = content.viewManager.CreateContainerView(
(Pdb)

/etc/network/scripts/sdk_test.py(66)main()
-> container, viewType, recursive)
(Pdb)
/etc/network/scripts/sdk_test.py(67)main()
-> containerView_hyper = content.viewManager.CreateContainerView(
(Pdb)
/etc/network/scripts/sdk_test.py(68)main()
-> container, viewType_hyper, recursive)
(Pdb)
TypeError: TypeErro...Module',)

or TypeError: For "type" expected type type, but got LazyModule

Something like

viewType_hyper = [vim.HostSystem] works fine but I don't know how from this root to access to thread needed for me. What is I doing wrong? I just got all needed info about cluster and it structure, about virtual machine but I also need cdp neighbours of hypervisors. Please, I need help )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/vim/host/PhysicalNic/CdpInfo.rst and the failing code in /etc/network/scripts/sdk_test.py around line 66. Reproduce the CreateContainerView TypeError and inspect the types accepted by viewType. Done means documenting or validating a supported way to reach CDP neighbor information from the relevant host objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.