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>
<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>
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;
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;
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
}
}
else {
- Action act = SubjectFeatures.getAction(AllowAction.ID);
+ Action act = SubjectFeatures.getAction(AllowAction.DEFINITION.getId());
abl = act.updateAction(abl, new HashMap<String,Object>(), 0);
}
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));
* 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() {
@Override
public ActionDefinition getActionDef() {
- return DEF;
+ return DEFINITION;
}
@Override
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.");
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;
}
/*
* 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
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;
*/
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)
@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.");
}
@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) {
/*
* 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
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;
*/
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)
@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.");
}
@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) {
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;
}
/*
* 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
*/
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()))
@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());
}
}
}
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<>();
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.");
} 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);
}
@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);
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
.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))
.build()))
.build()));
}
-
+
protected EndpointBuilder baseEP() {
return new EndpointBuilder()
.setL2Context(bd)
.setMacAddress(new MacAddress("00:00:00:00:00:02"))
.addAugmentation(OfOverlayContext.class, ofc);
}
-
+
}
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());
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()));
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()));
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);
@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);
@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");
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()));
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()));
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);
@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);
@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");
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();
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();
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<>();
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();
.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) {
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<>();
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();
.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) {
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<>();
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);
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);
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);
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);
.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);
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);
@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");
@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");
@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");
@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");