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
8 package org.opendaylight.openflowjava.util;
10 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdMeterSubTypeSerializerKey;
11 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey;
12 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeSerializerKey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterMeterBandSubType;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
17 import org.opendaylight.yangtools.yang.common.Uint32;
18 import org.opendaylight.yangtools.yang.common.Uint8;
21 * Factory for creating experimenter serializer keys.
23 * @author michal.polkorab
25 public abstract class ExperimenterSerializerKeyFactory {
28 * Creates an experimenter message serializer key.
30 * @param msgVersion openflow wire version
31 * @param experimenterId experimenter / vendor ID
32 * @param type experimenter type according to vendor implementation
33 * @return key instance
35 public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createExperimenterMessageSerializerKey(
36 final Uint8 msgVersion, final Uint32 experimenterId, final long type) {
37 return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
41 * Creates a multi-part request serializer key.
43 * @param msgVersion openflow wire version
44 * @param experimenterId experimenter / vendor ID
45 * @param type experimenter type according to vendor implementation
46 * @return key instance
48 public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createMultipartRequestSerializerKey(
49 final Uint8 msgVersion, final Uint32 experimenterId, final long type) {
50 return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
54 * Creates a multi-part request TF serializer key.
56 * @param msgVersion openflow wire version
57 * @param experimenterId experimenter / vendor ID
58 * @return key instance
60 public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(
61 final Uint8 msgVersion, final Uint32 experimenterId) {
62 return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);
66 * Creates a meter band serializer key.
68 * @param msgVersion openflow wire version
69 * @param experimenterId experimenter / vendor ID
70 * @return key instance
72 public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
73 final Uint8 msgVersion, final Uint32 experimenterId) {
74 return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId,
75 MeterBandExperimenterCase.class, null);
78 public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
79 final Uint8 msgVersion, final Uint32 experimenterId,
80 final ExperimenterMeterBandSubType meterSubType) {
81 return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId,
82 MeterBandExperimenterCase.class, meterSubType);