diff --git a/neutron_taas/services/taas/agents/common/taas_agent.py b/neutron_taas/services/taas/agents/common/taas_agent.py index 847f8484..43a508e2 100644 --- a/neutron_taas/services/taas/agents/common/taas_agent.py +++ b/neutron_taas/services/taas/agents/common/taas_agent.py @@ -188,7 +188,7 @@ class TaasAgentRpcCallback(api.TaasAgentRpcCallbackMixin): # if not self._is_driver_port_type_compatible(tap_service_msg['port']): LOG.debug("RPC Call for Delete Tap Service. Incompatible driver " - "type. Ignoring the message. Host=[%s]" % (host)) + "type. Ignoring the message. Host=[%s]", host) return LOG.debug("In RPC Call for Delete Tap Service: MSG=%s", tap_service_msg) @@ -203,7 +203,7 @@ class TaasAgentRpcCallback(api.TaasAgentRpcCallbackMixin): LOG.debug("RPC Call for Delete Tap Flow. Either Host value [%s]" "(received in RPC) doesn't match the host value " "stored in agent [%s], or incompatible driver type. " - "Ignoring the message." % (host, self.conf.host)) + "Ignoring the message.", host, self.conf.host) return LOG.debug("In RPC Call for Delete Tap Flow: MSG=%s", tap_flow_msg) diff --git a/neutron_taas/services/taas/service_drivers/taas_agent_api.py b/neutron_taas/services/taas/service_drivers/taas_agent_api.py index fc45ee8b..c0e2dc1f 100644 --- a/neutron_taas/services/taas/service_drivers/taas_agent_api.py +++ b/neutron_taas/services/taas/service_drivers/taas_agent_api.py @@ -30,32 +30,32 @@ class TaasAgentApi(object): self.client = n_rpc.get_client(target) def create_tap_service(self, context, tap_service_msg, host): - LOG.debug("In RPC Call for Create Tap Service: Host=%s, MSG=%s" % - (host, tap_service_msg)) + LOG.debug("In RPC Call for Create Tap Service: Host=%s, MSG=%s", + host, tap_service_msg) cctxt = self.client.prepare(fanout=True) cctxt.cast(context, 'create_tap_service', tap_service_msg=tap_service_msg, host=host) def create_tap_flow(self, context, tap_flow_msg, host): - LOG.debug("In RPC Call for Create Tap Flow: Host=%s, MSG=%s" % - (host, tap_flow_msg)) + LOG.debug("In RPC Call for Create Tap Flow: Host=%s, MSG=%s", + host, tap_flow_msg) cctxt = self.client.prepare(fanout=True) cctxt.cast(context, 'create_tap_flow', tap_flow_msg=tap_flow_msg, host=host) def delete_tap_service(self, context, tap_service_msg, host): - LOG.debug("In RPC Call for Delete Tap Service: Host=%s, MSG=%s" % - (host, tap_service_msg)) + LOG.debug("In RPC Call for Delete Tap Service: Host=%s, MSG=%s", + host, tap_service_msg) cctxt = self.client.prepare(fanout=True) cctxt.cast(context, 'delete_tap_service', tap_service_msg=tap_service_msg, host=host) def delete_tap_flow(self, context, tap_flow_msg, host): - LOG.debug("In RPC Call for Delete Tap Flow: Host=%s, MSG=%s" % - (host, tap_flow_msg)) + LOG.debug("In RPC Call for Delete Tap Flow: Host=%s, MSG=%s", + host, tap_flow_msg) cctxt = self.client.prepare(fanout=True) cctxt.cast(context, 'delete_tap_flow', tap_flow_msg=tap_flow_msg, diff --git a/neutron_taas/services/taas/service_drivers/taas_rpc.py b/neutron_taas/services/taas/service_drivers/taas_rpc.py index a2e916dc..9a17393e 100644 --- a/neutron_taas/services/taas/service_drivers/taas_rpc.py +++ b/neutron_taas/services/taas/service_drivers/taas_rpc.py @@ -45,7 +45,7 @@ class TaasCallbacks(object): def sync_tap_resources(self, context, sync_tap_res, host): """Handle Rpc from Agent to sync up Tap resources.""" - LOG.debug("In RPC Call for Sync Tap Resources: MSG=%s" % sync_tap_res) + LOG.debug("In RPC Call for Sync Tap Resources: MSG=%s", sync_tap_res) # Get list of configured tap-services active_tss = self.plugin.get_tap_services( @@ -96,7 +96,7 @@ class TaasCallbacks(object): def set_tap_service_status(self, context, msg, status, host=None): """Handle Rpc from Agent to set the status of Tap resources.""" LOG.info("In RPC Call to set tap service status: Host=%s, " - "MSG=%s, STATUS=%s" % (host, msg, status)) + "MSG=%s, STATUS=%s", host, msg, status) # Clear the resource from DB once agent indicates successful deletion # by mech driver. @@ -124,7 +124,7 @@ class TaasCallbacks(object): def set_tap_flow_status(self, context, msg, status, host=None): """Handle Rpc from Agent to set the status of Tap resources.""" LOG.info("In RPC Call to set tap flow status: Host=%s, " - "MSG=%s, STATUS=%s" % (host, msg, status)) + "MSG=%s, STATUS=%s", host, msg, status) # Clear the resource from DB once agent indicates successful deletion # by mech driver. diff --git a/neutron_taas/services/taas/taas_plugin.py b/neutron_taas/services/taas/taas_plugin.py index 41dfbd0f..2f6e5cd2 100644 --- a/neutron_taas/services/taas/taas_plugin.py +++ b/neutron_taas/services/taas/taas_plugin.py @@ -88,7 +88,7 @@ class TaasPlugin(taas_db.Taas_db_Mixin): host = port['binding:host_id'] if host is not None: - LOG.debug("Host on which the port is created = %s" % host) + LOG.debug("Host on which the port is created = %s", host) else: LOG.debug("Host could not be found, Port Binding disbaled!") diff --git a/neutron_taas/tests/unit/services/drivers/test_linux_sriov_utils.py b/neutron_taas/tests/unit/services/drivers/test_linux_sriov_utils.py index 1efedb59..0a0de978 100644 --- a/neutron_taas/tests/unit/services/drivers/test_linux_sriov_utils.py +++ b/neutron_taas/tests/unit/services/drivers/test_linux_sriov_utils.py @@ -31,7 +31,7 @@ FAKE_SRIOV_PORT = { 'id': 'fake_1', 'mac_address': "52:54:00:12:35:02", 'binding:profile': { 'pci_slot': None}, 'binding:vif_details': {'vlan': 20} - } +} class TestSriovNicUtils(base.TaasTestCase): diff --git a/neutron_taas/tests/unit/services/taas/test_taas_plugin.py b/neutron_taas/tests/unit/services/taas/test_taas_plugin.py index ed92a0bf..dcb77484 100644 --- a/neutron_taas/tests/unit/services/taas/test_taas_plugin.py +++ b/neutron_taas/tests/unit/services/taas/test_taas_plugin.py @@ -154,7 +154,7 @@ class TestTaasPlugin(testlib_api.SqlTestCase): cfg.CONF.set_override("vlan_range_start", 1, group="taas") cfg.CONF.set_override("vlan_range_end", 3, group="taas") with self.tap_service() as ts_1, self.tap_service() as ts_2, \ - self.tap_service() as ts_3, self.tap_service() as ts_4: + self.tap_service() as ts_3, self.tap_service() as ts_4: ts_id_1 = ts_1['id'] ts_id_2 = ts_2['id'] ts_id_3 = ts_3['id'] @@ -183,7 +183,7 @@ class TestTaasPlugin(testlib_api.SqlTestCase): def test_create_tap_service_wrong_tenant_id(self): self._port_details['tenant_id'] = 'other-tenant' with testtools.ExpectedException(taas_exc.PortDoesNotBelongToTenant), \ - self.tap_service(): + self.tap_service(): pass self.assertEqual([], self.driver.mock_calls) @@ -220,7 +220,7 @@ class TestTaasPlugin(testlib_api.SqlTestCase): def test_delete_tap_service_with_flow(self): with self.tap_service() as ts, \ - self.tap_flow(tap_service=ts['id']) as tf: + self.tap_flow(tap_service=ts['id']) as tf: self._plugin.delete_tap_service(self._context, ts['id']) self._tap_service['id'] = ts['id'] self._tap_flow['id'] = tf['id'] @@ -255,9 +255,9 @@ class TestTaasPlugin(testlib_api.SqlTestCase): def test_create_tap_flow_wrong_tenant_id(self): with self.tap_service() as ts, \ - testtools.ExpectedException( - taas_exc.TapServiceNotBelongToTenant), \ - self.tap_flow(tap_service=ts['id'], tenant_id='other-tenant'): + testtools.ExpectedException( + taas_exc.TapServiceNotBelongToTenant), \ + self.tap_flow(tap_service=ts['id'], tenant_id='other-tenant'): pass def test_create_tap_flow_failed_on_service_driver(self): @@ -275,7 +275,7 @@ class TestTaasPlugin(testlib_api.SqlTestCase): def test_delete_tap_flow(self): with self.tap_service() as ts, \ - self.tap_flow(tap_service=ts['id']) as tf: + self.tap_flow(tap_service=ts['id']) as tf: self._plugin.delete_tap_flow(self._context, tf['id']) self._tap_flow['id'] = tf['id'] self.driver.assert_has_calls([ diff --git a/requirements.txt b/requirements.txt index 4514220f..59dd2cae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - pbr>=5.5.0 # Apache-2.0 Babel>=2.8.0 # BSD neutron>=16.0.0.0b1 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 3ef3c54c..9e788cae 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - hacking>=6.1.0,<6.2.0 # Apache-2.0 coverage>=5.2.1 # Apache-2.0 @@ -16,6 +12,6 @@ testscenarios>=0.5.0 # Apache-2.0/BSD testtools>=2.4.0 # MIT astroid>=2.12.4 # LGPLv2.1 -pylint==2.15.6 # GPLv2 +pylint==2.17.4 # GPLv2 isort==5.10.1 # MIT WebTest>=2.0.27 # MIT diff --git a/tox.ini b/tox.ini index 3e2376cb..240769b1 100644 --- a/tox.ini +++ b/tox.ini @@ -64,12 +64,24 @@ commands = oslopolicy-sample-generator --config-file etc/policy-generator.conf commands = oslo_debug_helper {posargs} [flake8] -# E123, E125 skipped as they are invalid PEP-8. -# W504 Line break occurred after a binary operator show-source = True -ignore = E123,E125,W504 +# N530 direct neutron imports not allowed +# W504 Line break occurred after a binary operator +# E126 continuation line over-indented for hanging indent +# E128 continuation line under-indented for visual indent +# H405 multi line docstring summary not separated with an empty line +# I202 Additional newline in a group of imports +# E731 do not assign a lambda expression, use a def +# W504 line break after binary operator +ignore = E126,E128,E731,I202,H405,N530,W504 builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build +# H106: Don't put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +# H204: Use assert(Not)Equal to check for equality +# H205: Use assert(Greater|Less)(Equal) for comparison +# H904: Delay string interpolations at logging calls +enable-extensions=H106,H203,H204,H205,H904 [flake8:local-plugins] extension =