Exported package for classifier-definitions and action-definitions 20/17820/1
authorMartin Sunal <msunal@cisco.com>
Mon, 6 Apr 2015 23:25:20 +0000 (01:25 +0200)
committerMartin Sunal <msunal@cisco.com>
Tue, 7 Apr 2015 00:37:50 +0000 (02:37 +0200)
This allows to use classes from this package in other bundles.
Added javadoc comments. Corrected visibility of class members on API.

Signed-off-by: Martin Sunal <msunal@cisco.com>
14 files changed:
renderers/ofoverlay/pom.xml
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/PolicyEnforcer.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/AllowAction.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/ClassificationResult.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/EtherTypeClassifier.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/IpProtoClassifier.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/L4Classifier.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/ParamDerivator.java
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/SubjectFeatures.java
renderers/ofoverlay/src/test/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/OfTableTest.java
renderers/ofoverlay/src/test/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/ClassifierTest.java
renderers/ofoverlay/src/test/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/EtherTypeClassifierTest.java
renderers/ofoverlay/src/test/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/IpProtoClassifierTest.java
renderers/ofoverlay/src/test/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/sf/L4ClassifierTest.java

index 6b4df61c642d67c3e5337644c1f1c7e8e312a6e3..a1cf6576a2683c5ea187c46b9dbc63ed437a10a0 100644 (file)
         <configuration>
           <instructions>
             <Import-Package>
-             org.apache.http.*;version="4.3.2",
-            *;resolution:=optional
+              org.apache.http.*;version="4.3.2",
+              *;resolution:=optional
             </Import-Package>
             <Embed-Dependency>httpclient,httpcore,commons-lang,commons-exec;type=!pom;inline=false</Embed-Dependency>
             <Export-Package>
-           </Export-Package>
+              org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf
+            </Export-Package>
           </instructions>
           <manifestLocation>${project.basedir}/META-INF</manifestLocation>
         </configuration>
index 2ecfd5ebc7155557a0d65fe1a85bee384253f416..9555a18449c2d748efb6a4251203bdd72ea50c32 100644 (file)
@@ -8,6 +8,11 @@
 
 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow;
 
+import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.addNxRegMatch;
+import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.applyActionIns;
+import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.instructions;
+import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.nxOutputRegAction;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -23,10 +28,10 @@ import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.OfContext;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.PolicyManager.Dirty;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.RegMatch;
+import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.Action;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.AllowAction;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.ClassificationResult;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.Classifier;
-import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.Action;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.ParamDerivator;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.SubjectFeatures;
 import org.opendaylight.groupbasedpolicy.resolver.ConditionGroup;
@@ -67,8 +72,6 @@ import org.slf4j.LoggerFactory;
 import com.google.common.collect.ComparisonChain;
 import com.google.common.collect.Ordering;
 
-import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.*;
-
 /**
  * Manage the table that enforces policy on the traffic.  Traffic is denied
  * unless specifically allowed by policy
@@ -305,7 +308,7 @@ public class PolicyEnforcer extends FlowTable {
             }
         }
         else {
-            Action act = SubjectFeatures.getAction(AllowAction.ID);
+            Action act = SubjectFeatures.getAction(AllowAction.DEFINITION.getId());
             abl = act.updateAction(abl, new HashMap<String,Object>(),  0);
         }
 
@@ -386,7 +389,7 @@ public class PolicyEnforcer extends FlowTable {
                 ClassificationResult result = cfier.updateMatch(matches, flowParams);
                 if(!result.isSuccessfull()) {
                     //TODO consider different handling.
-                    throw new IllegalArgumentException(result.getMessage());
+                    throw new IllegalArgumentException(result.getErrorMessage());
                 }
                 String baseId = idb.toString();
                 FlowBuilder flow = base().setPriority(Integer.valueOf(priority));
index 87bad604888f811f93ca0cac4de2231550e0464e..8a2cc7de4e41ca2260cd31650ace1fc7f569ea6d 100644 (file)
@@ -26,19 +26,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14
  * Allow action
  */
 public class AllowAction extends Action {
-    public static final ActionDefinitionId ID =
-            new ActionDefinitionId("f942e8fd-e957-42b7-bd18-f73d11266d17");
-    protected static final String TYPE = "type";
-    protected static final ActionDefinition DEF =
-            new ActionDefinitionBuilder()
-                .setId(ID)
-                .setName(new ActionName("allow"))
-                .setDescription(new Description("Allow the specified traffic to pass"))
-                .build();
+
+    protected static final ActionDefinitionId ID = new ActionDefinitionId("f942e8fd-e957-42b7-bd18-f73d11266d17");
+    /**
+     * Access control - allow action-definition
+     */
+    public static final ActionDefinition DEFINITION = new ActionDefinitionBuilder().setId(ID)
+        .setName(new ActionName("allow"))
+        .setDescription(new Description("Allow the specified traffic to pass"))
+        .build();
 
     // How allow is implemented in the PolicyEnforcer table
-       private final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action allow = 
-                       nxOutputRegAction(NxmNxReg7.class);
+    private final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action allow = nxOutputRegAction(NxmNxReg7.class);
 
     @Override
     public ActionDefinitionId getId() {
@@ -47,7 +46,7 @@ public class AllowAction extends Action {
 
     @Override
     public ActionDefinition getActionDef() {
-        return DEF;
+        return DEFINITION;
     }
 
     @Override
index 5f38f90a621721321fb9687a545182edff3a8b7e..3c605e4377138842ff773b4e595c0847e47f4d84 100644 (file)
@@ -16,22 +16,32 @@ import com.google.common.base.Preconditions;
 
 public class ClassificationResult {
 
-    private final String message;
+    private final String errorMessage;
     private final boolean isSuccessful;
     private final List<MatchBuilder> matchBuilders;
 
+    /**
+     * @param errorMessage cannot be {@code null}
+     */
     public ClassificationResult(String errorMessage) {
-        this.message = Preconditions.checkNotNull(errorMessage);
+        this.errorMessage = Preconditions.checkNotNull(errorMessage);
         this.isSuccessful = false;
         matchBuilders = null;
     }
 
+    /**
+     * @param matches cannot be {@code null}
+     */
     public ClassificationResult(List<MatchBuilder> matches) {
-        message = "";
+        errorMessage = "";
         this.matchBuilders = Preconditions.checkNotNull(matches);
         this.isSuccessful = true;
     }
 
+    /**
+     * @return list of {@link MatchBuilder}
+     * @throws IllegalStateException if this method is called and {@link #isSuccessfull()} == {@code false}
+     */
     public List<MatchBuilder> getMatchBuilders() {
         if (isSuccessful == false) {
             throw new IllegalStateException("Classification was not successfull.");
@@ -39,10 +49,16 @@ public class ClassificationResult {
         return matchBuilders;
     }
 
-    public String getMessage() {
-        return message;
+    /**
+     * @return contains error message if {@link #isSuccessfull()} == {@code false}
+     */
+    public String getErrorMessage() {
+        return errorMessage;
     }
 
+    /**
+     * @return {@code true} if {@link ClassificationResult} contains result. {@code false} if {@link ClassificationResult} contains error message.
+     */
     public boolean isSuccessfull() {
         return isSuccessful;
     }
index 70ba21e7aadd2b77c62dea54fdaf014375a27f80..24c1b64435f577dab90d711658de38ad8ad6b714 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -16,9 +16,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.Description;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ParameterName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.ParameterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.Parameter.IsRequired;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.Parameter.Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.ParameterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinition;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinitionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.instance.ParameterValue;
@@ -34,13 +34,33 @@ import com.google.common.collect.ImmutableList;
  */
 public class EtherTypeClassifier extends Classifier {
 
-    public static final ClassifierDefinitionId ID = new ClassifierDefinitionId("6a48ab45-a462-429d-b18c-3a575b2c8bef");
-    public static final String ETHER_TYPE = "ethertype";
-    protected static final ClassifierDefinition DEF = new ClassifierDefinitionBuilder().setId(ID)
+    /**
+     * Ethertype parameter name
+     */
+    public static final String ETHERTYPE_PARAM = "ethertype";
+    /**
+     * ARP ethertype value
+     */
+    public static final Long ARP_VALUE = Long.valueOf(0x0806);
+    /**
+     * IPv4 ethertype value
+     */
+    public static final Long IPv4_VALUE = Long.valueOf(0x0800);
+    /**
+     * IPv6 ethertype value
+     */
+    public static final Long IPv6_VALUE = Long.valueOf(0x86DD);
+
+    protected static final ClassifierDefinitionId ID = new ClassifierDefinitionId(
+            "6a48ab45-a462-429d-b18c-3a575b2c8bef");
+    /**
+     * Ethertype classifier-definition
+     */
+    public static final ClassifierDefinition DEFINITION = new ClassifierDefinitionBuilder().setId(ID)
         .setName(new ClassifierName("ether_type"))
         .setDescription(new Description("Match on the ether type of the traffic"))
         .setParameter(
-                ImmutableList.of(new ParameterBuilder().setName(new ParameterName(ETHER_TYPE))
+                ImmutableList.of(new ParameterBuilder().setName(new ParameterName(ETHERTYPE_PARAM))
                     .setDescription(new Description("The ethertype to match against"))
                     .setIsRequired(IsRequired.Required)
                     .setType(Type.Int)
@@ -58,16 +78,16 @@ public class EtherTypeClassifier extends Classifier {
 
     @Override
     public ClassifierDefinition getClassDef() {
-        return DEF;
+        return DEFINITION;
     }
 
     @Override
     protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) {
-        if (params.get(ETHER_TYPE) == null) {
+        if (params.get(ETHERTYPE_PARAM) == null) {
             throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                     + "}+ Parameter ethertype not present.");
         }
-        if (params.get(ETHER_TYPE).getIntValue() == null) {
+        if (params.get(ETHERTYPE_PARAM).getIntValue() == null) {
             throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                     + "}+ Value of ethertype parameter is not present.");
         }
@@ -75,7 +95,7 @@ public class EtherTypeClassifier extends Classifier {
 
     @Override
     protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) {
-        Long type = params.get(ETHER_TYPE).getIntValue();
+        Long type = params.get(ETHERTYPE_PARAM).getIntValue();
         for (MatchBuilder match : matches) {
             EthernetMatchBuilder em;
             if (match.getEthernetMatch() != null) {
index d884cec61db5c99c635fecbdb930a58624f7412d..65d6b0b23c7394eb2501e0bbfecfb2f61893a915 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -17,9 +17,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.Description;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ParameterName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.ParameterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.Parameter.IsRequired;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.Parameter.Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definition.ParameterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinition;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinitionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.instance.ParameterValue;
@@ -32,17 +32,38 @@ import com.google.common.collect.ImmutableList;
  */
 public class IpProtoClassifier extends Classifier {
 
-    public static final Long TCP = Long.valueOf(6);
-    public static final Long UDP = Long.valueOf(17);
-    public static final Long SCTP = Long.valueOf(132);
-    public static final String PROTO = "proto";
-    public static final ClassifierDefinitionId ID = new ClassifierDefinitionId("79c6fdb2-1e1a-4832-af57-c65baf5c2335");
-    protected static final ClassifierDefinition DEF = new ClassifierDefinitionBuilder().setId(ID)
+    /**
+     * Protocol parameter name
+     */
+    public static final String PROTO_PARAM = "proto";
+    /**
+     * TCP protocol value
+     */
+    public static final Long TCP_VALUE = Long.valueOf(6);
+    /**
+     * UDP protocol value
+     */
+    public static final Long UDP_VALUE = Long.valueOf(17);
+    /**
+     * ICMP protocol value
+     */
+    public static final Long ICMP_VALUE = Long.valueOf(1);
+    /**
+     * SCTP protocol value
+     */
+    public static final Long SCTP_VALUE = Long.valueOf(132);
+
+    protected static final ClassifierDefinitionId ID = new ClassifierDefinitionId(
+            "79c6fdb2-1e1a-4832-af57-c65baf5c2335");
+    /**
+     * Protocol classifier-definition
+     */
+    public static final ClassifierDefinition DEFINITION = new ClassifierDefinitionBuilder().setId(ID)
         .setParent(EtherTypeClassifier.ID)
         .setName(new ClassifierName("ip_proto"))
         .setDescription(new Description("Match on the IP protocol of IP traffic"))
         .setParameter(
-                ImmutableList.of(new ParameterBuilder().setName(new ParameterName(PROTO))
+                ImmutableList.of(new ParameterBuilder().setName(new ParameterName(PROTO_PARAM))
                     .setDescription(new Description("The IP protocol to match against"))
                     .setIsRequired(IsRequired.Required)
                     .setType(Type.Int)
@@ -60,16 +81,16 @@ public class IpProtoClassifier extends Classifier {
 
     @Override
     public ClassifierDefinition getClassDef() {
-        return DEF;
+        return DEFINITION;
     }
 
     @Override
     protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) {
-        if (params.get(PROTO) == null) {
+        if (params.get(PROTO_PARAM) == null) {
             throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                     + "}+ Parameter proto not present.");
         }
-        if (params.get(PROTO).getIntValue() == null) {
+        if (params.get(PROTO_PARAM).getIntValue() == null) {
             throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                     + "}+ Value of proto parameter is not present.");
         }
@@ -77,7 +98,7 @@ public class IpProtoClassifier extends Classifier {
 
     @Override
     protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) {
-        Long proto = params.get(PROTO).getIntValue();
+        Long proto = params.get(PROTO_PARAM).getIntValue();
         for (MatchBuilder match : matches) {
             IpMatchBuilder imb;
             if (match.getIpMatch() != null) {
@@ -124,10 +145,10 @@ public class IpProtoClassifier extends Classifier {
         if (params == null) {
             return null;
         }
-        if (params.get(PROTO) == null) {
+        if (params.get(PROTO_PARAM) == null) {
             return null;
         }
-        Long proto = params.get(PROTO).getIntValue();
+        Long proto = params.get(PROTO_PARAM).getIntValue();
         if (proto != null) {
             return proto;
         }
index ce15981b620d1a0872311b314540760b71925be6..87a016ab822ef43bb5f14aee2245a4e188f30adf 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -43,31 +43,47 @@ import com.google.common.collect.ImmutableList;
  */
 public class L4Classifier extends Classifier {
 
-    public static final String SPORT = "sourceport";
-    public static final String SPORT_RANGE = "sourceport_range";
-    public static final String DPORT = "destport";
-    public static final String DPORT_RANGE = "destport_range";
-    public static final ClassifierDefinitionId ID = new ClassifierDefinitionId("4250ab32-e8b8-445a-aebb-e1bd2cdd291f");
-    private static final ClassifierDefinition DEF = new ClassifierDefinitionBuilder().setId(
+    /**
+     * Source port parameter name
+     */
+    public static final String SRC_PORT_PARAM = "sourceport";
+    /**
+     * Source port range parameter name
+     */
+    public static final String SRC_PORT_RANGE_PARAM = "sourceport_range";
+    /**
+     * Destination port parameter name
+     */
+    public static final String DST_PORT_PARAM = "destport";
+    /**
+     * Destination port range parameter name
+     */
+    public static final String DST_PORT_RANGE_PARAM = "destport_range";
+
+    protected static final ClassifierDefinitionId ID = new ClassifierDefinitionId(
+            "4250ab32-e8b8-445a-aebb-e1bd2cdd291f");
+    /**
+     * Layer 4 classifier-definition
+     */
+    public static final ClassifierDefinition DEFINITION = new ClassifierDefinitionBuilder().setId(
             new ClassifierDefinitionId("4250ab32-e8b8-445a-aebb-e1bd2cdd291f"))
         .setParent(IpProtoClassifier.ID)
         .setName(new ClassifierName("l4"))
         .setDescription(new Description("Match on the port number of UDP or TCP traffic"))
         .setParameter(
                 ImmutableList.of(
-                        new ParameterBuilder().setName(new ParameterName(SPORT))
+                        new ParameterBuilder().setName(new ParameterName(SRC_PORT_PARAM))
                             .setDescription(new Description("The source port number to match against"))
                             .setType(Type.Int)
                             .build(),
-                        new ParameterBuilder().setName(new ParameterName(SPORT_RANGE))
+                        new ParameterBuilder().setName(new ParameterName(SRC_PORT_RANGE_PARAM))
                             .setDescription(new Description("The source port range to match against"))
                             .setType(Type.Range)
                             .build(),
-                        new ParameterBuilder().setName(new ParameterName(DPORT))
+                        new ParameterBuilder().setName(new ParameterName(DST_PORT_PARAM))
                             .setDescription(new Description("The destination port number to match against"))
                             .setType(Type.Int)
-                            .build(),
-                        new ParameterBuilder().setName(new ParameterName(DPORT_RANGE))
+                            .build(), new ParameterBuilder().setName(new ParameterName(DST_PORT_RANGE_PARAM))
                             .setDescription(new Description("The destination port range to match against"))
                             .setType(Type.Range)
                             .build()))
@@ -84,40 +100,40 @@ public class L4Classifier extends Classifier {
 
     @Override
     public ClassifierDefinition getClassDef() {
-        return DEF;
+        return DEFINITION;
     }
 
     @Override
     protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) {
-        if (params.get(SPORT) != null && params.get(SPORT_RANGE) != null) {
+        if (params.get(SRC_PORT_PARAM) != null && params.get(SRC_PORT_RANGE_PARAM) != null) {
             throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                     + "}+. Illegal source port parameters: 'int' and 'range' values are mutually exclusive.");
         }
-        if (params.get(DPORT) != null && params.get(DPORT_RANGE) != null) {
+        if (params.get(DST_PORT_PARAM) != null && params.get(DST_PORT_RANGE_PARAM) != null) {
             throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                     + "}+. Illegal destination port parameters: 'int' and 'range' values are mutually exclusive.");
         }
-        if (params.get(SPORT) != null) {
-            if (params.get(SPORT).getIntValue() == null) {
+        if (params.get(SRC_PORT_PARAM) != null) {
+            if (params.get(SRC_PORT_PARAM).getIntValue() == null) {
                 throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                         + "}+ Value of sourceport parameter is not present.");
             }
         }
-        if (params.get(SPORT_RANGE) != null) {
-            if (params.get(SPORT_RANGE) != null) {
-                validateRangeValue(params.get(SPORT_RANGE).getRangeValue());
+        if (params.get(SRC_PORT_RANGE_PARAM) != null) {
+            if (params.get(SRC_PORT_RANGE_PARAM) != null) {
+                validateRangeValue(params.get(SRC_PORT_RANGE_PARAM).getRangeValue());
             }
         }
 
-        if (params.get(DPORT) != null) {
-            if (params.get(DPORT).getIntValue() == null) {
+        if (params.get(DST_PORT_PARAM) != null) {
+            if (params.get(DST_PORT_PARAM).getIntValue() == null) {
                 throw new IllegalArgumentException("Classifier: {" + this.getClassDef().getName()
                         + "}+ Value of destport parameter is not present.");
             }
         }
-        if (params.get(DPORT_RANGE) != null) {
-            if (params.get(DPORT_RANGE) != null) {
-                validateRangeValue(params.get(DPORT_RANGE).getRangeValue());
+        if (params.get(DST_PORT_RANGE_PARAM) != null) {
+            if (params.get(DST_PORT_RANGE_PARAM) != null) {
+                validateRangeValue(params.get(DST_PORT_RANGE_PARAM).getRangeValue());
             }
         }
     }
@@ -139,15 +155,15 @@ public class L4Classifier extends Classifier {
     public List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) {
         Set<Long> sPorts = new HashSet<>();
         Set<Long> dPorts = new HashSet<>();
-        if (params.get(SPORT) != null) {
-            sPorts.add(params.get(SPORT).getIntValue());
-        } else if (params.get(SPORT_RANGE) != null) {
-            sPorts.addAll(createSetFromRange(params.get(SPORT_RANGE).getRangeValue()));
+        if (params.get(SRC_PORT_PARAM) != null) {
+            sPorts.add(params.get(SRC_PORT_PARAM).getIntValue());
+        } else if (params.get(SRC_PORT_RANGE_PARAM) != null) {
+            sPorts.addAll(createSetFromRange(params.get(SRC_PORT_RANGE_PARAM).getRangeValue()));
         }
-        if (params.get(DPORT) != null) {
-            dPorts.add(params.get(DPORT).getIntValue());
-        } else if (params.get(DPORT_RANGE) != null) {
-            dPorts.addAll(createSetFromRange(params.get(DPORT_RANGE).getRangeValue()));
+        if (params.get(DST_PORT_PARAM) != null) {
+            dPorts.add(params.get(DST_PORT_PARAM).getIntValue());
+        } else if (params.get(DST_PORT_RANGE_PARAM) != null) {
+            dPorts.addAll(createSetFromRange(params.get(DST_PORT_RANGE_PARAM).getRangeValue()));
         }
 
         List<MatchBuilder> newMatches = new ArrayList<>();
@@ -177,11 +193,11 @@ public class L4Classifier extends Classifier {
             throw new IllegalArgumentException("Classifier-instance " + this.getClassDef().getName()
                     + ": L4 protocol is null.");
         }
-        if (IpProtoClassifier.UDP.equals(ipProto)) {
+        if (IpProtoClassifier.UDP_VALUE.equals(ipProto)) {
             return new UdpMatchBuilder().build();
-        } else if (IpProtoClassifier.TCP.equals(ipProto)) {
+        } else if (IpProtoClassifier.TCP_VALUE.equals(ipProto)) {
             return new TcpMatchBuilder().build();
-        } else if (IpProtoClassifier.SCTP.equals(ipProto)) {
+        } else if (IpProtoClassifier.SCTP_VALUE.equals(ipProto)) {
             return new SctpMatchBuilder().build();
         }
         throw new IllegalArgumentException("Unsupported L4 protocol.");
@@ -300,8 +316,8 @@ public class L4Classifier extends Classifier {
             } catch (NullPointerException e) {
                 throw new IllegalArgumentException("Ip proto match is missing.");
             }
-            if (!IpProtoClassifier.TCP.equals(proto) && !IpProtoClassifier.UDP.equals(proto)
-                    && !IpProtoClassifier.SCTP.equals(proto)) {
+            if (!IpProtoClassifier.TCP_VALUE.equals(proto) && !IpProtoClassifier.UDP_VALUE.equals(proto)
+                    && !IpProtoClassifier.SCTP_VALUE.equals(proto)) {
                 throw new IllegalArgumentException("Unsupported proto value.\n" + "Classifier: "
                         + this.getClass().getName() + ", proto set: " + proto);
             }
index 99b60df9dfb27c2dd5a5aedcecdfd2b9823622e5..b5f66066ebe3f96c1f74db8a33f155cdf0c99272 100644 (file)
@@ -39,12 +39,12 @@ public abstract class ParamDerivator {
         @Override
         public List<Map<String, ParameterValue>> deriveParameter(Map<String, ParameterValue> params) {
 
-            if (!params.containsKey(EtherTypeClassifier.ETHER_TYPE)) {
+            if (!params.containsKey(EtherTypeClassifier.ETHERTYPE_PARAM)) {
                 Map<String, ParameterValue> ipv4Params = new HashMap<>(params);
                 Map<String, ParameterValue> ipv6Params = new HashMap<>(params);
-                ipv4Params.put(EtherTypeClassifier.ETHER_TYPE, new ParameterValueBuilder().setIntValue(FlowUtils.IPv4)
+                ipv4Params.put(EtherTypeClassifier.ETHERTYPE_PARAM, new ParameterValueBuilder().setIntValue(FlowUtils.IPv4)
                     .build());
-                ipv6Params.put(EtherTypeClassifier.ETHER_TYPE, new ParameterValueBuilder().setIntValue(FlowUtils.IPv6)
+                ipv6Params.put(EtherTypeClassifier.ETHERTYPE_PARAM, new ParameterValueBuilder().setIntValue(FlowUtils.IPv6)
                     .build());
                 List<Map<String, ParameterValue>> derivedParams = new ArrayList<>();
                 derivedParams.add(ipv4Params);
index 3840f3f8f34e3d7017ff12a5a9dc0ea4669eb017..64822f1ca78a458e7ef4c100aee7e3e4c0f6f92d 100644 (file)
@@ -47,7 +47,7 @@ public class SubjectFeatures {
             ImmutableMap.<ActionDefinitionId, Action>
                 of(AllowAction.ID, new AllowAction());
 
-    public static final List<ActionDefinition> actionDefs =
+    private static final List<ActionDefinition> actionDefs =
             ImmutableList.copyOf(Collections2.transform(actions.values(),
                 new Function<Action, ActionDefinition>() {
                     @Override
index b17756d267d6c222c34c2325ce1613054c865ebb..cd7beaf4228e99b19edda8ab621caf9dc5b3f8d4 100644 (file)
@@ -157,7 +157,7 @@ public class OfTableTest {
             .setSubjectFeatureInstances(new SubjectFeatureInstancesBuilder()
                 .setClassifierInstance(ImmutableList.of(new ClassifierInstanceBuilder()
                      .setName(new ClassifierName("tcp_80"))
-                     .setClassifierDefinitionId(L4Classifier.ID)
+                     .setClassifierDefinitionId(L4Classifier.DEFINITION.getId())
                      .setParameterValue(ImmutableList.of(new ParameterValueBuilder()
                               .setName(new ParameterName("destport"))
                               .setIntValue(Long.valueOf(80))
@@ -195,7 +195,7 @@ public class OfTableTest {
                     .build()))
                 .build()));
     }
-    
+
     protected EndpointBuilder baseEP() {
         return new EndpointBuilder()
             .setL2Context(bd)
@@ -222,5 +222,5 @@ public class OfTableTest {
             .setMacAddress(new MacAddress("00:00:00:00:00:02"))
             .addAugmentation(OfOverlayContext.class, ofc);
     }
-    
+
 }
index d9d461c17dac9ed395b403b2b9ee01545532050f..e3deebf9aa008a7df1453117f667a7070ea9d024 100644 (file)
@@ -43,10 +43,10 @@ public class ClassifierTest {
 
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHER_TYPE, FlowUtils.IPv4));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SPORT, 80));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHERTYPE_PARAM, FlowUtils.IPv4));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SRC_PORT_PARAM, 80));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         ClassificationResult result = Classifier.L4_CL.updateMatch(matches, params);
         assertEquals(true, result.isSuccessfull());
         assertEquals(3, result.getMatchBuilders().size());
index 7ccc63b3186e0bb8fb38d7125bcb9842e62c3df8..07c330cdcbcad385ddc50abc47444ea9edf16496 100644 (file)
@@ -36,7 +36,7 @@ public class EtherTypeClassifierTest {
     public void setValueTest() {
         matches.add(new MatchBuilder()
                 .setIpMatch(ClassifierTestUtils.createIpMatch(ClassifierTestUtils.TCP.shortValue())));
-        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHER_TYPE, FlowUtils.IPv4));
+        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHERTYPE_PARAM, FlowUtils.IPv4));
         matches = Classifier.ETHER_TYPE_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV4_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         assertEquals(true, ClassifierTestUtils.TCP.equals(matches.get(0).getIpMatch().getIpProtocol().longValue()));
@@ -47,7 +47,7 @@ public class EtherTypeClassifierTest {
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV6_ETH_TYPE))
                 .setIpMatch(ClassifierTestUtils.createIpMatch(ClassifierTestUtils.UDP.shortValue())));
-        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHER_TYPE, FlowUtils.IPv6));
+        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHERTYPE_PARAM, FlowUtils.IPv6));
         matches = Classifier.ETHER_TYPE_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV6_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         assertEquals(true, ClassifierTestUtils.UDP.equals(matches.get(0).getIpMatch().getIpProtocol().longValue()));
@@ -58,7 +58,7 @@ public class EtherTypeClassifierTest {
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE))
                 .setIpMatch(ClassifierTestUtils.createIpMatch(ClassifierTestUtils.SCTP.shortValue())));
-        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHER_TYPE, FlowUtils.IPv6));
+        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHERTYPE_PARAM, FlowUtils.IPv6));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Trying to override ether-type value:");
         matches = Classifier.ETHER_TYPE_CL.update(matches, params);
@@ -66,7 +66,7 @@ public class EtherTypeClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters1Test() {
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Parameter ethertype not present");
         Classifier.ETHER_TYPE_CL.checkPresenceOfRequiredParams(params);
@@ -74,7 +74,7 @@ public class EtherTypeClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters2Test() {
-        params.putAll(ImmutableMap.<String, ParameterValue> of(EtherTypeClassifier.ETHER_TYPE,
+        params.putAll(ImmutableMap.<String, ParameterValue> of(EtherTypeClassifier.ETHERTYPE_PARAM,
                 new ParameterValueBuilder().build()));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Value of ethertype parameter is not present");
index d106fd6d59efe20afe5d4e14c6b7529291c60da7..5db2da60164ac67e00c0566e9b605a927785edad 100644 (file)
@@ -36,7 +36,7 @@ public class IpProtoClassifierTest {
     public void setValueTest() {
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE)));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
         matches = Classifier.IP_PROTO_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV4_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         assertEquals(true, ClassifierTestUtils.TCP.equals(matches.get(0).getIpMatch().getIpProtocol().longValue()));
@@ -47,7 +47,7 @@ public class IpProtoClassifierTest {
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV6_ETH_TYPE))
                 .setIpMatch(ClassifierTestUtils.createIpMatch(ClassifierTestUtils.UDP.shortValue())));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.UDP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.UDP));
         matches = Classifier.IP_PROTO_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV6_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         assertEquals(true, ClassifierTestUtils.UDP.equals(matches.get(0).getIpMatch().getIpProtocol().longValue()));
@@ -58,7 +58,7 @@ public class IpProtoClassifierTest {
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE))
                 .setIpMatch(ClassifierTestUtils.createIpMatch(ClassifierTestUtils.SCTP.shortValue())));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Trying to override proto value");
         matches = Classifier.IP_PROTO_CL.update(matches, params);
@@ -66,7 +66,7 @@ public class IpProtoClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters1Test() {
-        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHER_TYPE, FlowUtils.IPv4));
+        params.putAll(ClassifierTestUtils.createIntValueParam(EtherTypeClassifier.ETHERTYPE_PARAM, FlowUtils.IPv4));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Parameter proto not present");
         Classifier.IP_PROTO_CL.checkPresenceOfRequiredParams(params);
@@ -74,7 +74,7 @@ public class IpProtoClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters2Test() {
-        params.putAll(ImmutableMap.<String, ParameterValue> of(IpProtoClassifier.PROTO,
+        params.putAll(ImmutableMap.<String, ParameterValue> of(IpProtoClassifier.PROTO_PARAM,
                 new ParameterValueBuilder().build()));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Value of proto parameter is not present");
index 08d52df0350768b01ce2135916d8d79ebd190b26..38a44c20890eb798b6618c43f8fcbd8c2f7cd923 100644 (file)
@@ -45,8 +45,8 @@ public class L4ClassifierTest {
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE)));
         Long sPort = Long.valueOf(80);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SPORT, sPort));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SRC_PORT_PARAM, sPort));
         matches = Classifier.L4_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV4_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         TcpMatch match = new TcpMatchBuilder((TcpMatch) matches.get(0).getLayer4Match()).build();
@@ -59,8 +59,8 @@ public class L4ClassifierTest {
         Long dPort = Long.valueOf(80);
         matches.add(new MatchBuilder()
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV6_ETH_TYPE)));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DPORT, dPort));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DST_PORT_PARAM, dPort));
         matches = Classifier.L4_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV6_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         TcpMatch match = new TcpMatchBuilder((TcpMatch) matches.get(0).getLayer4Match()).build();
@@ -75,9 +75,9 @@ public class L4ClassifierTest {
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
         Long srcPort = Long.valueOf(80);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SPORT, srcPort));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SRC_PORT_PARAM, srcPort));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         Classifier.L4_CL.checkPresenceOfRequiredParams(params);
         matches = Classifier.L4_CL.update(matches, params);
         Set<Long> dstPorts = new HashSet<>();
@@ -100,8 +100,8 @@ public class L4ClassifierTest {
         matches.add(new MatchBuilder()
                 .setLayer4Match(ClassifierTestUtils.createUdpDstPort(80))
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV6_ETH_TYPE)));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.UDP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DPORT, dPort));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.UDP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DST_PORT_PARAM, dPort));
         matches = Classifier.L4_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV6_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         UdpMatch match = new UdpMatchBuilder((UdpMatch) matches.get(0).getLayer4Match()).build();
@@ -116,8 +116,8 @@ public class L4ClassifierTest {
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE)));
         Long srcRangeStart = Long.valueOf(8079);
         Long srcRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.UDP));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SPORT_RANGE, srcRangeStart, srcRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.UDP));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SRC_PORT_RANGE_PARAM, srcRangeStart, srcRangeEnd));
         matches = Classifier.L4_CL.update(matches, params);
         Set<Long> srcPorts = new HashSet<>();
         for (MatchBuilder match : matches) {
@@ -143,9 +143,9 @@ public class L4ClassifierTest {
         Long dPort = Long.valueOf(80);
         Long srcRangeStart = Long.valueOf(8079);
         Long srcRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.UDP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DPORT, dPort));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SPORT_RANGE, srcRangeStart, srcRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.UDP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DST_PORT_PARAM, dPort));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SRC_PORT_RANGE_PARAM, srcRangeStart, srcRangeEnd));
         Classifier.L4_CL.checkPresenceOfRequiredParams(params);
         matches = Classifier.L4_CL.update(matches, params);
         Set<Long> srcPorts = new HashSet<>();
