2 * Copyright (C) 2014 Red Hat, Inc.
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 * Authors : Madhu Venugopal
10 package org.opendaylight.ovs.nx.ofjava;
11 import org.opendaylight.openflowjava.nx.api.NiciraExtensionCodecRegistrator;
12 import org.opendaylight.ovs.nx.ofjava.codec.action.NiciraActionCodecs;
13 import org.opendaylight.ovs.nx.ofjava.codec.action.ResubmitCodec;
14 import org.opendaylight.ovs.nx.ofjava.codec.action.SetNsiCodec;
15 import org.opendaylight.ovs.nx.ofjava.codec.action.SetNspCodec;
16 import org.opendaylight.ovs.nx.ofjava.codec.match.NiciraMatchCodecs;
17 import org.opendaylight.ovs.nx.ofjava.codec.match.NspCodec;
19 import com.google.common.base.Preconditions;
21 public class NiciraExtensionsRegistrator implements AutoCloseable {
23 private final NiciraExtensionCodecRegistrator registrator;
24 public NiciraExtensionsRegistrator(NiciraExtensionCodecRegistrator registrator) {
25 Preconditions.checkNotNull(registrator);
26 this.registrator = registrator;
29 public void registerNiciraExtensions() {
30 registrator.registerActionDeserializer(ResubmitCodec.RESUBMIT_DESERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC);
31 registrator.registerActionDeserializer(ResubmitCodec.RESUBMIT_TABLE_DESERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC);
32 registrator.registerActionSerializer(ResubmitCodec.SERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC);
34 registrator.registerActionDeserializer(SetNspCodec.DESERIALIZER_KEY, NiciraActionCodecs.SET_NSP_CODEC);
35 registrator.registerActionSerializer(SetNspCodec.SERIALIZER_KEY, NiciraActionCodecs.SET_NSP_CODEC);
37 registrator.registerActionDeserializer(SetNsiCodec.DESERIALIZER_KEY, NiciraActionCodecs.SET_NSI_CODEC);
38 registrator.registerActionSerializer(SetNsiCodec.SERIALIZER_KEY, NiciraActionCodecs.SET_NSI_CODEC);
40 registrator.registerMatchEntrySerializer(NspCodec.SERIALIZER_KEY, NiciraMatchCodecs.NSP_CODEC);
41 registrator.registerMatchEntryDeserializer(NspCodec.DESERIALIZER_KEY, NiciraMatchCodecs.NSP_CODEC);
44 public void unregisterExtensions() {
45 registrator.unregisterActionDeserializer(ResubmitCodec.RESUBMIT_DESERIALIZER_KEY);
46 registrator.unregisterActionDeserializer(ResubmitCodec.RESUBMIT_TABLE_DESERIALIZER_KEY);
47 registrator.unregisterActionSerializer(ResubmitCodec.SERIALIZER_KEY);
48 registrator.unregisterActionDeserializer(SetNsiCodec.DESERIALIZER_KEY);
49 registrator.unregisterActionSerializer(SetNsiCodec.SERIALIZER_KEY);
50 registrator.unregisterActionDeserializer(SetNspCodec.DESERIALIZER_KEY);
51 registrator.unregisterActionSerializer(SetNspCodec.SERIALIZER_KEY);
53 registrator.unregisterMatchEntrySerializer(NspCodec.SERIALIZER_KEY);
54 registrator.unregisterMatchEntryDeserializer(NspCodec.DESERIALIZER_KEY);
58 public void close() throws Exception {
59 unregisterExtensions();