Bump hacking

hacking 3.0.x is too old.
Try to synchronize pylint ignore and extension list with
other Networking projects.

With new pip the order of packages is not relevant, so the
related comment from requirements.txts is removed, see pip
documentation:
https://pip.pypa.io/en/stable/cli/pip_install/#installation-order

Change-Id: I99a2d30149088d3d71d56351d180e665c38686ef
This commit is contained in:
elajkat 2024-02-06 15:17:56 +01:00 committed by Lajos Katona
parent 3fe92291f2
commit 625b6526ca
19 changed files with 111 additions and 126 deletions

View File

@ -1,4 +1,4 @@
#Copyright 2015 OpenStack Foundation # Copyright 2015 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain

View File

@ -54,8 +54,7 @@ def get_inspector():
def get_tables(): def get_tables():
""" """Returns hardcoded list of tables which have ``tenant_id`` column.
Returns hardcoded list of tables which have ``tenant_id`` column.
The list is hardcoded to match the state of the schema when this The list is hardcoded to match the state of the schema when this
upgrade script is run. upgrade script is run.

View File

@ -145,9 +145,8 @@ class Firewall_v2(extensions.APIExtensionDescriptor):
return Firewallv2PluginBase return Firewallv2PluginBase
class Firewallv2PluginBase( class Firewallv2PluginBase(service_base.ServicePluginBase,
service_base.ServicePluginBase, metaclass=abc.ABCMeta):
metaclass=abc.ABCMeta):
def get_plugin_type(self): def get_plugin_type(self):
return fwaas_constants.FIREWALL_V2 return fwaas_constants.FIREWALL_V2

View File

