neutron-tempest-plugin: there is no way to create a subnet without a gateway and this breaks trunk tests

Bug #1769609 reported by Daniel Alvarez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Slawek Kaplonski

Bug Description

This commit [0] fixed an issue with the subnet CIDR generation in tempest tests.
With the fix all subnets will get a gateway assigned regardless that it's attached to a router or not so it may happen that the gateway port doesn't exist. Normally, this shouldn't be a big deal but for trunk ports it's currently an issue with test_subport_connectivity [1] where the test boots a VM (advanced image) and then opens an SSH connection to its FIP to configure the interface for the subport and runs dhclient on it.

When dhclient runs, a new default gateway route is installed and the connectivity to the FIP is lost thus making the test to fail as it fails to execute/read any further commands:

I logged into the VM with virsh and checked the routes:

[root@tempest-server-test-378882328 ~]# ip r
default via 10.100.0.17 dev eth0.10
default via 10.100.0.1 dev eth0 proto static metric 100
default via 10.100.0.17 dev eth0.10 proto static metric 400
10.100.0.0/28 dev eth0 proto kernel scope link src 10.100.0.5 metric 100
10.100.0.16/28 dev eth0.10 proto kernel scope link src 10.100.0.25
169.254.169.254 via 10.100.0.18 dev eth0.10 proto dhcp
169.254.169.254 via 10.100.0.2 dev eth0 proto dhcp metric 100

This shouldn't happen as the subnet is not even connected to a router and also 10.100.0.17 doesn't even exist in Neutron. Prior to [0] it didn't fail because old code would create the subnet with gateway=None and it was skipped (actually it will only setup a gateway automatically if gateway equals to '' [2] but it was None instead [3]).

Let's allow a way to have the ability to configure subnets without a gateway.

[0] https://github.com/openstack/neutron-tempest-plugin/commit/0ddc93b1b19922d08bedf331b57c363535bb357e
[1] https://github.com/openstack/neutron-tempest-plugin/blob/02a5e2b07680d8c4dd69d681ae9a01d92b4be0ac/neutron_tempest_plugin/scenario/test_trunk.py#L229
[2] https://github.com/openstack/neutron-tempest-plugin/commit/0ddc93b1b19922d08bedf331b57c363535bb357e#diff-872f814e35c7437b9f42aef71a991279L295
[3] https://github.com/openstack/neutron-tempest-plugin/commit/0ddc93b1b19922d08bedf331b57c363535bb357e#diff-2f4232239c10eae0d0688617a3e6f98dL238

Changed in neutron:
assignee: nobody → Slawek Kaplonski (slaweq)
Revision history for this message
Federico Ressi (fressi-redhat) wrote :

There is indeed a regression and the patch for it looks very simple. It can be resumed by below points:

1) Restore the default value for gateway parameter as before in method create_subnet
  gateway=''

2) In create_subnet method where gateway is assigned and restore old behavior:

  if gateway is not None:
    kwargs['gateway_ip'] = str(gateway) or str(subnet_cidr.ip + 1)

3) Remove gateway_ip parameter in below call:

  body = client.create_subnet(
    network_id=network['id'],
    cidr=str(subnet_cidr),
    ip_version=subnet_cidr.version,
    **kwargs)

4) Call it with parameter gateway=None in trunk_test.py (as it was before).

Miguel Lavalle (minsel)
Changed in neutron:
importance: Undecided → Medium
status: New → Confirmed
Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-tempest-plugin (master)

Reviewed: https://review.openstack.org/615206
Committed: https://git.openstack.org/cgit/openstack/neutron-tempest-plugin/commit/?id=21f5342de8b36c3c033d959b63451723e4fdbcf3
Submitter: Zuul
Branch: master

commit 21f5342de8b36c3c033d959b63451723e4fdbcf3
Author: Slawek Kaplonski <email address hidden>
Date: Fri Nov 2 16:02:09 2018 +0100

    Fix creating subnet without gateway

    If create_subnet() method is called with gateway=None explicity,
    subnet should be created without gateway_ip specified.
    To achieve that "gateway_ip=null" should be passed in json in
    request's body to neutron server.
    This was missing, so neutron-server allocated gateway_ip automatically.
    Now gateway for such network will not be set as is expected.

    Closes-Bug: #1769609

    Change-Id: Ia9f0646a3cf371f82f2aa2dc22837249531d1ff5

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-tempest-plugin 0.3.0

This issue was fixed in the openstack/neutron-tempest-plugin 0.3.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.