Browse Source

Merge "use EGRESS_DIRECTION and INGRESS_DIRECTION from neutron-lib"

Zuul 1 year ago
parent
commit
5c8a435ca1
1 changed files with 7 additions and 8 deletions
  1. 7
    8
      networking_hyperv/neutron/security_groups_driver.py

+ 7
- 8
networking_hyperv/neutron/security_groups_driver.py View File

@@ -17,6 +17,7 @@ import threading
17 17
 
18 18
 import netaddr
19 19
 from neutron.agent import firewall
20
+from neutron_lib import constants
20 21
 from os_win import exceptions
21 22
 from os_win.utils.network import networkutils
22 23
 from os_win import utilsfactory
@@ -28,10 +29,8 @@ from networking_hyperv.neutron import _common_utils as c_utils
28 29
 
29 30
 LOG = logging.getLogger(__name__)
30 31
 
31
-INGRESS_DIRECTION = 'ingress'
32
-EGRESS_DIRECTION = 'egress'
33
-DIRECTION_IP_PREFIX = {'ingress': 'source_ip_prefix',
34
-                       'egress': 'dest_ip_prefix'}
32
+DIRECTION_IP_PREFIX = {constants.INGRESS_DIRECTION: 'source_ip_prefix',
33
+                       constants.EGRESS_DIRECTION: 'dest_ip_prefix'}
35 34
 
36 35
 ACL_PROP_MAP = {
37 36
     'direction': {'ingress': networkutils.NetworkUtils._ACL_DIR_IN,
@@ -126,10 +125,10 @@ class HyperVSecurityGroupsDriverMixin(object):
126 125
         newports = {}
127 126
         for port in ports:
128 127
             _rules = []
129
-            _rules.extend(self._select_sg_rules_for_port(port,
130
-                                                         INGRESS_DIRECTION))
131
-            _rules.extend(self._select_sg_rules_for_port(port,
132
-                                                         EGRESS_DIRECTION))
128
+            _rules.extend(self._select_sg_rules_for_port(
129
+                port, constants.INGRESS_DIRECTION))
130
+            _rules.extend(self._select_sg_rules_for_port(
131
+                port, constants.EGRESS_DIRECTION))
133 132
             newports[port['id']] = _rules
134 133
         return newports
135 134
 

Loading…
Cancel
Save