From 354ea46ac18f95454ceb695c61a6dd49263c36cc Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 31 Jan 2018 20:39:37 +0200 Subject: [PATCH] VLAN ID and trunk spec are exclusive - can only set one We should only set one - the vlan id or the trunk spec. The trunk spec will have precedence. Change-Id: Id62cad5b2c7b5caa8c817039819114806281746d --- vmware_nsxlib/v3/core_resources.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vmware_nsxlib/v3/core_resources.py b/vmware_nsxlib/v3/core_resources.py index 6480a4de..72493888 100644 --- a/vmware_nsxlib/v3/core_resources.py +++ b/vmware_nsxlib/v3/core_resources.py @@ -137,12 +137,6 @@ class NsxLibLogicalSwitch(utils.NsxLibApiBase): else: body['admin_state'] = nsx_constants.ADMIN_STATE_DOWN - if vlan_id: - body['vlan'] = vlan_id - - # trunk_vlan_range is mutually exclusive with vlan_id - # For guest vlan tagging it is allowed for overlay networks - # TODO(asarfaty): check network type? different for ENS? if trunk_vlan_range: failed = False if (self.nsxlib and @@ -173,6 +167,8 @@ class NsxLibLogicalSwitch(utils.NsxLibApiBase): operation=operation, arg_val=trunk_vlan_range, arg_name='trunk_vlan_range') + elif vlan_id: + body['vlan'] = vlan_id if ip_pool_id: body['ip_pool_id'] = ip_pool_id