Repository: ansible/ansible

Issue:
vmware_guest "msg": "VLAN 'XX' does not exist."
<!---
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release, and devel branch are affected too.
Always add information AFTER of these html comments.
-->

##### ISSUE TYPE
<!--- Pick one below and delete the rest -->
 - Bug Report


##### COMPONENT NAME
<!---
Insert below this comment the name of the module, plugin, task or feature.
Do not include extra details here, e.g. "vyos_command" not "the network module vyos_command" or the full path
-->
vmware_guest

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below -->
```
ansible 2.5.0
  config file = /home/jrottmann/Dokumente/ansible/ansible-root/ansible.cfg
  configured module search path = [u'/home/jrottmann/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Jan  5 2018, 10:41:29) [GCC 7.2.1 20171224]
```

##### CONFIGURATION
<!---
If using Ansible 2.4 or above, paste the results of "ansible-config dump --only-changed"
Otherwise, mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
-->
DEFAULT_HASH_BEHAVIOUR(/home/jrottmann/Dokumente/ansible/ansible-root/ansible.cfg) = merge
DEFAULT_REMOTE_USER(/home/jrottmann/Dokumente/ansible/ansible-root/ansible.cfg) = root
DEFAULT_SCP_IF_SSH(/home/jrottmann/Dokumente/ansible/ansible-root/ansible.cfg) = True
##### OS / ENVIRONMENT
<!---
Mention the OS you are running Ansible from, and the OS you are
managing, or say "N/A" for anything that is not platform-specific.
Also mention the specific version of what you are trying to control,
e.g. if this is a network bug the version of firmware on the network device.
-->
arch linux
##### SUMMARY
<!--- Explain the problem briefly -->
After Upgrading from 2.4.3 to 2.5.0 my playbook fails with "msg": "VLAN 'XX' does not exist." . This VLAN definitely exists and I have access to it( 2.4.3 works)
##### STEPS TO REPRODUCE
<!---
For bugs, show exactly how to reproduce the problem, using a minimal test-case.
For new features, show how the feature would be used.
-->
Get Playbook to work in 2.4.3 and upgrade to 2.5.0. Execute one time with state: present and with state: poweredon

<!--- Paste example playbooks or commands between quotes below -->
```yaml
- name: VMware Deployment
  vmware_guest:
    hostname: "{{ deployment_vmware.vmwarehost }}"
    datacenter: "{{ deployment_vmware.datacenter }}"
    validate_certs: "{{ deployment_vmware.validate_certs }}"
    username: "{{ deployment_vmware.username }}"
    password: "{{ deployment_vmware.password }}"
    resource_pool: "{{ deployment_vmware.resource_pool }}"
    folder: "{{ deployment_vmware.folder }}"
    wait_for_ip_address: "{{ deployment_vmware.wait_for_ip_address }}"
    template: "{{ deployment_vmware.template }}"
    name: "{{ deployment.name | default(inventory_hostname) }}"
    state: "present"
    networks: "{{ tmp_networks_final }}"
    disk: "{{ tmp_disks_final }}"
  register: vm_config
```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->
Deploy VM, and adjust it if needed.
##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->
If the vm does not exist yet it exits with the error message.
If the vm does already exist(i.e. deployed with ansible 2.4.3), with state: poweredon it runs successfully(as this state does not check configuration of vm), with state: present it exits with the same error message. This happens for both VLANs I'm using.
<!--- Paste verbatim command output between quotes below -->
```
fatal: [mi-ci]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "annotation": null, 
            "cdrom": {}, 
            "cluster": null, 
            "customization": {}, 
            "customvalues": [], 
            "datacenter": "XXX", 
            "disk": [
                {
                    "datastore": "SATA_XXX", 
                    "size_gb": 20, 
                    "type": "thin"
                }
            ], 
            "esxi_hostname": null, 
            "folder": "XXX/vm/intern/Dev-Testing/XX", 
            "force": false, 
            "guest_id": null, 
            "hardware": {}, 
            "hostname": "XXX", 
            "is_template": false, 
            "linked_clone": false, 
            "name": "mi-ci", 
            "name_match": "first", 
            "networks": [
                {
                    "gateway": "XXX", 
                    "ip": "XXX", 
                    "name": "VLAN_69_XXX-Server", 
                    "netmask": "255.255.255.0", 
                    "type": "static", 
                    "vlan": 69
                }
            ], 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "port": 443, 
            "resource_pool": "XXX", 
            "snapshot_src": null, 
            "state": "present", 
            "template": "ubuntu-16.04-template", 
            "username": "SAPDOM\\XXX", 
            "uuid": null, 
            "validate_certs": false, 
            "wait_for_ip_address": true
        }
    }, 
    "msg": "VLAN '69' does not exist."
}
```



