Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Add a script to verify vmodl.db from a wsdl file #177

Merged

Conversation

agrare
Copy link
Contributor

@agrare agrare commented Feb 16, 2020

This script parses the main vimService.wsdl and iterates through all of the ComplexTypes and checks that the params in the vmodl.db match the types from the WSDL.

It uses soap4r-ng which appears to be the only ruby soap wsdl parser that handles xsd:import/include directives which the VIM wsdls use extensively. This saved me a lot of manual parsing and recursive xml walking.

Example:

HostProxySwitch.pnic xsd:string doesn't match PhysicalNic
HostMultipathInfoLogicalUnit.lun xsd:string doesn't match ScsiLun
HostMultipathInfoPath.adapter xsd:string doesn't match HostHostBusAdapter
HostMultipathInfoPath.lun xsd:string doesn't match HostMultipathInfoLogicalUnit
HostOpaqueSwitch.pnic xsd:string doesn't match PhysicalNic
HostPlugStoreTopologyAdapter.adapter xsd:string doesn't match HostHostBusAdapter
HostPlugStoreTopologyAdapter.path xsd:string doesn't match HostPlugStoreTopologyPath
HostPlugStoreTopologyPath.adapter xsd:string doesn't match HostPlugStoreTopologyAdapter
HostPlugStoreTopologyPath.target xsd:string doesn't match HostPlugStoreTopologyTarget
HostPlugStoreTopologyPath.device xsd:string doesn't match HostPlugStoreTopologyDevice
HostPlugStoreTopologyDevice.lun xsd:string doesn't match ScsiLun
HostPlugStoreTopologyDevice.path xsd:string doesn't match HostPlugStoreTopologyPath
HostPlugStoreTopologyPlugin.device xsd:string doesn't match HostPlugStoreTopologyDevice
HostPlugStoreTopologyPlugin.claimedPath xsd:string doesn't match HostPlugStoreTopologyPath
HostPortGroup.vswitch xsd:string doesn't match HostVirtualSwitch
HostVMotionNetConfig.selectedVnic xsd:string doesn't match HostVirtualNic
HostVirtualNic.port xsd:string doesn't match HostPortGroupPort
VirtualNicManagerNetConfig.selectedVnic xsd:string doesn't match HostVirtualNic

@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch 2 times, most recently from 64adfe1 to d549352 Compare February 16, 2020 03:31
devel/verify-vim-wsdl.rb Outdated Show resolved Hide resolved
@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch 6 times, most recently from 7f5ee3c to 9c4cd11 Compare February 16, 2020 14:13
@jrgarcia jrgarcia self-requested a review February 17, 2020 19:24
@jrgarcia jrgarcia self-assigned this Feb 17, 2020
@jrgarcia
Copy link
Contributor

@agrare Is this using the stdlib wsdl/parser? If so, that was removed after 1.8.7 and I'm actually planning on dropping support for any non-stable Ruby versions in the very near future. If not, which library is it using?

@agrare
Copy link
Contributor Author

agrare commented Feb 17, 2020

Hey @jrgarcia this is using soap4r-ng (https://github.com/rubyjedi/soap4r), this was the only wsdl parser that I found that would follow the xsd:import and xsd:include directives and works on rubies at least as new as 2.5.7 which is what I have locally

@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch from 05cbd81 to f454cf1 Compare February 17, 2020 21:19
@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch from a5e9ddd to 851b664 Compare March 10, 2020 21:46
devel/verify-vim-wsdl.rb Outdated Show resolved Hide resolved
@agrare
Copy link
Contributor Author

agrare commented Mar 11, 2020

With #176 merged running this script results in 0 incorrect wsdl_types for the vsphere-ws and spbm service WSDLs

@Fryguy
Copy link
Contributor

Fryguy commented Mar 17, 2020

I could see this being added to CI as well, so that if someone makes a PR with updates to the wsdl file it will immediately fail the PR.

@agrare
Copy link
Contributor Author

agrare commented Mar 17, 2020

Yeah that would be nice, my goal is to actually turn this into a rake task that will actually generate the whole vmodl file repeatably.

@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch 2 times, most recently from 07636c4 to 899eae4 Compare April 13, 2020 11:54
@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch from 899eae4 to 63eef3e Compare April 13, 2020 14:50
@agrare agrare force-pushed the verify_vmodl_db_from_vim25_wsdl branch from 63eef3e to dfcc80b Compare August 3, 2020 18:07
@Fryguy
Copy link
Contributor

Fryguy commented Aug 3, 2020

@jrgarcia I think now that we are on newer rubies, this one is ready to go.

@jrgarcia
Copy link
Contributor

jrgarcia commented Aug 6, 2020

I'll revisit this at some point this week. Thanks for the nudge!

@jrgarcia
Copy link
Contributor

jrgarcia commented Aug 6, 2020

Hey @agrare! I'd love to accept this now that we've dropped those nasty, old Ruby versions. Can you do me a favor and add activesupport and soap4r-ng to the development (since they are only in this dev script) dependencies in the Gemspec? After that, I think this looks great and will be extremely helpful.

@agrare
Copy link
Contributor Author

agrare commented Aug 9, 2020

@jrgarcia Its a deal ;)

Copy link
Contributor

@jrgarcia jrgarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jrgarcia jrgarcia merged commit ada68a5 into vmware-archive:master Aug 10, 2020
@agrare agrare deleted the verify_vmodl_db_from_vim25_wsdl branch August 10, 2020 15:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants