Debian Codegraph @

neutron_fwaas/tests/unit/services/logapi/agents/drivers/iptables/test_driver.py

raw symbols SCIP
1 # Copyright (c) 2018 Fujitsu Limited
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from neutron.services.logapi.drivers import base as log_base_driver
17 from neutron_fwaas.tests import base
18
19 SUPPORTED_LOGGING_TYPES = ['firewall_group']
20
21
22 class FakeDriver(log_base_driver.DriverBase):
23
24 @staticmethod
25 def create():
26 return FakeDriver(
27 name='fake_driver',
28 vif_types=[],
29 vnic_types=[],
30 supported_logging_types=SUPPORTED_LOGGING_TYPES,
31 requires_rpc=True
32 )
33
34
35 class TestDriverBase(base.BaseTestCase):
36
37 def setUp(self):
38 super().setUp()
39 self.driver = FakeDriver.create()
40
41 def test_is_vif_type_compatible(self):
42 self.assertFalse(
43 self.driver.is_vif_type_compatible([]))
44
45 def test_is_vnic_compatible(self):
46 self.assertFalse(
47 self.driver.is_vnic_compatible([]))
48
49 def test_is_logging_type_supported(self):
50 self.assertTrue(
51 self.driver.is_logging_type_supported('firewall_group'))
52 self.assertFalse(
53 self.driver.is_logging_type_supported('security_group'))