From 83f943c41ddaabf5c802395886281330dd317f52 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Wed, 27 Jan 2021 10:42:34 +0200 Subject: [PATCH] Allow removing segment port address bindings Change-Id: I9374deebf7bdce8c886fceb70c0452a4377daf50 --- vmware_nsxlib/v3/policy/core_defs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vmware_nsxlib/v3/policy/core_defs.py b/vmware_nsxlib/v3/policy/core_defs.py index c0e2adce..daa70aee 100644 --- a/vmware_nsxlib/v3/policy/core_defs.py +++ b/vmware_nsxlib/v3/policy/core_defs.py @@ -1144,10 +1144,11 @@ class SegmentPortDef(ResourceDef): def get_obj_dict(self): body = super(SegmentPortDef, self).get_obj_dict() - address_bindings = self.get_attr('address_bindings') - if address_bindings: - body['address_bindings'] = [binding.get_obj_dict() - for binding in address_bindings] + if self.has_attr('address_bindings'): + address_bindings = self.get_attr('address_bindings') + if address_bindings is not None: + body['address_bindings'] = [binding.get_obj_dict() + for binding in address_bindings] 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