Debian Codegraph @

neutron_fwaas/services/firewall/service_drivers/agents/drivers/fwaas_base_v2.py

raw symbols SCIP
1 # Copyright (c) 2016
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 import abc
17
18
19 class FwaasDriverBase(metaclass=abc.ABCMeta):
20 """Firewall as a Service Driver base class.
21
22 Using FwaasDriver Class, an instance of L3 perimeter Firewall
23 can be created. The firewall co-exists with the L3 agent.
24
25 One instance is created for each tenant. One firewall policy
26 is associated with each tenant (in the Havana release).
27
28 The Firewall can be visualized as having two zones (in Havana
29 release), trusted and untrusted.
30
31 All the 'internal' interfaces of Neutron Router is treated as trusted. The
32 interface connected to 'external network' is treated as untrusted.
33
34 The policy is applied on traffic ingressing/egressing interfaces on
35 the trusted zone. This implies that policy will be applied for traffic
36 passing from
37
38 - trusted to untrusted zones
39 - untrusted to trusted zones
40 - trusted to trusted zones
41
42 Policy WILL NOT be applied for traffic from untrusted to untrusted zones.
43 This is not a problem in Havana release as there is only one interface
44 connected to external network.
45
46 Since the policy is applied on the internal interfaces, the traffic
47 will be not be NATed to floating IP. For incoming traffic, the
48 traffic will get NATed to internal IP address before it hits
49 the firewall rules. So, while writing the rules, care should be
50 taken if using rules based on floating IP.
51
52 The firewall rule addition/deletion/insertion/update are done by the
53 management console. When the policy is sent to the driver, the complete
54 policy is sent and the whole policy has to be applied atomically. The
55 firewall rules will not get updated individually. This is to avoid problems
56 related to out-of-order notifications or inconsistent behaviour by partial
57 application of rules. Argument agent_mode indicates the l3 agent in DVR or
58 DVR_SNAT or LEGACY mode.
59 """
60 @abc.abstractmethod
61 def create_firewall_group(self, agent_mode, apply_list, firewall):
62 """Create the Firewall with default (drop all) policy.
63
64 The default policy will be applied on all the interfaces of
65 trusted zone.
66 """
67 pass
68
69 @abc.abstractmethod
70 def delete_firewall_group(self, agent_mode, apply_list, firewall):
71 """Delete firewall.
72
73 Removes all policies created by this instance and frees up
74 all the resources.
75 """
76 pass
77
78 @abc.abstractmethod
79 def update_firewall_group(self, agent_mode, apply_list, firewall):
80 """Apply the policy on all trusted interfaces.
81
82 Remove previous policy and apply the new policy on all trusted
83 interfaces.
84 """
85 pass
86
87 @abc.abstractmethod
88 def apply_default_policy(self, agent_mode, apply_list, firewall):
89 """Apply the default policy on all trusted interfaces.
90
91 Remove current policy and apply the default policy on all trusted
92 interfaces.
93 """
94 pass