@@ -169,8 +169,8 @@ public class L4ClassifierTest {
         matches.add(new MatchBuilder()
                 .setLayer4Match(ClassifierTestUtils.createSctpSrcPort(sPort.intValue()))
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE)));
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.SCTP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SPORT, sPort));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.SCTP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SRC_PORT_PARAM, sPort));
         matches = Classifier.L4_CL.update(matches, params);
         assertEquals(true, ClassifierTestUtils.IPV4_ETH_TYPE.equals(matches.get(0).getEthernetMatch().getEthernetType()));
         SctpMatch match = new SctpMatchBuilder((SctpMatch) matches.get(0).getLayer4Match()).build();
@@ -185,8 +185,8 @@ public class L4ClassifierTest {
                 .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE)));
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.SCTP));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.SCTP));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         matches = Classifier.L4_CL.update(matches, params);
         Set<Long> dstPorts = new HashSet<>();
         for (MatchBuilder match : matches) {
@@ -209,9 +209,9 @@ public class L4ClassifierTest {
         Long srcRangeEnd = Long.valueOf(81);
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.SCTP));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SPORT_RANGE, srcRangeStart, srcRangeEnd));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.SCTP));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SRC_PORT_RANGE_PARAM, srcRangeStart, srcRangeEnd));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         Classifier.L4_CL.checkPresenceOfRequiredParams(params);
         matches = Classifier.L4_CL.update(matches, params);
         Set<Pair<Long, Long>> set = new HashSet<>();
@@ -235,9 +235,9 @@ public class L4ClassifierTest {
         Long srcRangeStart = Long.valueOf(8079);
         Long srcRangeEnd = Long.valueOf(8081);
         Long srcPort = Long.valueOf(80);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.SCTP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SPORT, srcPort));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SPORT_RANGE, srcRangeStart, srcRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.SCTP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.SRC_PORT_PARAM, srcPort));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.SRC_PORT_RANGE_PARAM, srcRangeStart, srcRangeEnd));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Illegal source port parameters");
         Classifier.L4_CL.checkPresenceOfRequiredParams(params);
@@ -249,9 +249,9 @@ public class L4ClassifierTest {
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
         Long dstPort = Long.valueOf(80);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.UDP));
-        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DPORT, dstPort));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.UDP));
+        params.putAll(ClassifierTestUtils.createIntValueParam(L4Classifier.DST_PORT_PARAM, dstPort));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Illegal destination port parameters");
         Classifier.L4_CL.checkPresenceOfRequiredParams(params);
@@ -262,8 +262,8 @@ public class L4ClassifierTest {
         matches.add(new MatchBuilder());
         Long dstRangeStart = Long.valueOf(8081);
         Long dstRangeEnd = Long.valueOf(8079);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.TCP));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.TCP));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Range value mismatch");
         Classifier.L4_CL.checkPresenceOfRequiredParams(params);
