L4 classifier for VPP renderer
[groupbasedpolicy.git] / renderers / vpp / src / main / java / org / opendaylight / groupbasedpolicy / renderer / vpp / sf / Classifier.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.groupbasedpolicy.renderer.vpp.sf;
10
11 import java.util.List;
12 import java.util.Map;
13
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierDefinitionId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinition;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.instance.ParameterValue;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.capabilities.supported.classifier.definition.SupportedParameterValues;
18
19 /**
20  * Represent a classifier definition.
21  */
22 public abstract class Classifier {
23
24     protected final Classifier parent;
25
26     public static final EtherTypeClassifier ETHER_TYPE_CL = new EtherTypeClassifier(null);
27     public static final IpProtoClassifier IP_PROTO_CL = new IpProtoClassifier(ETHER_TYPE_CL);
28     public static final L4Classifier L4_CL = new L4Classifier(IP_PROTO_CL);
29
30     protected Classifier(Classifier parent) {
31         this.parent = parent;
32     }
33
34     /**
35      * Get the classifier definition id for this classifier.
36      *
37      * @return the {@link ClassifierDefinitionId} for this classifier
38      */
39     public abstract ClassifierDefinitionId getId();
40
41     /**
42      * Get the classifier definition for this classifier.
43      *
44      * @return the {@link ClassifierDefinition} for this classifier
45      */
46     public abstract ClassifierDefinition getClassifierDefinition();
47
48     /**
49      * Get parent for this classifier.
50      *
51      * @return parent classifier, see {@link Classifier}
52      */
53     public final Classifier getParent() {
54         return parent;
55     }
56
57     /**
58      * The result represents supported parameters for the classifier by renderer.
59      *
60      * @return list of supported parameters by the classifier
61      */
62     public abstract List<SupportedParameterValues> getSupportedParameterValues();
63
64     /**
65      * Checks presence of required {@code params} in order to decide if classifier can update
66      * {@code matches} properly.
67      *
68      * @param params inserted parameters, not null
69      * @throws IllegalArgumentException when any of required {@code params} is not present
70      */
71     protected abstract void checkPresenceOfRequiredParams(Map<String, ParameterValue> params);
72
73 }