@ -241,7 +241,7 @@ class FirewallAgentDriver(driver_api.FirewallDriverDB,
'status': port_db['status'], 'status': port_db['status'],
} }
if device_owner.startswith( if device_owner.startswith(
nl_constants.DEVICE_OWNER_COMPUTE_PREFIX): nl_constants.DEVICE_OWNER_COMPUTE_PREFIX):
port_details[port_id].update( port_details[port_id].update(
{'host': port_db[pb_def.HOST_ID]}) {'host': port_db[pb_def.HOST_ID]})
return port_details return port_details
@ -314,7 +314,7 @@ class FirewallAgentDriver(driver_api.FirewallDriverDB,
# the old group had the same number of ports that need to be deleted. # the old group had the same number of ports that need to be deleted.
fwg_with_rules['last-port'] = (len(old_firewall_group['ports']) == len( fwg_with_rules['last-port'] = (len(old_firewall_group['ports']) == len(
fwg_with_rules['del-port-ids']) and fwg_with_rules['del-port-ids']) and
not(new_firewall_group['ports'])) not new_firewall_group['ports'])
LOG.debug("update_firewall_group %s: Add Ports: %s, Del Ports: %s", LOG.debug("update_firewall_group %s: Add Ports: %s, Del Ports: %s",
new_firewall_group['id'], new_firewall_group['id'],

View File

@ -281,7 +281,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
for pre_fw_rule in pre_fw_rules: for pre_fw_rule in pre_fw_rules:
for fw_rule in fw_rules: for fw_rule in fw_rules:
if (pre_fw_rule.get('id') == fw_rule.get('id') and if (pre_fw_rule.get('id') == fw_rule.get('id') and
pre_fw_rule != fw_rule): pre_fw_rule != fw_rule):
changed_rules.append(pre_fw_rule) changed_rules.append(pre_fw_rule)
changed_rules.append(fw_rule) changed_rules.append(fw_rule)
return changed_rules return changed_rules
@ -476,7 +476,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
# iptables adds '-m protocol' when any source # iptables adds '-m protocol' when any source
# or destination port number is specified # or destination port number is specified
if (rule.get('source_port') is not None or if (rule.get('source_port') is not None or
rule.get('destination_port') is not None): rule.get('destination_port') is not None):
args += self._match_arg(rule.get('protocol')) args += self._match_arg(rule.get('protocol'))
args += self._port_arg('sport', args += self._port_arg('sport',
@ -512,7 +512,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
return [] return []
if (protocol == constants.PROTO_NAME_ICMP and if (protocol == constants.PROTO_NAME_ICMP and
ip_version == constants.IP_VERSION_6): ip_version == constants.IP_VERSION_6):
protocol = constants.PROTO_NAME_IPV6_ICMP protocol = constants.PROTO_NAME_IPV6_ICMP
args = ['-p', protocol] args = ['-p', protocol]
@ -543,7 +543,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
def _ip_prefix_arg(self, direction, ip_prefix): def _ip_prefix_arg(self, direction, ip_prefix):
if not(ip_prefix): if not ip_prefix:
return [] return []
args = ['-%s' % direction, '%s' % utils.ip_to_cidr(ip_prefix)] args = ['-%s' % direction, '%s' % utils.ip_to_cidr(ip_prefix)]

View File

@ -287,7 +287,7 @@ class OVSFirewallDriver(driver_base.FirewallL2DriverBase):
def _drop_all_unmatched_flows(self): def _drop_all_unmatched_flows(self):
for table in fwaas_ovs_consts.OVS_FIREWALL_TABLES: for table in fwaas_ovs_consts.OVS_FIREWALL_TABLES:
if (table == fwaas_ovs_consts.FW_ACCEPT_OR_INGRESS_TABLE and if (table == fwaas_ovs_consts.FW_ACCEPT_OR_INGRESS_TABLE and
self.sg_with_ovs): self.sg_with_ovs):
continue continue
self.int_br.br.add_flow(table=table, priority=0, actions='drop') self.int_br.br.add_flow(table=table, priority=0, actions='drop')

View File

@ -86,7 +86,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
self.agent_api = agent_api self.agent_api = agent_api
def _register_rpc_consumers(self, connection): def _register_rpc_consumers(self, connection):
#TODO(njohnston): Add RPC consumer connection loading here. # TODO(njohnston): Add RPC consumer connection loading here.
pass pass
def start_rpc_listeners(self, host, conf): def start_rpc_listeners(self, host, conf):
@ -309,7 +309,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
try: try:
self._process_router_update(updated_router) self._process_router_update(updated_router)
except Exception: except Exception:
#TODO(njohnston): This repr should be replaced. # TODO(njohnston): This repr should be replaced.
LOG.exception( LOG.exception(
"FWaaS router update RPC info call failed for %s", "FWaaS router update RPC info call failed for %s",
repr(updated_router)) repr(updated_router))
@ -320,7 +320,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
in the context of FWaaS with an IPTables driver; the namespace will in the context of FWaaS with an IPTables driver; the namespace will
already have been deleted, taking the IPTables rules with it. already have been deleted, taking the IPTables rules with it.
""" """
#TODO(njohnston): When another firewall driver is implemented, look at # TODO(njohnston): When another firewall driver is implemented, look at
# expanding this out so that the driver can handle deletion calls. # expanding this out so that the driver can handle deletion calls.
pass pass

View File

@ -441,7 +441,7 @@ class FirewallDriverDB(FirewallDriverDBMixin):
related records in the databases. related records in the databases.
""" """
#Firewal Group # Firewall Group
def create_firewall_group_precommit(self, context, firewall_group): def create_firewall_group_precommit(self, context, firewall_group):
pass pass
@ -462,7 +462,7 @@ class FirewallDriverDB(FirewallDriverDBMixin):
def delete_firewall_group_postcommit(self, context, firewall_group): def delete_firewall_group_postcommit(self, context, firewall_group):
pass pass
#Firewall Policy # Firewall Policy
def create_firewall_policy_precommit(self, context, firewall_policy): def create_firewall_policy_precommit(self, context, firewall_policy):
pass pass
@ -483,7 +483,7 @@ class FirewallDriverDB(FirewallDriverDBMixin):
def delete_firewall_policy_postcommit(self, context, firewall_policy): def delete_firewall_policy_postcommit(self, context, firewall_policy):
pass pass
#Firewall Rule # Firewall Rule
def create_firewall_rule_precommit(self, context, firewall_rule): def create_firewall_rule_precommit(self, context, firewall_rule):
pass pass

View File

@ -18,7 +18,7 @@ from neutron.services.logapi.agent import log_extension as log_ext
from neutron.services.logapi.rpc import agent as agent_rpc from neutron.services.logapi.rpc import agent as agent_rpc
from neutron_lib.agent import l3_extension from neutron_lib.agent import l3_extension
#TODO(annp) move to neutron-lib # TODO(annp) move to neutron-lib
FIREWALL_LOG_DRIVER_NAME = 'fwaas_v2_log' FIREWALL_LOG_DRIVER_NAME = 'fwaas_v2_log'

View File

@ -137,8 +137,8 @@ class Host(fixtures.Fixture):
self.ovs_agent.agent_cfg_fixture.get_br_int_name())) self.ovs_agent.agent_cfg_fixture.get_br_int_name()))
def setup_host_with_linuxbridge_agent(self): def setup_host_with_linuxbridge_agent(self):
#First we need to provide connectivity for agent to prepare proper # First we need to provide connectivity for agent to prepare proper
#bridge mappings in agent's config: # bridge mappings in agent's config:
self.host_namespace = self.useFixture( self.host_namespace = self.useFixture(
net_helpers.NamespaceFixture(prefix="host-") net_helpers.NamespaceFixture(prefix="host-")
).name ).name
@ -269,7 +269,8 @@ class Environment(fixtures.Fixture):
""" """
def __init__(self, env_desc, hosts_desc): def __init__(self, env_desc, hosts_desc):
""" """Environment, represents a deployment topology
:param env_desc: An EnvironmentDescription instance. :param env_desc: An EnvironmentDescription instance.
:param hosts_desc: A list of HostDescription instances. :param hosts_desc: A list of HostDescription instances.
""" """
@ -308,13 +309,13 @@ class Environment(fixtures.Fixture):
def _setUp(self): def _setUp(self):
self.temp_dir = self.useFixture(fixtures.TempDir()).path self.temp_dir = self.useFixture(fixtures.TempDir()).path
#we need this bridge before rabbit and neutron service will start # we need this bridge before rabbit and neutron service will start
self.central_data_bridge = self.useFixture( self.central_data_bridge = self.useFixture(
net_helpers.OVSBridgeFixture('cnt-data')).bridge net_helpers.OVSBridgeFixture('cnt-data')).bridge
self.central_external_bridge = self.useFixture( self.central_external_bridge = self.useFixture(
net_helpers.OVSBridgeFixture('cnt-ex')).bridge net_helpers.OVSBridgeFixture('cnt-ex')).bridge
#Get rabbitmq address (and cnt-data network) # Get rabbitmq address (and cnt-data network)
rabbitmq_ip_address = self._configure_port_for_rabbitmq() rabbitmq_ip_address = self._configure_port_for_rabbitmq()
self.rabbitmq_environment = self.useFixture( self.rabbitmq_environment = self.useFixture(
process.RabbitmqEnvironmentFixture(host=rabbitmq_ip_address) process.RabbitmqEnvironmentFixture(host=rabbitmq_ip_address)
@ -349,7 +350,7 @@ class Environment(fixtures.Fixture):
return rabbitmq_ip return rabbitmq_ip
def _get_network_range(self): def _get_network_range(self):
#NOTE(slaweq): We need to choose IP address on which rabbitmq will be # NOTE(slaweq): We need to choose IP address on which rabbitmq will be
# available because LinuxBridge agents are spawned in their own # available because LinuxBridge agents are spawned in their own
# namespaces and need to know where the rabbitmq server is listening. # namespaces and need to know where the rabbitmq server is listening.
# For ovs agent it is not necessary because agents are spawned in # For ovs agent it is not necessary because agents are spawned in

View File

@ -99,7 +99,7 @@ class FakeFullstackMachine(machine_fixtures.FakeMachineBase):
def _configure_ipaddress(self, fixed_ip): def _configure_ipaddress(self, fixed_ip):
if (netaddr.IPAddress(fixed_ip['ip_address']).version == if (netaddr.IPAddress(fixed_ip['ip_address']).version ==
constants.IP_VERSION_6): constants.IP_VERSION_6):
# v6Address/default_route is auto-configured. # v6Address/default_route is auto-configured.
self._ipv6 = fixed_ip['ip_address'] self._ipv6 = fixed_ip['ip_address']
else: else:

View File

@ -393,7 +393,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
self.assertEqual(webob.exc.HTTPConflict.code, res.status_int) self.assertEqual(webob.exc.HTTPConflict.code, res.status_int)
def test_update_default_fwg_policy(self): def test_update_default_fwg_policy(self):
""" """Test that fw group associated policy can't be updated
Make sure that neither admin nor non-admin can update policy Make sure that neither admin nor non-admin can update policy
associated with default firewall group associated with default firewall group
""" """
@ -835,21 +836,21 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
def test_create_firewall_group_with_router_port(self): def test_create_firewall_group_with_router_port(self):
with self.port( with self.port(
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF) as port: device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF) as port:
attrs = self._get_test_firewall_group_attrs("fwg1") attrs = self._get_test_firewall_group_attrs("fwg1")
attrs['ports'] = [port['port']['id']] attrs['ports'] = [port['port']['id']]
self._test_create_firewall_group(attrs) self._test_create_firewall_group(attrs)
def test_create_firewall_group_with_dvr_port(self): def test_create_firewall_group_with_dvr_port(self):
with self.port( with self.port(
device_owner=nl_constants.DEVICE_OWNER_DVR_INTERFACE) as port: device_owner=nl_constants.DEVICE_OWNER_DVR_INTERFACE) as port:
attrs = self._get_test_firewall_group_attrs("fwg1") attrs = self._get_test_firewall_group_attrs("fwg1")
attrs['ports'] = [port['port']['id']] attrs['ports'] = [port['port']['id']]
self._test_create_firewall_group(attrs) self._test_create_firewall_group(attrs)
def test_create_firewall_group_with_router_port_l3ha(self): def test_create_firewall_group_with_router_port_l3ha(self):
with self.port( dev_owner_ha_repl_int = nl_constants.DEVICE_OWNER_HA_REPLICATED_INT
device_owner=nl_constants.DEVICE_OWNER_HA_REPLICATED_INT) as port: with self.port(device_owner=dev_owner_ha_repl_int) as port:
attrs = self._get_test_firewall_group_attrs("fwg1") attrs = self._get_test_firewall_group_attrs("fwg1")
attrs['ports'] = [port['port']['id']] attrs['ports'] = [port['port']['id']]
self._test_create_firewall_group(attrs) self._test_create_firewall_group(attrs)
@ -993,7 +994,7 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
for rule_id in policy['firewall_rules']: for rule_id in policy['firewall_rules']:
rule = self._show_req( rule = self._show_req(
'firewall_rules', rule_id)['firewall_rule'] 'firewall_rules', rule_id)['firewall_rule']
self.assertTrue(direction in rule["description"]) self.assertIn(direction, rule["description"])
for obj in result_map: for obj in result_map:
res = self._list_req(obj) res = self._list_req(obj)
@ -1098,8 +1099,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
def test_show_firewall_group_with_ports(self): def test_show_firewall_group_with_ports(self):
attrs = self._get_test_firewall_group_attrs('fwg1') attrs = self._get_test_firewall_group_attrs('fwg1')
with self.port( dev_owner_router_intf = nl_constants.DEVICE_OWNER_ROUTER_INTF
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF) as dummy_port: with self.port(device_owner=dev_owner_router_intf) as dummy_port:
attrs['ports'] = [dummy_port['port']['id']] attrs['ports'] = [dummy_port['port']['id']]
self._test_show_firewall_group(attrs) self._test_show_firewall_group(attrs)
@ -1161,8 +1162,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
ctx = self._get_nonadmin_context() ctx = self._get_nonadmin_context()
def_fwg_id = self._build_default_fwg(ctx=ctx)['id'] def_fwg_id = self._build_default_fwg(ctx=ctx)['id']
with self.port( with self.port(
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF, device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF,
tenant_id=ctx.project_id) as dummy_port: tenant_id=ctx.project_id) as dummy_port:
port_id = dummy_port['port']['id'] port_id = dummy_port['port']['id']
success_cases = [ success_cases = [
{'ports': [port_id]}, {'ports': [port_id]},
@ -1182,8 +1183,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
ctx = self._get_nonadmin_context() ctx = self._get_nonadmin_context()
def_fwg_id = self._build_default_fwg(ctx=ctx)['id'] def_fwg_id = self._build_default_fwg(ctx=ctx)['id']
with self.port( with self.port(
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF, device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF,
tenant_id=ctx.project_id) as dummy_port: tenant_id=ctx.project_id) as dummy_port:
port_id = dummy_port['port']['id'] port_id = dummy_port['port']['id']
conflict_cases = [ conflict_cases = [
{'name': ''}, {'name': ''},
@ -1208,8 +1209,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
def test_update_default_firewall_group_with_admin_success(self): def test_update_default_firewall_group_with_admin_success(self):
ctx = self._get_admin_context() ctx = self._get_admin_context()
with self.port( with self.port(
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF, device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF,
tenant_id=ctx.project_id) as dummy_port: tenant_id=ctx.project_id) as dummy_port:
port_id = dummy_port['port']['id'] port_id = dummy_port['port']['id']
def_fwg_id = self._build_default_fwg(ctx=ctx)['id'] def_fwg_id = self._build_default_fwg(ctx=ctx)['id']
success_cases = [ success_cases = [
@ -1233,8 +1234,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
def test_update_default_firewall_group_with_admin_failure(self): def test_update_default_firewall_group_with_admin_failure(self):
ctx = self._get_admin_context() ctx = self._get_admin_context()
with self.port( with self.port(
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF, device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF,
tenant_id=ctx.project_id) as dummy_port: tenant_id=ctx.project_id) as dummy_port:
port_id = dummy_port['port']['id'] port_id = dummy_port['port']['id']
def_fwg_id = self._build_default_fwg(ctx=ctx)['id'] def_fwg_id = self._build_default_fwg(ctx=ctx)['id']
conflict_cases = [ conflict_cases = [
@ -1272,9 +1273,10 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
self.assertEqual(200, res.status_int) self.assertEqual(200, res.status_int)
def test_change_fwg_name_to_default(self): def test_change_fwg_name_to_default(self):
""" """Test that fw group name can't be changed
Make sure that neither admin nor non-admin can change name of
existing firewall group to default Make sure that neither admin nor non-admin can change name of
existing firewall group to default
""" """
admin_ctx = self._get_admin_context() admin_ctx = self._get_admin_context()
nonadmin_ctx = self._get_nonadmin_context() nonadmin_ctx = self._get_nonadmin_context()

View File

@ -185,7 +185,8 @@ class ConntrackNetlinkTestCase(base.BaseTestCase):
not_in_dport_range = [(4, 'tcp', 1, 2, '1.1.1.1', '2.2.2.2'), not_in_dport_range = [(4, 'tcp', 1, 2, '1.1.1.1', '2.2.2.2'),
(4, 'tcp', [1], ['3', '100']), -1] (4, 'tcp', [1], ['3', '100']), -1]
for entry, rule_filter, expect in [ for entry, rule_filter, expect in [
wrong_ipv, wrong_proto, not_in_sport_range, not_in_dport_range]: wrong_ipv, wrong_proto, not_in_sport_range,
not_in_dport_range]:
self._test_entry_to_delete(rule_filter, entry, expect) self._test_entry_to_delete(rule_filter, entry, expect)
def test_get_filter_from_rules(self): def test_get_filter_from_rules(self):

View File

@ -401,13 +401,13 @@ class TestIsPortLayer2(TestFWaasV2AgentExtensionBase):
def test_not_vm_port(self): def test_not_vm_port(self):
for device_owner in [nl_consts.DEVICE_OWNER_ROUTER_INTF, for device_owner in [nl_consts.DEVICE_OWNER_ROUTER_INTF,
nl_consts.DEVICE_OWNER_ROUTER_GW, nl_consts.DEVICE_OWNER_ROUTER_GW,
nl_consts.DEVICE_OWNER_DHCP, nl_consts.DEVICE_OWNER_DHCP,
nl_consts.DEVICE_OWNER_DVR_INTERFACE, nl_consts.DEVICE_OWNER_DVR_INTERFACE,
nl_consts.DEVICE_OWNER_AGENT_GW, nl_consts.DEVICE_OWNER_AGENT_GW,
nl_consts.DEVICE_OWNER_ROUTER_SNAT, nl_consts.DEVICE_OWNER_ROUTER_SNAT,
'unknown device_owner', 'unknown device_owner',
'']: '']:
self.port['device_owner'] = device_owner self.port['device_owner'] = device_owner
self.assertFalse(self.l2._is_port_layer2(self.port)) self.assertFalse(self.l2._is_port_layer2(self.port))

View File

@ -40,9 +40,10 @@ DELETEFW_PATH = (FIREWALL_AGENT_PLUGIN + '.FirewallAgentApi.'
class FakeAgentApi(agents.FirewallAgentCallbacks): class FakeAgentApi(agents.FirewallAgentCallbacks):
""" """This class used to mock the AgentAPI delete method
This class used to mock the AgentAPI delete method inherits from
FirewallCallbacks because it needs access to the firewall_deleted method. It inherits from FirewallCallbacks because it needs access to
the firewall_deleted method.
The delete_firewall method belongs to the FirewallAgentApi, which has The delete_firewall method belongs to the FirewallAgentApi, which has
no access to the firewall_deleted method normally because it's not no access to the firewall_deleted method normally because it's not
responsible for deleting the firewall from the DB. However, it needs responsible for deleting the firewall from the DB. However, it needs
@ -241,10 +242,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
with self.firewall_policy(as_admin=True) as fwp: with self.firewall_policy(as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, egress_firewall_policy_id=fwp_id,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.INACTIVE, self.assertEqual(nl_constants.INACTIVE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -272,10 +273,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
with self.firewall_policy(as_admin=True) as fwp: with self.firewall_policy(as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, ports=fwg_ports, egress_firewall_policy_id=fwp_id, ports=fwg_ports,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.PENDING_CREATE, self.assertEqual(nl_constants.PENDING_CREATE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -313,11 +314,11 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
with self.firewall_policy(as_admin=True) as fwp: with self.firewall_policy(as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, egress_firewall_policy_id=fwp_id,
ports=fwg_ports, ports=fwg_ports,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.PENDING_CREATE, self.assertEqual(nl_constants.PENDING_CREATE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -343,10 +344,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
port_id2 = body['port_id'] port_id2 = body['port_id']
fwg_ports = [port_id1, port_id2] fwg_ports = [port_id1, port_id2]
with self.firewall_group( with self.firewall_group(
name='test', name='test',
default_policy=False, default_policy=False,
ports=fwg_ports, ports=fwg_ports,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.INACTIVE, self.assertEqual(nl_constants.INACTIVE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -381,10 +382,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
fwg_ports = [port_id1, port_id2] fwg_ports = [port_id1, port_id2]
with self.firewall_group( with self.firewall_group(
name='test', name='test',
default_policy=False, default_policy=False,
ports=fwg_ports, ports=fwg_ports,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.INACTIVE, self.assertEqual(nl_constants.INACTIVE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
data = {'firewall_group': {'ports': [port_id2, port_id3]}} data = {'firewall_group': {'ports': [port_id2, port_id3]}}
@ -433,10 +434,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
with self.firewall_policy(as_admin=True) as fwp: with self.firewall_policy(as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, ports=fwg_ports, egress_firewall_policy_id=fwp_id, ports=fwg_ports,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.PENDING_CREATE, self.assertEqual(nl_constants.PENDING_CREATE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
data = {'firewall_group': {'ports': [port_id2, port_id3]}} data = {'firewall_group': {'ports': [port_id2, port_id3]}}
@ -478,10 +479,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
with self.firewall_policy(as_admin=True) as fwp: with self.firewall_policy(as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, ports=fwg_ports, egress_firewall_policy_id=fwp_id, ports=fwg_ports,
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.PENDING_CREATE, self.assertEqual(nl_constants.PENDING_CREATE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -516,10 +517,10 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
as_admin=True) as fwp: as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, ports=[port_id1], egress_firewall_policy_id=fwp_id, ports=[port_id1],
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.PENDING_CREATE, self.assertEqual(nl_constants.PENDING_CREATE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -549,14 +550,14 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
port_id1 = body['port_id'] port_id1 = body['port_id']
with self.firewall_rule(as_admin=True) as fwr: with self.firewall_rule(as_admin=True) as fwr:
with self.firewall_policy( with self.firewall_policy(
firewall_rules=[fwr['firewall_rule']['id']], firewall_rules=[fwr['firewall_rule']['id']],
as_admin=True) as fwp: as_admin=True) as fwp:
fwp_id = fwp['firewall_policy']['id'] fwp_id = fwp['firewall_policy']['id']
with self.firewall_group( with self.firewall_group(
name='test', name='test',
ingress_firewall_policy_id=fwp_id, ingress_firewall_policy_id=fwp_id,
egress_firewall_policy_id=fwp_id, ports=[port_id1], egress_firewall_policy_id=fwp_id, ports=[port_id1],
admin_state_up=True) as fwg1: admin_state_up=True) as fwg1:
self.assertEqual(nl_constants.PENDING_CREATE, self.assertEqual(nl_constants.PENDING_CREATE,
fwg1['firewall_group']['status']) fwg1['firewall_group']['status'])
@ -597,8 +598,8 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase,
def test_update_firewall_group_with_ports_and_policy(self): def test_update_firewall_group_with_ports_and_policy(self):
"""neutron firewall_group create test-policy """ """neutron firewall_group create test-policy """
with self.router(name='router1', admin_state_up=True, with self.router(name='router1', admin_state_up=True,
tenant_id=self._tenant_id) as r,\ tenant_id=self._tenant_id) as r, \
self.subnet() as s1,\ self.subnet() as s1, \
self.subnet(cidr='20.0.0.0/24') as s2: self.subnet(cidr='20.0.0.0/24') as s2:
body = self._router_interface_action( body = self._router_interface_action(

View File

@ -24,7 +24,7 @@ class BaseLogTestCase(testlib_api.SqlTestCase):
with mock.patch.object( with mock.patch.object(
resource_manager.ResourceCallbacksManager, '_singleton', resource_manager.ResourceCallbacksManager, '_singleton',
new_callable=mock.PropertyMock(return_value=False)): new_callable=mock.PropertyMock(return_value=False)):
self.cons_mgr = resource_manager.ConsumerResourceCallbacksManager() self.cons_mgr = resource_manager.ConsumerResourceCallbacksManager()
self.prod_mgr = resource_manager.ProducerResourceCallbacksManager() self.prod_mgr = resource_manager.ProducerResourceCallbacksManager()

View File

@ -1,12 +1,3 @@
# Requirements lower bounds listed here are our best effort to keep them up to
# date but we do not test them so no guarantee of having them all correct. If
# you find any incorrect lower bounds, let us know or propose a fix.
# 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>=4.0.0 # Apache-2.0
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
netaddr>=0.7.18 # BSD netaddr>=0.7.18 # BSD
SQLAlchemy>=1.4.23 # MIT SQLAlchemy>=1.4.23 # MIT

View File

@ -1,10 +1,6 @@
# The order of packages is significant, because pip processes them in the order hacking>=6.1.0,<6.2.0 # Apache-2.0
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=3.0.1,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
flake8-import-order==0.12 # LGPLv3
python-subunit>=1.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD
requests-mock>=1.2.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0 oslo.concurrency>=3.26.0 # Apache-2.0
@ -15,6 +11,7 @@ testscenarios>=0.4 # Apache-2.0/BSD
WebOb>=1.8.2 # MIT WebOb>=1.8.2 # MIT
WebTest>=2.0.27 # MIT WebTest>=2.0.27 # MIT
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
pylint==2.17.4 # GPLv2
PyMySQL>=0.7.6 # MIT License PyMySQL>=0.7.6 # MIT License
psycopg2>=2.7.3 # LGPL/ZPL psycopg2>=2.7.3 # LGPL/ZPL
ddt>=1.0.1 # MIT ddt>=1.0.1 # MIT

20
tox.ini
View File

@ -151,26 +151,20 @@ ignore = D000
ignore-path = .venv,.git,.tox,.tmp,*neutron_fwaas/locale*,*lib/python*,neutron_fwaas.egg*,doc/build,releasenotes/*,doc/source/contributor/api,requirements.txt,test-requirements.txt ignore-path = .venv,.git,.tox,.tmp,*neutron_fwaas/locale*,*lib/python*,neutron_fwaas.egg*,doc/build,releasenotes/*,doc/source/contributor/api,requirements.txt,test-requirements.txt
[flake8] [flake8]
# E125 continuation line does not distinguish itself from next logical line # N530 direct neutron imports not allowed
# W504 Line break occurred after a binary operator
# E126 continuation line over-indented for hanging indent # E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent # E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line
# E265 block comment should start with '# '
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line # H405 multi line docstring summary not separated with an empty line
# TODO(dougwig) -- uncomment this to test for remaining linkages # I202 Additional newline in a group of imports
# N530 direct neutron imports not allowed # E731 do not assign a lambda expression, use a def
# TODO(ihrachys) -- reenable N537 when new neutron-lib release is available # W504 line break after binary operator
# H106: Do not put vim configuration in source files ignore = E126,E128,E731,I202,H405,N530,W504
# H106: Don't put vim configuration in source files
# H203: Use assertIs(Not)None to check for None # H203: Use assertIs(Not)None to check for None
# H204: Use assert(Not)Equal to check for equality # H204: Use assert(Not)Equal to check for equality
# H205: Use assert(Greater|Less)(Equal) for comparison # H205: Use assert(Greater|Less)(Equal) for comparison
# H904: Delay string interpolations at logging calls # H904: Delay string interpolations at logging calls
# N521: jsonutils.loads must be used instead of json.loads
# W504 line break after binary operator
# (W503 and W504 are incompatible and we need to choose one of them.
# Existing codes follows W503, so we disable W504.)
ignore = E125,E126,E128,E129,E265,H404,H405,N530,N521,W504
enable-extensions=H106,H203,H204,H205,H904 enable-extensions=H106,H203,H204,H205,H904
show-source = true show-source = true
exclude = .venv,.git,.tox,dist,doc,*lib/python*,.tmp,*egg,build,tools,.ropeproject,rally-scenarios exclude = .venv,.git,.tox,dist,doc,*lib/python*,.tmp,*egg,build,tools,.ropeproject,rally-scenarios