Fixes Bug 6909
[netvirt.git] / vpnservice / aclservice / impl / src / main / java / org / opendaylight / netvirt / aclservice / utils / AclConstants.java
index f91e73a85b93db45c3aa2f94b5a18d40f1260016..240a2cac1e6b26e8a774af1726728d641eb688b4 100644 (file)
@@ -9,6 +9,9 @@
 package org.opendaylight.netvirt.aclservice.utils;
 
 import java.math.BigInteger;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 import org.opendaylight.ovsdb.utils.config.ConfigProperties;
 
 /**
@@ -23,6 +26,7 @@ public final class AclConstants {
     public static final Integer PROTO_IPV6_ALLOWED_PRIORITY = 63010;
     public static final Integer PROTO_DHCP_SERVER_MATCH_PRIORITY = 63010;
     public static final Integer PROTO_DHCP_CLIENT_TRAFFIC_MATCH_PRIORITY = 63010;
+    public static final Integer PROTO_ARP_TRAFFIC_MATCH_PRIORITY = 63010;
     public static final Integer PROTO_MATCH_PRIORITY = 61010;
     public static final Integer PREFIX_MATCH_PRIORITY = 61009;
     public static final Integer PROTO_PREFIX_MATCH_PRIORITY = 61008;
@@ -60,6 +64,8 @@ public final class AclConstants {
     public static final long TCP_FLAG_SYN = 1 << 1;
     public static final long TCP_FLAG_ACK = 1 << 4;
     public static final long TCP_FLAG_SYN_ACK = TCP_FLAG_SYN + TCP_FLAG_ACK;
+    public static final int ALL_LAYER4_PORT = 65535;
+    public static final int ALL_LAYER4_PORT_MASK = 0x0000;
 
     public static final int ICMPV6_TYPE_MLD_QUERY = 130;
     public static final int ICMPV6_TYPE_RS = 133;
@@ -68,11 +74,33 @@ public final class AclConstants {
     public static final int ICMPV6_TYPE_NA = 136;
     public static final int ICMPV6_TYPE_MLD2_REPORT = 143;
 
+    public static final BigInteger METADATA_MASK_LEARN_FLAG = new BigInteger("FFFFFFFFFFFFFFFE", 16);
+
+    public static final String SECURITY_GROUP_TCP_IDLE_TO_KEY = "security-group-tcp-idle-timeout";
+    public static final String SECURITY_GROUP_TCP_HARD_TO_KEY = "security-group-tcp-hard-timeout";
+    public static final String SECURITY_GROUP_TCP_FIN_IDLE_TO_KEY = "security-group-tcp-fin-idle-timeout";
+    public static final String SECURITY_GROUP_TCP_FIN_HARD_TO_KEY = "security-group-tcp-fin-hard-timeout";
+    public static final String SECURITY_GROUP_UDP_IDLE_TO_KEY = "security-group-udp-idle-timeout";
+    public static final String SECURITY_GROUP_UDP_HARD_TO_KEY = "security-group-udp-hard-timeout";
+
+    public static final String LEARN_MATCH_REG_VALUE = "1";
+
     private AclConstants() {
     }
 
-    public static boolean isStatelessAcl() {
-        final String enabledPropertyStr = ConfigProperties.getProperty(AclConstants.class, "stateless.sg.enabled");
-        return enabledPropertyStr != null && enabledPropertyStr.equalsIgnoreCase("yes");
+    private static Map<String, Object> globalConf = Collections.synchronizedMap(new HashMap<>());
+
+    public static String getGlobalConf(String key, String defaultValue) {
+        String ret = defaultValue;
+        String value = (String)globalConf.get(key);
+        if (value == null) {
+            String propertyStr = ConfigProperties.getProperty(AclConstants.class, key);
+            if (propertyStr != null) {
+                ret = propertyStr;
+            }
+            globalConf.put(key, ret);
+        }
+        return ret;
     }
+
 }