← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2082883] [NEW] neutron-tempest-plugin: KeyError caused by missing 'previous' ref

 

Public bug reported:

Neutron returns reference to next and previous in list APIs "Only when any item is returned".
However the client implementation in neutron-tempest-plugin always assumes these refs are present.
This results in uexpected failures in some api call.

For example in 
 https://zuul.opendev.org/t/openstack/build/0208cd2fa5ac45199ee047f796ab1eb6
the following error is found.

```
ft1.6: neutron_tempest_plugin.api.test_subnets.SubnetsSearchCriteriaTest.test_list_pagination_with_href_links[id-351183ef-6ed9-4d71-a9f2-a5ac049bd7ea]testtools.testresult.real._StringException: pythonlogging:'': {{{
...
    Response - Headers: {'date': 'Thu, 26 Sep 2024 15:43:49 GMT', 'server': 'Apache/2.4.52 (Ubuntu)', 'content-type': 'application/json', 'content-length': '1024', 'x-openstack-request-id': 'req-da904a1e-52ed-4b19-81d9-fbe5c35fb52b', 'connection': 'close', 'status': '200', 'content-location': 'https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=b76f1872-968a-4acd-b114-6a4eb446c6e7&page_reverse=True'}
        Body: b'{"subnets":[{"id":"5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69","name":"123test","tenant_id":"37f53ece30b6499b8a2175032589df05","network_id":"fbf42c58-0463-4c09-b3f3-970adb269a1b","ip_version":4,"subnetpool_id":null,"enable_dhcp":true,"ipv6_ra_mode":null,"ipv6_address_mode":null,"gateway_ip":"10.1.0.49","cidr":"10.1.0.48/28","allocation_pools":[{"start":"10.1.0.50","end":"10.1.0.62"}],"host_routes":[],"dns_nameservers":[],"description":"","router:external":false,"service_types":[],"dns_publish_fixed_ip":false,"tags":[],"created_at":"2024-09-26T15:43:45Z","updated_at":"2024-09-26T15:43:45Z","revision_number":0,"project_id":"37f53ece30b6499b8a2175032589df05"}],"subnets_links":[{"rel":"next","href":"https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69"},{"rel":"previous","href":"https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69&page_reverse=True"}]}'
2024-09-26 15:43:50,279 88505 INFO     [tempest.lib.common.rest_client] Request (SubnetsSearchCriteriaTest:test_list_pagination_with_href_links): 200 GET https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69&page_reverse=True 0.050s
2024-09-26 15:43:50,280 88505 DEBUG    [tempest.lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<omitted>'}
        Body: None
    Response - Headers: {'date': 'Thu, 26 Sep 2024 15:43:50 GMT', 'server': 'Apache/2.4.52 (Ubuntu)', 'content-type': 'application/json', 'content-length': '150', 'x-openstack-request-id': 'req-3961b469-3fd6-459d-a2cb-566688c9c17c', 'connection': 'close', 'status': '200', 'content-location': 'https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69&page_reverse=True'}
        Body: b'{"subnets":[],"subnets_links":[{"rel":"next","href":"https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False"}]}'
}}}

Traceback (most recent call last):
  File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/test_subnets.py", line 50, in test_list_pagination_with_href_links
    self._test_list_pagination_with_href_links()
  File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1413, in inner
    return f(self, *args, **kwargs)
  File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1404, in inner
    return f(self, *args, **kwargs)
  File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1606, in _test_list_pagination_with_href_links
    self._test_list_pagination_iteratively(self._list_all_with_hrefs)
  File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1528, in _test_list_pagination_iteratively
    resources = lister(
  File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1589, in _list_all_with_hrefs
    uri = self.get_bare_url(prev_links['previous'])
KeyError: 'previous'
```

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2082883

Title:
  neutron-tempest-plugin: KeyError caused by missing 'previous' ref

Status in neutron:
  New