Discussion:
Files identified in the description:
* [lib/ansible/modules/cloud/vmware/vmware_guest.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/vmware/vmware_guest.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Akasurde @akasurde @dagwieers @dav1x @jctanner @nerzhul @pdellaert
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
@thorus90 Thanks for reporting this issue.
As a workaround, can you just use name in network parameter ? Let me know if it works for you.
@thorus90 Can you check Distributed Virtual Portgroup `VLAN_69_XXX-Server` is associated with hostsystem on which you are trying to deploy VM ?

I am only able to reproduce this error if host system is not associated with dvpg specified in networks.

needs_info
I'm on a business trip this week, will test this as soon as I can.
I'm running into this in ansible 2.5.1.
Here's my task:
```
  tasks:
  - name: Change VLANs
    vmware_guest:
      hostname: "{{ hostname }}"
      username: "{{ user }}"
      password: "{{ password }}"
      uuid: "{{ uuid }}"
      validate_certs: no
      networks:
      - vlan: {{ vlan }}
        ip: {{ ip }}
        netmask: 255.255.255.0
        gateway: {{ gateway }}
    register: vm_config
    delegate_to: localhost
```

Here's my debug output:
```
"msg": {
  "changed": false,
  "failed": false,
  "instance": {
    "annotation": "",
    "current_snapshot": null,
    "customvalues": {},
    "guest_consolidation_needed": false,
    "guest_question": null,
    "guest_tools_status": "guestToolsRunning",
    "guest_tools_version": "10277",
    "hw_cores_per_socket": 1,
    "hw_datastores": [
      "datastore1"
    ],
    "hw_esxi_host": "host.example.com",
    "hw_eth0": {
      "addresstype": "assigned",
      "ipaddresses": [
        "172.20.10.181"
      ],
      "label": "Network adapter 1",
      "macaddress": "00:50:56:84:47:d7",
      "macaddress_dash": "00-50-56-84-47-d7",
      "summary": "VLAN10"
    },
    "hw_files": [
      "[datastore1] dfwccdas2/dfwccdas2.vmx",
      "[datastore1] dfwccdas2/dfwccdas2.vmsd",
      "[datastore1] dfwccdas2/dfwccdas2.nvram",
      "[datastore1] dfwccdas2/dfwccdas2.vmdk"
    ],
    "hw_folder": "/DFW/vm",
    "hw_guest_full_name": "CentOS 7 (64-bit)",
    "hw_guest_ha_state": null,
    "hw_guest_id": "centos7_64Guest",
    "hw_interfaces": [
      "eth0"
    ],
    "hw_is_template": false,
    "hw_memtotal_mb": 12228,
    "hw_name": "dfwccdas2",
    "hw_power_status": "poweredOn",
    "hw_processor_count": 4,
    "hw_product_uuid": "4204ecae-d1c8-1bb1-80cd-08696f2d3e1d",
    "instance_uuid": "50045324-342b-bd78-72c3-ee682c76a47f",
    "ipv4": "172.20.10.181",
    "ipv6": null,
    "module_hw": true,
    "snapshots": []
  }
}
```
I can't seem to find a name to associate with the network adapter and I get the same error: `VLAN 'XX' does not exist.`
I don't have a Distributed Virtual Portgroup (which it searches for here: https://github.com/ansible/ansible/blob/fda67bae50c3384f8656b5c013bfed5cb360997d/lib/ansible/modules/cloud/vmware/vmware_guest.py#L997). Here's some json details about this instance:
```
{
  "VirtualMachines": [
    {
      "Self": {
        "Type": "VirtualMachine",
        "Value": "vm-1065"
      },
      "Value": null,
      "AvailableField": null,
      "Parent": {
        "Type": "Folder",
        "Value": "group-v22"
      },
      "CustomValue": null,
      "OverallStatus": "green",
      "ConfigStatus": "green",
      "ConfigIssue": null,
      "EffectiveRole": [
        -1
      ],
      "Permission": null,
      "Name": "dfwccdas2",
      "DisabledMethod": [
        "Destroy_Task",
        "UnregisterVM",
        "UnmountToolsInstaller",
        "AnswerVM",
        "UpgradeVM_Task",
        "UpgradeTools_Task",
        "UpgradeToolsFromImage_Task",
        "StartRecording_Task",
        "StopRecording_Task",
        "StartReplaying_Task",
        "StopReplaying_Task",
        "TurnOffFaultToleranceForVM_Task",
        "MakePrimaryVM_Task",
        "TerminateFaultTolerantVM_Task",
        "DisableSecondaryVM_Task",
        "EnableSecondaryVM_Task",
        "CreateSecondaryVM_Task",
        "CreateSecondaryVMEx_Task",
        "StopRecording_Task",
        "StopReplaying_Task",
        "CustomizeVM_Task",
        "MarkAsTemplate",
        "ResetGuestInformation",
        "ExportVm",
        "PowerOnVM_Task",
        "MarkAsVirtualMachine"
      ],
      "RecentTask": null,
      "DeclaredAlarmState": [{...}],
      "TriggeredAlarmState": null,
      "AlarmActionsEnabled": true,
      "Tag": null,
      "Capability": {
        "SnapshotOperationsSupported": true,
        "MultipleSnapshotsSupported": true,
        "SnapshotConfigSupported": true,
        "PoweredOffSnapshotsSupported": true,
        "MemorySnapshotsSupported": true,
        "RevertToSnapshotSupported": true,
        "QuiescedSnapshotsSupported": true,
        "DisableSnapshotsSupported": false,
        "LockSnapshotsSupported": true,
        "ConsolePreferencesSupported": false,
        "CpuFeatureMaskSupported": true,
        "S1AcpiManagementSupported": true,
        "SettingScreenResolutionSupported": false,
        "ToolsAutoUpdateSupported": false,
        "VmNpivWwnSupported": true,
        "NpivWwnOnNonRdmVmSupported": true,
        "VmNpivWwnDisableSupported": true,
        "VmNpivWwnUpdateSupported": true,
        "SwapPlacementSupported": true,
        "ToolsSyncTimeSupported": true,
        "VirtualMmuUsageSupported": true,
        "DiskSharesSupported": true,
        "BootOptionsSupported": true,
        "BootRetryOptionsSupported": true,
        "SettingVideoRamSizeSupported": true,
        "SettingDisplayTopologySupported": false,
        "RecordReplaySupported": false,
        "ChangeTrackingSupported": true,
        "MultipleCoresPerSocketSupported": true,
        "HostBasedReplicationSupported": true,
        "GuestAutoLockSupported": true,
        "MemoryReservationLockSupported": true,
        "FeatureRequirementSupported": true,
        "PoweredOnMonitorTypeChangeSupported": true,
        "SeSparseDiskSupported": true,
        "NestedHVSupported": true,
        "VPMCSupported": true,
        "SecureBootSupported": false
      },
      "Config": {
        "ChangeVersion": "2018-04-25T20:31:44.628377Z",
        "Modified": "1970-01-01T00:00:00Z",
        "Name": "dfwccdas2",
        "GuestFullName": "CentOS 4/5 or later (64-bit)",
        "Version": "vmx-09",
        "Uuid": "4204ecae-d1c8-1bb1-80cd-08696f2d3e1d",
        "InstanceUuid": "50045324-342b-bd78-72c3-ee682c76a47f",
        "NpivNodeWorldWideName": null,
        "NpivPortWorldWideName": null,
        "NpivWorldWideNameType": "",
        "NpivDesiredNodeWwns": 0,
        "NpivDesiredPortWwns": 0,
        "NpivTemporaryDisabled": true,
        "NpivOnNonRdmDisks": null,
        "LocationId": "564d6dd2-eab4-e024-43e2-e765b750bf19",
        "Template": false,
        "GuestId": "centos64Guest",
        "AlternateGuestName": "",
        "Annotation": "",
        "Files": {
          "VmPathName": "[datastore1] dfwccdas2/dfwccdas2.vmx",
          "SnapshotDirectory": "[datastore1] dfwccdas2/",
          "SuspendDirectory": "[datastore1] dfwccdas2/",
          "LogDirectory": "[datastore1] dfwccdas2/",
          "FtMetadataDirectory": ""
        },
        "Tools": {
          "ToolsVersion": 10277,
          "ToolsInstallType": "guestToolsTypeOpenVMTools",
          "AfterPowerOn": true,
          "AfterResume": true,
          "BeforeGuestStandby": true,
          "BeforeGuestShutdown": true,
          "BeforeGuestReboot": null,
          "ToolsUpgradePolicy": "upgradeAtPowerCycle",
          "PendingCustomization": "",
          "CustomizationKeyId": null,
          "SyncTimeWithHost": false,
          "LastInstallInfo": {
            "Counter": 0,
            "Fault": null
          }
        },
        "Flags": {
          "DisableAcceleration": false,
          "EnableLogging": false,
          "UseToe": false,
          "RunWithDebugInfo": false,
          "MonitorType": "release",
          "HtSharing": "any",
          "SnapshotDisabled": false,
          "SnapshotLocked": false,
          "DiskUuidEnabled": false,
          "VirtualMmuUsage": "automatic",
          "VirtualExecUsage": "hvAuto",
          "SnapshotPowerOffBehavior": "powerOff",
          "RecordReplayEnabled": false,
          "FaultToleranceType": "unset",
          "CbrcCacheEnabled": false
        },
        "ConsolePreferences": null,
        "DefaultPowerOps": {
          "PowerOffType": "soft",
          "SuspendType": "soft",
          "ResetType": "soft",
          "DefaultPowerOffType": "soft",
          "DefaultSuspendType": "hard",
          "DefaultResetType": "soft",
          "StandbyAction": "checkpoint"
        },
        "Hardware": {
          "NumCPU": 4,
          "NumCoresPerSocket": 1,
          "MemoryMB": 12228,
          "VirtualICH7MPresent": false,
          "VirtualSMCPresent": false,
          "Device": [
            {
              "Key": 200,
              "DeviceInfo": {
                "Label": "IDE 0",
                "Summary": "IDE 0"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 0,
              "UnitNumber": null,
              "BusNumber": 0,
              "Device": null
            },
            {
              "Key": 201,
              "DeviceInfo": {
                "Label": "IDE 1",
                "Summary": "IDE 1"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 0,
              "UnitNumber": null,
              "BusNumber": 1,
              "Device": null
            },
            {
              "Key": 300,
              "DeviceInfo": {
                "Label": "PS2 controller 0",
                "Summary": "PS2 controller 0"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 0,
              "UnitNumber": null,
              "BusNumber": 0,
              "Device": [
                600,
                700
              ]
            },
            {
              "Key": 100,
              "DeviceInfo": {
                "Label": "PCI controller 0",
                "Summary": "PCI controller 0"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 0,
              "UnitNumber": null,
              "BusNumber": 0,
              "Device": [
                500,
                12000,
                14000,
                1000,
                4000
              ]
            },
            {
              "Key": 400,
              "DeviceInfo": {
                "Label": "SIO controller 0",
                "Summary": "SIO controller 0"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 0,
              "UnitNumber": null,
              "BusNumber": 0,
              "Device": null
            },
            {
              "Key": 600,
              "DeviceInfo": {
                "Label": "Keyboard ",
                "Summary": "Keyboard"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 300,
              "UnitNumber": 0
            },
            {
              "Key": 700,
              "DeviceInfo": {
                "Label": "Pointing device",
                "Summary": "Pointing device; Device"
              },
              "Backing": {
                "DeviceName": "",
                "UseAutoDetect": false,
                "HostPointingDevice": "autodetect"
              },
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 300,
              "UnitNumber": 1
            },
            {
              "Key": 500,
              "DeviceInfo": {
                "Label": "Video card ",
                "Summary": "Video card"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 100,
              "UnitNumber": 0,
              "VideoRamSizeInKB": 4096,
              "NumDisplays": 1,
              "UseAutoDetect": false,
              "Enable3DSupport": false,
              "Use3dRenderer": "automatic",
              "GraphicsMemorySizeInKB": 262144
            },
            {
              "Key": 12000,
              "DeviceInfo": {
                "Label": "VMCI device",
                "Summary": "Device on the virtual machine PCI bus that provides support for the virtual machine communication interface"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": {
                "PciSlotNumber": 35
              },
              "ControllerKey": 100,
              "UnitNumber": 17,
              "Id": 1865235997,
              "AllowUnrestrictedCommunication": false,
              "FilterEnable": false,
              "FilterInfo": null
            },
            {
              "Key": 14000,
              "DeviceInfo": {
                "Label": "USB xHCI controller ",
                "Summary": "USB xHCI controller"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": {
                "PciSlotNumber": 192
              },
              "ControllerKey": 100,
              "UnitNumber": 23,
              "BusNumber": 0,
              "Device": null,
              "AutoConnectDevices": false
            },
            {
              "Key": 1000,
              "DeviceInfo": {
                "Label": "SCSI controller 0",
                "Summary": "LSI Logic"
              },
              "Backing": null,
              "Connectable": null,
              "SlotInfo": {
                "PciSlotNumber": 16
              },
              "ControllerKey": 100,
              "UnitNumber": 3,
              "BusNumber": 0,
              "Device": [
                2000
              ],
              "HotAddRemove": true,
              "SharedBus": "noSharing",
              "ScsiCtlrUnitNumber": 7
            },
            {
              "Key": 2000,
              "DeviceInfo": {
                "Label": "Hard disk 1",
                "Summary": "125,829,120 KB"
              },
              "Backing": {
                "FileName": "[datastore1] dfwccdas2/dfwccdas2.vmdk",
                "Datastore": {
                  "Type": "Datastore",
                  "Value": "datastore-809"
                },
                "BackingObjectId": "",
                "DiskMode": "persistent",
                "Split": false,
                "WriteThrough": false,
                "ThinProvisioned": true,
                "EagerlyScrub": null,
                "Uuid": "6000C290-dfb0-09af-ddff-cc88b162e6ec",
                "ContentId": "54eac0e3f3f705652ab4c2694d6b5a25",
                "ChangeId": "",
                "Parent": null,
                "DeltaDiskFormat": "",
                "DigestEnabled": false,
                "DeltaGrainSize": 0,
                "DeltaDiskFormatVariant": "",
                "Sharing": "sharingNone",
                "KeyId": null
              },
              "Connectable": null,
              "SlotInfo": null,
              "ControllerKey": 1000,
              "UnitNumber": 0,
              "CapacityInKB": 125829120,
              "CapacityInBytes": 128849018880,
              "Shares": {
                "Shares": 1000,
                "Level": "normal"
              },
              "StorageIOAllocation": {
                "Limit": -1,
                "Shares": {
                  "Shares": 1000,
                  "Level": "normal"
                },
                "Reservation": 0
              },
              "DiskObjectId": "218-2000",
              "VFlashCacheConfigInfo": null,
              "Iofilter": null,
              "VDiskId": null
            },
            {
              "Key": 4000,
              "DeviceInfo": {
                "Label": "Network adapter 1",
                "Summary": "VLAN10"
              },
              "Backing": {
                "DeviceName": "VLAN10",
                "UseAutoDetect": false,
                "Network": {
                  "Type": "Network",
                  "Value": "network-89"
                },
                "InPassthroughMode": null
              },
              "Connectable": {
                "StartConnected": true,
                "AllowGuestControl": true,
                "Connected": true,
                "Status": "ok"
              },
              "SlotInfo": null,
              "ControllerKey": 100,
              "UnitNumber": 7,
              "AddressType": "assigned",
              "MacAddress": "00:50:56:84:47:d7",
              "WakeOnLanEnabled": true,
              "ResourceAllocation": {
                "Reservation": 0,
                "Share": {
                  "Shares": 50,
                  "Level": "normal"
                },
                "Limit": -1
              },
              "ExternalId": "",
              "UptCompatibilityEnabled": true
            }
          ]
        },
        "CpuAllocation": {
          "Reservation": 0,
          "ExpandableReservation": false,
          "Limit": -1,
          "Shares": {
            "Shares": 4000,
            "Level": "normal"
          },
          "OverheadLimit": null
        },
        "MemoryAllocation": {
          "Reservation": 0,
          "ExpandableReservation": false,
          "Limit": -1,
          "Shares": {
            "Shares": 122280,
            "Level": "normal"
          },
          "OverheadLimit": null
        },
        "LatencySensitivity": {
          "Level": "normal",
          "Sensitivity": 0
        },
        "MemoryHotAddEnabled": false,
        "CpuHotAddEnabled": false,
        "CpuHotRemoveEnabled": false,
        "HotPlugMemoryLimit": 12228,
        "HotPlugMemoryIncrementSize": 0,
        "CpuAffinity": null,
        "MemoryAffinity": null,
        "NetworkShaper": null,
        "ExtraConfig": [
          {
            "Key": "sched.cpu.latencySensitivity",
            "Value": "normal"
          },
          {
            "Key": "tools.guest.desktop.autolock",
            "Value": "FALSE"
          },
          {
            "Key": "pciBridge0.present",
            "Value": "TRUE"
          },
          {
            "Key": "svga.present",
            "Value": "TRUE"
          },
          {
            "Key": "pciBridge4.present",
            "Value": "TRUE"
          },
          {
            "Key": "pciBridge4.virtualDev",
            "Value": "pcieRootPort"
          },
          {
            "Key": "pciBridge4.functions",
            "Value": "8"
          },
          {
            "Key": "pciBridge5.present",
            "Value": "TRUE"
          },
          {
            "Key": "pciBridge5.virtualDev",
            "Value": "pcieRootPort"
          },
          {
            "Key": "pciBridge5.functions",
            "Value": "8"
          },
          {
            "Key": "pciBridge6.present",
            "Value": "TRUE"
          },
          {
            "Key": "pciBridge6.virtualDev",
            "Value": "pcieRootPort"
          },
          {
            "Key": "pciBridge6.functions",
            "Value": "8"
          },
          {
            "Key": "pciBridge7.present",
            "Value": "TRUE"
          },
          {
            "Key": "pciBridge7.virtualDev",
            "Value": "pcieRootPort"
          },
          {
            "Key": "pciBridge7.functions",
            "Value": "8"
          },
          {
            "Key": "hpet0.present",
            "Value": "TRUE"
          },
          {
            "Key": "scsi0.pciSlotNumber",
            "Value": "16"
          },
          {
            "Key": "vmci0.pciSlotNumber",
            "Value": "35"
          },
          {
            "Key": "nvram",
            "Value": "dfwccdas2.nvram"
          },
          {
            "Key": "virtualhw.productcompatibility",
            "Value": "hosted"
          },
          {
            "Key": "vmware.tools.internalversion",
            "Value": "10277"
          },
          {
            "Key": "vmware.tools.requiredversion",
            "Value": "10272"
          },
          {
            "Key": "migrate.hostLogState",
            "Value": "none"
          },
          {
            "Key": "migrate.migrationId",
            "Value": "0"
          },
          {
            "Key": "migrate.hostLog",
            "Value": "dfwccdas2-4c800311.hlog"
          },
          {
            "Key": "ethernet0.pciSlotNumber",
            "Value": "160"
          },
          {
            "Key": "monitor.phys_bits_used",
            "Value": "40"
          },
          {
            "Key": "numa.autosize.cookie",
            "Value": "40001"
          },
          {
            "Key": "numa.autosize.vcpu.maxPerVirtualNode",
            "Value": "4"
          },
          {
            "Key": "pciBridge0.pciSlotNumber",
            "Value": "17"
          },
          {
            "Key": "pciBridge4.pciSlotNumber",
            "Value": "21"
          },
          {
            "Key": "pciBridge5.pciSlotNumber",
            "Value": "22"
          },
          {
            "Key": "pciBridge6.pciSlotNumber",
            "Value": "23"
          },
          {
            "Key": "pciBridge7.pciSlotNumber",
            "Value": "24"
          },
          {
            "Key": "sched.swap.derivedName",
            "Value": "/vmfs/volumes/4e086fd8-1d570ebe-655e-782bcb2f8914/dfwccdas2/dfwccdas2-a6d62811.vswp"
          },
          {
            "Key": "scsi0:0.redo",
            "Value": ""
          },
          {
            "Key": "softPowerOff",
            "Value": "FALSE"
          },
          {
            "Key": "usb_xhci.pciSlotNumber",
            "Value": "192"
          },
          {
            "Key": "usb_xhci:1.deviceType",
            "Value": "hub"
          },
          {
            "Key": "usb_xhci:1.parent",
            "Value": "-1"
          },
          {
            "Key": "usb_xhci:1.port",
            "Value": "1"
          },
          {
            "Key": "usb_xhci:1.present",
            "Value": "TRUE"
          },
          {
            "Key": "usb_xhci:1.speed",
            "Value": "2"
          },
          {
            "Key": "usb_xhci:3.deviceType",
            "Value": "hub"
          },
          {
            "Key": "usb_xhci:3.parent",
            "Value": "-1"
          },
          {
            "Key": "usb_xhci:3.port",
            "Value": "3"
          },
          {
            "Key": "usb_xhci:3.present",
            "Value": "TRUE"
          },
          {
            "Key": "usb_xhci:3.speed",
            "Value": "4"
          },
          {
            "Key": "usb_xhci:4.deviceType",
            "Value": "hid"
          },
          {
            "Key": "usb_xhci:4.parent",
            "Value": "1"
          },
          {
            "Key": "usb_xhci:4.port",
            "Value": "0"
          },
          {
            "Key": "usb_xhci:4.present",
            "Value": "TRUE"
          },
          {
            "Key": "vmotion.checkpointFBSize",
            "Value": "4194304"
          }
        ],
        "CpuFeatureMask": null,
        "DatastoreUrl": [
          {
            "Name": "datastore1",
            "Url": "/vmfs/volumes/4e086fd8-1d570ebe-655e-782bcb2f8914"
          }
        ],
        "SwapPlacement": "inherit",
        "BootOptions": {
          "BootDelay": 0,
          "EnterBIOSSetup": false,
          "EfiSecureBootEnabled": false,
          "BootRetryEnabled": false,
          "BootRetryDelay": 10000,
          "BootOrder": null,
          "NetworkBootProtocol": "ipv4"
        },
        "FtInfo": null,
        "RepConfig": null,
        "VAppConfig": {
          "Product": [
            {
              "Key": 0,
              "ClassId": "",
              "InstanceId": "",
              "Name": "",
              "Vendor": "",
              "Version": "",
              "FullVersion": "",
              "VendorUrl": "",
              "ProductUrl": "",
              "AppUrl": ""
            }
          ],
          "Property": null,
          "IpAssignment": {
            "SupportedAllocationScheme": null,
            "IpAllocationPolicy": "fixedPolicy",
            "SupportedIpProtocol": [
              "IPv4"
            ],
            "IpProtocol": "IPv4"
          },
          "Eula": null,
          "OvfSection": null,
          "OvfEnvironmentTransport": null,
          "InstallBootRequired": false,
          "InstallBootStopDelay": 0
        },
        "VAssertsEnabled": false,
        "ChangeTrackingEnabled": false,
        "Firmware": "bios",
        "MaxMksConnections": 40,
        "GuestAutoLockEnabled": false,
        "ManagedBy": null,
        "MemoryReservationLockedToMax": false,
        "InitialOverhead": {
          "InitialMemoryReservation": 129269760,
          "InitialSwapReservation": 207704064
        },
        "NestedHVEnabled": false,
        "VPMCEnabled": false,
        "ScheduledHardwareUpgradeInfo": {
          "UpgradePolicy": "never",
          "VersionKey": "",
          "ScheduledHardwareUpgradeStatus": "none",
          "Fault": null
        },
        "ForkConfigInfo": {
          "ParentEnabled": false,
          "ChildForkGroupId": "",
          "ParentForkGroupId": "",
          "ChildType": ""
        },
        "VFlashCacheReservation": 0,
        "VmxConfigChecksum": "YWk1ZXVZRmMwYUJ1WG5xZmVpMEV6QzdRM25JPQ==",
        "MessageBusTunnelEnabled": false,
        "VmStorageObjectId": "",
        "SwapStorageObjectId": "",
        "KeyId": null,
        "GuestIntegrityInfo": {
          "Enabled": false
        },
        "MigrateEncryption": "opportunistic"
      },
      "Layout": {
        "ConfigFile": [
          "dfwccdas2.vmsd",
          "dfwccdas2.nvram"
        ],
        "LogFile": null,
        "Disk": [
          {
            "Key": 2000,
            "DiskFile": [
              "[datastore1] dfwccdas2/dfwccdas2.vmdk"
            ]
          }
        ],
        "Snapshot": null,
        "SwapFile": "[datastore1] dfwccdas2/dfwccdas2-a6d62811.vswp"
      },
      "LayoutEx": {
        "File": [
          {
            "Key": 0,
            "Name": "[datastore1] dfwccdas2/dfwccdas2.vmx",
            "Type": "config",
            "Size": 1836,
            "UniqueSize": 1836,
            "BackingObjectId": "",
            "Accessible": true
          },
          {
            "Key": 1,
            "Name": "[datastore1] dfwccdas2/dfwccdas2.vmsd",
            "Type": "snapshotList",
            "Size": 0,
            "UniqueSize": 0,
            "BackingObjectId": "",
            "Accessible": true
          },
          {
            "Key": 2,
            "Name": "[datastore1] dfwccdas2/dfwccdas2.vmdk",
            "Type": "diskDescriptor",
            "Size": 524,
            "UniqueSize": 524,
            "BackingObjectId": "",
            "Accessible": true
          },
          {
            "Key": 3,
            "Name": "[datastore1] dfwccdas2/dfwccdas2-flat.vmdk",
            "Type": "diskExtent",
            "Size": 2601517056,
            "UniqueSize": 2601517056,
            "BackingObjectId": "",
            "Accessible": true
          },
          {
            "Key": 5,
            "Name": "[datastore1] dfwccdas2/dfwccdas2.nvram",
            "Type": "nvram",
            "Size": 8684,
            "UniqueSize": 8684,
            "BackingObjectId": "",
            "Accessible": true
          },
          {
            "Key": 6,
            "Name": "[datastore1] dfwccdas2/dfwccdas2-a6d62811.vswp",
            "Type": "swap",
            "Size": 12821987328,
            "UniqueSize": 12821987328,
            "BackingObjectId": "",
            "Accessible": true
          },
          {
            "Key": 7,
            "Name": "[datastore1] dfwccdas2/vmx-dfwccdas2-2799052817-1.vswp",
            "Type": "uwswap",
            "Size": 115343360,
            "UniqueSize": 115343360,
            "BackingObjectId": "",
            "Accessible": true
          }
        ],
        "Disk": [
          {
            "Key": 2000,
            "Chain": [
              {
                "FileKey": [
                  2,
                  3
                ]
              }
            ]
          }
        ],
        "Snapshot": null,
        "Timestamp": "2018-04-25T20:36:18.511958Z"
      },
      "Storage": {
        "PerDatastoreUsage": [
          {
            "Datastore": {
              "Type": "Datastore",
              "Value": "datastore-809"
            },
            "Committed": 15538858788,
            "Uncommitted": 40348155904,
            "Unshared": 2601517580
          }
        ],
        "Timestamp": "2018-04-25T19:08:33.776Z"
      },
      "EnvironmentBrowser": {
        "Type": "EnvironmentBrowser",
        "Value": "envbrowser-1065"
      },
      "ResourcePool": {
        "Type": "ResourcePool",
        "Value": "resgroup-807"
      },
      "ParentVApp": null,
      "ResourceConfig": {
        "Entity": {
          "Type": "VirtualMachine",
          "Value": "vm-1065"
        },
        "ChangeVersion": "",
        "LastModified": null,
        "CpuAllocation": {
          "Reservation": 0,
          "ExpandableReservation": false,
          "Limit": -1,
          "Shares": {
            "Shares": 4000,
            "Level": "normal"
          },
          "OverheadLimit": null
        },
        "MemoryAllocation": {
          "Reservation": 0,
          "ExpandableReservation": false,
          "Limit": -1,
          "Shares": {
            "Shares": 122280,
            "Level": "normal"
          },
          "OverheadLimit": null
        }
      },
      "Runtime": {
        "Device": [
          {
            "RuntimeState": {
              "VmDirectPathGen2Active": false,
              "VmDirectPathGen2InactiveReasonVm": null,
              "VmDirectPathGen2InactiveReasonOther": [
                "vmNptIncompatibleNetwork"
              ],
              "VmDirectPathGen2InactiveReasonExtended": "",
              "ReservationStatus": ""
            },
            "Key": 4000
          }
        ],
        "Host": {
          "Type": "HostSystem",
          "Value": "host-808"
        },
        "ConnectionState": "connected",
        "PowerState": "poweredOn",
        "FaultToleranceState": "notConfigured",
        "DasVmProtection": null,
        "ToolsInstallerMounted": false,
        "SuspendTime": null,
        "BootTime": "2018-04-25T19:08:16.748946Z",
        "SuspendInterval": 0,
        "Question": null,
        "MemoryOverhead": 0,
        "MaxCpuUsage": 12268,
        "MaxMemoryUsage": 12228,
        "NumMksConnections": 0,
        "RecordReplayState": "inactive",
        "CleanPowerOff": null,
        "NeedSecondaryReason": "",
        "OnlineStandby": false,
        "MinRequiredEVCModeKey": "",
        "ConsolidationNeeded": false,
        "OfflineFeatureRequirement": [
          {
            "Key": "cpuid.lm",
            "FeatureName": "cpuid.lm",
            "Value": "Bool:Min:1"
          }
        ],
        "FeatureRequirement": [
          {
            "Key": "cpuid.SSE3",
            "FeatureName": "cpuid.SSE3",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.PCLMULQDQ",
            "FeatureName": "cpuid.PCLMULQDQ",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.SSSE3",
            "FeatureName": "cpuid.SSSE3",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.CMPXCHG16B",
            "FeatureName": "cpuid.CMPXCHG16B",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.SSE41",
            "FeatureName": "cpuid.SSE41",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.SSE42",
            "FeatureName": "cpuid.SSE42",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.POPCNT",
            "FeatureName": "cpuid.POPCNT",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.AES",
            "FeatureName": "cpuid.AES",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.DS",
            "FeatureName": "cpuid.DS",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.SS",
            "FeatureName": "cpuid.SS",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.LAHF64",
            "FeatureName": "cpuid.LAHF64",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.NX",
            "FeatureName": "cpuid.NX",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.RDTSCP",
            "FeatureName": "cpuid.RDTSCP",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.LM",
            "FeatureName": "cpuid.LM",
            "Value": "Bool:Min:1"
          },
          {
            "Key": "cpuid.Intel",
            "FeatureName": "cpuid.Intel",
            "Value": "Bool:Min:1"
          }
        ],
        "FeatureMask": null,
        "VFlashCacheAllocation": 0,
        "Paused": false,
        "SnapshotInBackground": false,
        "QuiescedForkParent": null
      },
      "Guest": {
        "ToolsStatus": "toolsOk",
        "ToolsVersionStatus": "guestToolsUnmanaged",
        "ToolsVersionStatus2": "guestToolsUnmanaged",
        "ToolsRunningStatus": "guestToolsRunning",
        "ToolsVersion": "10277",
        "ToolsInstallType": "guestToolsTypeOpenVMTools",
        "GuestId": "centos7_64Guest",
        "GuestFamily": "linuxGuest",
        "GuestFullName": "CentOS 7 (64-bit)",
        "HostName": "dfwccdas2",
        "IpAddress": "172.20.10.181",
        "Net": [
          {
            "Network": "VLAN10",
            "IpAddress": [
              "172.20.10.181"
            ],
            "MacAddress": "00:50:56:84:47:d7",
            "Connected": true,
            "DeviceConfigId": 4000,
            "DnsConfig": null,
            "IpConfig": {
              "IpAddress": [
                {
                  "IpAddress": "172.20.10.181",
                  "PrefixLength": 24,
                  "Origin": "",
                  "State": "preferred",
                  "Lifetime": null
                }
              ],
              "Dhcp": null,
              "AutoConfigurationEnabled": null
            },
            "NetBIOSConfig": null
          }
        ],
        "IpStack": [
          {
            "DnsConfig": {
              "Dhcp": false,
              "HostName": "dfwccdas2",
              "DomainName": "...",
              "IpAddress": [
                ...
              ],
              "SearchDomain": [
                ...
              ]
            },
            "IpRouteConfig": {
              "IpRoute": [
                {
                  "Network": "0.0.0.0",
                  "PrefixLength": 0,
                  "Gateway": {
                    "IpAddress": "172.20.10.254",
                    "Device": "0"
                  }
                },
                {
                  "Network": "169.254.0.0",
                  "PrefixLength": 16,
                  "Gateway": {
                    "IpAddress": "",
                    "Device": "0"
                  }
                },
                {
                  "Network": "172.20.10.0",
                  "PrefixLength": 24,
                  "Gateway": {
                    "IpAddress": "",
                    "Device": "0"
                  }
                }
              ]
            },
            "IpStackConfig": null,
            "DhcpConfig": null
          }
        ],
        "Disk": [
          {
            "DiskPath": "/",
            "Capacity": 10726932480,
            "FreeSpace": 9084432384
          },
          {
            "DiskPath": "/boot",
            "Capacity": 533368832,
            "FreeSpace": 281219072
          },
          {
            "DiskPath": "/var",
            "Capacity": 6159335424,
            "FreeSpace": 5991346176
          },
          {
            "DiskPath": "/u01",
            "Capacity": 102796099584,
            "FreeSpace": 102761406464
          },
          {
            "DiskPath": "/home",
            "Capacity": 102796099584,
            "FreeSpace": 102761406464
          },
          {
            "DiskPath": "/var/tmp",
            "Capacity": 6159335424,
            "FreeSpace": 5991346176
          }
        ],
        "Screen": {
          "Width": 800,
          "Height": 600
        },
        "GuestState": "running",
        "AppHeartbeatStatus": "appStatusGray",
        "GuestKernelCrashed": false,
        "AppState": "none",
        "GuestOperationsReady": true,
        "InteractiveGuestOperationsReady": false,
        "GuestStateChangeSupported": true,
        "GenerationInfo": null
      },
      "Summary": {
        "Vm": {
          "Type": "VirtualMachine",
          "Value": "vm-1065"
        },
        "Runtime": {
          "Device": [
            {
              "RuntimeState": {
                "VmDirectPathGen2Active": false,
                "VmDirectPathGen2InactiveReasonVm": null,
                "VmDirectPathGen2InactiveReasonOther": [
                  "vmNptIncompatibleNetwork"
                ],
                "VmDirectPathGen2InactiveReasonExtended": "",
                "ReservationStatus": ""
              },
              "Key": 4000
            }
          ],
          "Host": {
            "Type": "HostSystem",
            "Value": "host-808"
          },
          "ConnectionState": "connected",
          "PowerState": "poweredOn",
          "FaultToleranceState": "notConfigured",
          "DasVmProtection": null,
          "ToolsInstallerMounted": false,
          "SuspendTime": null,
          "BootTime": "2018-04-25T19:08:16.748946Z",
          "SuspendInterval": 0,
          "Question": null,
          "MemoryOverhead": 0,
          "MaxCpuUsage": 12268,
          "MaxMemoryUsage": 12228,
          "NumMksConnections": 0,
          "RecordReplayState": "inactive",
          "CleanPowerOff": null,
          "NeedSecondaryReason": "",
          "OnlineStandby": false,
          "MinRequiredEVCModeKey": "",
          "ConsolidationNeeded": false,
          "OfflineFeatureRequirement": [
            {
              "Key": "cpuid.lm",
              "FeatureName": "cpuid.lm",
              "Value": "Bool:Min:1"
            }
          ],
          "FeatureRequirement": [
            {
              "Key": "cpuid.SSE3",
              "FeatureName": "cpuid.SSE3",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.PCLMULQDQ",
              "FeatureName": "cpuid.PCLMULQDQ",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.SSSE3",
              "FeatureName": "cpuid.SSSE3",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.CMPXCHG16B",
              "FeatureName": "cpuid.CMPXCHG16B",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.SSE41",
              "FeatureName": "cpuid.SSE41",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.SSE42",
              "FeatureName": "cpuid.SSE42",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.POPCNT",
              "FeatureName": "cpuid.POPCNT",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.AES",
              "FeatureName": "cpuid.AES",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.DS",
              "FeatureName": "cpuid.DS",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.SS",
              "FeatureName": "cpuid.SS",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.LAHF64",
              "FeatureName": "cpuid.LAHF64",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.NX",
              "FeatureName": "cpuid.NX",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.RDTSCP",
              "FeatureName": "cpuid.RDTSCP",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.LM",
              "FeatureName": "cpuid.LM",
              "Value": "Bool:Min:1"
            },
            {
              "Key": "cpuid.Intel",
              "FeatureName": "cpuid.Intel",
              "Value": "Bool:Min:1"
            }
          ],
          "FeatureMask": null,
          "VFlashCacheAllocation": 0,
          "Paused": false,
          "SnapshotInBackground": false,
          "QuiescedForkParent": null
        },
        "Guest": {
          "GuestId": "centos7_64Guest",
          "GuestFullName": "CentOS 7 (64-bit)",
          "ToolsStatus": "toolsOk",
          "ToolsVersionStatus": "guestToolsUnmanaged",
          "ToolsVersionStatus2": "guestToolsUnmanaged",
          "ToolsRunningStatus": "guestToolsRunning",
          "HostName": "dfwccdas2",
          "IpAddress": "172.20.10.181"
        },
        "Config": {
          "Name": "dfwccdas2",
          "Template": false,
          "VmPathName": "[datastore1] dfwccdas2/dfwccdas2.vmx",
          "MemorySizeMB": 12228,
          "CpuReservation": 0,
          "MemoryReservation": 0,
          "NumCpu": 4,
          "NumEthernetCards": 1,
          "NumVirtualDisks": 1,
          "Uuid": "4204ecae-d1c8-1bb1-80cd-08696f2d3e1d",
          "InstanceUuid": "50045324-342b-bd78-72c3-ee682c76a47f",
          "GuestId": "centos64Guest",
          "GuestFullName": "CentOS 4/5 or later (64-bit)",
          "Annotation": "",
          "Product": {
            "Key": 0,
            "ClassId": "",
            "InstanceId": "",
            "Name": "",
            "Vendor": "",
            "Version": "",
            "FullVersion": "",
            "VendorUrl": "",
            "ProductUrl": "",
            "AppUrl": ""
          },
          "InstallBootRequired": false,
          "FtInfo": null,
          "ManagedBy": null
        },
        "Storage": {
          "Committed": 15538858788,
          "Uncommitted": 40348155904,
          "Unshared": 2601517580,
          "Timestamp": "2018-04-25T19:08:33.776488Z"
        },
        "QuickStats": {
          "OverallCpuUsage": 30,
          "OverallCpuDemand": 30,
          "GuestMemoryUsage": 0,
          "HostMemoryUsage": 1870,
          "GuestHeartbeatStatus": "green",
          "DistributedCpuEntitlement": 0,
          "DistributedMemoryEntitlement": 0,
          "StaticCpuEntitlement": 0,
          "StaticMemoryEntitlement": 0,
          "PrivateMemory": 1826,
          "SharedMemory": 0,
          "SwappedMemory": 0,
          "BalloonedMemory": 0,
          "ConsumedOverheadMemory": 45,
          "FtLogBandwidth": -1,
          "FtSecondaryLatency": -1,
          "FtLatencyStatus": "gray",
          "CompressedMemory": 0,
          "UptimeSeconds": 6996,
          "SsdSwappedMemory": 0
        },
        "OverallStatus": "green",
        "CustomValue": null
      },
      "Datastore": [
        {
          "Type": "Datastore",
          "Value": "datastore-809"
        }
      ],
      "Network": [
        {
          "Type": "Network",
          "Value": "network-89"
        }
      ],
      "Snapshot": null,
      "RootSnapshot": null,
      "GuestHeartbeatStatus": "green"
    }
  ]
}
```
oh -- nvm, I figured out that I could set the name of the VLAN with the `name` param, ie: `VLAN10` and then get rid of the `vlan` param.
cc @warthog9
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py
--- a/lib/ansible/modules/cloud/vmware/vmware_guest.py
+++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py
@@ -998,10 +998,10 @@ def sanitize_network_params(self):
                 dvps = self.cache.get_all_objs(self.content, [vim.dvs.DistributedVirtualPortgroup])
                 for dvp in dvps:
                     if hasattr(dvp.config.defaultPortConfig, 'vlan') and \
-                            dvp.config.defaultPortConfig.vlan.vlanId == network['vlan']:
+                            dvp.config.defaultPortConfig.vlan.vlanId == int(network['vlan']):
                         network['name'] = dvp.config.name
                         break
-                    if dvp.config.name == network['vlan']:
+                    if dvp.config.name == str(network['vlan']):
                         network['name'] = dvp.config.name
                         break
                 else:


Test patch: