2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
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
9 package org.opendaylight.openflowjava.util;
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;
20 * Factory for creating experimenter serializer keys.
22 * @author michal.polkorab
24 public abstract class ExperimenterSerializerKeyFactory {
27 * Creates an experimenter message serializer key.
29 * @param msgVersion openflow wire version
30 * @param experimenterId experimenter / vendor ID
31 * @param type experimenter type according to vendor implementation
32 * @return key instance
34 public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createExperimenterMessageSerializerKey(
35 short msgVersion, long experimenterId, long type) {
36 return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
40 * Creates a multi-part request serializer key.
42 * @param msgVersion openflow wire version
43 * @param experimenterId experimenter / vendor ID
44 * @param type experimenter type according to vendor implementation
45 * @return key instance
47 public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createMultipartRequestSerializerKey(
48 short msgVersion, long experimenterId, long type) {
49 return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
53 * Creates a multi-part request TF serializer key.
55 * @param msgVersion openflow wire version
56 * @param experimenterId experimenter / vendor ID
57 * @return key instance
59 public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(
60 short msgVersion, long experimenterId) {
61 return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);
65 * Creates a meter band serializer key.
67 * @param msgVersion openflow wire version
68 * @param experimenterId experimenter / vendor ID
69 * @return key instance
71 public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
72 short msgVersion, long experimenterId) {
73 return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId,
74 MeterBandExperimenterCase.class, null);
77 public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
78 short msgVersion, long experimenterId, Class<? extends ExperimenterMeterBandSubType> meterSubType) {
79 return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId,
80 MeterBandExperimenterCase.class, meterSubType);