From 07211d71731fde9e8b7344aac4ea0bcc2c4e97f7 Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 5 Nov 2019 19:16:08 -0800 Subject: [PATCH] Updating segment port with empty attachment type From NSX 3.0.0, the attachment type PARENT will be deprecated, if attachment type is empty, that has the same meaning as PARENT, but other fields in attachment should be allowed to apply under such scenario. Change-Id: I17bb17c4986afdbc95f534a54aa98d855bb3f645 (cherry picked from commit 27d4662f90008790da824942a835c4f861973e61) --- vmware_nsxlib/v3/policy/core_defs.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vmware_nsxlib/v3/policy/core_defs.py b/vmware_nsxlib/v3/policy/core_defs.py index 6a434757..d536ef70 100644 --- a/vmware_nsxlib/v3/policy/core_defs.py +++ b/vmware_nsxlib/v3/policy/core_defs.py @@ -1046,9 +1046,11 @@ class SegmentPortDef(ResourceDef): if address_bindings: body['address_bindings'] = [binding.get_obj_dict() for binding in address_bindings] - if self.has_attr('attachment_type') or self.has_attr('vif_id'): + if (self.has_attr('attachment_type') or self.has_attr('vif_id') or + self.has_attr('hyperbus_mode')): if (not self.get_attr('attachment_type') and - not self.get_attr('vif_id')): + not self.get_attr('vif_id') and + not self.get_attr('hyperbus_mode')): # detach operation body['attachment'] = None else: @@ -1057,13 +1059,15 @@ class SegmentPortDef(ResourceDef): attachment['type'] = self.get_attr('attachment_type') if self.get_attr('vif_id'): attachment['id'] = self.get_attr('vif_id') + if self.get_attr('hyperbus_mode'): + self._set_attr_if_supported(attachment, 'hyperbus_mode') self._set_attrs_if_specified(attachment, ['context_id', 'app_id', 'traffic_tag', 'allocate_addresses']) - self._set_attr_if_supported(body, 'hyperbus_mode') + body['attachment'] = attachment if (self.has_attr('admin_state') and