python-neutron client sfc port pair operations fail

Bug #1801970 reported by Brian Trulove
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-neutronclient
New
Undecided
Davide Borsatti

Bug Description

Openstack version Rocky

Utilizing python-neutronclient==6.10.0 and python-openstackclient==3.16.1. I am able to successfully create port pairs with "openstack sfc port pair create". However, port pair deletion and port pair group creation operations fail with the same error.

Reproduction:

1. openstack sfc port pair create --ingress=cirros-02-port1 --egress=cirros-02-port1 ppCirros02
2. openstack sfc port pair group create --port-pair ppCirros02 ppgCirros02
3. fails with 'Client' object has no attribute 'list_port_pairs'
4. Try to delete port pair with "openstack sfc port pair delete ppCirros02"
5. fails with 'Client' object has no attribute 'list_port_pairs'

Traceback:

Instantiating neutron client: <class 'neutronclient.v2_0.client.Client'>
'Client' object has no attribute 'list_port_pairs'
Traceback (most recent call last):
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/cliff/app.py", line 401, in run_subcommand
    result = cmd.run(parsed_args)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/cliff/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/osc/v2/sfc/sfc_port_pair.py", line 103, in take_action
    port_pair_id = _get_id(client, parsed_args.port_pair, resource)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/osc/v2/sfc/sfc_port_pair.py", line 228, in _get_id
    return client.find_resource(resource, id_or_name)['id']
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 474, in find_resource
    cmd_resource, parent_id, fields)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 419, in find_resource_by_id
    obj_lister = getattr(self, "list_%s" % cmd_resource_plural)
AttributeError: 'Client' object has no attribute 'list_port_pairs'
clean_up DeleteSfcPortPair: 'Client' object has no attribute 'list_port_pairs'
Traceback (most recent call last):
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/osc_lib/shell.py", line 135, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/cliff/app.py", line 281, in run
    result = self.run_subcommand(remainder)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/osc_lib/shell.py", line 175, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/cliff/app.py", line 401, in run_subcommand
    result = cmd.run(parsed_args)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/cliff/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/osc/v2/sfc/sfc_port_pair.py", line 103, in take_action
    port_pair_id = _get_id(client, parsed_args.port_pair, resource)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/osc/v2/sfc/sfc_port_pair.py", line 228, in _get_id
    return client.find_resource(resource, id_or_name)['id']
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 474, in find_resource
    cmd_resource, parent_id, fields)
  File "/home/ansible/kollaenv/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 419, in find_resource_by_id
    obj_lister = getattr(self, "list_%s" % cmd_resource_plural)
AttributeError: 'Client' object has no attribute 'list_port_pairs'

Revision history for this message
Brian Trulove (brian-trulove-r) wrote :

Sorry should have included these other versions.

openstacksdk==0.19.0
osc-lib==1.11.1

Revision history for this message
James Denton (james-denton) wrote :

I, too, am having this issue. I believe I traced it back to the following commit:

https://github.com/openstack/python-neutronclient/commit/0907ccc4df68c71f1af71976819bff741829e434

It looks like the method names changed but the key didn't, meaning the logic at [1] and [2] should be trying the 'list_sfc_port_pairs' method vs 'list_port_pairs'.

[1]https://github.com/openstack/python-neutronclient/blob/d8cb1472c867d2a308e26abea0b0a01f1d6629a1/neutronclient/v2_0/client.py#L419

[2]https://github.com/openstack/python-neutronclient/blob/d8cb1472c867d2a308e26abea0b0a01f1d6629a1/neutronclient/v2_0/client.py#L445

I hacked on it and was able to create the port group seen here:

# openstack sfc port pair group create --port-pair PPAIR PPGROUP
+----------------------------+---------------------------------------------------------------------------------------------+
| Field | Value |
+----------------------------+---------------------------------------------------------------------------------------------+
| Description | |
| ID | 0294f041-6deb-4b43-9718-650caa3cca3b |
| Loadbalance ID | 1 |
| Name | PPGROUP |
| Port Pair | [u'4430c637-2e0d-4d72-a4c5-dd17017c48b4'] |
| Port Pair Group Parameters | {u'lb_fields': [], u'ppg_n_tuple_mapping': {u'ingress_n_tuple': {}, u'egress_n_tuple': {}}} |
| Project | 24754fc7285544c287c3716b75fe1678 |
| Tap Enabled | False |
| tenant_id | 24754fc7285544c287c3716b75fe1678 |
+----------------------------+---------------------------------------------------------------------------------------------+

I don't really know how to fix this one, though. Best left to the Neutron client folks.

Revision history for this message
James Denton (james-denton) wrote :

Turns out, this affects more than just the port pair group command. It looks like the cmd_resource is not being set for port_pair, port_pair_group, and flow_classifier. As a result, these resource names are being used to build out the 'list_' commands and are failing since the methods were renamed.

Revision history for this message
Bernard Cafarelli (bcafarel) wrote :

That is strange, I suspect something changed around this helper function:
https://github.com/openstack/python-neutronclient/blob/master/neutronclient/osc/v2/sfc/sfc_port_pair_group.py#L307

These create commands worked in the beginning of 2018 at least:
https://github.com/voyageur/openstack-scripts/blob/master/simple_sfc_vms.sh#L76 (did not run with networking-sfc installed recently though)

Davide Borsatti (dbors)
Changed in python-neutronclient:
assignee: nobody → Davide Borsatti (dbors)
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.