@@ -274,8 +274,8 @@ public class L4ClassifierTest {
         matches.add(new MatchBuilder());
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, 136));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, 136));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Unsupported L4 protocol.");
         matches = Classifier.L4_CL.update(matches, params);
@@ -287,8 +287,8 @@ public class L4ClassifierTest {
                 .setLayer4Match(ClassifierTestUtils.createSctpDstPort(80)));
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO, ClassifierTestUtils.UDP));
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifier.PROTO_PARAM, ClassifierTestUtils.UDP));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Classification conflict");
         matches = Classifier.L4_CL.update(matches, params);
@@ -299,7 +299,7 @@ public class L4ClassifierTest {
         matches.add(new MatchBuilder());
         Long dstRangeStart = Long.valueOf(8079);
         Long dstRangeEnd = Long.valueOf(8081);
-        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DPORT_RANGE, dstRangeStart, dstRangeEnd));
+        params.putAll(ClassifierTestUtils.createRangeValueParam(L4Classifier.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("L4 protocol is null.");
         matches = Classifier.L4_CL.update(matches, params);
@@ -307,7 +307,7 @@ public class L4ClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters1Test() {
-        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.SPORT,
+        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.SRC_PORT_PARAM,
                 new ParameterValueBuilder().build()));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Value of sourceport parameter is not present");
@@ -316,7 +316,7 @@ public class L4ClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters2Test() {
-        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.DPORT,
+        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.DST_PORT_PARAM,
                 new ParameterValueBuilder().build()));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Value of destport parameter is not present");
@@ -325,7 +325,7 @@ public class L4ClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters3Test() {
-        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.SPORT_RANGE,
+        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.SRC_PORT_RANGE_PARAM,
                 new ParameterValueBuilder().build()));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Range value is not present");
@@ -334,7 +334,7 @@ public class L4ClassifierTest {
 
     @Test
     public void checkPresenceOfRequiredParameters4Test() {
-        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.DPORT_RANGE,
+        params.putAll(ImmutableMap.<String, ParameterValue> of(L4Classifier.DST_PORT_RANGE_PARAM,
                 new ParameterValueBuilder().build()));
         thrown.expect(IllegalArgumentException.class);
         thrown.expectMessage("Range value is not present");