Comment 1 for bug 1697000

Revision history for this message
Slobodan Blatnjak (sblatnjak) wrote :

"openstack port create" was introduced in Newton.

Could it be fixed here in https://github.com/Juniper/contrail-neutron-plugin/blob/master/neutron_plugin_contrail/plugins/opencontrail/vnc_client/vmi_res_handler.py?

    def _get_allowed_adress_pairs(vmi_obj):
        allowed_address_pairs = (
            vmi_obj.get_virtual_machine_interface_allowed_address_pairs())
        if (allowed_address_pairs and
                allowed_address_pairs.allowed_address_pair):
            address_pairs = []
            for aap in allowed_address_pairs.allowed_address_pair:
                pair = {}
                pair['mac_address'] = aap.mac
                if aap.ip.get_ip_prefix_len() == 32:
                    pair['ip_address'] = '%s' % (aap.ip.get_ip_prefix())
                else:
                    pair['ip_address'] = '%s/%s' % (aap.ip.get_ip_prefix(),
                                                    aap.ip.get_ip_prefix_len())
                address_pairs.append(pair)
            return address_pairs

by moving address_pairs = [] before the if clause "if (allowed_address_pairs and
                allowed_address_pairs.allowed_address_pair):"
and "return address_pairs" out of the if clause

This could make it returning allowed_address_pairs[] in the vmi response even if it's not set.