Bug 6674 - the key of the serialization function registered by the vendor is not...
[openflowjava.git] / openflowjava-util / src / main / java / org / opendaylight / openflowjava / util / ExperimenterSerializerKeyFactory.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. 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.openflowjava.util;
10
11 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdMeterSubTypeSerializerKey;
12 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey;
13 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeSerializerKey;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterMeterBandSubType;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
18
19 /**
20  * @author michal.polkorab
21  *
22  */
23 public abstract class ExperimenterSerializerKeyFactory {
24
25     /**
26      * @param msgVersion openflow wire version
27      * @param experimenterId experimenter / vendor ID
28      * @param type experimenter type according to vendor implementation
29      * @return key instance
30      */
31     public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createExperimenterMessageSerializerKey(
32             short msgVersion, long experimenterId, long type) {
33         return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
34     }
35
36     /**
37      * @param msgVersion openflow wire version
38      * @param experimenterId experimenter / vendor ID
39      * @param type experimenter type according to vendor implementation
40      * @return key instance
41      */
42     public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createMultipartRequestSerializerKey(
43             short msgVersion, long experimenterId, long type) {
44         return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
45     }
46
47     /**
48      * @param msgVersion openflow wire version
49      * @param experimenterId experimenter / vendor ID
50      * @return key instance
51      */
52     public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(
53             short msgVersion, long experimenterId) {
54         return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);
55     }
56
57     /**
58      * @param msgVersion openflow wire version
59      * @param experimenterId experimenter / vendor ID
60      * @return key instance
61      */
62     public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
63             short msgVersion, long experimenterId) {
64         return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId, MeterBandExperimenterCase.class, null);
65     }
66
67     public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
68             short msgVersion, long experimenterId, Class<? extends ExperimenterMeterBandSubType> meterSubType) {
69         return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId, MeterBandExperimenterCase.class, meterSubType);
70     }
71 }