Merge "Do not use subnet broadcast address in unit test"

This commit is contained in:
Zuul 2019-03-28 19:21:58 +00:00 committed by Gerrit Code Review
commit d03bf63eaa
1 changed files with 3 additions and 5 deletions

View File

@ -13,7 +13,6 @@
# under the License.
#
import netaddr
from neutron_lib import context as nctx
from neutron_lib.db import api as db_api
from neutron_lib.plugins import constants
@ -161,13 +160,12 @@ class TestRevisionPlugin(test_plugin.Ml2PluginV2TestCase):
expected_code=exc.HTTPPreconditionFailed.code)
def test_port_ip_update_revises(self):
with self.port() as port:
with self.subnet() as subnet, self.port() as port:
rev = port['port']['revision_number']
new = {'port': {'fixed_ips': port['port']['fixed_ips']}}
# ensure adding an IP allocation updates the port
next_ip = str(netaddr.IPAddress(
new['port']['fixed_ips'][0]['ip_address']) + 1)
new['port']['fixed_ips'].append({'ip_address': next_ip})
free_ip = self._find_ip_address(subnet['subnet'])
new['port']['fixed_ips'].append({'ip_address': free_ip})
response = self._update('ports', port['port']['id'], new)
self.assertEqual(2, len(response['port']['fixed_ips']))
new_rev = response['port']['revision_number']