Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / InstructionsInitializer.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 package org.opendaylight.openflowjava.protocol.impl.serialization;
9
10 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
11 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
12 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ApplyActionsInstructionSerializer;
13 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ClearActionsInstructionSerializer;
14 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.GoToTableInstructionSerializer;
15 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.MeterInstructionSerializer;
16 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteActionsInstructionSerializer;
17 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteMetadataInstructionSerializer;
18 import org.opendaylight.openflowjava.protocol.impl.util.InstructionSerializerRegistryHelper;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCase;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase;
25
26 /**
27  * Initializes serializer registry with instruction serializers.
28  *
29  * @author michal.polkorab
30  */
31 public final class InstructionsInitializer {
32     private InstructionsInitializer() {
33         throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
34     }
35
36     /**
37      * Registers instruction serializers into provided registry.
38      *
39      * @param serializerRegistry registry to be initialized with instruction serializers
40      */
41     public static void registerInstructionSerializers(final SerializerRegistry serializerRegistry) {
42         // register OF v1.3 instruction serializers
43         InstructionSerializerRegistryHelper helper = new InstructionSerializerRegistryHelper(
44                 EncodeConstants.OF_VERSION_1_3, serializerRegistry);
45         helper.registerSerializer(GotoTableCase.class, new GoToTableInstructionSerializer());
46         helper.registerSerializer(WriteMetadataCase.class, new WriteMetadataInstructionSerializer());
47         helper.registerSerializer(WriteActionsCase.class, new WriteActionsInstructionSerializer());
48         helper.registerSerializer(ApplyActionsCase.class, new ApplyActionsInstructionSerializer());
49         helper.registerSerializer(ClearActionsCase.class, new ClearActionsInstructionSerializer());
50         helper.registerSerializer(MeterCase.class, new MeterInstructionSerializer());
51     }
52 }