Bug description:
  Neutron returns reference to next and previous in list APIs "Only when any item is returned".
  However the client implementation in neutron-tempest-plugin always assumes these refs are present.
  This results in uexpected failures in some api call.

  For example in 
   https://zuul.opendev.org/t/openstack/build/0208cd2fa5ac45199ee047f796ab1eb6
  the following error is found.

  ```
  ft1.6: neutron_tempest_plugin.api.test_subnets.SubnetsSearchCriteriaTest.test_list_pagination_with_href_links[id-351183ef-6ed9-4d71-a9f2-a5ac049bd7ea]testtools.testresult.real._StringException: pythonlogging:'': {{{
  ...
      Response - Headers: {'date': 'Thu, 26 Sep 2024 15:43:49 GMT', 'server': 'Apache/2.4.52 (Ubuntu)', 'content-type': 'application/json', 'content-length': '1024', 'x-openstack-request-id': 'req-da904a1e-52ed-4b19-81d9-fbe5c35fb52b', 'connection': 'close', 'status': '200', 'content-location': 'https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=b76f1872-968a-4acd-b114-6a4eb446c6e7&page_reverse=True'}
          Body: b'{"subnets":[{"id":"5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69","name":"123test","tenant_id":"37f53ece30b6499b8a2175032589df05","network_id":"fbf42c58-0463-4c09-b3f3-970adb269a1b","ip_version":4,"subnetpool_id":null,"enable_dhcp":true,"ipv6_ra_mode":null,"ipv6_address_mode":null,"gateway_ip":"10.1.0.49","cidr":"10.1.0.48/28","allocation_pools":[{"start":"10.1.0.50","end":"10.1.0.62"}],"host_routes":[],"dns_nameservers":[],"description":"","router:external":false,"service_types":[],"dns_publish_fixed_ip":false,"tags":[],"created_at":"2024-09-26T15:43:45Z","updated_at":"2024-09-26T15:43:45Z","revision_number":0,"project_id":"37f53ece30b6499b8a2175032589df05"}],"subnets_links":[{"rel":"next","href":"https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69"},{"rel":"previous","href":"https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69&page_reverse=True"}]}'
  2024-09-26 15:43:50,279 88505 INFO     [tempest.lib.common.rest_client] Request (SubnetsSearchCriteriaTest:test_list_pagination_with_href_links): 200 GET https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69&page_reverse=True 0.050s
  2024-09-26 15:43:50,280 88505 DEBUG    [tempest.lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<omitted>'}
          Body: None
      Response - Headers: {'date': 'Thu, 26 Sep 2024 15:43:50 GMT', 'server': 'Apache/2.4.52 (Ubuntu)', 'content-type': 'application/json', 'content-length': '150', 'x-openstack-request-id': 'req-3961b469-3fd6-459d-a2cb-566688c9c17c', 'connection': 'close', 'status': '200', 'content-location': 'https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False&marker=5bfc6a9e-bca1-4d0b-9cff-a6daabb16d69&page_reverse=True'}
          Body: b'{"subnets":[],"subnets_links":[{"rel":"next","href":"https://213.32.78.164/networking/v2.0/subnets?limit=1&sort_dir=asc&sort_key=name&shared=False"}]}'
  }}}

  Traceback (most recent call last):
    File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/test_subnets.py", line 50, in test_list_pagination_with_href_links
      self._test_list_pagination_with_href_links()
    File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1413, in inner
      return f(self, *args, **kwargs)
    File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1404, in inner
      return f(self, *args, **kwargs)
    File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1606, in _test_list_pagination_with_href_links
      self._test_list_pagination_iteratively(self._list_all_with_hrefs)
    File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1528, in _test_list_pagination_iteratively
      resources = lister(
    File "/opt/stack/tempest/.tox/tempest/lib/python3.10/site-packages/neutron_tempest_plugin/api/base.py", line 1589, in _list_all_with_hrefs
      uri = self.get_bare_url(prev_links['previous'])
  KeyError: 'previous'
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2082883/+subscriptions