Debian Codegraph @

neutron_fwaas/services/firewall/service_drivers/agents/drivers/linux/l2/driver_base.py

raw symbols SCIP
1 # Copyright (C) 2017 Fujitsu Limited
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 import abc
16 import contextlib
17
18
19 class FirewallL2DriverBase(metaclass=abc.ABCMeta):
20 """Abstract firewall L2 driver base"""
21
22 def __init__(self, integration_bridge, sg_enabled=False):
23 pass
24
25 def filter_defer_apply_on(self):
26 """Defer application of filtering rule."""
27 pass
28
29 def filter_defer_apply_off(self):
30 """Turn off deferral of rules and apply the rules now."""
31 pass
32
33 @property
34 def ports(self):
35 """Returns filtered ports."""
36 pass
37
38 @contextlib.contextmanager
39 def defer_apply(self):
40 """Defer apply context."""
41 self.filter_defer_apply_on()
42 try:
43 yield
44 finally:
45 self.filter_defer_apply_off()
46
47 def create_firewall_group(self, ports, firewall_group):
48 """Called when a firewall group is created.
49 """
50 raise NotImplementedError()
51
52 def update_firewall_group(self, ports, firewall_group):
53 """Called when a firewall group is updated.
54 """
55 raise NotImplementedError()
56
57 def delete_firewall_group(self, ports, firewall_group):
58 """Called when a firewall group is deleted.
59 """
60 raise NotImplementedError()