Skip to content

Commit

Permalink
Capturing the correct ip address length (ipv4: 32 & for ipv6: 128) to…
Browse files Browse the repository at this point in the history
… update the address pair field accordingly that goes from vnc->neutron.

Closes-Bug: 1529317

Change-Id: I00c7909c8dae328c3d0389cd22e4ea729a35fb5e
(cherry picked from commit 8c8b7e8)
  • Loading branch information
sahilsabharwal committed Aug 2, 2016
1 parent 899ffc3 commit 8e9ad6d
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 8e9ad6d

Please sign in to comment.