Move definitions of classifiers and actions to
[groupbasedpolicy.git] / neutron-mapper / src / main / java / org / opendaylight / groupbasedpolicy / neutron / mapper / mapping / rule / SecRuleEntityDecoder.java
old mode 100644 (file)
new mode 100755 (executable)
index 08a54b4..1e0b2b4
@@ -18,8 +18,9 @@ import javax.annotation.Nullable;
 import org.opendaylight.groupbasedpolicy.neutron.mapper.util.NeutronUtils;\r
 import org.opendaylight.groupbasedpolicy.neutron.mapper.util.Utils;\r
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.EtherTypeClassifier;\r
-import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.IpProtoClassifier;\r
-import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.L4Classifier;\r
+import org.opendaylight.groupbasedpolicy.sf.classifiers.EtherTypeClassifierDefinition;\r
+import org.opendaylight.groupbasedpolicy.sf.classifiers.IpProtoClassifierDefinition;\r
+import org.opendaylight.groupbasedpolicy.sf.classifiers.L4ClassifierDefinition;\r
 import org.opendaylight.neutron.spi.NeutronSecurityRule;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierName;\r
@@ -84,13 +85,13 @@ public class SecRuleEntityDecoder {
         Integer portMin = secRule.getSecurityRulePortMin();\r
         Integer portMax = secRule.getSecurityRulePortMax();\r
         if (portMin != null && portMax != null) {\r
-            classifierBuilder.setClassifierDefinitionId(L4Classifier.DEFINITION.getId());\r
+            classifierBuilder.setClassifierDefinitionId(L4ClassifierDefinition.DEFINITION.getId());\r
             if (portMin.equals(portMax)) {\r
-                params.add(new ParameterValueBuilder().setName(new ParameterName(L4Classifier.DST_PORT_PARAM))\r
+                params.add(new ParameterValueBuilder().setName(new ParameterName(L4ClassifierDefinition.DST_PORT_PARAM))\r
                     .setIntValue(portMin.longValue())\r
                     .build());\r
             } else {\r
-                params.add(new ParameterValueBuilder().setName(new ParameterName(L4Classifier.DST_PORT_RANGE_PARAM))\r
+                params.add(new ParameterValueBuilder().setName(new ParameterName(L4ClassifierDefinition.DST_PORT_RANGE_PARAM))\r
                     .setRangeValue(\r
                             new RangeValueBuilder().setMin(portMin.longValue()).setMax(portMax.longValue()).build())\r
                     .build());\r
@@ -99,18 +100,18 @@ public class SecRuleEntityDecoder {
         Long protocol = getProtocol(secRule);\r
         if (protocol != null) {\r
             if (classifierBuilder.getClassifierDefinitionId() == null) {\r
-                classifierBuilder.setClassifierDefinitionId(IpProtoClassifier.DEFINITION.getId());\r
+                classifierBuilder.setClassifierDefinitionId(IpProtoClassifierDefinition.DEFINITION.getId());\r
             }\r
-            params.add(new ParameterValueBuilder().setName(new ParameterName(IpProtoClassifier.PROTO_PARAM))\r
+            params.add(new ParameterValueBuilder().setName(new ParameterName(IpProtoClassifierDefinition.PROTO_PARAM))\r
                 .setIntValue(protocol)\r
                 .build());\r
         }\r
         Long ethertype = getEtherType(secRule);\r
         if (ethertype != null) {\r
             if (classifierBuilder.getClassifierDefinitionId() == null) {\r
-                classifierBuilder.setClassifierDefinitionId(EtherTypeClassifier.DEFINITION.getId());\r
+                classifierBuilder.setClassifierDefinitionId(EtherTypeClassifierDefinition.DEFINITION.getId());\r
             }\r
-            params.add(new ParameterValueBuilder().setName(new ParameterName(EtherTypeClassifier.ETHERTYPE_PARAM))\r
+            params.add(new ParameterValueBuilder().setName(new ParameterName(EtherTypeClassifierDefinition.ETHERTYPE_PARAM))\r
                 .setIntValue(ethertype)\r
                 .build());\r
         }\r
@@ -214,8 +215,8 @@ public class SecRuleEntityDecoder {
     /**\r
      * @param secRule\r
      * @return {@code null} if {@link NeutronSecurityRule#getSecurityRuleEthertype()} is null or\r
-     *         empty; value of {@link EtherTypeClassifier#IPv4_VALUE} or\r
-     *         {@link EtherTypeClassifier#IPv6_VALUE}\r
+     *         empty; value of {@link EtherTypeClassifierDefinition#IPv4_VALUE} or\r
+     *         {@link EtherTypeClassifierDefinition#IPv6_VALUE}\r
      * @throws IllegalArgumentException if return value of\r
      *         {@link NeutronSecurityRule#getSecurityRuleEthertype()} is not empty/null and is other\r
      *         than "IPv4" or "IPv6"\r
@@ -226,10 +227,10 @@ public class SecRuleEntityDecoder {
             return null;\r
         }\r
         if (NeutronUtils.IPv4.equals(ethertype)) {\r
-            return EtherTypeClassifier.IPv4_VALUE;\r
+            return EtherTypeClassifierDefinition.IPv4_VALUE;\r
         }\r
         if (NeutronUtils.IPv6.equals(ethertype)) {\r
-            return EtherTypeClassifier.IPv6_VALUE;\r
+            return EtherTypeClassifierDefinition.IPv6_VALUE;\r
         }\r
         throw new IllegalArgumentException("Ethertype " + ethertype + " is not supported.");\r
     }\r
@@ -248,15 +249,14 @@ public class SecRuleEntityDecoder {
             return null;\r
         }\r
         if (NeutronUtils.TCP.equals(protocol)) {\r
-            return IpProtoClassifier.TCP_VALUE;\r
+            return IpProtoClassifierDefinition.TCP_VALUE;\r
         }\r
         if (NeutronUtils.UDP.equals(protocol)) {\r
-            return IpProtoClassifier.UDP_VALUE;\r
+            return IpProtoClassifierDefinition.UDP_VALUE;\r
         }\r
         if (NeutronUtils.ICMP.equals(protocol)) {\r
-            return IpProtoClassifier.ICMP_VALUE;\r
+            return IpProtoClassifierDefinition.ICMP_VALUE;\r
         }\r
         throw new IllegalArgumentException("Protocol " + protocol + " is not supported.");\r
     }\r
-\r
 }\r