The functionality of this Fling is now officially available in vSphere 6.7!
May 05, 2017

Hi, I'm trying to install the learnswicth but I always get this error:

Traceback (most recent call last):
File "", line 28, in <module>
from pyVmomi import Vim, Vmodl, SoapStubAdapter, VmomiSupport
ImportError: cannot import name Vim

I'm using python 2.7.12 and I have tried on Windows, Ubuntu and Manjaro but I always get the same error.

Am I doing something wrong?


May 05, 2017

Hi I am trying to setup in my environment, but each time that I execute the python script y receive the following:

File “”, line 344, in
File “”, line 313, in main
content = get_vc_content()
File “”, line 244, in get_vc_content
ssl._create_default_https_context = ssl._create_unverified_context
AttributeError: ‘module’ object has no attribute ‘_create_unverified_context’

What I need to check in order to fix it?


May 05, 2017
May 13, 2017

Hi Msubin, Once I updated python, it works like a charm, thanks for your help.

May 02, 2017

Hi William,

This is working great! Thanks again
Had some issues installing the "pwd" module in python Windows, but removing the import
of "pwd" from the script it works just fine. Do you need the pwd module btw?

Do you think it will going to a new feature in time?
The reason I ask is because more and more firewall/routers are going virtual and
promisc mode is not a good solution....

thanks again

LearnSwitch Instance 'DV-SWITCH01' mac address table :

total number of MAC addresses: 4
number of MAC addresses returned: 4
Destination Address Address Type VLAN ID VXLAN ID Destination Port Age
------------------- ------------ ------- -------- ---------------- ---
00:50:56:50:b9:d7 Dynamic 0 0 335544323 1
00:50:56:9c:54:90 Dynamic 0 0 335544323 4
00:50:56:c6:2c:98 Dynamic 0 0 335544322 6
00:50:56:9c:98:d3 Dynamic 0 0 335544322 4

May 04, 2017

Newer ESX versions will have MAC learning as part of the native DVS implementation. Learnswitch will help for ESX 6.0 and 6.5

Apr 28, 2017

I'm getting an error when running the command.

python dvsname003 add
Traceback (most recent call last):
File "", line 339, in <module>
File "", line 315, in main
edit_learnswitch_overlay(dvsManager, dvs_mor.uuid, hostMor)
File "", line 113, in edit_learnswitch_overlay = hostMor
File "/root/pyVpx/pyVmomi/", line 514, in __setattr__
CheckField(self._GetPropertyInfo(name), val)
File "/root/pyVpx/pyVmomi/", line 883, in CheckField
raise TypeError('Required field "%s" not provided (not @optional)' %
TypeError: Required field "host" not provided (not @optional)

On the docs when editing the config section I see ]] after the dvpg_name_list. I'm assuming that's a typo at this point. It's not included in the original file.

The script appears to be connecting to vcenter and then bailing out after that. I have ran the script from current macOS and Ubuntu host systems with python 2.7.x installed. vCenter 6.5.0d ESXi 6.5.0d.

Any suggestions?


Apr 30, 2017

Thanks William..

Hmm. I have never hit this issue before.
Maybe the IP was not found in VC inventory as a physical host(note: this should be the IP of the Outer physical ESX(not the nested ESX IP))

Can you just do a "print hostMor" at the start of edit_learnswitch_overlay() and make sure it's not None.

Apr 28, 2017

Hi Blake,

Yes, that's a typo on the instructions. I'll file a bug to get that fixed. I assume you've successfully installed the VIB? I've got this working on a vSphere 6.5d env and I used my macOS running python 2.7.10 without issues.

Let see if Subin has additional steps for troubleshooting

May 08, 2017

Looking at this with fresh eyes again this morning I was able to configure without issue! Thanks!