Browse Source

use EGRESS_DIRECTION and INGRESS_DIRECTION from neutron-lib

The EGRESS_DIRECTION and INGRESS_DIRECTION constants live in neutron-lib
now and neutron is going to consume them in
I1b81f5c3de9e6f2c0967c2db23ddb716ee7ec6b9

This patch switches the code over to use neutron-lib's version of the
constants.

Change-Id: Idfd0fd9db6b4ebcf819664513ad98058e7124758
Boden R 1 year ago
parent
commit
361520779d
1 changed files with 4 additions and 7 deletions
  1. 4
    7
      networking_vsphere/drivers/ovs_firewall.py

+ 4
- 7
networking_vsphere/drivers/ovs_firewall.py View File

@@ -40,9 +40,6 @@ PROTOCOLS = {constants.PROTO_NAME_TCP: constants.PROTO_NAME_TCP,
40 40
 ETHERTYPE = {constants.IPv4: "ip",
41 41
              constants.IPv6: "ipv6"}
42 42
 
43
-INGRESS_DIRECTION = 'ingress'
44
-EGRESS_DIRECTION = 'egress'
45
-
46 43
 sg_conf = cfg.CONF.SECURITYGROUP
47 44
 
48 45
 PORT_KEYS = ['security_group_source_groups',
@@ -443,7 +440,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
443 440
 
444 441
     def _do_flows_action_on_sec_br(self, sec_br, port, flow,
445 442
                                    direction, flows_action):
446
-        if direction == EGRESS_DIRECTION:
443
+        if direction == constants.EGRESS_DIRECTION:
447 444
             for ip in port['fixed_ips']:
448 445
                 if flows_action == 'add':
449 446
                     sec_br.add_flow(priority=ovsvapp_const.SG_DEFAULT_PRI,
@@ -477,7 +474,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
477 474
                     if flow.get('cookie'):
478 475
                         del flow['cookie']
479 476
                     sec_br.delete_flows(**flow)
480
-        elif direction == INGRESS_DIRECTION:
477
+        elif direction == constants.INGRESS_DIRECTION:
481 478
                 flow['table'] = ovsvapp_const.SG_DEFAULT_TABLE_ID
482 479
                 if flows_action == 'add':
483 480
                     LOG.debug("OVSF adding flow: %s", flow)
@@ -569,11 +566,11 @@ class OVSFirewallDriver(firewall.FirewallDriver):
569 566
             if len(protocols) > 1:
570 567
                 flow["nw_proto"] = protocols[1]
571 568
             # set source and destination params and action for the flow.
572
-            if direction == INGRESS_DIRECTION:
569
+            if direction == constants.INGRESS_DIRECTION:
573 570
                 flow["dl_dst"] = port["mac_address"]
574 571
                 flow["in_port"] = self.patch_ofport
575 572
                 action = ingress_action
576
-            elif direction == EGRESS_DIRECTION:
573
+            elif direction == constants.EGRESS_DIRECTION:
577 574
                 flow["dl_src"] = port["mac_address"]
578 575
                 flow["in_port"] = self.phy_ofport
579 576
                 action = egress_action

Loading…
Cancel
Save