Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / InstructionDeserializerInitializer.java
1 /*
2  * Copyright (c) 2013 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.protocol.impl.deserialization;
10
11 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
12 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
13 import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ApplyActionsInstructionDeserializer;
14 import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ClearActionsInstructionDeserializer;
15 import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.GoToTableInstructionDeserializer;
16 import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.MeterInstructionDeserializer;
17 import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteActionsInstructionDeserializer;
18 import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteMetadataInstructionDeserializer;
19 import org.opendaylight.openflowjava.protocol.impl.util.InstructionDeserializerRegistryHelper;
20
21 /**
22  * Utilities for registering nstruction deserializer initializers.
23  *
24  * @author michal.polkorab
25  */
26 public final class InstructionDeserializerInitializer {
27
28     private InstructionDeserializerInitializer() {
29         throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
30     }
31
32     /**
33      * Registers instruction deserializers.
34      *
35      * @param registry registry to be filled with deserializers
36      */
37     public static void registerDeserializers(final DeserializerRegistry registry) {
38         // register OF v1.3 instruction deserializers
39         InstructionDeserializerRegistryHelper helper =
40                 new InstructionDeserializerRegistryHelper(EncodeConstants.OF_VERSION_1_3, registry);
41         helper.registerDeserializer(1, new GoToTableInstructionDeserializer());
42         helper.registerDeserializer(2, new WriteMetadataInstructionDeserializer());
43         helper.registerDeserializer(3, new WriteActionsInstructionDeserializer());
44         helper.registerDeserializer(4, new ApplyActionsInstructionDeserializer());
45         helper.registerDeserializer(5, new ClearActionsInstructionDeserializer());
46         helper.registerDeserializer(6, new MeterInstructionDeserializer());
47     }
48 }