Skip to content

Commit

Permalink
Merge "Capturing the correct ip address length (ipv4: 32 & for ipv6: …
Browse files Browse the repository at this point in the history
…128) to update the address pair field accordingly that goes from vnc->neutron."
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Aug 4, 2016
2 parents 089ea38 + c026ea0 commit 0be7f12
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Expand Up @@ -2071,11 +2071,17 @@ def _port_vnc_to_neutron(self, port_obj, port_req_memo=None):
for aap in allowed_address_pairs.allowed_address_pair:
pair = {}
pair["mac_address"] = aap.mac
if aap.ip.get_ip_prefix_len() == 32:

if IPAddress(aap.ip.get_ip_prefix()).version is 4:
ip_len = 32
elif IPAddress(aap.ip.get_ip_prefix()).version is 6:
ip_len = 128

if aap.ip.get_ip_prefix_len() == ip_len:
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()),
aap.ip.get_ip_prefix_len())
address_pairs.append(pair)
port_q_dict['allowed_address_pairs'] = address_pairs

Expand Down

0 comments on commit 0be7f12

Please sign in to comment.