From 99c05d5146e4947d15c2b946028c4f6c52c8b850 Mon Sep 17 00:00:00 2001 From: Sumukha Tumkur Vani Date: Thu, 21 Jan 2021 14:45:31 -0800 Subject: [PATCH] add vlan_intf_object only if there are ipv4 or ipv6 mappings (#1377) --- scripts/neighbor_advertiser | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/neighbor_advertiser b/scripts/neighbor_advertiser index c7892407a43f..62124c7400b3 100644 --- a/scripts/neighbor_advertiser +++ b/scripts/neighbor_advertiser @@ -302,17 +302,18 @@ def construct_neighbor_advertiser_slice(): ipv6_mappings.append(mapping) ctr += 1 - vlan_interface_obj = { - 'vlanId': vlan_id, - 'vxlanId': vxlan_id, - 'ipv4AddrMappings': ipv4_mappings, - 'ipv6AddrMappings': ipv6_mappings - } + if len(ipv4_mappings) > 0 or len(ipv6_mappings) > 0: + vlan_interface_obj = { + 'vlanId': vlan_id, + 'vxlanId': vxlan_id, + 'ipv4AddrMappings': ipv4_mappings, + 'ipv6AddrMappings': ipv6_mappings + } - if vxlanPort: - vlan_interface_obj['vxlanPort'] = vxlanPort + if vxlanPort: + vlan_interface_obj['vxlanPort'] = vxlanPort - vlan_interfaces_obj.append(vlan_interface_obj) + vlan_interfaces_obj.append(vlan_interface_obj) slice_obj = { 'switchInfo': switch_info_obj,