From 749aecda4c81f68eb1e4c0c9d10075135eb5ef81 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Mon, 31 Aug 2015 10:25:27 +0200 Subject: [PATCH] Fix usage of netaddr '.broadcast' netaddr 0.7.16 changed the behavior of IPNetworks with /31 and /32 prefixes to make their 'broadcast' attribute return None. This patch replaces the use of the attribute with a -1 index lookup to get the last address instead. Revert Ida700555c133e27da2c76357986adfc8193fe89b and re-enables the test_routerrule_detail test. Change-Id: I0887b0112f97b537e4c1467c47ab78b1f94f238b Closes-Bug: 1490403 Closes-Bug: 1490423 --- .../project/routers/extensions/routerrules/tabs.py | 8 ++++---- openstack_dashboard/dashboards/project/routers/tests.py | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/dashboards/project/routers/extensions/routerrules/tabs.py b/openstack_dashboard/dashboards/project/routers/extensions/routerrules/tabs.py index 1de7761b05..b146b1c946 100644 --- a/openstack_dashboard/dashboards/project/routers/extensions/routerrules/tabs.py +++ b/openstack_dashboard/dashboards/project/routers/extensions/routerrules/tabs.py @@ -156,10 +156,10 @@ class RulesGridTab(tabs.Tab): rd = netaddr.IPNetwork(rd) dst = netaddr.IPNetwork(dst) # check if cidrs are affected by rule first - if (int(dst.network) >= int(rd.broadcast) or - int(dst.broadcast) <= int(rd.network) or - int(src.network) >= int(rs.broadcast) or - int(src.broadcast) <= int(rs.network)): + if (int(dst.network) >= int(rd[-1]) or + int(dst[-1]) <= int(rd.network) or + int(src.network) >= int(rs[-1]) or + int(src[-1]) <= int(rs.network)): continue # skip matching rules for 'any' and 'external' networks diff --git a/openstack_dashboard/dashboards/project/routers/tests.py b/openstack_dashboard/dashboards/project/routers/tests.py index a3efe7db5a..8eb9e4d5da 100644 --- a/openstack_dashboard/dashboards/project/routers/tests.py +++ b/openstack_dashboard/dashboards/project/routers/tests.py @@ -15,7 +15,6 @@ import copy from django.core.urlresolvers import reverse from django import http -from django.utils import unittest from mox3.mox import IgnoreArg # noqa from mox3.mox import IsA # noqa @@ -698,7 +697,6 @@ class RouterRuleTests(RouterMixin, test.TestCase): res, '%s/routers/extensions/routerrules/grid.html' % self.DASHBOARD) - @unittest.skip("blocking the gate see bug 1490403") @test.create_stubs({api.neutron: ('network_list',)}) def test_routerrule_detail(self): router = self.routers_with_rules.first()