port_forwarding: validate args before invoking db update
Add validator to update_floatingip_port_forwarding so codepath does not
attempt performing invalid database operation. With that, operation fails
right away, with a hint on the offending argument(s).
Note: pep8 failed with following error:
./neutron/tests/unit/services/portforwarding/test_pf_plugin.py:237:9:
./neutron/tests/unit/services/portforwarding/test_pf_plugin.py:261:9:
N322 Possible use of no-op mock method. please use assert_called_once_with. mock_pf_get_objects.assert_called_once()
^
So additional changes were needed for backport.
Change-Id: I8284b22c5d691bfd9eadeb8590c3d4b27d261b04
Closes-Bug: #1878299
(cherry picked from commit f3797403486ba43100ff9ec8917d38c8723e12b2)
(cherry picked from commit 838399f0a489e898cfefe49dbe026553bc117381)
Reviewed: https:/ /review. opendev. org/744188 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=4ac33d1a9bf 1655ae1316f8c7b 2ad3047abba69c
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit 4ac33d1a9bf1655 ae1316f8c7b2ad3 047abba69c
Author: Flavio Fernandes <email address hidden>
Date: Thu Jun 25 23:34:32 2020 -0400
port_ forwarding: validate args before invoking db update
Add validator to update_ floatingip_ port_forwarding so codepath does not
attempt performing invalid database operation. With that, operation fails
right away, with a hint on the offending argument(s).
This is a backport that combines changes from 2 changes that go together: /review. opendev. org/#/c/ 738145/ /review. opendev. org/#/c/ 744993/
https:/
https:/
Note: pep8 failed with following error: /neutron/ tests/unit/ services/ portforwarding/ test_pf_ plugin. py:237: 9: /neutron/ tests/unit/ services/ portforwarding/ test_pf_ plugin. py:261: 9: called_ once_with.
mock_ pf_get_ objects. assert_ called_ once()
.
.
N322 Possible use of no-op mock method. please use assert_
^
So additional changes were needed for backport.
Change-Id: I8284b22c5d691b fd9eadeb8590c3d 4b27d261b04 100ff9ec8917d38 c8723e12b2) 8cfefe49dbe0265 53bc117381)
Closes-Bug: #1878299
(cherry picked from commit f3797403486ba43
(cherry picked from commit 838399f0a489e89