/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
- * Wrapper over augmentation and it's type in order to ease handing over and hooking of an augmentation
+ * Wrapper over augmentation and it's type in order to ease handing over and hooking of an augmentation.
+ *
* @param <E> augmentable type where wrapped augmentation belongs
*/
public class AugmentTuple<E extends Augmentable<E>> {
private final Augmentation<E> augmentationObject;
private final Class<? extends Augmentation<E>> augmentationClass;
- /**
- * @param augmentationClass
- * @param augmentationObject
- */
public AugmentTuple(Class<? extends Augmentation<E>> augmentationClass, Augmentation<E> augmentationObject) {
this.augmentationClass = augmentationClass;
this.augmentationObject = augmentationObject;
}
/**
- * @return instance of wrapped augmentation
+ * Returns the instance of wrapped augmentation.
*/
public Augmentation<E> getAugmentationObject() {
return augmentationObject;
}
/**
- * @return type of wrapped augmentation
+ * Returns the type of wrapped augmentation.
*/
public Class<? extends Augmentation<E>> getAugmentationClass() {
return augmentationClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
/**
- * Interface for bundle data injection
+ * Interface for bundle data injection.
*/
public interface BundleMessageDataInjector {
/**
- * Set xid
+ * Set xid.
+ *
* @param xid request id
*/
void setXid(long xid);
/**
- * Set node id
+ * Set node id.
+ *
* @param node node id
*/
void setNode(NodeRef node);
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey;
/**
- * lookup and register key for extension converters, basic case expects this to
- * correlate with input model type
+ * Lookup and register key for extension converters, basic case expects this to
+ * correlate with input model type.
*
* @param <T> type of key
*/
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * convert message from MD-SAL model into OFJava-API model
+ * Convert message from MD-SAL model into OFJava-API model.
*
* @param <F> input message model - MD-SAL model
* @param <T> output message model - OFJava-API
public interface ConverterMessageToOFJava<F extends ExperimenterMessageOfChoice, T extends DataContainer> {
/**
+ * Converts a message to MD-SAL model.
+ *
* @param experimenterMessageCase where is vendor's augmentation
* @return message converted to OFJava-API
*/
T convert(F experimenterMessageCase) throws ConversionException;
/**
- * @return corresponding experimenter id (vendor id)
+ * Returns the corresponding experimenter id (vendor id).
*/
ExperimenterId getExperimenterId();
/**
- * @return corresponding experimenter message type
+ * Returns the corresponding experimenter message type.
*/
long getType();
}
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * convert message from OFJava-API model into MD-SAL model
- *
+ * Convert action from OFJava-API model into MD-SAL model.
+ *
* @param <F> input message model - OFJava-API
* @param <P> represents possible paths in yang schema for augmentations
*/
public interface ConvertorActionFromOFJava<F extends DataContainer, P extends AugmentationPath> {
/**
- * @param input
+ * Convert MD-SAL model to OF action.
+ *
+ * @param input the MD-SAL container
* @param path in yang schema where a converted value has to be augmented
* @return message converted to MD-SAL and its type
*/
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * convert message from MD-SAL model into OFJava-API model
- * @param <F> input message model - MD-SAL model
+ * Convert action from MD-SAL model into OFJava-API model.
+ *
+ * @param <F> input message model - MD-SAL model
* @param <T> output message model - OFJava-API
*/
public interface ConvertorActionToOFJava<F extends Action, T extends DataContainer> {
/**
+ * Convert OF action MD-SAL model.
+ *
* @param actionCase where is vendor's augmentation
* @return message converted to OFJava-API
*/
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * convert message from OFJava-API model into MD-SAL model
- *
+ * Convert message from OFJava-API model into MD-SAL model.
+ *
* @param <F> input message model - OFJava-API
* @param <P> represents possible paths in yang schema for augmentations
*/
public interface ConvertorFromOFJava<F extends DataContainer, P extends AugmentationPath> {
/**
- * @param input
+ * Convert OF model to MD-SAL model.
+ *
+ * @param input OF model
* @param path in yang schema where a converted value has to be augmented
* @return message converted to MD-SAL and its type
*/
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * convert message from OFJava-API model into MD-SAL model
+ * Convert message from OFJava-API model into MD-SAL model.
*
* @param <F> input message model - OFJava-API
* @param <P> represents possible paths in yang schema for augmentations
public interface ConvertorMessageFromOFJava<F extends DataContainer, P extends AugmentationPath> {
/**
- * @param input
+ * Convert OF model to MD-SAL model.
+ *
+ * @param input OF model
* @param path in yang schema where a converted value has to be augmented
* @return message converted to MD-SAL and its type
*/
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * convert message from MD-SAL model into OFJava-API model
- *
+ * Convert message from MD-SAL model into OFJava-API model.
+ *
* @param <T> output message model - OFJava-API
*/
public interface ConvertorToOFJava<T extends DataContainer> {
/**
+ * Convert MD-SAL model to OF model.
+ *
* @param extension where is vendor's augmentation
* @return message converted to OFJava-API
*/
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Extension augmentation.
+ *
* @author msunal
* @param <T> type of wrapped augmentation
- *
*/
public class ExtensionAugment<T extends Augmentation<Extension>> extends AugmentTuple<Extension> {
private final Class<? extends ExtensionKey> key;
- /**
- * @param augmentationClass
- * @param augmentationObject
- */
public ExtensionAugment(Class<T> augmentationClass, T augmentationObject, Class<? extends ExtensionKey> key) {
super(augmentationClass, augmentationObject);
this.key = key;
}
/**
- * @return key which represents an extension type
+ * Returns the key which represents an extension type.
*/
public Class<? extends ExtensionKey> getKey() {
return key;
}
-
}
* Simple {@link ExtensionConverterProvider} place holder.
*/
public interface ExtensionConverterProviderKeeper {
+
/**
- * @param extensionConverterProvider here extension converters will be kept in order to be accessible by inner infrastructure
+ * Sets the ExtensionConverterProvider. Extension converters will be kept in order to be accessible by inner
+ * infrastructure.
+ *
+ * @param extensionConverterProvider the ExtensionConverterProvider
*/
void setExtensionConverterProvider(ExtensionConverterProvider extensionConverterProvider);
/**
- * @return extension converters registry access point for by inner infrastructure
+ * Returns the extension converters registry access point for by inner infrastructure.
*/
ExtensionConverterProvider getExtensionConverterProvider();
}
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * registration place for message converters provided by vendor extension
+ * Registry for message converters provided by vendor extension.
*/
public interface ExtensionConverterRegistrator {
ConvertorFromOFJava<MatchEntry, MatchPath> convertor);
/**
- * @param key action case type + ofp-version
- * @param convertor
+ * Registers an action converter.
+ *
+ * @param key action case type + ofp-version
+ * @param converter the converter
* @return closable registration
*/
- ObjectRegistration<ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>>
- registerActionConvertor(
- TypeVersionKey<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> key,
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action> convertor);
+ ObjectRegistration<ConvertorActionToOFJava<
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>>
+ registerActionConvertor(TypeVersionKey<? extends
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> key,
+ ConvertorActionToOFJava<
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action> converter);
/**
- * @param key actionSubType, action type (Experimenter), experimenterId, version
- * @param convertor
+ * Registers an action converter.
+ *
+ * @param key actionSubType, action type (Experimenter), experimenterId, version
+ * @param converter the converter
* @return closable registration
*/
ObjectRegistration<ConvertorActionFromOFJava<Action, ActionPath>> registerActionConvertor(
- ActionSerializerKey<?> key, ConvertorActionFromOFJava<Action, ActionPath> convertor);
+ ActionSerializerKey<?> key, ConvertorActionFromOFJava<Action, ActionPath> converter);
/**
- * @param key consists of: experimenter type, version
- * @param convertor TO OFJava (suitable for both: symmetric and multipart)
+ * Registers a message converter.
+ *
+ * @param key consists of: experimenter type, version
+ * @param converter TO OFJava (suitable for both: symmetric and multipart)
* @return closeable registration
*/
- <I extends ExperimenterMessageOfChoice, O extends DataContainer> ObjectRegistration<ConverterMessageToOFJava<I, O>> registerMessageConvertor(
- TypeVersionKey<I> key, ConverterMessageToOFJava<I, O> convertor);
+ <I extends ExperimenterMessageOfChoice, O extends DataContainer> ObjectRegistration<ConverterMessageToOFJava<I, O>>
+ registerMessageConvertor(TypeVersionKey<I> key, ConverterMessageToOFJava<I, O> converter);
/**
- * @param key consists of: experimenter type, version
- * @param convertor FROM OFJava (suitable for both: symmetric and multipart)
+ * Registers a message converter.
+ *
+ * @param key consists of: experimenter type, version
+ * @param converter FROM OFJava (suitable for both: symmetric and multipart)
* @return closeable registration
*/
- <I extends ExperimenterDataOfChoice> ObjectRegistration<ConvertorMessageFromOFJava<I, MessagePath>> registerMessageConvertor(
- MessageTypeKey<?> key, ConvertorMessageFromOFJava<I, MessagePath> convertor);
+ <I extends ExperimenterDataOfChoice> ObjectRegistration<ConvertorMessageFromOFJava<I, MessagePath>>
+ registerMessageConvertor(MessageTypeKey<?> key, ConvertorMessageFromOFJava<I, MessagePath> converter);
}
*/
public class GroupingLooseResolver<G> {
- private Class<G> commonInterface;
- private Set<Class<? extends Augmentation<?>>> classes;
+ private final Class<G> commonInterface;
+ private final Set<Class<? extends Augmentation<?>>> classes;
/**
+ * Constructor.
+ *
* @param commonInterface common interface
*/
public GroupingLooseResolver(Class<G> commonInterface) {
}
/**
- * Get augmentation classes
+ * Get augmentation classes.
+ *
* @return list of augmentation classes
*/
public Set<Class<? extends Augmentation<?>>> getClasses() {
}
/**
+ * Adds an augmentation class.
+ *
* @param cls equivalent augmentation class
* @return this for chaining
*/
}
/**
+ * Gets the extension for the give data.
+ *
* @param data expected to match <tt><T extends Augmentable<T>></tt>
* @return shared grouping
*/
return Optional.empty();
}
-
}
-/**
+/*
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowplugin.extension.api;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
import java.util.HashSet;
import java.util.Set;
-
import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-
/**
* Provides augmentation resolving upon given {@link Augmentable}.
* Used {@link #classes} share the same {@link Augmentable}.
* <br>
* <b>Usage:</b> in case there is {@link Augmentable} which might contain
- * multiple {@link Augmentation}s depending on origin. And those {@link Augmentation}s
+ * multiple {@link Augmentation}s depending on origin. And those {@link Augmentation}s
* are sharing the same grouping so that they could be processed in the same way.
- *
+ *
* @param <G> grouping
- * @param <T>
+ * @param <T> Augmentable
*/
public class GroupingResolver<G, T extends Augmentable<T>> {
Class<G> commonInterface;
Set<Class<? extends Augmentation<T>>> classes;
- /**
- * @param commonInterface
- */
public GroupingResolver(Class<G> commonInterface) {
this.commonInterface = commonInterface;
classes = new HashSet<>();
}
/**
+ * Adds an augmentation class.
+ *
* @param cls equivalent augmentation class
* @return this for chaining
*/
}
/**
+ * Sets the augmentation classes.
+ *
* @param clses set of equivalent augmentation classes
*/
public void setAugmentations(Set<Class<? extends Augmentation<T>>> clses) {
}
/**
- * @param data
+ * Gets the extension for the given data.
+ *
+ * @param data data
* @return shared grouping
*/
@SuppressWarnings("unchecked")
* Created by mirehak on 4/25/15.
*/
public interface OpenFlowPluginExtensionRegistratorProvider {
+
/**
- * @return the extensionConverterRegistry - here extension converters can be registered in order to support
- * vendor messages
+ * Returns the extensionConverterRegistry - here extension converters can be registered in order to support
+ * vendor messages.
*/
ExtensionConverterRegistrator getExtensionConverterRegistrator();
}
/**
- * lookup and register key for extension converters, basic case expects this to
- * correlate with input model type
+ * Lookup and register key for extension converters, basic case expects this to
+ * correlate with input model type.
*
* @param <T> type of key
*/
}
/**
- * @return key type
+ * Returns the key type.
*/
public Class<? extends T> getType() {
return type;
public String toString() {
return getClass().getSimpleName() + " [type=" + type + ", ofVersion=" + ofVersion + "]";
}
-
}
import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
/**
- * unifying interface
+ * Unifying interface.
*/
public interface ExtensionConverterManager extends ExtensionConverterProvider, ExtensionConverterRegistrator {
// see parents
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
+import org.opendaylight.openflowplugin.extension.api.ConverterMessageToOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorMessageFromOFJava;
-import org.opendaylight.openflowplugin.extension.api.ConverterMessageToOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
import org.opendaylight.openflowplugin.extension.api.path.AugmentationPath;
public interface ExtensionConverterProvider {
/**
- * lookup converter
- * @param key
+ * Lookup converter.
+ *
+ * @param key the message type key
* @return found converter
*/
<F extends DataContainer, P extends AugmentationPath> ConvertorFromOFJava<F, P> getConverter(MessageTypeKey<?> key);
/**
- * lookup converter
- * @param key
+ * Lookup converter.
+ *
+ * @param key the converter extension key
* @return found converter
*/
<T extends DataContainer> ConvertorToOFJava<T> getConverter(ConverterExtensionKey<?> key);
/**
- * @param key
+ * Lookup converter.
+ *
+ * @param key the type version key
* @return found converter
*/
<F extends Action, T extends DataContainer> ConvertorActionToOFJava<F, T> getConverter(TypeVersionKey<F> key);
/**
- * lookup converter<br>
- * TODO: this method should be compatible with {@link #getConverter(MessageTypeKey)} after matches are migrated to similar structure
- * @param key
+ * Lookup converter.
+ * TODO: this method should be compatible with {@link #getConverter(MessageTypeKey)} after matches are migrated
+ * to similar structure
+ * @param key the message type key
* @return found converter
*/
- <F extends DataContainer, P extends AugmentationPath> ConvertorActionFromOFJava<F, P> getActionConverter(MessageTypeKey<?> key);
+ <F extends DataContainer, P extends AugmentationPath> ConvertorActionFromOFJava<F, P> getActionConverter(
+ MessageTypeKey<?> key);
/**
- * lookup converter for experimenter message
+ * Lookup converter for experimenter message.
*
- * @param key
+ * @param key the type version key
* @return found converter
*/
- <F extends ExperimenterMessageOfChoice, T extends DataContainer> ConverterMessageToOFJava<F, T> getMessageConverter(TypeVersionKey<F> key);
+ <F extends ExperimenterMessageOfChoice, T extends DataContainer> ConverterMessageToOFJava<F, T> getMessageConverter(
+ TypeVersionKey<F> key);
/**
- * lookup converter for experimenter message
+ * Lookup converter for experimenter message.
*
- * @param key
+ * @param key the message type key
* @return found converter
*/
- <F extends DataContainer, P extends AugmentationPath> ConvertorMessageFromOFJava<F, P> getMessageConverter(MessageTypeKey<?> key);
+ <F extends DataContainer, P extends AugmentationPath> ConvertorMessageFromOFJava<F, P> getMessageConverter(
+ MessageTypeKey<?> key);
}
public interface ExtensionSessionManager {
/**
+ * Sets the ExtensionConverterProvider.
+ *
* @param extensionConverterProvider extension converter provider
*/
void setExtensionConverterProvider(ExtensionConverterProvider extensionConverterProvider);
/**
- * @return extensionConverterProvider
+ * Returns the ExtensionConverterProvider.
*/
ExtensionConverterProvider getExtensionConverterProvider();
-
}
package org.opendaylight.openflowplugin.extension.api.exception;
/**
- * General exception for conversion related operations
+ * General exception for conversion related operations.
*/
public class ConversionException extends Exception {
public ConversionException(String message) {
package org.opendaylight.openflowplugin.extension.api.exception;
/**
- * For case when converter is not available
+ * For case when converter is not available.
*/
public class ConverterNotFoundException extends ConversionException {
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * @author msunal
+ * Enumerates the extension action paths.
*
+ * @author msunal
*/
public enum ActionPath implements AugmentationPath {
* | | | | +--rw (action)?
* </pre>
    */
- NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION(null),
+ INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS(null),
+
/**
* openflowplugin-extension-general.yang
* <pre>
* | | | | +--rw flownode:apply-actions
* | | | | +--rw flownode:action* [order]
* | | | | +--rw (action)?
- *
+ *
* </pre>
    */
- NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION(null),
+ INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS(null),
+
/**
* openflowplugin-extension-general.yang
* <pre>
* module: opendaylight-flow-statistics
* notifications:
- * +---n flows-statistics-update
+ * +---n flows-statistics-update
* | +--ro flow-and-statistics-map-list* [flow-id]
* | | +--ro instructions
* | | | +--ro instruction* [order]
* | | | | +--ro (action)?
* </pre>
*/
- FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION(null),
+ FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS(null),
+
/**
* openflowplugin-extension-general.yang
* <pre>
* module: opendaylight-flow-statistics
* notifications:
- * +---n flows-statistics-update
+ * +---n flows-statistics-update
* | +--ro flow-and-statistics-map-list* [flow-id]
* | | +--ro instructions
* | | | +--ro instruction* [order]
* | | | | +--ro (action)?
* </pre>
*/
- FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION(null),
+ FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS(null),
+
/**
* openflowplugin-extension-general.yang
* <pre>
* module: opendaylight-group-statistics
* notifications:
- * +---n group-desc-stats-updated
+ * +---n group-desc-stats-updated
* | +--ro group-desc-stats* [group-id]
* | | +--ro buckets
* | | +--ro bucket* [bucket-id]
* | | +--ro (action)?
* </pre>
*/
- GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION(null),
+ GROUP_DESC_STATS_UPDATED_BUCKET_ACTION(null),
+
/**
* openflowplugin-extension-general.yang
* <pre>
* | | | | +--ro (action)?
* </pre>
*/
- RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION(null),
+ FLOWS_STATISTICS_RPC_WRITE_ACTIONS(null),
+
/**
* openflowplugin-extension-general.yang
* <pre>
* | | | | +--ro (action)?
* </pre>
*/
- RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION(null);
+ FLOWS_STATISTICS_RPC_APPLY_ACTIONS(null);
private final InstanceIdentifier<Extension> iid;
- private ActionPath(InstanceIdentifier<Extension> iid) {
+ ActionPath(InstanceIdentifier<Extension> iid) {
this.iid = iid;
}
public final InstanceIdentifier<Extension> getInstanceIdentifier() {
return iid;
}
-
}
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * @author msunal
+ * Interface for an extension augmentation path.
*
+ * @author msunal
*/
public interface AugmentationPath {
InstanceIdentifier<Extension> getInstanceIdentifier();
-
}
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * @author msunal
+ * Enumerates the match paths.
*
+ * @author msunal
*/
public enum MatchPath implements AugmentationPath {
/**
- * openflowplugin-extension-general.yang
+ * openflowplugin-extension-general.yang.
* <pre>
* module: sal-flow
* notifications:
* | +--ro match
* </pre>
*/
- SWITCHFLOWREMOVED_MATCH(null),
+ SWITCH_FLOW_REMOVED_MATCH(null),
+
/**
- * openflowplugin-extension-general.yang
+ * openflowplugin-extension-general.yang.
* <pre>
* module: packet-processing
* notifications:
* +--ro match
* </pre>
*/
- PACKETRECEIVED_MATCH(null),
+ PACKET_RECEIVED_MATCH(null),
+
/**
- * openflowplugin-extension-general.yang
+ * openflowplugin-extension-general.yang.
* <pre>
* module: packet-processing
* container:
* +--ro match
* </pre>
*/
- PACKETINMESSAGE_MATCH(null),
+ PACKET_IN_MESSAGE_MATCH(null),
+
/**
- * openflowplugin-extension-general.yang
+ * openflowplugin-extension-general.yang.
* <pre>
* module: opendaylight-flow-statistics
* notifications:
* | | +--ro match
* </pre>
*/
- FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH(null),
+ FLOWS_STATISTICS_UPDATE_MATCH(null),
+
/**
- * openflowplugin-extension-general.yang
+ * openflowplugin-extension-general.yang.
* <pre>
* module: opendaylight-direct-statistics
* rpc:
* | | +--ro match
* </pre>
*/
- RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH(null);
+ FLOWS_STATISTICS_RPC_MATCH(null);
private final InstanceIdentifier<Extension> iid;
- private MatchPath(InstanceIdentifier<Extension> iid) {
+ MatchPath(InstanceIdentifier<Extension> iid) {
this.iid = iid;
}
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * List of augmentation points available for experimenter symmetric message and multipart message
+ * List of augmentation points available for experimenter symmetric message and multipart message.
*/
public enum MessagePath implements AugmentationPath {
/**
* <pre>
- * module: sal-experimenter-message
+ * module: sal-experimenter-message.
* notifications:
* +---n experimenter-message-from-dev
* +--ro (experimenter-message-of-choice)?module: sal-flow
* </pre>
*/
MESSAGE_NOTIFICATION(null),
+
/**
* <pre>
- * module: sal-experimenter-mp-message
+ * module: sal-experimenter-mp-message.
* rpcs:
* +---x send-experimenter-mp-request
* +--ro output
private final InstanceIdentifier<Extension> iid;
- private MessagePath(InstanceIdentifier<Extension> iid) {
+ MessagePath(InstanceIdentifier<Extension> iid) {
this.iid = iid;
}
public final InstanceIdentifier<Extension> getInstanceIdentifier() {
return iid;
}
-
}
*/
package org.opendaylight.openflowplugin.extension.api;
-
-/**
- *
- */
public class ConverterExtensionActionKeyTest {
- /**
- * Test method for {@link org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey#equals(java.lang.Object)}.
- */
- /**
- * Test method for {@link org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey#equals(java.lang.Object)}.
- */
// @Test
// public void testEqualsObject() {
// ConverterExtensionMatchKey key1 = new ConverterExtensionMatchKey(Match.class);
*/
package org.opendaylight.openflowplugin.extension.api;
-/**
- *
- */
public class ConverterExtensionMatchKeyTest {
- /**
- * Test method for {@link org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey#equals(java.lang.Object)}.
- */
// @Test
// public void testEqualsObject() {
// ConverterExtensionActionKey key1 = new ConverterExtensionActionKey(OutputActionCase.class);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder;
/**
- * Test of {@link GroupingLooseResolver}
+ * Test of {@link GroupingLooseResolver}.
*/
public class GroupingLooseResolverTest {
@Test
public void testGetExtension() {
- GroupingLooseResolver<GeneralExtensionListGrouping> eqGroup = new GroupingLooseResolver<>(GeneralExtensionListGrouping.class);
+ GroupingLooseResolver<GeneralExtensionListGrouping> eqGroup =
+ new GroupingLooseResolver<>(GeneralExtensionListGrouping.class);
eqGroup.add(GeneralAugMatchNodesNodeTableFlow.class);
eqGroup.add(GeneralAugMatchNotifPacketIn.class);
.setExtensionList(Collections.singletonList(extension1)).build();
Match match1 = mb1.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, odlxxx1).build();
- org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder mb2 = new org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder mb2 =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
+ .rev130709.packet.received.MatchBuilder();
ExtensionList extension2 = new ExtensionListBuilder().setExtensionKey(JoachimTheTiny.class).build();
GeneralAugMatchNotifPacketIn odlxxx2 = new GeneralAugMatchNotifPacketInBuilder()
.setExtensionList(Collections.singletonList(extension2)).build();
- org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match match2 = mb2.addAugmentation(GeneralAugMatchNotifPacketIn.class, odlxxx2).build();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match match2 =
+ mb2.addAugmentation(GeneralAugMatchNotifPacketIn.class, odlxxx2).build();
- Assert.assertEquals(JoachimTheBig.class, eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
- Assert.assertEquals(JoachimTheTiny.class, eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
+ Assert.assertEquals(JoachimTheBig.class,
+ eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
+ Assert.assertEquals(JoachimTheTiny.class,
+ eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
}
private static class JoachimTheBig extends ExtensionKey {
package org.opendaylight.openflowplugin.extension.api;
import java.util.Collections;
-
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yangtools.yang.binding.Augmentable;
/**
- * Test of {@link GroupingResolver}
+ * Test of {@link GroupingResolver}.
*/
public class GroupingResolverTest {
/**
- * test of method {@link GroupingResolver#getExtension(Augmentable)}
+ * test of method {@link GroupingResolver#getExtension(Augmentable)}.
*/
@Test
public void testGetExtension() {
- GroupingResolver<GeneralExtensionListGrouping, Match> eqGroup = new GroupingResolver<>(GeneralExtensionListGrouping.class);
+ GroupingResolver<GeneralExtensionListGrouping, Match> eqGroup =
+ new GroupingResolver<>(GeneralExtensionListGrouping.class);
eqGroup.add(GeneralAugMatchNodesNodeTableFlow.class);
eqGroup.add(GeneralAugMatchRpcAddFlow.class);
MatchBuilder mb1 = new MatchBuilder();
ExtensionList extension1 = new ExtensionListBuilder().setExtensionKey(JoachimTheBig.class).build();
- GeneralAugMatchNodesNodeTableFlow odlxxx1 = new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(Collections.singletonList(extension1)).build();
+ GeneralAugMatchNodesNodeTableFlow odlxxx1 = new GeneralAugMatchNodesNodeTableFlowBuilder()
+ .setExtensionList(Collections.singletonList(extension1)).build();
Match match1 = mb1.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, odlxxx1).build();
MatchBuilder mb2 = new MatchBuilder();
ExtensionList extension2 = new ExtensionListBuilder().setExtensionKey(JoachimTheTiny.class).build();
- GeneralAugMatchNodesNodeTableFlow odlxxx2 = new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(Collections.singletonList(extension2)).build();
+ GeneralAugMatchNodesNodeTableFlow odlxxx2 = new GeneralAugMatchNodesNodeTableFlowBuilder()
+ .setExtensionList(Collections.singletonList(extension2)).build();
Match match2 = mb2.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, odlxxx2).build();
- Assert.assertEquals(JoachimTheBig.class, eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
- Assert.assertEquals(JoachimTheTiny.class, eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
+ Assert.assertEquals(JoachimTheBig.class,
+ eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
+ Assert.assertEquals(JoachimTheTiny.class,
+ eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
}
-
+
private static class JoachimTheBig extends ExtensionKey {
// nobody
}
-
+
private static class JoachimTheTiny extends ExtensionKey {
// nobody
}
public class SetFieldExtensionTest {
@Test
public void testGetExtension() {
- GroupingLooseResolver<GeneralExtensionListGrouping> eqGroup = new GroupingLooseResolver<>(GeneralExtensionListGrouping.class);
+ GroupingLooseResolver<GeneralExtensionListGrouping> eqGroup =
+ new GroupingLooseResolver<>(GeneralExtensionListGrouping.class);
eqGroup.add(GeneralAugMatchRpcAddFlowWriteActionsSetField.class);
eqGroup.add(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class);
SetFieldBuilder sb1 = new SetFieldBuilder();
ExtensionList extension1 = new ExtensionListBuilder().setExtensionKey(ZVendorExt1.class).build();
- GeneralAugMatchRpcAddFlowWriteActionsSetField odlxxx1 = new GeneralAugMatchRpcAddFlowWriteActionsSetFieldBuilder().setExtensionList(Collections.singletonList(extension1)).build();
+ GeneralAugMatchRpcAddFlowWriteActionsSetField odlxxx1 =
+ new GeneralAugMatchRpcAddFlowWriteActionsSetFieldBuilder()
+ .setExtensionList(Collections.singletonList(extension1)).build();
SetField setField1 = sb1.addAugmentation(GeneralAugMatchRpcAddFlowWriteActionsSetField.class, odlxxx1).build();
SetFieldBuilder sb2 = new SetFieldBuilder();
ExtensionList extension2 = new ExtensionListBuilder().setExtensionKey(ZVendorExt2.class).build();
- GeneralAugMatchNodesNodeTableFlowWriteActionsSetField odlxxx2 = new GeneralAugMatchNodesNodeTableFlowWriteActionsSetFieldBuilder().setExtensionList(Collections.singletonList(extension2)).build();
- SetField setField2 = sb2.addAugmentation(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class, odlxxx2).build();
+ GeneralAugMatchNodesNodeTableFlowWriteActionsSetField odlxxx2 =
+ new GeneralAugMatchNodesNodeTableFlowWriteActionsSetFieldBuilder()
+ .setExtensionList(Collections.singletonList(extension2)).build();
+ SetField setField2 = sb2.addAugmentation(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class,
+ odlxxx2).build();
- Assert.assertEquals(ZVendorExt1.class, eqGroup.getExtension(setField1).get().getExtensionList().get(0).getExtensionKey());
- Assert.assertEquals(ZVendorExt2.class, eqGroup.getExtension(setField2).get().getExtensionList().get(0).getExtensionKey());
+ Assert.assertEquals(ZVendorExt1.class,
+ eqGroup.getExtension(setField1).get().getExtensionList().get(0).getExtensionKey());
+ Assert.assertEquals(ZVendorExt2.class,
+ eqGroup.getExtension(setField2).get().getExtensionList().get(0).getExtensionKey());
}
private static class ZVendorExt1 extends ExtensionKey {
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowplugin.extension.api;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierReply;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeVersionKeyTest {\r
-\r
- /**\r
- * Tests {@link TypeVersionKey#equals(Object)} and {@link TypeVersionKey#hashCode()}\r
- */\r
- @Test\r
- public void test() {\r
- TypeVersionKey<? extends DataObject> key1 =\r
- new TypeVersionKey<>(HelloMessage.class, EncodeConstants.OF13_VERSION_ID);\r
- TypeVersionKey<? extends DataObject> key2 =\r
- new TypeVersionKey<>(HelloMessage.class, EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertTrue("Wrong equals()", key1.equals(key2));\r
- Assert.assertEquals("Wrong hashCode()", key1.hashCode(), key2.hashCode());\r
-\r
- key2 = new TypeVersionKey<>(HelloMessage.class, EncodeConstants.OF10_VERSION_ID);\r
- Assert.assertFalse("Wrong equals()", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode()", key1.hashCode() == key2.hashCode());\r
-\r
- key2 = new TypeVersionKey<>(BarrierReply.class, EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertFalse("Wrong equals()", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode()", key1.hashCode() == key2.hashCode());\r
- }\r
-}
\ No newline at end of file
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.extension.api;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierReply;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * Unit tests for TypeVersionKey.
+ *
+ * @author michal.polkorab
+ */
+public class TypeVersionKeyTest {
+
+ /**
+ * Tests {@link TypeVersionKey#equals(Object)} and {@link TypeVersionKey#hashCode()}.
+ */
+ @Test
+ public void test() {
+ TypeVersionKey<? extends DataObject> key1 =
+ new TypeVersionKey<>(HelloMessage.class, EncodeConstants.OF13_VERSION_ID);
+ TypeVersionKey<? extends DataObject> key2 =
+ new TypeVersionKey<>(HelloMessage.class, EncodeConstants.OF13_VERSION_ID);
+ Assert.assertTrue("Wrong equals()", key1.equals(key2));
+ Assert.assertEquals("Wrong hashCode()", key1.hashCode(), key2.hashCode());
+
+ key2 = new TypeVersionKey<>(HelloMessage.class, EncodeConstants.OF10_VERSION_ID);
+ Assert.assertFalse("Wrong equals()", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode()", key1.hashCode() == key2.hashCode());
+
+ key2 = new TypeVersionKey<>(BarrierReply.class, EncodeConstants.OF13_VERSION_ID);
+ Assert.assertFalse("Wrong equals()", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode()", key1.hashCode() == key2.hashCode());
+ }
+}
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira;
-import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec;
-import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4DstKey;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIPv4DstConvertor;
-
import com.google.common.base.Preconditions;
-
import java.util.HashSet;
import java.util.Set;
-
import org.opendaylight.openflowjava.nx.api.NiciraUtil;
import org.opendaylight.openflowjava.nx.codec.action.ConntrackCodec;
import org.opendaylight.openflowjava.nx.codec.action.FinTimeoutCodec;
import org.opendaylight.openflowjava.nx.codec.action.LearnCodec;
import org.opendaylight.openflowjava.nx.codec.action.MultipathCodec;
import org.opendaylight.openflowjava.nx.codec.action.OutputRegCodec;
+import org.opendaylight.openflowjava.nx.codec.action.PopNshCodec;
+import org.opendaylight.openflowjava.nx.codec.action.PushNshCodec;
import org.opendaylight.openflowjava.nx.codec.action.RegLoadCodec;
import org.opendaylight.openflowjava.nx.codec.action.RegMoveCodec;
import org.opendaylight.openflowjava.nx.codec.action.ResubmitCodec;
-import org.opendaylight.openflowjava.nx.codec.action.PushNshCodec;
-import org.opendaylight.openflowjava.nx.codec.action.PopNshCodec;
import org.opendaylight.openflowjava.nx.codec.match.ArpOpCodec;
import org.opendaylight.openflowjava.nx.codec.match.ArpShaCodec;
import org.opendaylight.openflowjava.nx.codec.match.ArpSpaCodec;
import org.opendaylight.openflowjava.nx.codec.match.ArpThaCodec;
import org.opendaylight.openflowjava.nx.codec.match.ArpTpaCodec;
-import org.opendaylight.openflowjava.nx.codec.match.InPortCodec;
import org.opendaylight.openflowjava.nx.codec.match.CtMarkCodec;
import org.opendaylight.openflowjava.nx.codec.match.CtStateCodec;
import org.opendaylight.openflowjava.nx.codec.match.CtZoneCodec;
+import org.opendaylight.openflowjava.nx.codec.match.EncapEthDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.EncapEthSrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.EncapEthTypeCodec;
import org.opendaylight.openflowjava.nx.codec.match.EthDstCodec;
import org.opendaylight.openflowjava.nx.codec.match.EthSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.EthTypeCodec;
+import org.opendaylight.openflowjava.nx.codec.match.InPortCodec;
+import org.opendaylight.openflowjava.nx.codec.match.NshMdtypeCodec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc1Codec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc2Codec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc3Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg5Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg6Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec;
-import org.opendaylight.openflowjava.nx.codec.match.TcpSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.TcpDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpSrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.TunGpeNpCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec;
+import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EncapEthTypeCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EncapEthSrcCodec;
-import org.opendaylight.openflowjava.nx.codec.match.EncapEthDstCodec;
-import org.opendaylight.openflowjava.nx.codec.match.NshMdtypeCodec;
-import org.opendaylight.openflowjava.nx.codec.match.TunGpeNpCodec;
-import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.UdpDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
+import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider;
import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.ConntrackConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.LearnConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.MultipathConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.OutputRegConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.PopNshConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.PushNshConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.RegLoadConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.RegMoveConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.ResubmitConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.PushNshConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.PopNshConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.ArpOpConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.ArpShaConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.ArpSpaConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.CtMarkConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.CtStateConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.CtZoneConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EncapEthDstConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EncapEthSrcConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EncapEthTypeConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EthDstConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EthSrcConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EthTypeConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NshMdtypeConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NshNpConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.Nshc1Convertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.Nshc2Convertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.Nshc3Convertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.Nshc4Convertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NsiConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NspConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NxmInPortConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.RegConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TcpDstConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TcpSrcConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunGpeNpConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIPv4DstConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIPv4SrcConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIdConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EncapEthTypeConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EncapEthSrcConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.EncapEthDstConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NshMdtypeConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NshNpConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunGpeNpConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.UdpDstConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.UdpSrcConvertor;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NxmInPortConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionConntrack;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionLearn;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionPopNsh;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionPushNsh;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionResubmit;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionPushNsh;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionPopNsh;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionConntrackRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionFinTimeoutRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionLearnRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionMultipathRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionOutputRegRpcAddFlowApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPopNshRpcAddFlowApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPushNshRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionResubmitRpcAddFlowApplyActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPushNshRpcAddFlowApplyActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPopNshRpcAddFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionConntrackRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionFinTimeoutRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionLearnRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionMultipathRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegRpcAddFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPopNshRpcAddFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPushNshRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionResubmitRpcAddFlowWriteActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPushNshRpcAddFlowWriteActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPopNshRpcAddFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionConntrackRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionFinTimeoutRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionLearnRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionMultipathRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionOutputRegRpcAddGroupCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionPopNshRpcAddGroupCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionPushNshRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionRegLoadRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionRegMoveRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionPushNshRpcAddGroupCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionPopNshRpcAddGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionConntrackNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionFinTimeoutNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionLearnNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionMultipathNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionOutputRegNodesNodeGroupBucketsBucketActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionPopNshNodesNodeGroupBucketsBucketActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionPushNshNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionRegLoadNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionRegMoveNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionResubmitNodesNodeGroupBucketsBucketActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionPushNshNodesNodeGroupBucketsBucketActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionPopNshNodesNodeGroupBucketsBucketActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionConntrackNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionFinTimeoutNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionLearnNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionMultipathNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionOutputRegNodesNodeTableFlowApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPopNshNodesNodeTableFlowApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPushNshNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionResubmitNodesNodeTableFlowApplyActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPushNshNodesNodeTableFlowApplyActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPopNshNodesNodeTableFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionConntrackNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionFinTimeoutNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionLearnNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionMultipathNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPopNshNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPushNshNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionResubmitNodesNodeTableFlowWriteActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPushNshNodesNodeTableFlowWriteActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionPopNshNodesNodeTableFlowWriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadRpcRemoveFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveRpcRemoveFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionResubmitRpcRemoveFlowApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionLearnRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionMultipathRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionOutputRegRpcRemoveGroupCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionPopNshRpcRemoveGroupCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionPushNshRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionRegLoadRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionRegMoveRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionResubmitRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.transmit.packet.input.action.action.NxActionRegLoadRpcTransmitPacketCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.transmit.packet.input.action.action.NxActionResubmitRpcTransmitPacketCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionPushNshRpcRemoveGroupCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionPopNshRpcRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.flow.input.original.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadRpcUpdateFlowOriginalApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.flow.input.updated.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadRpcUpdateFlowUpdatedApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.flow.input.updated.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveRpcUpdateFlowUpdatedApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionLearnRpcUpdateGroupOriginalCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionMultipathRpcUpdateGroupOriginalCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionOutputRegRpcUpdateGroupOriginalCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionPopNshRpcUpdateGroupOriginalCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionPushNshRpcUpdateGroupOriginalCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionRegLoadRpcUpdateGroupOriginalCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionRegMoveRpcUpdateGroupOriginalCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionResubmitRpcUpdateGroupOriginalCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionPushNshRpcUpdateGroupOriginalCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionPopNshRpcUpdateGroupOriginalCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionConntrackRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionFinTimeoutRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionLearnRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionMultipathRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionOutputRegRpcUpdateGroupUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionPopNshRpcUpdateGroupUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionPushNshRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionRegLoadRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionRegMoveRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionResubmitRpcUpdateGroupUpdatedCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionPushNshRpcUpdateGroupUpdatedCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionPopNshRpcUpdateGroupUpdatedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxArpShaKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxArpThaKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxCtMarkKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxCtStateKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxCtZoneKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxEncapEthDstKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxEncapEthSrcKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxEncapEthTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshMdtypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshNpKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshc1Key;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshc2Key;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshc3Key;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg5Key;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg6Key;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg7Key;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunGpeNpKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIdKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4DstKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4SrcKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxEncapEthTypeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxEncapEthSrcKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxEncapEthDstKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshMdtypeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshNpKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunGpeNpKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfArpOpKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfArpSpaKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfArpTpaKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthDstKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthSrcKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfInPortKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpDstKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpSrcKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpDstKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpSrcKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfInPortKey;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- *
- */
public class NiciraExtensionProvider implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(NiciraExtensionProvider.class);
private final Set<ObjectRegistration<?>> registrations;
/**
- * register appropriate converters
+ * Register appropriate converters.
*/
public NiciraExtensionProvider(final OpenFlowPluginExtensionRegistratorProvider provider) {
this.extensionConverterRegistrator = Preconditions.checkNotNull(provider.getExtensionConverterRegistrator());
}
@Override
+ @SuppressWarnings("checkstyle:IllegalCatch")
public void close() {
registrations.forEach(janitor -> {
try {
janitor.close();
- } catch (Exception e) {
+ } catch (RuntimeException e) {
LOG.warn("closing of extension converter failed", e);
}
});
registrations.clear();
}
- /**
- * @param actionCaseType
- * @param actionConvertor
- */
private void registerAction13(final Class<? extends Action> actionCaseType, final ConvertorActionToOFJava<
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionConvertor) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>
+ actionConvertor) {
TypeVersionKey<? extends Action> key = new TypeVersionKey<>(actionCaseType, EncodeConstants.OF13_VERSION_ID);
registrations.add(extensionConverterRegistrator.registerActionConvertor(key, actionConvertor));
}
- /**
- * @param actionCaseType
- * @param actionConvertor
- */
private void registerAction13(Class<? extends ActionChoice> actionCaseType,
- ConvertorActionFromOFJava<
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action,
- ActionPath> actionConvertor) {
+ ConvertorActionFromOFJava<
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action,
+ ActionPath> actionConvertor) {
ActionSerializerKey<?> key = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, actionCaseType, null);
registrations.add(extensionConverterRegistrator.registerActionConvertor(key, actionConvertor));
}
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension;
/**
- * @author msunal
+ * Codec precondition exception.
*
+ * @author msunal
*/
public class CodecPreconditionException extends RuntimeException {
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-
import java.util.List;
import java.util.ListIterator;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
/**
- * @author msunal
+ * IP conversion utilities.
*
+ * @author msunal
*/
public final class IpConverter {
+ private IpConverter() {
+ }
- public static long Ipv4AddressToLong(Ipv4Address ipv4Address) {
+ public static long ipv4AddressToLong(Ipv4Address ipv4Address) {
long result = 0 ;
Iterable<String> splitted = Splitter.on('.')
.trimResults()
List<String> splittedAddress = Lists.newArrayList(splitted.iterator());
int maxIndex = splittedAddress.size() - 1;
ListIterator<String> listIter = splittedAddress.listIterator();
- while(listIter.hasNext()) {
+ while (listIter.hasNext()) {
String current = listIter.next();
- int i = splittedAddress.indexOf(current);
- result |= (Long.parseLong(current) << ((maxIndex-i) * 8));
+ int index = splittedAddress.indexOf(current);
+ result |= Long.parseLong(current) << (maxIndex - index) * 8;
}
return result & 0xFFFFFFFF;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
/**
+ * Action utilities.
+ *
* @author msunal
*/
-public class ActionUtil {
+public final class ActionUtil {
+ public static final ExperimenterId EXPERIMENTER_ID = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
- public final static ExperimenterId EXPERIMENTER_ID = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
+ private ActionUtil() {
+ }
- public static final Action createAction(ActionChoice actionChoice){
+ public static Action createAction(ActionChoice actionChoice) {
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(actionChoice);
actionBuilder.setExperimenterId(EXPERIMENTER_ID);
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
import com.google.common.base.Preconditions;
-
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.OfpactActions;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionCtMarkCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionCtMarkCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMark;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNat;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNat;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder;
/**
+ * Conntrack converter implementation.
+ *
* @author Aswin Suryanarayanan.
*/
-
public class ConntrackConvertor implements
ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
.Action, Action>,
return resolveAction(builder.build(), path);
}
- private List<CtActions> getCtAction(final NxActionConntrack action) {
- if (action.getCtActions() == null) {
- return null;
- }
- List<CtActions> ctActions = new ArrayList<>();
- for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack
- .grouping.nx.action.conntrack.CtActions ctAction : action.getCtActions()) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions
- .OfpactActions ofpactAction = ctAction.getOfpactActions();
- if (ofpactAction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421
- .ofpact.actions.ofpact.actions.NxActionNatCase) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact
- .actions.nx.action.nat._case.NxActionNat nxActionNat = ((org.opendaylight.yang.gen.v1.urn
- .opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions
- .NxActionNatCase) ofpactAction).getNxActionNat();
- NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder();
- nxActionNatBuilder.setFlags(nxActionNat.getFlags());
- nxActionNatBuilder.setRangePresent(nxActionNat.getRangePresent());
- nxActionNatBuilder.setIpAddressMin(nxActionNat.getIpAddressMin());
- nxActionNatBuilder.setIpAddressMax(nxActionNat.getIpAddressMax());
- nxActionNatBuilder.setPortMin(nxActionNat.getPortMin());
- nxActionNatBuilder.setPortMax(nxActionNat.getPortMax());
- NxActionNatCaseBuilder caseBuilder = new NxActionNatCaseBuilder();
- caseBuilder.setNxActionNat(nxActionNatBuilder.build());
- CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
- ctActionsBuilder.setOfpactActions(caseBuilder.build());
- ctActions.add(ctActionsBuilder.build());
- } else if (ofpactAction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421
- .ofpact.actions.ofpact.actions.NxActionCtMarkCase) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact
- .actions.nx.action.ct.mark._case.NxActionCtMark nxActionCtMark = ((org.opendaylight.yang.gen.v1.urn
- .opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions
- .NxActionCtMarkCase) ofpactAction).getNxActionCtMark();
- NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
- nxActionCtMarkBuilder.setCtMark(nxActionCtMark.getCtMark());
- // TODO: ct_mark mask is not supported yet
- NxActionCtMarkCaseBuilder caseBuilder = new NxActionCtMarkCaseBuilder();
- caseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
- CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
- ctActionsBuilder.setOfpactActions(caseBuilder.build());
- ctActions.add(ctActionsBuilder.build());
- }
- }
- return ctActions;
- }
-
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
- .Action resolveAction(final NxConntrack value, final ActionPath path) {
- switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
- return new NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder().setNxConntrack(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxConntrack(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxConntrack(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
- return new NxActionConntrackNotifGroupDescStatsUpdatedCaseBuilder().setNxConntrack(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionConntrackNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxConntrack(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionConntrackNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxConntrack(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
- return new NxActionConntrackNodesNodeTableFlowApplyActionsCaseBuilder().setNxConntrack(value).build();
- default:
- throw new CodecPreconditionException(path);
- }
- }
-
@Override
public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
.Action nxActionArg) {
return ActionUtil.createAction(actionConntrackBuilder.build());
}
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+ .Action resolveAction(final NxConntrack value, final ActionPath path) {
+ switch (path) {
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
+ return new NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder().setNxConntrack(value).build();
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxConntrack(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxConntrack(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
+ return new NxActionConntrackNotifGroupDescStatsUpdatedCaseBuilder().setNxConntrack(value).build();
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionConntrackNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxConntrack(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionConntrackNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxConntrack(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
+ return new NxActionConntrackNodesNodeTableFlowApplyActionsCaseBuilder().setNxConntrack(value).build();
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
+
private List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack
.grouping.nx.action.conntrack.CtActions> getCtAction(final NxConntrack action) {
if (action.getCtActions() == null) {
} else if (ofpactAction instanceof NxActionCtMarkCase) {
NxActionCtMark nxActionCtMark = ((NxActionCtMarkCase) ofpactAction).getNxActionCtMark();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact
- .actions.nx.action.ct.mark._case.NxActionCtMarkBuilder nxActionCtMarkBuilder = new org.opendaylight.yang.gen
- .v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.ct.mark
- ._case.NxActionCtMarkBuilder();
+ .actions.nx.action.ct.mark._case.NxActionCtMarkBuilder nxActionCtMarkBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact
+ .actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder();
nxActionCtMarkBuilder.setCtMark(nxActionCtMark.getCtMark());
// TODO: ct_mark mask is not supported yet
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact
}
return ctActions;
}
+
+ private List<CtActions> getCtAction(final NxActionConntrack action) {
+ if (action.getCtActions() == null) {
+ return null;
+ }
+ List<CtActions> ctActions = new ArrayList<>();
+ for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack
+ .grouping.nx.action.conntrack.CtActions ctAction : action.getCtActions()) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions
+ .OfpactActions ofpactAction = ctAction.getOfpactActions();
+ if (ofpactAction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421
+ .ofpact.actions.ofpact.actions.NxActionNatCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact
+ .actions.nx.action.nat._case.NxActionNat nxActionNat = ((org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions
+ .NxActionNatCase) ofpactAction).getNxActionNat();
+ NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder();
+ nxActionNatBuilder.setFlags(nxActionNat.getFlags());
+ nxActionNatBuilder.setRangePresent(nxActionNat.getRangePresent());
+ nxActionNatBuilder.setIpAddressMin(nxActionNat.getIpAddressMin());
+ nxActionNatBuilder.setIpAddressMax(nxActionNat.getIpAddressMax());
+ nxActionNatBuilder.setPortMin(nxActionNat.getPortMin());
+ nxActionNatBuilder.setPortMax(nxActionNat.getPortMax());
+ NxActionNatCaseBuilder caseBuilder = new NxActionNatCaseBuilder();
+ caseBuilder.setNxActionNat(nxActionNatBuilder.build());
+ CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
+ ctActionsBuilder.setOfpactActions(caseBuilder.build());
+ ctActions.add(ctActionsBuilder.build());
+ } else if (ofpactAction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action
+ .rev140421.ofpact.actions.ofpact.actions.NxActionCtMarkCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact
+ .actions.nx.action.ct.mark._case.NxActionCtMark nxActionCtMark = ((org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions
+ .NxActionCtMarkCase) ofpactAction).getNxActionCtMark();
+ NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
+ nxActionCtMarkBuilder.setCtMark(nxActionCtMark.getCtMark());
+ // TODO: ct_mark mask is not supported yet
+ NxActionCtMarkCaseBuilder caseBuilder = new NxActionCtMarkCaseBuilder();
+ caseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
+ CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
+ ctActionsBuilder.setOfpactActions(caseBuilder.build());
+ ctActions.add(ctActionsBuilder.build());
+ }
+ }
+ return ctActions;
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionFinTimeoutNodesNodeTableFlowWriteActionsCaseBuilder;
/**
- * Convert to/from SAL flow model to openflowjava model for FinTimeout action
+ * Convert to/from SAL flow model to openflowjava model for FinTimeout action.
*/
public class FinTimeoutConvertor
implements ConvertorActionToOFJava<
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
final Action input, final ActionPath path) {
NxActionFinTimeout action = ((ActionFinTimeout) input.getActionChoice()).getNxActionFinTimeout();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping.NxActionFinTimeoutBuilder builder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping.NxActionFinTimeoutBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin
+ .timeout.grouping.NxActionFinTimeoutBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping
+ .NxActionFinTimeoutBuilder();
builder.setFinIdleTimeout(action.getFinIdleTimeout());
builder.setFinHardTimeout(action.getFinHardTimeout());
return resolveAction(builder.build(), path);
}
+ @Override
+ public Action convert(
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ Preconditions.checkArgument(nxActionArg instanceof NxActionFinTimeoutGrouping);
+ NxActionFinTimeoutGrouping nxAction = (NxActionFinTimeoutGrouping) nxActionArg;
+ ActionFinTimeoutBuilder builder = new ActionFinTimeoutBuilder();
+ NxActionFinTimeoutBuilder nxActionFinTimeoutBuilder = new NxActionFinTimeoutBuilder();
+ nxActionFinTimeoutBuilder.setFinIdleTimeout(nxAction.getNxActionFinTimeout().getFinIdleTimeout());
+ nxActionFinTimeoutBuilder.setFinHardTimeout(nxAction.getNxActionFinTimeout().getFinHardTimeout());
+ builder.setNxActionFinTimeout(nxActionFinTimeoutBuilder.build());
+ return ActionUtil.createAction(builder.build());
+ }
+
private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
- final org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping.NxActionFinTimeout nxActionFinTimeout,
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx
+ .action.fin.timeout.grouping.NxActionFinTimeout nxActionFinTimeout,
final ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionFinTimeoutNodesNodeTableFlowWriteActionsCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
return new NxActionFinTimeoutNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
return new NxActionFinTimeoutNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionFinTimeoutNotifGroupDescStatsUpdatedCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
return new NxActionFinTimeoutNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
return new NxActionFinTimeoutNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionFinTimeoutNodesNodeTableFlowApplyActionsCaseBuilder()
.setNxActionFinTimeout(nxActionFinTimeout).build();
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public Action convert(
- final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionFinTimeoutGrouping);
- NxActionFinTimeoutGrouping nxAction = (NxActionFinTimeoutGrouping) nxActionArg;
- ActionFinTimeoutBuilder builder = new ActionFinTimeoutBuilder();
- NxActionFinTimeoutBuilder nxActionFinTimeoutBuilder = new NxActionFinTimeoutBuilder();
- nxActionFinTimeoutBuilder.setFinIdleTimeout(nxAction.getNxActionFinTimeout().getFinIdleTimeout());
- nxActionFinTimeoutBuilder.setFinHardTimeout(nxAction.getNxActionFinTimeout().getFinHardTimeout());
- builder.setNxActionFinTimeout(nxActionFinTimeoutBuilder.build());
- return ActionUtil.createAction(builder.build());
- }
-
}
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
+import com.google.common.base.Preconditions;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.NxLearn;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.NxLearnBuilder;
-import com.google.common.base.Preconditions;
-
/**
+ * Convert to/from SAL flow model to openflowjava model for NxLearn action.
+ *
* @author Slava Radune
*/
-
public class LearnConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ final Action input, final ActionPath path) {
NxActionLearn action = ((ActionLearn) input.getActionChoice()).getNxActionLearn();
NxLearnBuilder builder = new NxLearnBuilder();
LearnConvertorUtil.convertUp(action, builder);
return resolveAction(builder.build(), path);
}
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(final NxLearn value, final ActionPath path) {
+ @Override
+ public Action convert(
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ Preconditions.checkArgument(nxActionArg instanceof NxActionLearnGrouping);
+ NxActionLearnGrouping nxAction = (NxActionLearnGrouping) nxActionArg;
+
+ NxActionLearnBuilder nxActionLearnBuilder = new NxActionLearnBuilder();
+ LearnConvertorUtil.convertDown(nxAction, nxActionLearnBuilder);
+ ActionLearnBuilder actionLearnBuilder = new ActionLearnBuilder();
+ actionLearnBuilder.setNxActionLearn(nxActionLearnBuilder.build());
+ return ActionUtil.createAction(actionLearnBuilder.build());
+ }
+
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ final NxLearn value, final ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionLearnNodesNodeTableFlowWriteActionsCaseBuilder().setNxLearn(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
return new NxActionLearnNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxLearn(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
return new NxActionLearnNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxLearn(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionLearnNotifGroupDescStatsUpdatedCaseBuilder().setNxLearn(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
return new NxActionLearnNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxLearn(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
return new NxActionLearnNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxLearn(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionLearnNodesNodeTableFlowApplyActionsCaseBuilder().setNxLearn(value).build();
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionLearnGrouping);
- NxActionLearnGrouping nxAction = (NxActionLearnGrouping) nxActionArg;
-
- NxActionLearnBuilder nxActionLearnBuilder = new NxActionLearnBuilder();
- LearnConvertorUtil.convertDown(nxAction, nxActionLearnBuilder);
- ActionLearnBuilder actionLearnBuilder = new ActionLearnBuilder();
- actionLearnBuilder.setNxActionLearn(nxActionLearnBuilder.build());
- return ActionUtil.createAction(actionLearnBuilder.build());
- }
-
}
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearn;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionLearnGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowMods;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowModsBuilder;
-public class LearnConvertorUtil {
+public final class LearnConvertorUtil {
+ private LearnConvertorUtil() {
+ }
/*
- * CONVERT UP
- */
+ * CONVERT UP
+ */
static void convertUp(NxActionLearn action, NxLearnBuilder builder) {
builder.setFlags(action.getFlags());
}
private static List<FlowMods> getFlowMods(NxActionLearn action) {
- if(action.getFlowMods() == null){
+ if (action.getFlowMods() == null) {
return null;
}
- List<FlowMods> flowMods = new ArrayList<FlowMods>();
- for(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods flowMod : action.getFlowMods()){
+ List<FlowMods> flowMods = new ArrayList<>();
+ for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn
+ .grouping.nx.action.learn.FlowMods flowMod : action.getFlowMods()) {
FlowModsBuilder flowModBuilder = new FlowModsBuilder();
- FlowModSpec flowModSpec = buildFlowModSpec(flowMod.getFlowModSpec());
+ FlowModSpec flowModSpec = buildExtFlowModSpec(flowMod.getFlowModSpec());
flowModBuilder.setFlowModSpec(flowModSpec);
flowMods.add(flowModBuilder.build());
}
return flowMods;
}
+ private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action
+ .learn.grouping.nx.action.learn.FlowMods> getFlowMods(NxLearn nxLearn) {
+ if (nxLearn.getFlowMods() == null) {
+ return null;
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn
+ .grouping.nx.action.learn.FlowMods> flowMods = new ArrayList<>();
+ for (FlowMods flowMod : nxLearn.getFlowMods()) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn
+ .grouping.nx.action.learn.FlowModsBuilder flowModBuilder = new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn
+ .FlowModsBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec
+ flowModSpec = buildFlowModSpec(flowMod.getFlowModSpec());
+ flowModBuilder.setFlowModSpec(flowModSpec);
+ flowMods.add(flowModBuilder.build());
+ }
+ return flowMods;
+ }
- private static FlowModSpec buildFlowModSpec(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec flowModSpec) {
- if(flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase){
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromField flowModAdd2 =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase) flowModSpec).getFlowModAddMatchFromField();
+ private static FlowModSpec buildExtFlowModSpec(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action
+ .rev140421.flow.mod.spec.FlowModSpec flowModSpec) {
+ if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow
+ .mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .flow.mod.add.match.from.field._case.FlowModAddMatchFromField flowModAdd2 =
+ ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.FlowModAddMatchFromFieldCase) flowModSpec).getFlowModAddMatchFromField();
FlowModAddMatchFromFieldBuilder flowModAdd = new FlowModAddMatchFromFieldBuilder();
flowModAdd.setDstField(flowModAdd2.getDstField());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
FlowModAddMatchFromFieldCaseBuilder caseBuilder = new FlowModAddMatchFromFieldCaseBuilder();
caseBuilder.setFlowModAddMatchFromField(flowModAdd.build());
return caseBuilder.build();
- } else if(flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase){
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValue flowModAdd2 =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase) flowModSpec).getFlowModAddMatchFromValue();
+ } else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action
+ .rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod
+ .spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValue flowModAdd2 =
+ ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.FlowModAddMatchFromValueCase) flowModSpec).getFlowModAddMatchFromValue();
FlowModAddMatchFromValueBuilder flowModAdd = new FlowModAddMatchFromValueBuilder();
flowModAdd.setValue(flowModAdd2.getValue());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
FlowModAddMatchFromValueCaseBuilder caseBuilder = new FlowModAddMatchFromValueCaseBuilder();
caseBuilder.setFlowModAddMatchFromValue(flowModAdd.build());
return caseBuilder.build();
- } else if(flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase){
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoField flowModCopy2 =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase) flowModSpec).getFlowModCopyFieldIntoField();
+ } else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action
+ .rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod
+ .spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoField flowModCopy2 =
+ ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.FlowModCopyFieldIntoFieldCase) flowModSpec).getFlowModCopyFieldIntoField();
FlowModCopyFieldIntoFieldBuilder flowModCopy = new FlowModCopyFieldIntoFieldBuilder();
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
FlowModCopyFieldIntoFieldCaseBuilder caseBuilder = new FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyFieldIntoField(flowModCopy.build());
return caseBuilder.build();
- } else if(flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase){
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoField flowModCopy2 =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase) flowModSpec).getFlowModCopyValueIntoField();
+ } else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action
+ .rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod
+ .spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoField flowModCopy2 =
+ ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.FlowModCopyValueIntoFieldCase) flowModSpec).getFlowModCopyValueIntoField();
FlowModCopyValueIntoFieldBuilder flowModCopy = new FlowModCopyValueIntoFieldBuilder();
flowModCopy.setValue(flowModCopy2.getValue());
flowModCopy.setDstField(flowModCopy2.getDstField());
FlowModCopyValueIntoFieldCaseBuilder caseBuilder = new FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyValueIntoField(flowModCopy.build());
return caseBuilder.build();
- } else if(flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase){
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPort flowModOut2 =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase) flowModSpec).getFlowModOutputToPort();
+ } else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action
+ .rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod
+ .spec.flow.mod.output.to.port._case.FlowModOutputToPort flowModOut2 =
+ ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.FlowModOutputToPortCase) flowModSpec).getFlowModOutputToPort();
FlowModOutputToPortBuilder flowModOut = new FlowModOutputToPortBuilder();
flowModOut.setSrcField(flowModOut2.getSrcField());
flowModOut.setSrcOfs(flowModOut2.getSrcOfs());
nxActionLearnBuilder.setFlowMods(getFlowMods(nxAction.getNxLearn()));
}
- private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods> getFlowMods(
- NxLearn nxLearn) {
- if(nxLearn.getFlowMods() == null){
- return null;
- }
-
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods> flowMods = new ArrayList<>();
- for(FlowMods flowMod : nxLearn.getFlowMods()){
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder flowModBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec flowModSpec = buildFlowModSpec(flowMod.getFlowModSpec());
- flowModBuilder.setFlowModSpec(flowModSpec);
- flowMods.add(flowModBuilder.build());
- }
- return flowMods;
- }
-
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec buildFlowModSpec(FlowModSpec flowModSpec) {
- if(flowModSpec instanceof FlowModAddMatchFromFieldCase){
- FlowModAddMatchFromField flowModAdd2 = ((FlowModAddMatchFromFieldCase) flowModSpec).getFlowModAddMatchFromField();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromFieldBuilder
- flowModAdd = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromFieldBuilder();
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .FlowModSpec buildFlowModSpec(FlowModSpec flowModSpec) {
+ if (flowModSpec instanceof FlowModAddMatchFromFieldCase) {
+ FlowModAddMatchFromField flowModAdd2 = ((FlowModAddMatchFromFieldCase) flowModSpec)
+ .getFlowModAddMatchFromField();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod
+ .spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromFieldBuilder flowModAdd =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromFieldBuilder();
flowModAdd.setDstField(flowModAdd2.getDstField());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
flowModAdd.setDstOfs(flowModAdd2.getDstOfs());
flowModAdd.setSrcOfs(flowModAdd2.getSrcOfs());
flowModAdd.setFlowModNumBits(flowModAdd2.getFlowModNumBits());
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCaseBuilder
- caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCaseBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModAddMatchFromFieldCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCaseBuilder();
caseBuilder.setFlowModAddMatchFromField(flowModAdd.build());
return caseBuilder.build();
- } else if(flowModSpec instanceof FlowModAddMatchFromValueCase){
- FlowModAddMatchFromValue flowModAdd2 = ((FlowModAddMatchFromValueCase) flowModSpec).getFlowModAddMatchFromValue();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValueBuilder
- flowModAdd = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValueBuilder();
+ } else if (flowModSpec instanceof FlowModAddMatchFromValueCase) {
+ FlowModAddMatchFromValue flowModAdd2 = ((FlowModAddMatchFromValueCase) flowModSpec)
+ .getFlowModAddMatchFromValue();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .flow.mod.add.match.from.value._case.FlowModAddMatchFromValueBuilder flowModAdd =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValueBuilder();
flowModAdd.setValue(flowModAdd2.getValue());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
flowModAdd.setSrcOfs(flowModAdd2.getSrcOfs());
flowModAdd.setFlowModNumBits(flowModAdd2.getFlowModNumBits());
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder
- caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModAddMatchFromValueCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder();
caseBuilder.setFlowModAddMatchFromValue(flowModAdd.build());
return caseBuilder.build();
- } else if(flowModSpec instanceof FlowModCopyFieldIntoFieldCase){
- FlowModCopyFieldIntoField flowModCopy2 = ((FlowModCopyFieldIntoFieldCase) flowModSpec).getFlowModCopyFieldIntoField();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoFieldBuilder
- flowModCopy = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoFieldBuilder();
+ } else if (flowModSpec instanceof FlowModCopyFieldIntoFieldCase) {
+ FlowModCopyFieldIntoField flowModCopy2 = ((FlowModCopyFieldIntoFieldCase) flowModSpec)
+ .getFlowModCopyFieldIntoField();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoFieldBuilder flowModCopy =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoFieldBuilder();
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
flowModCopy.setSrcField(flowModCopy2.getSrcField());
flowModCopy.setSrcOfs(flowModCopy2.getSrcOfs());
flowModCopy.setFlowModNumBits(flowModCopy2.getFlowModNumBits());
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCaseBuilder
- caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCaseBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModCopyFieldIntoFieldCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyFieldIntoField(flowModCopy.build());
return caseBuilder.build();
} else if (flowModSpec instanceof FlowModCopyValueIntoFieldCase) {
- FlowModCopyValueIntoField flowModCopy2 = ((FlowModCopyValueIntoFieldCase) flowModSpec).getFlowModCopyValueIntoField();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoFieldBuilder
- flowModCopy = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoFieldBuilder();
+ FlowModCopyValueIntoField flowModCopy2 = ((FlowModCopyValueIntoFieldCase) flowModSpec)
+ .getFlowModCopyValueIntoField();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .flow.mod.copy.value.into.field._case.FlowModCopyValueIntoFieldBuilder flowModCopy =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoFieldBuilder();
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
flowModCopy.setValue(flowModCopy2.getValue());
flowModCopy.setFlowModNumBits(flowModCopy2.getFlowModNumBits());
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCaseBuilder
- caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCaseBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModCopyValueIntoFieldCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyValueIntoField(flowModCopy.build());
return caseBuilder.build();
} else if (flowModSpec instanceof FlowModOutputToPortCase) {
FlowModOutputToPort flowModOut2 = ((FlowModOutputToPortCase) flowModSpec).getFlowModOutputToPort();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPortBuilder
- flowModOut = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPortBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .flow.mod.output.to.port._case.FlowModOutputToPortBuilder flowModOut =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec
+ .flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPortBuilder();
flowModOut.setSrcField(flowModOut2.getSrcField());
flowModOut.setSrcOfs(flowModOut2.getSrcOfs());
flowModOut.setFlowModNumBits(flowModOut2.getFlowModNumBits());
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCaseBuilder
- caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCaseBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec
+ .FlowModOutputToPortCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCaseBuilder();
caseBuilder.setFlowModOutputToPort(flowModOut.build());
return caseBuilder.build();
}
return null;
}
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.DstBuilder;
public class MultipathConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
+ public Action convert(
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ Preconditions.checkArgument(nxActionArg instanceof NxActionMultipathGrouping);
+ NxActionMultipathGrouping nxAction = (NxActionMultipathGrouping) nxActionArg;
+
+ NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
+ nxActionMultipathBuilder.setFields(nxAction.getNxMultipath().getFields());
+ nxActionMultipathBuilder.setBasis(nxAction.getNxMultipath().getBasis());
+ nxActionMultipathBuilder.setAlgorithm(nxAction.getNxMultipath().getAlgorithm());
+ nxActionMultipathBuilder.setMaxLink(nxAction.getNxMultipath().getMaxLink());
+ nxActionMultipathBuilder.setArg(nxAction.getNxMultipath().getArg());
+ Dst dst = nxAction.getNxMultipath().getDst();
+ nxActionMultipathBuilder.setOfsNbits(dst.getStart() << 6 | dst.getEnd() - dst.getStart());
+ nxActionMultipathBuilder.setDst(RegMoveConvertor.resolveDst(dst.getDstChoice()));
+ ActionMultipathBuilder actionMultipathBuilder = new ActionMultipathBuilder();
+ actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
+ return ActionUtil.createAction(actionMultipathBuilder.build());
+ }
+
+ @Override
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ final Action input, final ActionPath path) {
NxActionMultipath action = ((ActionMultipath) input.getActionChoice()).getNxActionMultipath();
DstBuilder dstBuilder = new DstBuilder();
- dstBuilder.setDstChoice(RegMoveConvertor.resolveDst(action.getDst()));
+ dstBuilder.setDstChoice(RegMoveConvertor.resolveDstValue(action.getDst()));
dstBuilder.setStart(resolveStart(action.getOfsNbits()));
dstBuilder.setEnd(resolveEnd(action.getOfsNbits()));
NxMultipathBuilder builder = new NxMultipathBuilder();
private static int resolveEnd(final int ofsNBints) {
int ofs = extractSub(ofsNBints, 10, 6);
- int nBits = extractSub(ofsNBints, 6, 0);
- return ofs + nBits;
+ int numBits = extractSub(ofsNBints, 6, 0);
+ return ofs + numBits;
}
- private static int extractSub(final int l, final int nrBits, final int offset) {
- final int rightShifted = l >>> offset;
+ private static int extractSub(final int value, final int nrBits, final int offset) {
+ final int rightShifted = value >>> offset;
final int mask = (1 << nrBits) - 1;
return rightShifted & mask;
}
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(final NxMultipath value, final ActionPath path) {
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ final NxMultipath value, final ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionMultipathNodesNodeTableFlowWriteActionsCaseBuilder().setNxMultipath(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxMultipath(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxMultipath(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxMultipath(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxMultipath(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionMultipathNotifGroupDescStatsUpdatedCaseBuilder().setNxMultipath(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxMultipath(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxMultipath(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxMultipath(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxMultipath(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionMultipathNodesNodeTableFlowApplyActionsCaseBuilder().setNxMultipath(value).build();
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionMultipathGrouping);
- NxActionMultipathGrouping nxAction = (NxActionMultipathGrouping) nxActionArg;
-
- NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
- nxActionMultipathBuilder.setFields(nxAction.getNxMultipath().getFields());
- nxActionMultipathBuilder.setBasis(nxAction.getNxMultipath().getBasis());
- nxActionMultipathBuilder.setAlgorithm(nxAction.getNxMultipath().getAlgorithm());
- nxActionMultipathBuilder.setMaxLink(nxAction.getNxMultipath().getMaxLink());
- nxActionMultipathBuilder.setArg(nxAction.getNxMultipath().getArg());
- Dst dst = nxAction.getNxMultipath().getDst();
- nxActionMultipathBuilder.setOfsNbits((dst.getStart() << 6) | (dst.getEnd() - dst.getStart()));
- nxActionMultipathBuilder.setDst(RegMoveConvertor.resolveDst(dst.getDstChoice()));
- ActionMultipathBuilder actionMultipathBuilder = new ActionMultipathBuilder();
- actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
- return ActionUtil.createAction(actionMultipathBuilder.build());
- }
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.SrcBuilder;
/**
- * Convert to/from openflowplugin model to openflowjava model for
- * OutputReg action
+ * Convert to/from openflowplugin model to openflowjava model for OutputReg action.
*
* @author readams
*/
public class OutputRegConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ final Action input, final ActionPath path) {
NxActionOutputReg action = ((ActionOutputReg) input.getActionChoice()).getNxActionOutputReg();
SrcBuilder srcBuilder = new SrcBuilder();
- srcBuilder.setSrcChoice(RegMoveConvertor.resolveSrc(action.getSrc()));
+ srcBuilder.setSrcChoice(RegMoveConvertor.resolveSrcValue(action.getSrc()));
srcBuilder.setOfsNbits(action.getNBits());
NxOutputRegBuilder builder = new NxOutputRegBuilder();
builder.setSrc(srcBuilder.build());
return resolveAction(builder.build(), path);
}
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(final NxOutputReg value, final ActionPath path) {
- switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
- return new NxActionOutputRegNodesNodeTableFlowWriteActionsCaseBuilder().setNxOutputReg(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxOutputReg(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxOutputReg(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
- return new NxActionOutputRegNotifGroupDescStatsUpdatedCaseBuilder().setNxOutputReg(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxOutputReg(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionOutputRegNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxOutputReg(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
- return new NxActionOutputRegNodesNodeTableFlowApplyActionsCaseBuilder().setNxOutputReg(value).build();
- default:
- throw new CodecPreconditionException(path);
- }
- }
-
@Override
- public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ public Action convert(
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
Preconditions.checkArgument(nxActionArg instanceof NxActionOutputRegGrouping);
NxActionOutputRegGrouping nxAction = (NxActionOutputRegGrouping) nxActionArg;
Src src = nxAction.getNxOutputReg().getSrc();
- ActionOutputRegBuilder builder = new ActionOutputRegBuilder();
+ final ActionOutputRegBuilder builder = new ActionOutputRegBuilder();
NxActionOutputRegBuilder nxActionOutputRegBuilder = new NxActionOutputRegBuilder();
nxActionOutputRegBuilder.setSrc(RegMoveConvertor.resolveSrc(src.getSrcChoice()));
nxActionOutputRegBuilder.setNBits(src.getOfsNbits());
return ActionUtil.createAction(builder.build());
}
-}
\ No newline at end of file
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ final NxOutputReg value, final ActionPath path) {
+ switch (path) {
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
+ return new NxActionOutputRegNodesNodeTableFlowWriteActionsCaseBuilder().setNxOutputReg(value).build();
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxOutputReg(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxOutputReg(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
+ return new NxActionOutputRegNotifGroupDescStatsUpdatedCaseBuilder().setNxOutputReg(value).build();
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxOutputReg(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionOutputRegNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxOutputReg(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
+ return new NxActionOutputRegNodesNodeTableFlowApplyActionsCaseBuilder().setNxOutputReg(value).build();
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.pop.nsh.grouping.NxPopNshBuilder;
public class PopNshConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
- @Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) {
- NxActionPopNsh action = ((ActionPopNsh) input.getActionChoice()).getNxActionPopNsh();
- NxPopNshBuilder builder = new NxPopNshBuilder();
- return resolveAction(builder.build(), path);
- }
-
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(NxPopNsh value, ActionPath path) {
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ NxPopNsh value, ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionPopNshNodesNodeTableFlowWriteActionsCaseBuilder().setNxPopNsh(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
return new NxActionPopNshNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxPopNsh(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
return new NxActionPopNshNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxPopNsh(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionPopNshNotifGroupDescStatsUpdatedCaseBuilder().setNxPopNsh(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionPopNshNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxPopNsh(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionPopNshNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxPopNsh(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionPopNshNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxPopNsh(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionPopNshNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxPopNsh(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionPopNshNodesNodeTableFlowApplyActionsCaseBuilder().setNxPopNsh(value).build();
default:
throw new CodecPreconditionException(path);
}
@Override
- public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ Action input, ActionPath path) {
+ NxActionPopNsh action = ((ActionPopNsh) input.getActionChoice()).getNxActionPopNsh();
+ NxPopNshBuilder builder = new NxPopNshBuilder();
+ return resolveAction(builder.build(), path);
+ }
+
+ @Override
+ public Action convert(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
Preconditions.checkArgument(nxActionArg instanceof NxActionPopNshGrouping);
NxActionPopNshGrouping nxAction = (NxActionPopNshGrouping) nxActionArg;
ActionPopNshBuilder builder = new ActionPopNshBuilder();
builder.setNxActionPopNsh(nxActionPopNshBuilder.build());
return ActionUtil.createAction(builder.build());
}
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.push.nsh.grouping.NxPushNshBuilder;
public class PushNshConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
- @Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) {
- NxActionPushNsh action = ((ActionPushNsh) input.getActionChoice()).getNxActionPushNsh();
- NxPushNshBuilder builder = new NxPushNshBuilder();
- return resolveAction(builder.build(), path);
- }
-
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(NxPushNsh value, ActionPath path) {
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ NxPushNsh value, ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionPushNshNodesNodeTableFlowWriteActionsCaseBuilder().setNxPushNsh(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionPushNshNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxPushNsh(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionPushNshNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxPushNsh(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionPushNshNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxPushNsh(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionPushNshNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxPushNsh(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionPushNshNotifGroupDescStatsUpdatedCaseBuilder().setNxPushNsh(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionPushNshNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxPushNsh(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionPushNshNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxPushNsh(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionPushNshNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxPushNsh(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionPushNshNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxPushNsh(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionPushNshNodesNodeTableFlowApplyActionsCaseBuilder().setNxPushNsh(value).build();
default:
throw new CodecPreconditionException(path);
}
@Override
- public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ Action input, ActionPath path) {
+ NxActionPushNsh action = ((ActionPushNsh) input.getActionChoice()).getNxActionPushNsh();
+ NxPushNshBuilder builder = new NxPushNshBuilder();
+ return resolveAction(builder.build(), path);
+ }
+
+ @Override
+ public Action convert(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
Preconditions.checkArgument(nxActionArg instanceof NxActionPushNshGrouping);
NxActionPushNshGrouping nxAction = (NxActionPushNshGrouping) nxActionArg;
ActionPushNshBuilder builder = new ActionPushNshBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;
/**
+ * Convert to/from SAL flow model to openflowjava model for NxActionRegLoad action.
+ *
* @author msunal
*/
public class RegLoadConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
+
+ @Override
+ public Action convert(
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ Preconditions.checkArgument(nxActionArg instanceof NxActionRegLoadGrouping);
+
+ NxActionRegLoadGrouping nxAction = (NxActionRegLoadGrouping) nxActionArg;
+ Dst dst = nxAction.getNxRegLoad().getDst();
+
+
+ final ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
+ NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
+ nxActionRegLoadBuilder.setDst(RegMoveConvertor.resolveDst(dst.getDstChoice()));
+ nxActionRegLoadBuilder.setOfsNbits(dst.getStart() << 6 | dst.getEnd() - dst.getStart());
+ nxActionRegLoadBuilder.setValue(nxAction.getNxRegLoad().getValue());
+ actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
+ return ActionUtil.createAction(actionRegLoadBuilder.build());
+ }
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ final Action input, final ActionPath path) {
NxActionRegLoad actionRegLoad = ((ActionRegLoad) input.getActionChoice()).getNxActionRegLoad();
DstBuilder dstBuilder = new DstBuilder();
- dstBuilder.setDstChoice(RegMoveConvertor.resolveDst(actionRegLoad.getDst()));
+ dstBuilder.setDstChoice(RegMoveConvertor.resolveDstValue(actionRegLoad.getDst()));
dstBuilder.setStart(resolveStart(actionRegLoad.getOfsNbits()));
dstBuilder.setEnd(resolveEnd(actionRegLoad.getOfsNbits()));
NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
private static int resolveEnd(final int ofsNBints) {
int ofs = extractSub(ofsNBints, 10, 6);
- int nBits = extractSub(ofsNBints, 6, 0);
- return ofs + nBits;
+ int numBits = extractSub(ofsNBints, 6, 0);
+ return ofs + numBits;
}
- private static int extractSub(final int l, final int nrBits, final int offset) {
- final int rightShifted = l >>> offset;
+ private static int extractSub(final int value, final int nrBits, final int offset) {
+ final int rightShifted = value >>> offset;
final int mask = (1 << nrBits) - 1;
return rightShifted & mask;
}
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(final NxRegLoad value,
- final ActionPath path) {
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ final NxRegLoad value, final ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionRegLoadNodesNodeTableFlowWriteActionsCaseBuilder().setNxRegLoad(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxRegLoad(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxRegLoad(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxRegLoad(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxRegLoad(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionRegLoadNotifGroupDescStatsUpdatedCaseBuilder().setNxRegLoad(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxRegLoad(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxRegLoad(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxRegLoad(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxRegLoad(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder().setNxRegLoad(value).build();
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionRegLoadGrouping);
-
- NxActionRegLoadGrouping nxAction = (NxActionRegLoadGrouping) nxActionArg;
- Dst dst = nxAction.getNxRegLoad().getDst();
-
-
- ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
- NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
- nxActionRegLoadBuilder.setDst(RegMoveConvertor.resolveDst(dst.getDstChoice()));
- nxActionRegLoadBuilder.setOfsNbits((dst.getStart() << 6) | (dst.getEnd() - dst.getStart()));
- nxActionRegLoadBuilder.setValue(nxAction.getNxRegLoad().getValue());
- actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
- return ActionUtil.createAction(actionRegLoadBuilder.build());
- }
-
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpSrcCaseBuilder;
/**
+ * Convert to/from SAL flow model to openflowjava model for NxActionRegMove action.
+ *
* @author msunal
* @author Josh Hershberg (jhershbe@redhat.com)
*/
public class RegMoveConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
+
+ @Override
+ public Action convert(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ Preconditions.checkArgument(nxActionArg instanceof NxActionRegMoveGrouping);
+ NxActionRegMoveGrouping nxAction = (NxActionRegMoveGrouping) nxActionArg;
+
+ Dst dst = nxAction.getNxRegMove().getDst();
+ Src src = nxAction.getNxRegMove().getSrc();
+ final ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
+ NxActionRegMoveBuilder nxActionRegMove = new NxActionRegMoveBuilder();
+
+ nxActionRegMove.setDst(resolveDst(dst.getDstChoice()));
+ nxActionRegMove.setDstOfs(dst.getStart());
+ nxActionRegMove.setSrc(resolveSrc(src.getSrcChoice()));
+ nxActionRegMove.setSrcOfs(src.getStart());
+ nxActionRegMove.setNBits(dst.getEnd() - dst.getStart() + 1);
+ actionRegMoveBuilder.setNxActionRegMove(nxActionRegMove.build());
+ return ActionUtil.createAction(actionRegMoveBuilder.build());
+ }
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ Action input, ActionPath path) {
NxActionRegMove actionRegMove = ((ActionRegMove) input.getActionChoice()).getNxActionRegMove();
DstBuilder dstBuilder = new DstBuilder();
- dstBuilder.setDstChoice(resolveDst(actionRegMove.getDst()));
+ dstBuilder.setDstChoice(resolveDstValue(actionRegMove.getDst()));
dstBuilder.setStart(actionRegMove.getDstOfs());
dstBuilder.setEnd(actionRegMove.getDstOfs() + actionRegMove.getNBits() - 1);
SrcBuilder srcBuilder = new SrcBuilder();
- srcBuilder.setSrcChoice(resolveSrc(actionRegMove.getSrc()));
+ srcBuilder.setSrcChoice(resolveSrcValue(actionRegMove.getSrc()));
srcBuilder.setStart(actionRegMove.getSrcOfs());
srcBuilder.setEnd(actionRegMove.getSrcOfs() + actionRegMove.getNBits() - 1);
NxRegMoveBuilder nxRegMoveBuilder = new NxRegMoveBuilder();
return resolveAction(nxRegMoveBuilder.build(), path);
}
- public static DstChoice resolveDst(long dstValue) {
- Class<? extends NxmNxReg> potentialDst = resolveReg(dstValue);
+ public static DstChoice resolveDstValue(long dstValue) {
+ Class<? extends NxmNxReg> potentialDst = resolveCodec(dstValue);
if (potentialDst != null) {
return new DstNxRegCaseBuilder().setNxReg(potentialDst).build();
}
throw new CodecPreconditionException("Missing codec for " + new NxmHeader(dstValue));
}
- static SrcChoice resolveSrc(long srcValue) {
- Class<? extends NxmNxReg> potentialSrc = resolveReg(srcValue);
+ static SrcChoice resolveSrcValue(long srcValue) {
+ Class<? extends NxmNxReg> potentialSrc = resolveCodec(srcValue);
if (potentialSrc != null) {
return new SrcNxRegCaseBuilder().setNxReg(potentialSrc).build();
}
throw new CodecPreconditionException("Missing codec for " + new NxmHeader(srcValue));
}
- private static Class<? extends NxmNxReg> resolveReg(long value) {
+ private static Class<? extends NxmNxReg> resolveCodec(long value) {
if (value == NiciraMatchCodecs.REG0_CODEC.getHeaderWithoutHasMask().toLong()) {
return NxmNxReg0.class;
}
private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
NxRegMove value, ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionRegMoveNodesNodeTableFlowWriteActionsCaseBuilder().setNxRegMove(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxRegMove(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxRegMove(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxRegMove(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxRegMove(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionRegMoveNotifGroupDescStatsUpdatedCaseBuilder().setNxRegMove(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxRegMove(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxRegMove(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxRegMove(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxRegMove(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionRegMoveNodesNodeTableFlowApplyActionsCaseBuilder().setNxRegMove(value).build();
default:
throw new CodecPreconditionException(path);
}
}
- @Override
- public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionRegMoveGrouping);
- NxActionRegMoveGrouping nxAction = (NxActionRegMoveGrouping) nxActionArg;
-
- Dst dst = nxAction.getNxRegMove().getDst();
- Src src = nxAction.getNxRegMove().getSrc();
- ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
- NxActionRegMoveBuilder nxActionRegMove = new NxActionRegMoveBuilder();
-
- nxActionRegMove.setDst(resolveDst(dst.getDstChoice()));
- nxActionRegMove.setDstOfs(dst.getStart());
- nxActionRegMove.setSrc(resolveSrc(src.getSrcChoice()));
- nxActionRegMove.setSrcOfs(src.getStart());
- nxActionRegMove.setNBits(dst.getEnd() - dst.getStart() + 1);
- actionRegMoveBuilder.setNxActionRegMove(nxActionRegMove.build());
- return ActionUtil.createAction(actionRegMoveBuilder.build());
- }
-
public static long resolveDst(DstChoice dstChoice) {
if (dstChoice instanceof DstNxRegCase) {
return resolveReg(((DstNxRegCase) dstChoice).getNxReg());
}
throw new CodecPreconditionException("Missing codec for nxm_nx_reg?" + reg);
}
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.resubmit.grouping.NxResubmitBuilder;
/**
- * Convert to/from SAL flow model to openflowjava model for Resubmit action
+ * Convert to/from SAL flow model to openflowjava model for Resubmit action.
*/
public class ResubmitConvertor implements
- ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
- ConvertorActionFromOFJava<Action, ActionPath> {
+ ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action,
+ Action>, ConvertorActionFromOFJava<Action, ActionPath> {
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
+ public Action convert(
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ Preconditions.checkArgument(nxActionArg instanceof NxActionResubmitGrouping);
+ NxActionResubmitGrouping nxAction = (NxActionResubmitGrouping) nxActionArg;
+ ActionResubmitBuilder builder = new ActionResubmitBuilder();
+ NxActionResubmitBuilder nxActionResubmitBuilder = new NxActionResubmitBuilder();
+ nxActionResubmitBuilder.setInPort(nxAction.getNxResubmit().getInPort());
+ nxActionResubmitBuilder.setTable(nxAction.getNxResubmit().getTable());
+ builder.setNxActionResubmit(nxActionResubmitBuilder.build());
+ return ActionUtil.createAction(builder.build());
+ }
+
+ @Override
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ final Action input, final ActionPath path) {
NxActionResubmit action = ((ActionResubmit) input.getActionChoice()).getNxActionResubmit();
NxResubmitBuilder builder = new NxResubmitBuilder();
builder.setInPort(action.getInPort());
return resolveAction(builder.build(), path);
}
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(final NxResubmit value, final ActionPath path) {
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
+ final NxResubmit value, final ActionPath path) {
switch (path) {
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionResubmitNodesNodeTableFlowWriteActionsCaseBuilder().setNxResubmit(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxResubmit(value).build();
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxResubmit(value).build();
- case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
+ case FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS:
+ return new NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxResubmit(value).build();
+ case FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS:
+ return new NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxResubmit(value).build();
+ case GROUP_DESC_STATS_UPDATED_BUCKET_ACTION:
return new NxActionResubmitNotifGroupDescStatsUpdatedCaseBuilder().setNxResubmit(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
- return new NxActionResubmitNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxResubmit(value).build();
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
- return new NxActionResubmitNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxResubmit(value).build();
- case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
+ case FLOWS_STATISTICS_RPC_WRITE_ACTIONS:
+ return new NxActionResubmitNotifDirectStatisticsUpdateWriteActionsCaseBuilder()
+ .setNxResubmit(value).build();
+ case FLOWS_STATISTICS_RPC_APPLY_ACTIONS:
+ return new NxActionResubmitNotifDirectStatisticsUpdateApplyActionsCaseBuilder()
+ .setNxResubmit(value).build();
+ case INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS:
return new NxActionResubmitNodesNodeTableFlowApplyActionsCaseBuilder().setNxResubmit(value).build();
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionResubmitGrouping);
- NxActionResubmitGrouping nxAction = (NxActionResubmitGrouping) nxActionArg;
- ActionResubmitBuilder builder = new ActionResubmitBuilder();
- NxActionResubmitBuilder nxActionResubmitBuilder = new NxActionResubmitBuilder();
- nxActionResubmitBuilder.setInPort(nxAction.getNxResubmit().getInPort());
- nxActionResubmitBuilder.setTable(nxAction.getNxResubmit().getTable());
- builder.setNxActionResubmit(nxActionResubmitBuilder.build());
- return ActionUtil.createAction(builder.build());
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for ArpOpCase.
+ *
* @author msunal
*/
public class ArpOpConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- ArpOpCase arpOpCase = ((ArpOpCase) input.getMatchEntryValue());
+ ArpOpCase arpOpCase = (ArpOpCase) input.getMatchEntryValue();
return resolveAugmentation(new NxmOfArpOpBuilder().setValue(arpOpCase.getArpOp().getOpCode()).build(), path,
NxmOfArpOpKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfArpOpGrouping> matchGrouping = MatchUtil.ARP_OP_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Integer value = matchGrouping.get().getNxmOfArpOp().getValue();
+ ArpOpCaseValueBuilder arpOpCaseValueBuilder = new ArpOpCaseValueBuilder();
+ arpOpCaseValueBuilder.setArpOpValues(new ArpOpValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx
+ .match.rev140421.NxmOfArpOp.class, Nxm0Class.class, arpOpCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfArpOp value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfArpOp(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfArpOp(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfArpOp(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfArpOp(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfArpOp(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmOfArpOpGrouping> matchGrouping = MatchUtil.arpOpResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Integer value = matchGrouping.get().getNxmOfArpOp().getValue();
- ArpOpCaseValueBuilder arpOpCaseValueBuilder = new ArpOpCaseValueBuilder();
- arpOpCaseValueBuilder.setArpOpValues(new ArpOpValuesBuilder()
- .setValue(value).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpOp.class,
- Nxm0Class.class,
- arpOpCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for ArpShaCase.
+ *
* @author msunal
*/
public class ArpShaConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- ArpShaCaseValue arpShaCaseValue = ((ArpShaCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxArpShaBuilder().setMacAddress(arpShaCaseValue.getArpShaValues().getMacAddress()).build(), path,
- NxmNxArpShaKey.class);
+ ArpShaCaseValue arpShaCaseValue = (ArpShaCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(new NxmNxArpShaBuilder().setMacAddress(arpShaCaseValue.getArpShaValues()
+ .getMacAddress()).build(), path, NxmNxArpShaKey.class);
+ }
+
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxArpShaGrouping> matchGrouping = MatchUtil.ARP_SHA_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ MacAddress macAddress = matchGrouping.get().getNxmNxArpSha().getMacAddress();
+ ArpShaCaseValueBuilder arpShaCaseValueBuilder = new ArpShaCaseValueBuilder();
+ arpShaCaseValueBuilder.setArpShaValues(new ArpShaValuesBuilder()
+ .setMacAddress(macAddress).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx
+ .match.rev140421.NxmNxArpSha.class, Nxm1Class.class, arpShaCaseValueBuilder.build()).build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxArpSha value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxArpSha(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxArpSha(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxArpSha(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxArpSha(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxArpSha(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxArpShaGrouping> matchGrouping = MatchUtil.arpShaResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- MacAddress macAddress = matchGrouping.get().getNxmNxArpSha().getMacAddress();
- ArpShaCaseValueBuilder arpShaCaseValueBuilder = new ArpShaCaseValueBuilder();
- arpShaCaseValueBuilder.setArpShaValues(new ArpShaValuesBuilder()
- .setMacAddress(macAddress).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxArpSha.class,
- Nxm1Class.class,
- arpShaCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for ArpSpaCase.
+ *
* @author msunal
*/
public class ArpSpaConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- ArpSpaCaseValue arpSpaCaseValue = ((ArpSpaCaseValue) input.getMatchEntryValue());
+ ArpSpaCaseValue arpSpaCaseValue = (ArpSpaCaseValue) input.getMatchEntryValue();
Ipv4Address ipv4Address = IpConverter.longToIpv4Address(arpSpaCaseValue.getArpSpaValues().getValue());
return resolveAugmentation(new NxmOfArpSpaBuilder().setIpv4Address(ipv4Address).build(), path,
NxmOfArpSpaKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfArpSpaGrouping> matchGrouping = MatchUtil.ARP_SPA_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpSpa().getIpv4Address());
+ ArpSpaCaseValueBuilder arpSpaCaseValueBuilder = new ArpSpaCaseValueBuilder();
+ arpSpaCaseValueBuilder.setArpSpaValues(new ArpSpaValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx
+ .match.rev140421.NxmOfArpSpa.class, Nxm0Class.class, arpSpaCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfArpSpa value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfArpSpa(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfArpSpa(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfArpSpa(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfArpSpa(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfArpSpa(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmOfArpSpaGrouping> matchGrouping = MatchUtil.arpSpaResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = IpConverter.Ipv4AddressToLong(matchGrouping.get().getNxmOfArpSpa().getIpv4Address());
- ArpSpaCaseValueBuilder arpSpaCaseValueBuilder = new ArpSpaCaseValueBuilder();
- arpSpaCaseValueBuilder.setArpSpaValues(new ArpSpaValuesBuilder()
- .setValue(value).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpSpa.class,
- Nxm0Class.class,
- arpSpaCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for ArpThaCase.
+ *
* @author msunal
*/
public class ArpThaConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- ArpThaCaseValue arpThaCaseValue = ((ArpThaCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxArpThaBuilder().setMacAddress(arpThaCaseValue.getArpThaValues().getMacAddress()).build(), path,
+ ArpThaCaseValue arpThaCaseValue = (ArpThaCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(
+ new NxmNxArpThaBuilder().setMacAddress(arpThaCaseValue.getArpThaValues().getMacAddress()).build(), path,
NxmNxArpThaKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxArpThaGrouping> matchGrouping = MatchUtil.ARP_THA_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ MacAddress macAddress = matchGrouping.get().getNxmNxArpTha().getMacAddress();
+ ArpThaCaseValueBuilder arpThaCaseValueBuilder = new ArpThaCaseValueBuilder();
+ arpThaCaseValueBuilder.setArpThaValues(new ArpThaValuesBuilder()
+ .setMacAddress(macAddress).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx
+ .match.rev140421.NxmNxArpTha.class, Nxm1Class.class, arpThaCaseValueBuilder.build()).build();
+
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxArpTha value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxArpTha(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxArpTha(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxArpTha(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxArpTha(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxArpTha(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxArpThaGrouping> matchGrouping = MatchUtil.arpThaResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- MacAddress macAddress = matchGrouping.get().getNxmNxArpTha().getMacAddress();
- ArpThaCaseValueBuilder arpThaCaseValueBuilder = new ArpThaCaseValueBuilder();
- arpThaCaseValueBuilder.setArpThaValues(new ArpThaValuesBuilder()
- .setMacAddress(macAddress).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxArpTha.class,
- Nxm1Class.class,
- arpThaCaseValueBuilder.build()).build();
-
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for ArpTpaCase.
+ *
* @author msunal
*/
public class ArpTpaConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- ArpTpaCaseValue arpTpaCaseValue = ((ArpTpaCaseValue) input.getMatchEntryValue());
+ ArpTpaCaseValue arpTpaCaseValue = (ArpTpaCaseValue) input.getMatchEntryValue();
Ipv4Address ipv4Address = IpConverter.longToIpv4Address(arpTpaCaseValue.getArpTpaValues().getValue());
return resolveAugmentation(new NxmOfArpTpaBuilder().setIpv4Address(ipv4Address).build(), path,
NxmOfArpTpaKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfArpTpaGrouping> matchGrouping = MatchUtil.ARP_TPA_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpTpa().getIpv4Address());
+ ArpTpaCaseValueBuilder arpTpaCaseValueBuilder = new ArpTpaCaseValueBuilder();
+ arpTpaCaseValueBuilder.setArpTpaValues(new ArpTpaValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpTpa.class,
+ Nxm0Class.class, arpTpaCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfArpTpa value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfArpTpa(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfArpTpa(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfArpTpa(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfArpTpa(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfArpTpa(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmOfArpTpaGrouping> matchGrouping = MatchUtil.arpTpaResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = IpConverter.Ipv4AddressToLong(matchGrouping.get().getNxmOfArpTpa().getIpv4Address());
- ArpTpaCaseValueBuilder arpTpaCaseValueBuilder = new ArpTpaCaseValueBuilder();
- arpTpaCaseValueBuilder.setArpTpaValues(new ArpTpaValuesBuilder()
- .setValue(value).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpTpa.class,
- Nxm0Class.class,
- arpTpaCaseValueBuilder.build()).build();
- }
-
}
*/
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmNxCtMarkGrouping> matchGrouping = MatchUtil.ctMarkResolver.getExtension(extension);
+ Optional<NxmNxCtMarkGrouping> matchGrouping = MatchUtil.CT_MARK_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxCtMark value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxCtMark(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxCtMark(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxCtMark(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxCtMark(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxCtMark(value).build(), key);
default:
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for CtStateCase.
+ *
* @author Aswin Suryanarayanan.
*/
-
public class CtStateConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- CtStateCaseValue ctStateCaseValue = ((CtStateCaseValue) input.getMatchEntryValue());
+ CtStateCaseValue ctStateCaseValue = (CtStateCaseValue) input.getMatchEntryValue();
NxmNxCtStateBuilder ctStateBuilder = new NxmNxCtStateBuilder();
ctStateBuilder.setCtState(ctStateCaseValue.getCtStateValues().getCtState());
ctStateBuilder.setMask(ctStateCaseValue.getCtStateValues().getMask());
NxmNxCtStateKey.class);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmNxCtStateGrouping> matchGrouping = MatchUtil.ctStateResolver.getExtension(extension);
+ Optional<NxmNxCtStateGrouping> matchGrouping = MatchUtil.CT_STATE_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxCtState value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxCtState(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxCtState(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxCtState(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxCtState(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxCtState(value).build(), key);
default:
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for CtZoneCase.
+ *
* @author Aswin Suryanarayanan.
*/
-
public class CtZoneConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- CtZoneCaseValue ctZoneCaseValue = ((CtZoneCaseValue) input.getMatchEntryValue());
+ CtZoneCaseValue ctZoneCaseValue = (CtZoneCaseValue) input.getMatchEntryValue();
NxmNxCtZoneBuilder ctZoneBuilder = new NxmNxCtZoneBuilder();
ctZoneBuilder.setCtZone(ctZoneCaseValue.getCtZoneValues().getCtZone());
return resolveAugmentation(ctZoneBuilder.build(), path,
NxmNxCtZoneKey.class);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmNxCtZoneGrouping> matchGrouping = MatchUtil.ctZoneResolver.getExtension(extension);
+ Optional<NxmNxCtZoneGrouping> matchGrouping = MatchUtil.CT_ZONE_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxCtZone value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxCtZone(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxCtZone(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxCtZone(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxCtZone(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxCtZone(value).build(), key);
default:
public class EncapEthDstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- EncapEthDstCaseValue encapEthDstCaseValue = ((EncapEthDstCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxEncapEthDstBuilder().setMacAddress(encapEthDstCaseValue.getEncapEthDstValues().getMacAddress()).build(), path,
+ EncapEthDstCaseValue encapEthDstCaseValue = (EncapEthDstCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(new NxmNxEncapEthDstBuilder()
+ .setMacAddress(encapEthDstCaseValue.getEncapEthDstValues().getMacAddress()).build(), path,
NxmNxEncapEthDstKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxEncapEthDstGrouping> matchGrouping = MatchUtil.ENCAP_ETH_DST_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ MacAddress macAddress = matchGrouping.get().getNxmNxEncapEthDst().getMacAddress();
+ EncapEthDstCaseValueBuilder encapEthDstCaseValueBuilder = new EncapEthDstCaseValueBuilder();
+ encapEthDstCaseValueBuilder.setEncapEthDstValues(new EncapEthDstValuesBuilder()
+ .setMacAddress(macAddress).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthDst.class,
+ Nxm1Class.class, encapEthDstCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxEncapEthDst value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxEncapEthDst(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxEncapEthDst(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxEncapEthDst(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxEncapEthDst(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxEncapEthDst(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxEncapEthDstGrouping> matchGrouping = MatchUtil.encapEthDstResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- MacAddress macAddress = matchGrouping.get().getNxmNxEncapEthDst().getMacAddress();
- EncapEthDstCaseValueBuilder encapEthDstCaseValueBuilder = new EncapEthDstCaseValueBuilder();
- encapEthDstCaseValueBuilder.setEncapEthDstValues(new EncapEthDstValuesBuilder()
- .setMacAddress(macAddress).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthDst.class,
- Nxm1Class.class,
- encapEthDstCaseValueBuilder.build()).build();
- }
-
}
public class EncapEthSrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- EncapEthSrcCaseValue encapEthSrcCaseValue = ((EncapEthSrcCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxEncapEthSrcBuilder().setMacAddress(encapEthSrcCaseValue.getEncapEthSrcValues().getMacAddress()).build(), path,
+ EncapEthSrcCaseValue encapEthSrcCaseValue = (EncapEthSrcCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(new NxmNxEncapEthSrcBuilder()
+ .setMacAddress(encapEthSrcCaseValue.getEncapEthSrcValues().getMacAddress()).build(), path,
NxmNxEncapEthSrcKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxEncapEthSrcGrouping> matchGrouping = MatchUtil.ENCAP_ETH_SRC_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ MacAddress macAddress = matchGrouping.get().getNxmNxEncapEthSrc().getMacAddress();
+ EncapEthSrcCaseValueBuilder encapEthSrcCaseValueBuilder = new EncapEthSrcCaseValueBuilder();
+ encapEthSrcCaseValueBuilder.setEncapEthSrcValues(new EncapEthSrcValuesBuilder()
+ .setMacAddress(macAddress).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthSrc.class,
+ Nxm1Class.class, encapEthSrcCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxEncapEthSrc value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxEncapEthSrc(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxEncapEthSrc(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxEncapEthSrc(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxEncapEthSrc(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxEncapEthSrc(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxEncapEthSrcGrouping> matchGrouping = MatchUtil.encapEthSrcResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- MacAddress macAddress = matchGrouping.get().getNxmNxEncapEthSrc().getMacAddress();
- EncapEthSrcCaseValueBuilder encapEthSrcCaseValueBuilder = new EncapEthSrcCaseValueBuilder();
- encapEthSrcCaseValueBuilder.setEncapEthSrcValues(new EncapEthSrcValuesBuilder()
- .setMacAddress(macAddress).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthSrc.class,
- Nxm1Class.class,
- encapEthSrcCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.encap.eth.type.grouping.NxmNxEncapEthTypeBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
-public class EncapEthTypeConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
+public class EncapEthTypeConvertor
+ implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- EncapEthTypeCaseValue encapEthTypeCaseValue = ((EncapEthTypeCaseValue) input.getMatchEntryValue());
+ EncapEthTypeCaseValue encapEthTypeCaseValue = (EncapEthTypeCaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxEncapEthTypeBuilder().setValue(encapEthTypeCaseValue.getEncapEthTypeValues().getEncapEthType()).build(), path,
+ return resolveAugmentation(new NxmNxEncapEthTypeBuilder()
+ .setValue(encapEthTypeCaseValue.getEncapEthTypeValues().getEncapEthType()).build(), path,
NxmNxEncapEthTypeKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxEncapEthTypeGrouping> matchGrouping = MatchUtil.ENCAP_ETH_TYPE_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Integer value = matchGrouping.get().getNxmNxEncapEthType().getValue();
+ EncapEthTypeCaseValueBuilder encapEthTypeCaseValueBuilder = new EncapEthTypeCaseValueBuilder();
+ encapEthTypeCaseValueBuilder.setEncapEthTypeValues(new EncapEthTypeValuesBuilder()
+ .setEncapEthType(value).build());
+
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthType.class,
+ Nxm1Class.class, encapEthTypeCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxEncapEthType value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxEncapEthType(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxEncapEthType(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxEncapEthType(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxEncapEthType(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxEncapEthType(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxEncapEthTypeGrouping> matchGrouping = MatchUtil.encapEthTypeResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Integer value = matchGrouping.get().getNxmNxEncapEthType().getValue();
- EncapEthTypeCaseValueBuilder encapEthTypeCaseValueBuilder = new EncapEthTypeCaseValueBuilder();
- encapEthTypeCaseValueBuilder.setEncapEthTypeValues(new EncapEthTypeValuesBuilder()
- .setEncapEthType(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthType.class,
- Nxm1Class.class,
- encapEthTypeCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for EthDstCase.
+ *
* @author msunal
*/
public class EthDstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- EthDstCaseValue ethDstCaseValue = ((EthDstCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmOfEthDstBuilder().setMacAddress(ethDstCaseValue.getEthDstValues().getMacAddress()).build(), path,
+ EthDstCaseValue ethDstCaseValue = (EthDstCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(
+ new NxmOfEthDstBuilder().setMacAddress(ethDstCaseValue.getEthDstValues().getMacAddress()).build(), path,
NxmOfEthDstKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfEthDstGrouping> matchGrouping = MatchUtil.ETH_DST_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ MacAddress macAddress = matchGrouping.get().getNxmOfEthDst().getMacAddress();
+ EthDstCaseValueBuilder ethDstCaseValueBuilder = new EthDstCaseValueBuilder();
+ ethDstCaseValueBuilder.setEthDstValues(new EthDstValuesBuilder()
+ .setMacAddress(macAddress).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthDst.class,
+ Nxm0Class.class, ethDstCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfEthDst value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfEthDst(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfEthDst(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfEthDst(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfEthDst(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfEthDst(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmOfEthDstGrouping> matchGrouping = MatchUtil.ethDstResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- MacAddress macAddress = matchGrouping.get().getNxmOfEthDst().getMacAddress();
- EthDstCaseValueBuilder ethDstCaseValueBuilder = new EthDstCaseValueBuilder();
- ethDstCaseValueBuilder.setEthDstValues(new EthDstValuesBuilder()
- .setMacAddress(macAddress).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthDst.class,
- Nxm0Class.class,
- ethDstCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for EthSrcCase.
+ *
* @author msunal
*/
public class EthSrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- EthSrcCaseValue ethSrcCaseValue = ((EthSrcCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmOfEthSrcBuilder().setMacAddress(ethSrcCaseValue.getEthSrcValues().getMacAddress()).build(), path,
+ EthSrcCaseValue ethSrcCaseValue = (EthSrcCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(
+ new NxmOfEthSrcBuilder().setMacAddress(ethSrcCaseValue.getEthSrcValues().getMacAddress()).build(), path,
NxmOfEthSrcKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfEthSrcGrouping> matchGrouping = MatchUtil.ETH_SRC_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ MacAddress macAddress = matchGrouping.get().getNxmOfEthSrc().getMacAddress();
+ EthSrcCaseValueBuilder ethSrcCaseValueBuilder = new EthSrcCaseValueBuilder();
+ ethSrcCaseValueBuilder.setEthSrcValues(new EthSrcValuesBuilder()
+ .setMacAddress(macAddress).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthSrc.class,
+ Nxm0Class.class, ethSrcCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfEthSrc value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfEthSrc(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfEthSrc(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfEthSrc(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfEthSrc(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfEthSrc(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmOfEthSrcGrouping> matchGrouping = MatchUtil.ethSrcResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- MacAddress macAddress = matchGrouping.get().getNxmOfEthSrc().getMacAddress();
- EthSrcCaseValueBuilder ethSrcCaseValueBuilder = new EthSrcCaseValueBuilder();
- ethSrcCaseValueBuilder.setEthSrcValues(new EthSrcValuesBuilder()
- .setMacAddress(macAddress).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthSrc.class,
- Nxm0Class.class,
- ethSrcCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for EthTypeCase.
+ *
* @author msunal
*/
public class EthTypeConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- EthTypeCaseValue ethTypeCaseValue = ((EthTypeCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmOfEthTypeBuilder().setValue(ethTypeCaseValue.getEthTypeValues().getValue()).build(), path,
+ EthTypeCaseValue ethTypeCaseValue = (EthTypeCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(
+ new NxmOfEthTypeBuilder().setValue(ethTypeCaseValue.getEthTypeValues().getValue()).build(), path,
NxmOfEthTypeKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfEthTypeGrouping> matchGrouping = MatchUtil.ETH_TYPE_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Integer value = matchGrouping.get().getNxmOfEthType().getValue();
+ EthTypeCaseValueBuilder ethTypeCaseValueBuilder = new EthTypeCaseValueBuilder();
+ ethTypeCaseValueBuilder.setEthTypeValues(new EthTypeValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthType.class,
+ Nxm0Class.class, ethTypeCaseValueBuilder.build()).build();
+
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfEthType value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfEthType(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfEthType(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfEthType(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfEthType(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfEthType(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmOfEthTypeGrouping> matchGrouping = MatchUtil.ethTypeResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Integer value = matchGrouping.get().getNxmOfEthType().getValue();
- EthTypeCaseValueBuilder ethTypeCaseValueBuilder = new EthTypeCaseValueBuilder();
- ethTypeCaseValueBuilder.setEthTypeValues(new EthTypeValuesBuilder()
- .setValue(value).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthType.class,
- Nxm0Class.class,
- ethTypeCaseValueBuilder.build()).build();
-
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
- * @author msunal
+ * Match utilities.
*
+ * @author msunal
*/
-public class MatchUtil {
+public final class MatchUtil {
private static final Splitter SPLITTER = Splitter.on('.');
private static final Joiner JOINER = Joiner.on('.');
- private final static Set<Class<? extends Augmentation<Extension>>> augmentationsOfExtension = new HashSet<>();
- public final static GroupingResolver<NxmNxRegGrouping, Extension> regResolver = new GroupingResolver<>(
+ private static final Set<Class<? extends Augmentation<Extension>>> AUGMENTATIONS_OF_EXTENSION = new HashSet<>();
+ public static final GroupingResolver<NxmNxRegGrouping, Extension> REG_RESOLVER = new GroupingResolver<>(
NxmNxRegGrouping.class);
- public final static GroupingResolver<NxmNxTunIdGrouping, Extension> tunIdResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxTunIdGrouping, Extension> TUN_ID_RESOLVER = new GroupingResolver<>(
NxmNxTunIdGrouping.class);
- public final static GroupingResolver<NxmNxArpShaGrouping, Extension> arpShaResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxArpShaGrouping, Extension> ARP_SHA_RESOLVER = new GroupingResolver<>(
NxmNxArpShaGrouping.class);
- public final static GroupingResolver<NxmNxArpThaGrouping, Extension> arpThaResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxArpThaGrouping, Extension> ARP_THA_RESOLVER = new GroupingResolver<>(
NxmNxArpThaGrouping.class);
- public final static GroupingResolver<NxmOfArpOpGrouping, Extension> arpOpResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfArpOpGrouping, Extension> ARP_OP_RESOLVER = new GroupingResolver<>(
NxmOfArpOpGrouping.class);
- public final static GroupingResolver<NxmOfArpSpaGrouping, Extension> arpSpaResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfArpSpaGrouping, Extension> ARP_SPA_RESOLVER = new GroupingResolver<>(
NxmOfArpSpaGrouping.class);
- public final static GroupingResolver<NxmOfArpTpaGrouping, Extension> arpTpaResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfArpTpaGrouping, Extension> ARP_TPA_RESOLVER = new GroupingResolver<>(
NxmOfArpTpaGrouping.class);
- public final static GroupingResolver<NxmNxTunIpv4DstGrouping, Extension> tunIpv4DstResolver = new GroupingResolver<>(
- NxmNxTunIpv4DstGrouping.class);
- public final static GroupingResolver<NxmNxTunIpv4SrcGrouping, Extension> tunIpv4SrcResolver = new GroupingResolver<>(
- NxmNxTunIpv4SrcGrouping.class);
- public final static GroupingResolver<NxmOfEthDstGrouping, Extension> ethDstResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxTunIpv4DstGrouping, Extension> TUN_IPV4_DST_RESOLVER =
+ new GroupingResolver<>(NxmNxTunIpv4DstGrouping.class);
+ public static final GroupingResolver<NxmNxTunIpv4SrcGrouping, Extension> TUN_IPV4_SRC_RESOLVER =
+ new GroupingResolver<>(NxmNxTunIpv4SrcGrouping.class);
+ public static final GroupingResolver<NxmOfEthDstGrouping, Extension> ETH_DST_RESOLVER = new GroupingResolver<>(
NxmOfEthDstGrouping.class);
- public final static GroupingResolver<NxmOfEthSrcGrouping, Extension> ethSrcResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfEthSrcGrouping, Extension> ETH_SRC_RESOLVER = new GroupingResolver<>(
NxmOfEthSrcGrouping.class);
- public final static GroupingResolver<NxmOfEthTypeGrouping, Extension> ethTypeResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfEthTypeGrouping, Extension> ETH_TYPE_RESOLVER = new GroupingResolver<>(
NxmOfEthTypeGrouping.class);
- public final static GroupingResolver<NxmNxNsiGrouping, Extension> nsiResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxNsiGrouping, Extension> NSI_RESOLVER = new GroupingResolver<>(
NxmNxNsiGrouping.class);
- public final static GroupingResolver<NxmNxNspGrouping, Extension> nspResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxNspGrouping, Extension> NSP_RESOLVER = new GroupingResolver<>(
NxmNxNspGrouping.class);
- public final static GroupingResolver<NxmNxNshc1Grouping, Extension> nsc1Resolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxNshc1Grouping, Extension> NSC1_RESOLVER = new GroupingResolver<>(
NxmNxNshc1Grouping.class);
- public final static GroupingResolver<NxmNxNshc2Grouping, Extension> nsc2Resolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxNshc2Grouping, Extension> NSC2_RESOLVER = new GroupingResolver<>(
NxmNxNshc2Grouping.class);
- public final static GroupingResolver<NxmNxNshc3Grouping, Extension> nsc3Resolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxNshc3Grouping, Extension> NSC3_RESOLVER = new GroupingResolver<>(
NxmNxNshc3Grouping.class);
- public final static GroupingResolver<NxmNxNshc4Grouping, Extension> nsc4Resolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxNshc4Grouping, Extension> NSC4_RESOLVER = new GroupingResolver<>(
NxmNxNshc4Grouping.class);
- public final static GroupingResolver<NxmNxEncapEthTypeGrouping, Extension> encapEthTypeResolver = new GroupingResolver<>(
- NxmNxEncapEthTypeGrouping.class);
- public final static GroupingResolver<NxmNxEncapEthSrcGrouping, Extension> encapEthSrcResolver = new GroupingResolver<>(
- NxmNxEncapEthSrcGrouping.class);
- public final static GroupingResolver<NxmNxEncapEthDstGrouping, Extension> encapEthDstResolver = new GroupingResolver<>(
- NxmNxEncapEthDstGrouping.class);
- public final static GroupingResolver<NxmNxNshMdtypeGrouping, Extension> nshMdtypeResolver = new GroupingResolver<>(
- NxmNxNshMdtypeGrouping.class);
- public final static GroupingResolver<NxmNxNshNpGrouping, Extension> nshNpResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxEncapEthTypeGrouping, Extension> ENCAP_ETH_TYPE_RESOLVER =
+ new GroupingResolver<>(NxmNxEncapEthTypeGrouping.class);
+ public static final GroupingResolver<NxmNxEncapEthSrcGrouping, Extension> ENCAP_ETH_SRC_RESOLVER =
+ new GroupingResolver<>(NxmNxEncapEthSrcGrouping.class);
+ public static final GroupingResolver<NxmNxEncapEthDstGrouping, Extension> ENCAP_ETH_DST_RESOLVER =
+ new GroupingResolver<>(NxmNxEncapEthDstGrouping.class);
+ public static final GroupingResolver<NxmNxNshMdtypeGrouping, Extension> NSH_MDTYPE_RESOLVER =
+ new GroupingResolver<>(NxmNxNshMdtypeGrouping.class);
+ public static final GroupingResolver<NxmNxNshNpGrouping, Extension> NSH_NP_RESOLVER = new GroupingResolver<>(
NxmNxNshNpGrouping.class);
- public final static GroupingResolver<NxmNxTunGpeNpGrouping, Extension> tunGpeNpResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxTunGpeNpGrouping, Extension> TUN_GPE_NP_RESOLVER = new GroupingResolver<>(
NxmNxTunGpeNpGrouping.class);
- public final static GroupingResolver<NxmOfTcpSrcGrouping, Extension> tcpSrcResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfTcpSrcGrouping, Extension> TCP_SRC_RESOLVER = new GroupingResolver<>(
NxmOfTcpSrcGrouping.class);
- public final static GroupingResolver<NxmOfTcpDstGrouping, Extension> tcpDstResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfTcpDstGrouping, Extension> TCP_DST_RESOLVER = new GroupingResolver<>(
NxmOfTcpDstGrouping.class);
- public final static GroupingResolver<NxmOfUdpSrcGrouping, Extension> udpSrcResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfUdpSrcGrouping, Extension> UDP_SRC_RESOLVER = new GroupingResolver<>(
NxmOfUdpSrcGrouping.class);
- public final static GroupingResolver<NxmOfUdpDstGrouping, Extension> udpDstResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmOfUdpDstGrouping, Extension> UDP_DST_RESOLVER = new GroupingResolver<>(
NxmOfUdpDstGrouping.class);
- public final static GroupingResolver<NxmNxCtMarkGrouping, Extension> ctMarkResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxCtMarkGrouping, Extension> CT_MARK_RESOLVER = new GroupingResolver<>(
NxmNxCtMarkGrouping.class);
- public final static GroupingResolver<NxmNxCtStateGrouping, Extension> ctStateResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxCtStateGrouping, Extension> CT_STATE_RESOLVER = new GroupingResolver<>(
NxmNxCtStateGrouping.class);
- public final static GroupingResolver<NxmNxCtZoneGrouping, Extension> ctZoneResolver = new GroupingResolver<>(
+ public static final GroupingResolver<NxmNxCtZoneGrouping, Extension> CT_ZONE_RESOLVER = new GroupingResolver<>(
NxmNxCtZoneGrouping.class);
- public final static GroupingResolver<NxmOfInPortGrouping, Extension> nxmOfInportResolver = new GroupingResolver<>(
- NxmOfInPortGrouping.class);
+ public static final GroupingResolver<NxmOfInPortGrouping, Extension> NXM_OF_INPORT_RESOLVER =
+ new GroupingResolver<>(NxmOfInPortGrouping.class);
static {
- augmentationsOfExtension.add(NxAugMatchRpcAddFlow.class);
- augmentationsOfExtension.add(NxAugMatchRpcRemoveFlow.class);
- augmentationsOfExtension.add(NxAugMatchRpcUpdateFlowOriginal.class);
- augmentationsOfExtension.add(NxAugMatchRpcUpdateFlowUpdated.class);
- augmentationsOfExtension.add(NxAugMatchNodesNodeTableFlow.class);
- augmentationsOfExtension.add(NxAugMatchNotifSwitchFlowRemoved.class);
- augmentationsOfExtension.add(NxAugMatchNotifPacketIn.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcAddFlow.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcRemoveFlow.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcUpdateFlowOriginal.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcUpdateFlowUpdated.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchNodesNodeTableFlow.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchNotifSwitchFlowRemoved.class);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchNotifPacketIn.class);
//augmentationsOfExtension.add(NxAugMatchNotifUpdateFlowStats.class);
- augmentationsOfExtension.add(NxAugMatchPacketInMessage.class);
- regResolver.setAugmentations(augmentationsOfExtension);
- tunIdResolver.setAugmentations(augmentationsOfExtension);
- arpShaResolver.setAugmentations(augmentationsOfExtension);
- arpThaResolver.setAugmentations(augmentationsOfExtension);
- arpOpResolver.setAugmentations(augmentationsOfExtension);
- arpSpaResolver.setAugmentations(augmentationsOfExtension);
- arpTpaResolver.setAugmentations(augmentationsOfExtension);
- tunIpv4DstResolver.setAugmentations(augmentationsOfExtension);
- tunIpv4SrcResolver.setAugmentations(augmentationsOfExtension);
- ethDstResolver.setAugmentations(augmentationsOfExtension);
- ethSrcResolver.setAugmentations(augmentationsOfExtension);
- ethTypeResolver.setAugmentations(augmentationsOfExtension);
- nspResolver.setAugmentations(augmentationsOfExtension);
- nsiResolver.setAugmentations(augmentationsOfExtension);
- nsc1Resolver.setAugmentations(augmentationsOfExtension);
- nsc2Resolver.setAugmentations(augmentationsOfExtension);
- nsc3Resolver.setAugmentations(augmentationsOfExtension);
- nsc4Resolver.setAugmentations(augmentationsOfExtension);
- encapEthTypeResolver.setAugmentations(augmentationsOfExtension);
- encapEthSrcResolver.setAugmentations(augmentationsOfExtension);
- encapEthDstResolver.setAugmentations(augmentationsOfExtension);
- nshMdtypeResolver.setAugmentations(augmentationsOfExtension);
- nshNpResolver.setAugmentations(augmentationsOfExtension);
- tunGpeNpResolver.setAugmentations(augmentationsOfExtension);
- tcpSrcResolver.setAugmentations(augmentationsOfExtension);
- tcpDstResolver.setAugmentations(augmentationsOfExtension);
- udpSrcResolver.setAugmentations(augmentationsOfExtension);
- udpDstResolver.setAugmentations(augmentationsOfExtension);
- ctStateResolver.setAugmentations(augmentationsOfExtension);
- ctZoneResolver.setAugmentations(augmentationsOfExtension);
- nxmOfInportResolver.setAugmentations(augmentationsOfExtension);
- ctMarkResolver.setAugmentations(augmentationsOfExtension);
+ AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchPacketInMessage.class);
+ REG_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ TUN_ID_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ARP_SHA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ARP_THA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ARP_OP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ARP_SPA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ARP_TPA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ TUN_IPV4_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ TUN_IPV4_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ETH_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ETH_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ETH_TYPE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSI_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSC1_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSC2_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSC3_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSC4_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ENCAP_ETH_TYPE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ENCAP_ETH_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ ENCAP_ETH_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSH_MDTYPE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NSH_NP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ TUN_GPE_NP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ TCP_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ TCP_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ UDP_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ UDP_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ CT_STATE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ CT_ZONE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ NXM_OF_INPORT_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ CT_MARK_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+ }
+
+ private MatchUtil() {
}
public static MatchEntryBuilder createDefaultMatchEntryBuilder(Class<? extends MatchField> matchField,
Class<? extends OxmClassBase> oxmClass,
- MatchEntryValue matchEntryValue){
+ MatchEntryValue matchEntryValue) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(matchField);
public static Long ipv4ToLong(Ipv4Address ipv4) {
Iterator<String> iterator = SPLITTER.split(ipv4.getValue()).iterator();
byte[] bytes = new byte[8];
- for(int i =0;i < bytes.length;i++) {
- if(i<4) {
+ for (int i = 0; i < bytes.length; i++) {
+ if (i < 4) {
bytes[i] = 0;
} else {
- bytes[i] = UnsignedBytes.parseUnsignedByte((iterator.next()));
+ bytes[i] = UnsignedBytes.parseUnsignedByte(iterator.next());
}
}
Long result = Longs.fromByteArray(bytes);
return result;
}
- public static Ipv4Address longToIpv4Address(Long l) {
- byte[] bytes = Longs.toByteArray(l);
+ public static Ipv4Address longToIpv4Address(Long value) {
+ byte[] bytes = Longs.toByteArray(value);
String[] strArray = new String[4];
- for(int i = 4;i < bytes.length;i++) {
- strArray[i-4]=UnsignedBytes.toString(bytes[i]);
+ for (int i = 4; i < bytes.length; i++) {
+ strArray[i - 4] = UnsignedBytes.toString(bytes[i]);
}
String str = JOINER.join(strArray);
Ipv4Address result = new Ipv4Address(str);
public class NshMdtypeConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- NshMdtypeCaseValue nshMdtypeCaseValue = ((NshMdtypeCaseValue) input.getMatchEntryValue());
+ NshMdtypeCaseValue nshMdtypeCaseValue = (NshMdtypeCaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxNshMdtypeBuilder().setValue(nshMdtypeCaseValue.getNshMdtypeValues().getValue()).build(), path,
+ return resolveAugmentation(
+ new NxmNxNshMdtypeBuilder().setValue(nshMdtypeCaseValue.getNshMdtypeValues().getValue()).build(), path,
NxmNxNshMdtypeKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNshMdtypeGrouping> matchGrouping = MatchUtil.NSH_MDTYPE_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Short value = matchGrouping.get().getNxmNxNshMdtype().getValue();
+ NshMdtypeCaseValueBuilder nshMdtypeCaseValueBuilder = new NshMdtypeCaseValueBuilder();
+ nshMdtypeCaseValueBuilder.setNshMdtypeValues(new NshMdtypeValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshMdtype.class,
+ Nxm1Class.class, nshMdtypeCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNshMdtype value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNshMdtype(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNshMdtype(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNshMdtype(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNshMdtype(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNshMdtype(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNshMdtypeGrouping> matchGrouping = MatchUtil.nshMdtypeResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Short value = matchGrouping.get().getNxmNxNshMdtype().getValue();
- NshMdtypeCaseValueBuilder nshMdtypeCaseValueBuilder = new NshMdtypeCaseValueBuilder();
- nshMdtypeCaseValueBuilder.setNshMdtypeValues(new NshMdtypeValuesBuilder()
- .setValue(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshMdtype.class,
- Nxm1Class.class,
- nshMdtypeCaseValueBuilder.build()).build();
- }
-
}
public class NshNpConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- NshNpCaseValue nshNpCaseValue = ((NshNpCaseValue) input.getMatchEntryValue());
+ NshNpCaseValue nshNpCaseValue = (NshNpCaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxNshNpBuilder().setValue(nshNpCaseValue.getNshNpValues().getValue()).build(), path,
- NxmNxNshNpKey.class);
+ return resolveAugmentation(new NxmNxNshNpBuilder().setValue(nshNpCaseValue.getNshNpValues().getValue()).build(),
+ path, NxmNxNshNpKey.class);
+ }
+
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNshNpGrouping> matchGrouping = MatchUtil.NSH_NP_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Short value = matchGrouping.get().getNxmNxNshNp().getValue();
+ NshNpCaseValueBuilder nshNpCaseValueBuilder = new NshNpCaseValueBuilder();
+ nshNpCaseValueBuilder.setNshNpValues(new NshNpValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshNp.class,
+ Nxm1Class.class, nshNpCaseValueBuilder.build()).build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNshNp value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNshNp(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNshNp(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNshNp(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNshNp(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNshNp(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNshNpGrouping> matchGrouping = MatchUtil.nshNpResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Short value = matchGrouping.get().getNxmNxNshNp().getValue();
- NshNpCaseValueBuilder nshNpCaseValueBuilder = new NshNpCaseValueBuilder();
- nshNpCaseValueBuilder.setNshNpValues(new NshNpValuesBuilder()
- .setValue(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshNp.class,
- Nxm1Class.class,
- nshNpCaseValueBuilder.build()).build();
- }
-
}
public class Nshc1Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- Nshc1CaseValue nsc1CaseValue = ((Nshc1CaseValue) input.getMatchEntryValue());
+ Nshc1CaseValue nsc1CaseValue = (Nshc1CaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxNshc1Builder().setValue(nsc1CaseValue.getNshc1Values().getNshc()).build(), path,
- NxmNxNshc1Key.class);
+ return resolveAugmentation(new NxmNxNshc1Builder().setValue(nsc1CaseValue.getNshc1Values().getNshc()).build(),
+ path, NxmNxNshc1Key.class);
+ }
+
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNshc1Grouping> matchGrouping = MatchUtil.NSC1_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = matchGrouping.get().getNxmNxNshc1().getValue();
+ Nshc1CaseValueBuilder nsc1CaseValueBuilder = new Nshc1CaseValueBuilder();
+ nsc1CaseValueBuilder.setNshc1Values(new Nshc1ValuesBuilder()
+ .setNshc(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc1.class,
+ Nxm1Class.class, nsc1CaseValueBuilder.build()).build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNshc1 value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNshc1(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNshc1(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNshc1(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNshc1(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNshc1(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNshc1Grouping> matchGrouping = MatchUtil.nsc1Resolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = matchGrouping.get().getNxmNxNshc1().getValue();
- Nshc1CaseValueBuilder nsc1CaseValueBuilder = new Nshc1CaseValueBuilder();
- nsc1CaseValueBuilder.setNshc1Values(new Nshc1ValuesBuilder()
- .setNshc(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc1.class,
- Nxm1Class.class,
- nsc1CaseValueBuilder.build()).build();
- }
-
}
public class Nshc2Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- Nshc2CaseValue nsc2CaseValue = ((Nshc2CaseValue) input.getMatchEntryValue());
+ Nshc2CaseValue nsc2CaseValue = (Nshc2CaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxNshc2Builder().setValue(nsc2CaseValue.getNshc2Values().getNshc()).build(), path,
- NxmNxNshc2Key.class);
+ return resolveAugmentation(new NxmNxNshc2Builder().setValue(nsc2CaseValue.getNshc2Values().getNshc()).build(),
+ path, NxmNxNshc2Key.class);
+ }
+
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNshc2Grouping> matchGrouping = MatchUtil.NSC2_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = matchGrouping.get().getNxmNxNshc2().getValue();
+ Nshc2CaseValueBuilder nsc2CaseValueBuilder = new Nshc2CaseValueBuilder();
+ nsc2CaseValueBuilder.setNshc2Values(new Nshc2ValuesBuilder()
+ .setNshc(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc2.class,
+ Nxm1Class.class, nsc2CaseValueBuilder.build()).build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNshc2 value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNshc2(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNshc2(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNshc2(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNshc2(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNshc2(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNshc2Grouping> matchGrouping = MatchUtil.nsc2Resolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = matchGrouping.get().getNxmNxNshc2().getValue();
- Nshc2CaseValueBuilder nsc2CaseValueBuilder = new Nshc2CaseValueBuilder();
- nsc2CaseValueBuilder.setNshc2Values(new Nshc2ValuesBuilder()
- .setNshc(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc2.class,
- Nxm1Class.class,
- nsc2CaseValueBuilder.build()).build();
- }
-
}
public class Nshc3Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- Nshc3CaseValue nsc3CaseValue = ((Nshc3CaseValue) input.getMatchEntryValue());
+ Nshc3CaseValue nsc3CaseValue = (Nshc3CaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxNshc3Builder().setValue(nsc3CaseValue.getNshc3Values().getNshc()).build(), path,
- NxmNxNshc3Key.class);
+ return resolveAugmentation(new NxmNxNshc3Builder().setValue(nsc3CaseValue.getNshc3Values().getNshc()).build(),
+ path, NxmNxNshc3Key.class);
+ }
+
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNshc3Grouping> matchGrouping = MatchUtil.NSC3_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = matchGrouping.get().getNxmNxNshc3().getValue();
+ Nshc3CaseValueBuilder nsc3CaseValueBuilder = new Nshc3CaseValueBuilder();
+ nsc3CaseValueBuilder.setNshc3Values(new Nshc3ValuesBuilder()
+ .setNshc(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc3.class,
+ Nxm1Class.class, nsc3CaseValueBuilder.build()).build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNshc3 value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNshc3(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNshc3(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNshc3(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNshc3(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNshc3(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNshc3Grouping> matchGrouping = MatchUtil.nsc3Resolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = matchGrouping.get().getNxmNxNshc3().getValue();
- Nshc3CaseValueBuilder nsc3CaseValueBuilder = new Nshc3CaseValueBuilder();
- nsc3CaseValueBuilder.setNshc3Values(new Nshc3ValuesBuilder()
- .setNshc(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc3.class,
- Nxm1Class.class,
- nsc3CaseValueBuilder.build()).build();
- }
-
}
public class Nshc4Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- Nshc4CaseValue nsc4CaseValue = ((Nshc4CaseValue) input.getMatchEntryValue());
+ Nshc4CaseValue nsc4CaseValue = (Nshc4CaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxNshc4Builder().setValue(nsc4CaseValue.getNshc4Values().getNshc()).build(), path,
- NxmNxNshc4Key.class);
+ return resolveAugmentation(new NxmNxNshc4Builder().setValue(nsc4CaseValue.getNshc4Values().getNshc()).build(),
+ path, NxmNxNshc4Key.class);
+ }
+
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNshc4Grouping> matchGrouping = MatchUtil.NSC4_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = matchGrouping.get().getNxmNxNshc4().getValue();
+ Nshc4CaseValueBuilder nsc4CaseValueBuilder = new Nshc4CaseValueBuilder();
+ nsc4CaseValueBuilder.setNshc4Values(new Nshc4ValuesBuilder()
+ .setNshc(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc4.class,
+ Nxm1Class.class, nsc4CaseValueBuilder.build()).build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNshc4 value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNshc4(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNshc4(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNshc4(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNshc4(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNshc4(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNshc4Grouping> matchGrouping = MatchUtil.nsc4Resolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = matchGrouping.get().getNxmNxNshc4().getValue();
- Nshc4CaseValueBuilder nsc4CaseValueBuilder = new Nshc4CaseValueBuilder();
- nsc4CaseValueBuilder.setNshc4Values(new Nshc4ValuesBuilder()
- .setNshc(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc4.class,
- Nxm1Class.class,
- nsc4CaseValueBuilder.build()).build();
- }
-
}
public class NsiConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- NsiCaseValue nsiCaseValue = ((NsiCaseValue) input.getMatchEntryValue());
+ NsiCaseValue nsiCaseValue = (NsiCaseValue) input.getMatchEntryValue();
return resolveAugmentation(new NxmNxNsiBuilder().setNsi(nsiCaseValue.getNsiValues().getNsi()).build(), path,
NxmNxNsiKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNsiGrouping> matchGrouping = MatchUtil.NSI_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Short value = matchGrouping.get().getNxmNxNsi().getNsi();
+
+ NsiCaseValueBuilder nsiCaseValueBuilder = new NsiCaseValueBuilder();
+ nsiCaseValueBuilder.setNsiValues(new NsiValuesBuilder()
+ .setNsi(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsi.class,
+ Nxm1Class.class, nsiCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNsi value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNsi(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNsi(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNsi(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNsi(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNsi(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNsiGrouping> matchGrouping = MatchUtil.nsiResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Short value = matchGrouping.get().getNxmNxNsi().getNsi();
-
- NsiCaseValueBuilder nsiCaseValueBuilder = new NsiCaseValueBuilder();
- nsiCaseValueBuilder.setNsiValues(new NsiValuesBuilder()
- .setNsi(value).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsi.class,
- Nxm1Class.class,
- nsiCaseValueBuilder.build()).build();
-
- }
-
}
public class NspConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- NspCaseValue nspCaseValue = ((NspCaseValue) input.getMatchEntryValue());
+ NspCaseValue nspCaseValue = (NspCaseValue) input.getMatchEntryValue();
return resolveAugmentation(new NxmNxNspBuilder().setValue(nspCaseValue.getNspValues().getNsp()).build(), path,
NxmNxNspKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxNspGrouping> matchGrouping = MatchUtil.NSP_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Long value = matchGrouping.get().getNxmNxNsp().getValue();
+ NspCaseValueBuilder nspCaseValueBuilder = new NspCaseValueBuilder();
+ nspCaseValueBuilder.setNspValues(new NspValuesBuilder()
+ .setNsp(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsp.class,
+ Nxm1Class.class, nspCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxNsp value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxNsp(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxNsp(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxNsp(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNsp(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxNsp(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxNspGrouping> matchGrouping = MatchUtil.nspResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Long value = matchGrouping.get().getNxmNxNsp().getValue();
- NspCaseValueBuilder nspCaseValueBuilder = new NspCaseValueBuilder();
- nspCaseValueBuilder.setNspValues(new NspValuesBuilder()
- .setNsp(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsp.class,
- Nxm1Class.class,
- nspCaseValueBuilder.build()).build();
- }
-
}
public class NxmInPortConvertor implements ConvertorToOFJava<MatchEntry>,
ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(
MatchEntry input, MatchPath path) {
- OfInPortCaseValue inPortCaseValue = ((OfInPortCaseValue) input
- .getMatchEntryValue());
+ OfInPortCaseValue inPortCaseValue = (OfInPortCaseValue) input
+ .getMatchEntryValue();
return NxmInPortConvertor.resolveAugmentation(new OfInPortBuilder()
.setValue(inPortCaseValue.getNxmOfInPortValues().getValue())
.build(), path, NxmOfInPortKey.class);
}
- private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.in.port.grouping.OfInPort value,
- MatchPath path, Class<? extends ExtensionKey> key) {
- switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
- new NxAugMatchNodesNodeTableFlowBuilder().setOfInPort(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
- new NxAugMatchRpcGetFlowStatsBuilder().setOfInPort(value).build(), key);
- case PACKETRECEIVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class,
- new NxAugMatchNotifPacketInBuilder().setOfInPort(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
- new NxAugMatchNotifSwitchFlowRemovedBuilder().setOfInPort(value).build(), key);
- case PACKETINMESSAGE_MATCH:
- return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
- new NxAugMatchPacketInMessageBuilder().setOfInPort(value).build(), key);
- default:
- throw new CodecPreconditionException(path);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.
- * general .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmOfInPortGrouping> matchGrouping = MatchUtil.nxmOfInportResolver
+ Optional<NxmOfInPortGrouping> matchGrouping = MatchUtil.NXM_OF_INPORT_RESOLVER
.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
.build();
}
+
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.in
+ .port.grouping.OfInPort value, MatchPath path, Class<? extends ExtensionKey> key) {
+ switch (path) {
+ case FLOWS_STATISTICS_UPDATE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
+ new NxAugMatchNodesNodeTableFlowBuilder().setOfInPort(value).build(), key);
+ case FLOWS_STATISTICS_RPC_MATCH:
+ return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
+ new NxAugMatchRpcGetFlowStatsBuilder().setOfInPort(value).build(), key);
+ case PACKET_RECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class,
+ new NxAugMatchNotifPacketInBuilder().setOfInPort(value).build(), key);
+ case SWITCH_FLOW_REMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setOfInPort(value).build(), key);
+ case PACKET_IN_MESSAGE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
+ new NxAugMatchPacketInMessageBuilder().setOfInPort(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
}
import org.slf4j.LoggerFactory;
/**
+ * Convert to/from SAL flow model to openflowjava model for NxmNxReg.
+ *
* @author msunal
*/
public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- private final static Logger LOG = LoggerFactory.getLogger(RegConvertor.class);
+ private static final Logger LOG = LoggerFactory.getLogger(RegConvertor.class);
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@SuppressWarnings("unchecked")
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
LOG.warn(msg);
throw new IllegalStateException(msg);
}
- nxRegBuilder
- .setReg((Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg>) input
- .getOxmMatchField());
- RegCaseValue regCaseValue = ((RegCaseValue) input.getMatchEntryValue());
+ nxRegBuilder.setReg((Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match
+ .rev140421.NxmNxReg>) input.getOxmMatchField());
+ RegCaseValue regCaseValue = (RegCaseValue) input.getMatchEntryValue();
nxRegBuilder.setValue(regCaseValue.getRegValues().getValue());
if (input.isHasMask()) {
return resolveAugmentation(nxRegBuilder.build(), path, resolveRegKey(input.getOxmMatchField()));
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxRegGrouping> matchGrouping = MatchUtil.REG_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ NxmNxReg nxmNxReg = matchGrouping.get().getNxmNxReg();
+ RegValuesBuilder regValuesBuilder = new RegValuesBuilder()
+ .setValue(nxmNxReg.getValue())
+ .setMask(nxmNxReg.getMask());
+
+ RegCaseValueBuilder regCaseValueBuilder = new RegCaseValueBuilder();
+ regCaseValueBuilder.setRegValues(regValuesBuilder.build());
+ return MatchUtil.createDefaultMatchEntryBuilder(nxmNxReg.getReg(),
+ Nxm1Class.class,
+ regCaseValueBuilder.build())
+ .setHasMask(Objects.nonNull(nxmNxReg.getMask()))
+ .build();
+ }
+
private static Class<? extends ExtensionKey> resolveRegKey(Class<? extends MatchField> oxmMatchField) {
if (NiciraMatchCodecs.REG0_CODEC.getNxmField().isAssignableFrom(oxmMatchField)) {
return NxmNxReg0Key.class;
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxReg nxmNxReg,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxReg(nxmNxReg).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxReg(nxmNxReg).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxReg(nxmNxReg).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxReg(nxmNxReg).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxReg(nxmNxReg).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxRegGrouping> matchGrouping = MatchUtil.regResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- NxmNxReg nxmNxReg = matchGrouping.get().getNxmNxReg();
- RegValuesBuilder regValuesBuilder = new RegValuesBuilder()
- .setValue(nxmNxReg.getValue())
- .setMask(nxmNxReg.getMask());
-
- RegCaseValueBuilder regCaseValueBuilder = new RegCaseValueBuilder();
- regCaseValueBuilder.setRegValues(regValuesBuilder.build());
- return MatchUtil.createDefaultMatchEntryBuilder(nxmNxReg.getReg(),
- Nxm1Class.class,
- regCaseValueBuilder.build())
- .setHasMask(Objects.nonNull(nxmNxReg.getMask()))
- .build();
- }
-
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for TcpDstCase.
+ *
* @author Aswin Suryanarayanan.
*/
public class TcpDstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- TcpDstCaseValue tcpDstCaseValue = ((TcpDstCaseValue) input.getMatchEntryValue());
+ TcpDstCaseValue tcpDstCaseValue = (TcpDstCaseValue) input.getMatchEntryValue();
NxmOfTcpDstBuilder tcpDstBuilder = new NxmOfTcpDstBuilder();
tcpDstBuilder.setPort(tcpDstCaseValue.getTcpDstValues().getPort());
tcpDstBuilder.setMask(tcpDstCaseValue.getTcpDstValues().getMask());
NxmOfTcpDstKey.class);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmOfTcpDstGrouping> matchGrouping = MatchUtil.tcpDstResolver.getExtension(extension);
+ Optional<NxmOfTcpDstGrouping> matchGrouping = MatchUtil.TCP_DST_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfTcpDst value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfTcpDst(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfTcpDst(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfTcpDst(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfTcpDst(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfTcpDst(value).build(), key);
default:
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for TcpSrcCase.
+ *
* @author Aswin Suryanarayanan.
*/
public class TcpSrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- TcpSrcCaseValue tcpSrcCaseValue = ((TcpSrcCaseValue) input.getMatchEntryValue());
+ TcpSrcCaseValue tcpSrcCaseValue = (TcpSrcCaseValue) input.getMatchEntryValue();
NxmOfTcpSrcBuilder tcpSrcBuilder = new NxmOfTcpSrcBuilder();
tcpSrcBuilder.setPort(tcpSrcCaseValue.getTcpSrcValues().getPort());
tcpSrcBuilder.setMask(tcpSrcCaseValue.getTcpSrcValues().getMask());
NxmOfTcpSrcKey.class);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmOfTcpSrcGrouping> matchGrouping = MatchUtil.tcpSrcResolver.getExtension(extension);
+ Optional<NxmOfTcpSrcGrouping> matchGrouping = MatchUtil.TCP_SRC_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfTcpSrc value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfTcpSrc(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfTcpSrc(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfTcpSrc(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfTcpSrc(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfTcpSrc(value).build(), key);
default:
public class TunGpeNpConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- TunGpeNpCaseValue tunGpeNpCaseValue = ((TunGpeNpCaseValue) input.getMatchEntryValue());
+ TunGpeNpCaseValue tunGpeNpCaseValue = (TunGpeNpCaseValue) input.getMatchEntryValue();
- return resolveAugmentation(new NxmNxTunGpeNpBuilder().setValue(tunGpeNpCaseValue.getTunGpeNpValues().getValue()).build(), path,
+ return resolveAugmentation(
+ new NxmNxTunGpeNpBuilder().setValue(tunGpeNpCaseValue.getTunGpeNpValues().getValue()).build(), path,
NxmNxTunGpeNpKey.class);
}
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmNxTunGpeNpGrouping> matchGrouping = MatchUtil.TUN_GPE_NP_RESOLVER.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ Short value = matchGrouping.get().getNxmNxTunGpeNp().getValue();
+ TunGpeNpCaseValueBuilder tunGpeNpCaseValueBuilder = new TunGpeNpCaseValueBuilder();
+ tunGpeNpCaseValueBuilder.setTunGpeNpValues(new TunGpeNpValuesBuilder()
+ .setValue(value).build());
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunGpeNp.class,
+ Nxm1Class.class, tunGpeNpCaseValueBuilder.build()).build();
+ }
+
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxTunGpeNp value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunGpeNp(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunGpeNp(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmNxTunGpeNp(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunGpeNp(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmNxTunGpeNp(value).build(), key);
default:
throw new CodecPreconditionException(path);
}
}
-
- @Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxTunGpeNpGrouping> matchGrouping = MatchUtil.tunGpeNpResolver.getExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Short value = matchGrouping.get().getNxmNxTunGpeNp().getValue();
- TunGpeNpCaseValueBuilder tunGpeNpCaseValueBuilder = new TunGpeNpCaseValueBuilder();
- tunGpeNpCaseValueBuilder.setTunGpeNpValues(new TunGpeNpValuesBuilder()
- .setValue(value).build());
-
-
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunGpeNp.class,
- Nxm1Class.class,
- tunGpeNpCaseValueBuilder.build()).build();
- }
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.ipv4.dst.grouping.NxmNxTunIpv4DstBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
-public class TunIPv4DstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath>{
+public class TunIPv4DstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxTunIpv4Dst value,
MatchPath path, Class<? extends ExtensionKey> key) {
- switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
- new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunIpv4Dst(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
- new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunIpv4Dst(value).build(), key);
- case PACKETRECEIVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class,
- new NxAugMatchNotifPacketInBuilder().setNxmNxTunIpv4Dst(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
- new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunIpv4Dst(value).build(), key);
- case PACKETINMESSAGE_MATCH:
- return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
- new NxAugMatchPacketInMessageBuilder().setNxmNxTunIpv4Dst(value).build(), key);
- default:
- throw new CodecPreconditionException(path);
- }
+ switch (path) {
+ case FLOWS_STATISTICS_UPDATE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
+ new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunIpv4Dst(value).build(), key);
+ case FLOWS_STATISTICS_RPC_MATCH:
+ return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
+ new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunIpv4Dst(value).build(), key);
+ case PACKET_RECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class,
+ new NxAugMatchNotifPacketInBuilder().setNxmNxTunIpv4Dst(value).build(), key);
+ case SWITCH_FLOW_REMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunIpv4Dst(value).build(), key);
+ case PACKET_IN_MESSAGE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
+ new NxAugMatchPacketInMessageBuilder().setNxmNxTunIpv4Dst(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
}
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(
MatchEntry input, MatchPath path) {
- TunIpv4DstCaseValue tunIpv4DstCaseValue = ((TunIpv4DstCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxTunIpv4DstBuilder().setIpv4Address(MatchUtil.longToIpv4Address(tunIpv4DstCaseValue.getTunIpv4DstValues().getValue())).build(), path,
- NxmNxTunIpv4DstKey.class);
+ TunIpv4DstCaseValue tunIpv4DstCaseValue = (TunIpv4DstCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(new NxmNxTunIpv4DstBuilder()
+ .setIpv4Address(MatchUtil.longToIpv4Address(tunIpv4DstCaseValue.getTunIpv4DstValues().getValue()))
+ .build(), path, NxmNxTunIpv4DstKey.class);
}
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmNxTunIpv4DstGrouping> matchGrouping = MatchUtil.tunIpv4DstResolver.getExtension(extension);
+ Optional<NxmNxTunIpv4DstGrouping> matchGrouping = MatchUtil.TUN_IPV4_DST_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
TunIpv4DstCaseValueBuilder tunIpv4DstCaseValueBuilder = new TunIpv4DstCaseValueBuilder();
tunIpv4DstCaseValueBuilder.setTunIpv4DstValues(new TunIpv4DstValuesBuilder()
.setValue(MatchUtil.ipv4ToLong(value)).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Dst.class,
- Nxm1Class.class,
- tunIpv4DstCaseValueBuilder.build()).build();
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Dst.class,
+ Nxm1Class.class, tunIpv4DstCaseValueBuilder.build()).build();
}
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.ipv4.src.grouping.NxmNxTunIpv4SrcBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
-public class TunIPv4SrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath>{
+public class TunIPv4SrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxTunIpv4Src value,
MatchPath path, Class<? extends ExtensionKey> key) {
- switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
- new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunIpv4Src(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
- new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunIpv4Src(value).build(), key);
- case PACKETRECEIVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class,
- new NxAugMatchNotifPacketInBuilder().setNxmNxTunIpv4Src(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
- new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunIpv4Src(value).build(), key);
- case PACKETINMESSAGE_MATCH:
- return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
- new NxAugMatchPacketInMessageBuilder().setNxmNxTunIpv4Src(value).build(), key);
- default:
- throw new CodecPreconditionException(path);
- }
+ switch (path) {
+ case FLOWS_STATISTICS_UPDATE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
+ new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunIpv4Src(value).build(), key);
+ case FLOWS_STATISTICS_RPC_MATCH:
+ return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
+ new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunIpv4Src(value).build(), key);
+ case PACKET_RECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class,
+ new NxAugMatchNotifPacketInBuilder().setNxmNxTunIpv4Src(value).build(), key);
+ case SWITCH_FLOW_REMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunIpv4Src(value).build(), key);
+ case PACKET_IN_MESSAGE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
+ new NxAugMatchPacketInMessageBuilder().setNxmNxTunIpv4Src(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
}
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(
MatchEntry input, MatchPath path) {
- TunIpv4SrcCaseValue tunIpv4SrcCaseValue = ((TunIpv4SrcCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxTunIpv4SrcBuilder().setIpv4Address(MatchUtil.longToIpv4Address(tunIpv4SrcCaseValue.getTunIpv4SrcValues().getValue())).build(), path,
- NxmNxTunIpv4SrcKey.class);
+ TunIpv4SrcCaseValue tunIpv4SrcCaseValue = (TunIpv4SrcCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(new NxmNxTunIpv4SrcBuilder()
+ .setIpv4Address(MatchUtil.longToIpv4Address(tunIpv4SrcCaseValue.getTunIpv4SrcValues().getValue()))
+ .build(), path, NxmNxTunIpv4SrcKey.class);
}
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmNxTunIpv4SrcGrouping> matchGrouping = MatchUtil.tunIpv4SrcResolver.getExtension(extension);
+ Optional<NxmNxTunIpv4SrcGrouping> matchGrouping = MatchUtil.TUN_IPV4_SRC_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
TunIpv4SrcCaseValueBuilder tunIpv4SrcCaseValueBuilder = new TunIpv4SrcCaseValueBuilder();
tunIpv4SrcCaseValueBuilder.setTunIpv4SrcValues(new TunIpv4SrcValuesBuilder()
.setValue(MatchUtil.ipv4ToLong(value)).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Src.class,
- Nxm1Class.class,
- tunIpv4SrcCaseValueBuilder.build()).build();
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Src.class,
+ Nxm1Class.class, tunIpv4SrcCaseValueBuilder.build()).build();
}
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for TunIdCase.
+ *
* @author msunal
*/
public class TunIdConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(final MatchEntry input, final MatchPath path) {
- TunIdCaseValue tunnelIdCase = ((TunIdCaseValue) input.getMatchEntryValue());
- return resolveAugmentation(new NxmNxTunIdBuilder().setValue(tunnelIdCase.getTunIdValues().getValue()).build(), path,
- NxmNxTunIdKey.class);
+ TunIdCaseValue tunnelIdCase = (TunIdCaseValue) input.getMatchEntryValue();
+ return resolveAugmentation(new NxmNxTunIdBuilder().setValue(tunnelIdCase.getTunIdValues().getValue()).build(),
+ path, NxmNxTunIdKey.class);
}
- private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmNxTunId value,
- final MatchPath path, final Class<? extends ExtensionKey> key) {
- switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
- new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunId(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
- return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
- new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunId(value).build(), key);
- case PACKETRECEIVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
- .setNxmNxTunId(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
- return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
- new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunId(value).build(), key);
- case PACKETINMESSAGE_MATCH:
- return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
- new NxAugMatchPacketInMessageBuilder().setNxmNxTunId(value).build(), key);
- default:
- throw new CodecPreconditionException(path);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(final Extension extension) {
- Optional<NxmNxTunIdGrouping> matchGrouping = MatchUtil.tunIdResolver.getExtension(extension);
+ Optional<NxmNxTunIdGrouping> matchGrouping = MatchUtil.TUN_ID_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
tunnelIdBuilder.setValue(value);
tunnelIdCaseBuilder.setTunIdValues(tunnelIdBuilder.build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunId.class,
- Nxm1Class.class,
- tunnelIdCaseBuilder.build()).build();
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunId.class,
+ Nxm1Class.class, tunnelIdCaseBuilder.build()).build();
}
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmNxTunId value,
+ final MatchPath path, final Class<? extends ExtensionKey> key) {
+ switch (path) {
+ case FLOWS_STATISTICS_UPDATE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
+ new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxTunId(value).build(), key);
+ case FLOWS_STATISTICS_RPC_MATCH:
+ return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
+ new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxTunId(value).build(), key);
+ case PACKET_RECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
+ .setNxmNxTunId(value).build(), key);
+ case SWITCH_FLOW_REMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxTunId(value).build(), key);
+ case PACKET_IN_MESSAGE_MATCH:
+ return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
+ new NxAugMatchPacketInMessageBuilder().setNxmNxTunId(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
}
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for UdpDstCase.
+ *
* @author Aswin Suryanarayanan.
*/
public class UdpDstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- UdpDstCaseValue udpDstCaseValue = ((UdpDstCaseValue) input.getMatchEntryValue());
+ UdpDstCaseValue udpDstCaseValue = (UdpDstCaseValue) input.getMatchEntryValue();
NxmOfUdpDstBuilder udpDstBuilder = new NxmOfUdpDstBuilder();
udpDstBuilder.setPort(udpDstCaseValue.getUdpDstValues().getPort());
udpDstBuilder.setMask(udpDstCaseValue.getUdpDstValues().getMask());
NxmOfUdpDstKey.class);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmOfUdpDstGrouping> matchGrouping = MatchUtil.udpDstResolver.getExtension(extension);
+ Optional<NxmOfUdpDstGrouping> matchGrouping = MatchUtil.UDP_DST_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfUdpDst value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfUdpDst(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfUdpDst(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfUdpDst(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfUdpDst(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfUdpDst(value).build(), key);
default:
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
+ * Convert to/from SAL flow model to openflowjava model for CtZoneCase.
+ *
* @author Aswin Suryanarayanan.
*/
public class UdpSrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
- * (org.opendaylight.yangtools.yang.binding.DataContainer,
- * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
- */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
- UdpSrcCaseValue udpSrcCaseValue = ((UdpSrcCaseValue) input.getMatchEntryValue());
+ UdpSrcCaseValue udpSrcCaseValue = (UdpSrcCaseValue) input.getMatchEntryValue();
NxmOfUdpSrcBuilder udpSrcBuilder = new NxmOfUdpSrcBuilder();
udpSrcBuilder.setPort(udpSrcCaseValue.getUdpSrcValues().getPort());
udpSrcBuilder.setMask(udpSrcCaseValue.getUdpSrcValues().getMask());
return resolveAugmentation(udpSrcBuilder.build(), path,
NxmOfUdpSrcKey.class);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
- * (org
- * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
- * .rev140714.general.extension.grouping.Extension)
- */
+
@Override
public MatchEntry convert(Extension extension) {
- Optional<NxmOfUdpSrcGrouping> matchGrouping = MatchUtil.udpSrcResolver.getExtension(extension);
+ Optional<NxmOfUdpSrcGrouping> matchGrouping = MatchUtil.UDP_SRC_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfUdpSrc value,
MatchPath path, Class<? extends ExtensionKey> key) {
switch (path) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
new NxAugMatchNodesNodeTableFlowBuilder().setNxmOfUdpSrc(value).build(), key);
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
new NxAugMatchRpcGetFlowStatsBuilder().setNxmOfUdpSrc(value).build(), key);
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
.setNxmOfUdpSrc(value).build(), key);
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfUdpSrc(value).build(), key);
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
new NxAugMatchPacketInMessageBuilder().setNxmOfUdpSrc(value).build(), key);
default:
@Test
public void testRegisterConverters() throws Exception {
- Mockito.verify(extensionConverterRegistrator, Mockito.atLeastOnce()).registerActionConvertor(Matchers.<TypeVersionKey<? extends Action>>any(), Matchers.<ConvertorActionToOFJava<Action, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>>any());
+ Mockito.verify(extensionConverterRegistrator, Mockito.atLeastOnce()).registerActionConvertor(
+ Matchers.<TypeVersionKey<? extends Action>>any(),
+ Matchers.<ConvertorActionToOFJava<Action, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+ .common.action.rev150203.actions.grouping.Action>>any());
}
}
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
public void testIpv4AddressToLong() {
Ipv4Address ipAddress = new Ipv4Address("192.168.1.2");
long address = 0xc0a80102L;
- assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
+ assertEquals(address, IpConverter.ipv4AddressToLong(ipAddress));
}
@Test
public void testIpv4AddressToLong2() {
Ipv4Address ipAddress = new Ipv4Address("10.168.1.2");
long address = 0x0aa80102L;
- assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
+ assertEquals(address, IpConverter.ipv4AddressToLong(ipAddress));
}
}
import static org.junit.Assert.assertEquals;
-import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.MatchUtil;
-
import org.junit.Test;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.MatchUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
public class MatchUtilTest {
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNat;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Test for {@link ConntrackConvertor}.
NxActionNat natactionCase = ((NxActionNatCase) actionsCase.getNxConntrack().getCtActions().get(0)
.getOfpactActions()).getNxActionNat();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions
- .nx.action.nat._case.NxActionNat nataction = ( (org.opendaylight
+ .nx.action.nat._case.NxActionNat nataction = ((org.opendaylight
.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions
.NxActionNatCase) actionConntrack.getNxActionConntrack().getCtActions().get(0).getOfpactActions())
.getNxActionNat();
final Action groupingAction = actionBuilder.build();
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action
- = conntrackConvertor.convert(groupingAction, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ = conntrackConvertor.convert(groupingAction, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action1
- = conntrackConvertor.convert(groupingAction, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = conntrackConvertor.convert(groupingAction, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action2
- = conntrackConvertor.convert(groupingAction, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = conntrackConvertor.convert(groupingAction, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action3
- = conntrackConvertor.convert(groupingAction, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ = conntrackConvertor.convert(groupingAction, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action4
- = conntrackConvertor.convert(groupingAction, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = conntrackConvertor.convert(groupingAction, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action5
- = conntrackConvertor.convert(groupingAction, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = conntrackConvertor.convert(groupingAction, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
Assert.assertEquals(1, ((NxActionConntrackNodesNodeTableFlowWriteActionsCase) action).getNxConntrack()
.getConntrackZone().longValue());
Assert.assertEquals(1, ((NxActionConntrackNotifDirectStatisticsUpdateApplyActionsCase) action5).getNxConntrack()
.getFlags().intValue());
}
-}
\ No newline at end of file
+}
@Before
public void setUp() throws Exception {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping.NxActionFinTimeout nxFinTimeout =
- Mockito.mock(
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping.NxActionFinTimeout.class);
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action
+ .fin.timeout.grouping.NxActionFinTimeout nxFinTimeout = Mockito.mock(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.fin.timeout.grouping
+ .NxActionFinTimeout.class);
when(actionsCase.getNxActionFinTimeout()).thenReturn(nxFinTimeout);
when(nxFinTimeout.getFinIdleTimeout()).thenReturn(1);
when(nxFinTimeout.getFinHardTimeout()).thenReturn(2);
public void testConvert1() throws Exception {
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult =
finTimeoutConvertor.convert(action,
- ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1 =
finTimeoutConvertor.convert(action,
- ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2 =
finTimeoutConvertor.convert(action,
- ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3 =
finTimeoutConvertor.convert(action,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4 =
finTimeoutConvertor.convert(action,
- ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5 =
finTimeoutConvertor.convert(action,
- ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
Assert.assertEquals(3, ((NxActionFinTimeoutNotifFlowsStatisticsUpdateApplyActionsCase) actionResult)
.getNxActionFinTimeout().getFinIdleTimeout().intValue());
Assert.assertEquals(4, ((NxActionFinTimeoutNotifDirectStatisticsUpdateWriteActionsCase) actionResult5)
.getNxActionFinTimeout().getFinHardTimeout().intValue());
}
-}
\ No newline at end of file
+}
@Test
public void testConvert() throws Exception {
- final ActionMultipath actionMultipath = (ActionMultipath) multipathConvertor.convert(bucketActionsCase).getActionChoice();
+ final ActionMultipath actionMultipath =
+ (ActionMultipath) multipathConvertor.convert(bucketActionsCase).getActionChoice();
Assert.assertEquals(OfjNxHashFields.NXHASHFIELDSETHSRC, actionMultipath.getNxActionMultipath().getFields());
Assert.assertEquals(Integer.valueOf(2), actionMultipath.getNxActionMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHASHTHRESHOLD, actionMultipath.getNxActionMultipath().getAlgorithm());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHASHTHRESHOLD,
+ actionMultipath.getNxActionMultipath().getAlgorithm());
Assert.assertEquals(Integer.valueOf(2), actionMultipath.getNxActionMultipath().getMaxLink());
Assert.assertEquals(Long.valueOf(2L), actionMultipath.getNxActionMultipath().getArg());
}
@Test
public void testConvert1() throws Exception {
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
- = multipathConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = multipathConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
- = multipathConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = multipathConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
- = multipathConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ = multipathConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
- = multipathConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ = multipathConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
- = multipathConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = multipathConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
- = multipathConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
-
- Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getAlgorithm());
- Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getArg());
- Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getMaxLink());
-
- Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getAlgorithm());
- Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getArg());
- Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getMaxLink());
-
- Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getAlgorithm());
- Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getArg());
- Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getMaxLink());
-
- Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getAlgorithm());
- Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getArg());
- Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getMaxLink());
-
- Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath().getAlgorithm());
- Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath().getArg());
- Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath().getMaxLink());
-
- Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath().getBasis());
- Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath().getAlgorithm());
- Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath().getArg());
- Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath().getMaxLink());
+ = multipathConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
+
+ Assert.assertEquals(Integer.valueOf(1),
+ ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath()
+ .getBasis());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW,
+ ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath()
+ .getAlgorithm());
+ Assert.assertEquals(Long.valueOf(2L),
+ ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getArg());
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath()
+ .getMaxLink());
+
+ Assert.assertEquals(Integer.valueOf(1),
+ ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath()
+ .getBasis());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW,
+ ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath()
+ .getAlgorithm());
+ Assert.assertEquals(Long.valueOf(2L),
+ ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath()
+ .getArg());
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath()
+ .getMaxLink());
+
+ Assert.assertEquals(Integer.valueOf(1),
+ ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getBasis());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW,
+ ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getAlgorithm());
+ Assert.assertEquals(Long.valueOf(2L),
+ ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getArg());
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getMaxLink());
+
+ Assert.assertEquals(Integer.valueOf(1),
+ ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getBasis());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW,
+ ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getAlgorithm());
+ Assert.assertEquals(Long.valueOf(2L),
+ ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getArg());
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getMaxLink());
+
+ Assert.assertEquals(Integer.valueOf(1),
+ ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath()
+ .getBasis());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW,
+ ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath()
+ .getAlgorithm());
+ Assert.assertEquals(Long.valueOf(2L),
+ ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath()
+ .getArg());
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxActionMultipathNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxMultipath()
+ .getMaxLink());
+
+ Assert.assertEquals(Integer.valueOf(1),
+ ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath()
+ .getBasis());
+ Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW,
+ ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath()
+ .getAlgorithm());
+ Assert.assertEquals(Long.valueOf(2L),
+ ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath()
+ .getArg());
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxActionMultipathNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxMultipath()
+ .getMaxLink());
}
}
@Test
public void testConvert() throws Exception {
- final ActionOutputReg actionOutputReg = (ActionOutputReg) outputRegConvertor.convert(actionsCase).getActionChoice();
+ final ActionOutputReg actionOutputReg =
+ (ActionOutputReg) outputRegConvertor.convert(actionsCase).getActionChoice();
Assert.assertEquals(Integer.valueOf(1), actionOutputReg.getNxActionOutputReg().getNBits());
Assert.assertEquals(Integer.valueOf(2), actionOutputReg.getNxActionOutputReg().getMaxLen());
}
@Test
public void testConvert1() throws Exception {
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
- = outputRegConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = outputRegConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
- = outputRegConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ = outputRegConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
- = outputRegConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = outputRegConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
- = outputRegConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ = outputRegConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
- = outputRegConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = outputRegConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
- = outputRegConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
-
- Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxOutputReg().getMaxLen());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxOutputReg().getSrc().getOfsNbits());
-
- Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNodesNodeTableFlowWriteActionsCase) actionResult1).getNxOutputReg().getMaxLen());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNodesNodeTableFlowWriteActionsCase) actionResult1).getNxOutputReg().getSrc().getOfsNbits());
-
- Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxOutputReg().getMaxLen());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxOutputReg().getSrc().getOfsNbits());
-
- Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifGroupDescStatsUpdatedCase) actionResult3).getNxOutputReg().getMaxLen());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifGroupDescStatsUpdatedCase) actionResult3).getNxOutputReg().getSrc().getOfsNbits());
-
- Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxOutputReg().getMaxLen());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxOutputReg().getSrc().getOfsNbits());
-
- Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxOutputReg().getMaxLen());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxOutputReg().getSrc().getOfsNbits());
-
+ = outputRegConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
+
+ Assert.assertEquals(Integer.valueOf(3),
+ ((NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxOutputReg()
+ .getMaxLen());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxOutputReg().getSrc()
+ .getOfsNbits());
+
+ Assert.assertEquals(Integer.valueOf(3),
+ ((NxActionOutputRegNodesNodeTableFlowWriteActionsCase) actionResult1).getNxOutputReg().getMaxLen());
+ Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNodesNodeTableFlowWriteActionsCase) actionResult1)
+ .getNxOutputReg().getSrc().getOfsNbits());
+
+ Assert.assertEquals(Integer.valueOf(3),
+ ((NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxOutputReg()
+ .getMaxLen());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxOutputReg().getSrc()
+ .getOfsNbits());
+
+ Assert.assertEquals(Integer.valueOf(3),
+ ((NxActionOutputRegNotifGroupDescStatsUpdatedCase) actionResult3).getNxOutputReg().getMaxLen());
+ Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifGroupDescStatsUpdatedCase) actionResult3)
+ .getNxOutputReg().getSrc().getOfsNbits());
+
+ Assert.assertEquals(Integer.valueOf(3),
+ ((NxActionOutputRegNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxOutputReg()
+ .getMaxLen());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionOutputRegNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxOutputReg().getSrc()
+ .getOfsNbits());
+
+ Assert.assertEquals(Integer.valueOf(3),
+ ((NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxOutputReg()
+ .getMaxLen());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionOutputRegNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxOutputReg().getSrc()
+ .getOfsNbits());
}
}
@Test
public void testConvert1() throws Exception {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
- = regLoadConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ = regLoadConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
- = regLoadConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = regLoadConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
- = regLoadConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = regLoadConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
- = regLoadConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ = regLoadConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
- = regLoadConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = regLoadConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
- = regLoadConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getDst().getEnd());
- Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getValue());
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getDst().getEnd());
- Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getValue());
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getDst().getEnd());
- Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getValue());
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getDst().getEnd());
- Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getValue());
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegLoad().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegLoad().getDst().getEnd());
- Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegLoad().getValue());
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegLoad().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegLoad().getDst().getEnd());
- Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegLoad().getValue());
-
+ = regLoadConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
+
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getDst().getStart());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getDst().getEnd());
+ Assert.assertEquals(BigInteger.ONE,
+ ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getValue());
+
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getDst()
+ .getEnd());
+ Assert.assertEquals(BigInteger.ONE,
+ ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getValue());
+
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getDst()
+ .getEnd());
+ Assert.assertEquals(BigInteger.ONE,
+ ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getValue());
+
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getDst().getStart());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getDst().getEnd());
+ Assert.assertEquals(BigInteger.ONE,
+ ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getValue());
+
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegLoad().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegLoad().getDst()
+ .getEnd());
+ Assert.assertEquals(BigInteger.ONE,
+ ((NxActionRegLoadNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegLoad().getValue());
+
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegLoad().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(4),
+ ((NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegLoad().getDst()
+ .getEnd());
+ Assert.assertEquals(BigInteger.ONE,
+ ((NxActionRegLoadNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegLoad().getValue());
}
-
}
@Test
public void testConvert1() throws Exception {
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
- = regMoveConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = regMoveConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
- = regMoveConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ = regMoveConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
- = regMoveConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = regMoveConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
- = regMoveConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ = regMoveConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
- = regMoveConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = regMoveConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
- = regMoveConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
-
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxRegMove().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxRegMove().getDst().getEnd());
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNodesNodeTableFlowWriteActionsCase) actionResult1).getNxRegMove().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNodesNodeTableFlowWriteActionsCase) actionResult1).getNxRegMove().getDst().getEnd());
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegMove().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegMove().getDst().getEnd());
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegMove().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegMove().getDst().getEnd());
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegMove().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegMove().getDst().getEnd());
- Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegMove().getDst().getStart());
- Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegMove().getDst().getEnd());
+ = regMoveConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxRegMove().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(6),
+ ((NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxRegMove().getDst()
+ .getEnd());
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegMoveNodesNodeTableFlowWriteActionsCase) actionResult1).getNxRegMove().getDst().getStart());
+ Assert.assertEquals(Integer.valueOf(6),
+ ((NxActionRegMoveNodesNodeTableFlowWriteActionsCase) actionResult1).getNxRegMove().getDst().getEnd());
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegMove().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(6),
+ ((NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegMove().getDst()
+ .getEnd());
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegMoveNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegMove().getDst().getStart());
+ Assert.assertEquals(Integer.valueOf(6),
+ ((NxActionRegMoveNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegMove().getDst().getEnd());
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegMove().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(6),
+ ((NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxRegMove().getDst()
+ .getEnd());
+ Assert.assertEquals(Integer.valueOf(0),
+ ((NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegMove().getDst()
+ .getStart());
+ Assert.assertEquals(Integer.valueOf(6),
+ ((NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxRegMove().getDst()
+ .getEnd());
}
@Test
@Test
public void testResolveSrc1() throws Exception {
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIdCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxArpShaCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxArpThaCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpOpCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpSpaCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpTpaCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthDstCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthSrcCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ETH_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthTypeCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIpv4DstCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIpv4SrcCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNspCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNsiCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc1Case);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc2Case);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc3Case);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc4Case);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfIpDstCase);
- Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfIpSrcCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIdCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxArpShaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxArpThaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpOpCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpSpaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpTpaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthDstCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthSrcCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.ETH_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthTypeCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(NiciraMatchCodecs.TUN_IPV4_DST_CODEC
+ .getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIpv4DstCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC
+ .getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIpv4SrcCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNspCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNsiCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc1Case);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc2Case);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc3Case);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc4Case);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfIpDstCase);
+ Assert.assertTrue(RegMoveConvertor.resolveSrcValue(
+ NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfIpSrcCase);
}
@Test
public void testResolveDst1() throws Exception {
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIdCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxArpShaCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxArpThaCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpOpCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpSpaCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpTpaCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfEthDstCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfEthSrcCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIpv4DstCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIpv4SrcCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNspCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNsiCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc1Case);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc2Case);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc3Case);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc4Case);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIpDstCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIpSrcCase);
- Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIcmpTypeCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIdCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxArpShaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxArpThaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpOpCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpSpaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpTpaCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfEthDstCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfEthSrcCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(NiciraMatchCodecs.TUN_IPV4_DST_CODEC
+ .getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIpv4DstCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC
+ .getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIpv4SrcCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNspCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNsiCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc1Case);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc2Case);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc3Case);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc4Case);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIpDstCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIpSrcCase);
+ Assert.assertTrue(RegMoveConvertor.resolveDstValue(
+ NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIcmpTypeCase);
}
-
}
@Test
public void testConvert1() throws Exception {
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
- = resubmitConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = resubmitConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
- = resubmitConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ = resubmitConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
- = resubmitConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ = resubmitConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
- = resubmitConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+ = resubmitConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
- = resubmitConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ = resubmitConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
- = resubmitConvertor.convert(action, ActionPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
-
- Assert.assertEquals(3, ((NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxResubmit().getInPort().intValue());
- Assert.assertEquals(4, ((NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxResubmit().getTable().intValue());
-
- Assert.assertEquals(3, ((NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxResubmit().getInPort().intValue());
- Assert.assertEquals(4, ((NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxResubmit().getTable().intValue());
-
- Assert.assertEquals(3, ((NxActionResubmitNotifGroupDescStatsUpdatedCase) actionResult2).getNxResubmit().getInPort().intValue());
- Assert.assertEquals(4, ((NxActionResubmitNotifGroupDescStatsUpdatedCase) actionResult2).getNxResubmit().getTable().intValue());
-
- Assert.assertEquals(3, ((NxActionResubmitNodesNodeTableFlowWriteActionsCase) actionResult3).getNxResubmit().getInPort().intValue());
- Assert.assertEquals(4, ((NxActionResubmitNodesNodeTableFlowWriteActionsCase) actionResult3).getNxResubmit().getTable().intValue());
-
- Assert.assertEquals(3, ((NxActionResubmitNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxResubmit().getInPort().intValue());
- Assert.assertEquals(4, ((NxActionResubmitNotifDirectStatisticsUpdateApplyActionsCase) actionResult4).getNxResubmit().getTable().intValue());
-
- Assert.assertEquals(3, ((NxActionResubmitNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxResubmit().getInPort().intValue());
- Assert.assertEquals(4, ((NxActionResubmitNotifDirectStatisticsUpdateWriteActionsCase) actionResult5).getNxResubmit().getTable().intValue());
+ = resubmitConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
+
+ Assert.assertEquals(3, ((NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase) actionResult)
+ .getNxResubmit().getInPort().intValue());
+ Assert.assertEquals(4, ((NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase) actionResult)
+ .getNxResubmit().getTable().intValue());
+
+ Assert.assertEquals(3, ((NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1)
+ .getNxResubmit().getInPort().intValue());
+ Assert.assertEquals(4, ((NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1)
+ .getNxResubmit().getTable().intValue());
+
+ Assert.assertEquals(3, ((NxActionResubmitNotifGroupDescStatsUpdatedCase) actionResult2).getNxResubmit()
+ .getInPort().intValue());
+ Assert.assertEquals(4,
+ ((NxActionResubmitNotifGroupDescStatsUpdatedCase) actionResult2).getNxResubmit().getTable().intValue());
+
+ Assert.assertEquals(3, ((NxActionResubmitNodesNodeTableFlowWriteActionsCase) actionResult3).getNxResubmit()
+ .getInPort().intValue());
+ Assert.assertEquals(4, ((NxActionResubmitNodesNodeTableFlowWriteActionsCase) actionResult3).getNxResubmit()
+ .getTable().intValue());
+
+ Assert.assertEquals(3, ((NxActionResubmitNotifDirectStatisticsUpdateApplyActionsCase) actionResult4)
+ .getNxResubmit().getInPort().intValue());
+ Assert.assertEquals(4, ((NxActionResubmitNotifDirectStatisticsUpdateApplyActionsCase) actionResult4)
+ .getNxResubmit().getTable().intValue());
+
+ Assert.assertEquals(3, ((NxActionResubmitNotifDirectStatisticsUpdateWriteActionsCase) actionResult5)
+ .getNxResubmit().getInPort().intValue());
+ Assert.assertEquals(4, ((NxActionResubmitNotifDirectStatisticsUpdateWriteActionsCase) actionResult5)
+ .getNxResubmit().getTable().intValue());
}
-}
\ No newline at end of file
+}
nxAugMatchRpcAddFlowBuilder.setNxmOfArpOp(nxmOfArpOpBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
- final MatchEntry matchEntry = arpOpConvertor.convert(extension);
- Assert.assertEquals(nxAugMatchRpcAddFlowBuilder.getNxmOfArpOp().getValue(), ((ArpOpCaseValue)matchEntry.getMatchEntryValue()).getArpOpValues().getValue());
+ final MatchEntry converted = arpOpConvertor.convert(extension);
+ Assert.assertEquals(nxAugMatchRpcAddFlowBuilder.getNxmOfArpOp().getValue(),
+ ((ArpOpCaseValue) converted.getMatchEntryValue()).getArpOpValues().getValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(arpOpCase);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpOpConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(arpOpCase.getArpOp().getOpCode(), ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfArpOp().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpOpConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(arpOpCase.getArpOp().getOpCode(),
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfArpOp().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpOpKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpOpConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(arpOpCase.getArpOp().getOpCode(), ((NxAugMatchNodesNodeTableFlow)extensionAugment1.getAugmentationObject()).getNxmOfArpOp().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpOpConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(arpOpCase.getArpOp().getOpCode(),
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment1.getAugmentationObject()).getNxmOfArpOp().getValue());
Assert.assertEquals(extensionAugment1.getKey(), NxmOfArpOpKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpOpConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(arpOpCase.getArpOp().getOpCode(), ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment2.getAugmentationObject()).getNxmOfArpOp().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpOpConvertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(arpOpCase.getArpOp().getOpCode(),
+ ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment2.getAugmentationObject()).getNxmOfArpOp()
+ .getValue());
Assert.assertEquals(extensionAugment2.getKey(), NxmOfArpOpKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpOpConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(arpOpCase.getArpOp().getOpCode(), ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfArpOp().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpOpConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(arpOpCase.getArpOp().getOpCode(),
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfArpOp().getValue());
Assert.assertEquals(extensionAugment3.getKey(), NxmOfArpOpKey.class);
-
}
}
.setNxmNxArpSha(nxmNxArpShaBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
arpShaConvertor = new ArpShaConvertor();
}
@Test
public void testConvertToOFJava() throws Exception {
- final MatchEntry matchEntry = arpShaConvertor.convert(extension);
- Assert.assertEquals(MAC_ADDRESS.getValue(), ((ArpShaCaseValue)matchEntry.getMatchEntryValue()).getArpShaValues().getMacAddress().getValue());
+ final MatchEntry converted = arpShaConvertor.convert(extension);
+ Assert.assertEquals(MAC_ADDRESS.getValue(),
+ ((ArpShaCaseValue) converted.getMatchEntryValue()).getArpShaValues().getMacAddress().getValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(arpShaCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpShaConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpShaConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(),
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpShaConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpShaConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(),
+ ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxArpSha()
+ .getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpShaConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpShaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(),
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxArpSha()
+ .getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpShaConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpShaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(),
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxArpSha()
+ .getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
}
nxAugMatchRpcAddFlowBuilder.setNxmOfArpSpa(nxmOfArpSpaBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
- final MatchEntry matchEntry = arpSpaConvertor.convert(extension);
- Assert.assertEquals(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS), ((ArpSpaCaseValue)matchEntry.getMatchEntryValue()).getArpSpaValues().getValue().longValue());
+ final MatchEntry converted = arpSpaConvertor.convert(extension);
+ Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS),
+ ((ArpSpaCaseValue) converted.getMatchEntryValue()).getArpSpaValues().getValue().longValue());
}
@Test
public void testConvertFromOFJava() throws Exception {
final ArpSpaValuesBuilder arpSpaValuesBuilder = new ArpSpaValuesBuilder()
- .setValue(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS));
+ .setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final ArpSpaCaseValueBuilder arpSpaCaseValueBuilder = new ArpSpaCaseValueBuilder()
.setArpSpaValues(arpSpaValuesBuilder.build());
when(matchEntry.getMatchEntryValue()).thenReturn(arpSpaCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpSpaConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpSpaConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpSpaConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpSpaConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpSpaConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpSpaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpSpaConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpSpaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
-
}
-
}
.setNxmNxArpTha(nxArpThaBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
arpThaConvertor = new ArpThaConvertor();
}
@Test
public void testConvertToOFJava() throws Exception {
- final MatchEntry matchEntry = arpThaConvertor.convert(extension);
- Assert.assertEquals(MAC_ADDRESS.getValue(), ((ArpThaCaseValue)matchEntry.getMatchEntryValue()).getArpThaValues().getMacAddress().getValue());
+ final MatchEntry converted = arpThaConvertor.convert(extension);
+ Assert.assertEquals(MAC_ADDRESS.getValue(),
+ ((ArpThaCaseValue) converted.getMatchEntryValue()).getArpThaValues().getMacAddress().getValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(arpThaCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpThaConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(), ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxArpTha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpThaConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(),
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxArpTha().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpThaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpThaConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(), ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxArpTha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpThaConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(),
+ ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxArpTha()
+ .getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpThaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpThaConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(), ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxArpTha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpThaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(),
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxArpTha()
+ .getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpThaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpThaConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(), ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxArpTha().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpThaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(arpThaCaseValue.getArpThaValues().getMacAddress(),
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxArpTha()
+ .getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmNxArpThaKey.class);
-
}
-
}
nxAugMatchRpcAddFlowBuilder.setNxmOfArpTpa(nxmOfArpTpaBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
arpTpaConvertor = new ArpTpaConvertor();
}
@Test
public void testConvertFromOFJava() throws Exception {
- final MatchEntry matchEntry = arpTpaConvertor.convert(extension);
- Assert.assertEquals(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS), ((ArpTpaCaseValue)matchEntry.getMatchEntryValue()).getArpTpaValues().getValue().longValue());
+ final MatchEntry converted = arpTpaConvertor.convert(extension);
+ Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS),
+ ((ArpTpaCaseValue)converted.getMatchEntryValue()).getArpTpaValues().getValue().longValue());
}
@Test
public void testConvertToOFJava() throws Exception {
final ArpTpaValuesBuilder arpTpaValuesBuilder = new ArpTpaValuesBuilder()
- .setValue(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS));
+ .setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final ArpTpaCaseValueBuilder arpTpaCaseValueBuilder = new ArpTpaCaseValueBuilder()
.setArpTpaValues(arpTpaValuesBuilder.build());
when(matchEntry.getMatchEntryValue()).thenReturn(arpTpaCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpTpaConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpTpaConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpTpaConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpTpaConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpTpaConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpTpaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpTpaConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpTpaConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
}
-
}
final NxmNxCtStateBuilder nxmNxCtStateBuilder = new NxmNxCtStateBuilder()
.setCtState(1L)
.setMask(2L);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxCtState(nxmNxCtStateBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
ctStateConvertor = new CtStateConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = ctStateConvertor.convert(extension);
- Assert.assertEquals(1L, ((CtStateCaseValue)matchEntry.getMatchEntryValue()).getCtStateValues().getCtState().longValue());
- Assert.assertEquals(2L, ((CtStateCaseValue)matchEntry.getMatchEntryValue()).getCtStateValues().getMask().longValue());
+ final MatchEntry converted = ctStateConvertor.convert(extension);
+ Assert.assertEquals(1L,
+ ((CtStateCaseValue) converted.getMatchEntryValue()).getCtStateValues().getCtState().longValue());
+ Assert.assertEquals(2L,
+ ((CtStateCaseValue) converted.getMatchEntryValue()).getCtStateValues().getMask().longValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(ctStateCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ctStateConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(3L, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
- Assert.assertEquals(4L, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ctStateConvertor
+ .convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(3L, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxCtState()
+ .getCtState().longValue());
+ Assert.assertEquals(4L, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxCtState()
+ .getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ctStateConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(3L, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
- Assert.assertEquals(4L, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ctStateConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(3L, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxCtState().getCtState().longValue());
+ Assert.assertEquals(4L, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ctStateConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(3L, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
- Assert.assertEquals(4L, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ctStateConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(3L, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxCtState().getCtState().longValue());
+ Assert.assertEquals(4L, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ctStateConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(3L, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
- Assert.assertEquals(4L, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ctStateConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(3L, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmNxCtState().getCtState().longValue());
+ Assert.assertEquals(4L, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
-
}
-
}
final NxmNxCtZoneBuilder nxmNxCtZoneBuilder = new NxmNxCtZoneBuilder()
.setCtZone(1);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxCtZone(nxmNxCtZoneBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
ctZoneConvertor = new CtZoneConvertor();
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = ctZoneConvertor.convert(extension);
- Assert.assertEquals(1L, ((CtZoneCaseValue)matchEntry.getMatchEntryValue()).getCtZoneValues().getCtZone().longValue());
+ final MatchEntry converted = ctZoneConvertor.convert(extension);
+ Assert.assertEquals(1L,
+ ((CtZoneCaseValue) converted.getMatchEntryValue()).getCtZoneValues().getCtZone().longValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(ctZoneCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ctZoneConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(2L, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxCtZone().getCtZone().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ctZoneConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(2L, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxCtZone()
+ .getCtZone().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtZoneKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ctZoneConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(2L, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxCtZone().getCtZone().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ctZoneConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(2L, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxCtZone().getCtZone().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtZoneKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ctZoneConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2L, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxCtZone().getCtZone().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ctZoneConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(2L, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxCtZone().getCtZone().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtZoneKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ctZoneConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2L, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxCtZone().getCtZone().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ctZoneConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(2L, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxCtZone()
+ .getCtZone().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtZoneKey.class);
-
}
-
}
final NxmOfEthDstBuilder nxmOfEthDstBuilder = new NxmOfEthDstBuilder()
.setMacAddress(MAC_ADDRESS);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthDst(nxmOfEthDstBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
ethDstConvertor = new EthDstConvertor();
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = ethDstConvertor.convert(extension);
- Assert.assertEquals(MAC_ADDRESS, ((EthDstCaseValue)matchEntry.getMatchEntryValue()).getEthDstValues().getMacAddress());
+ final MatchEntry converted = ethDstConvertor.convert(extension);
+ Assert.assertEquals(MAC_ADDRESS, ((EthDstCaseValue)converted.getMatchEntryValue())
+ .getEthDstValues().getMacAddress());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(ethDstCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethDstConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethDstConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(MAC_ADDRESS,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethDstConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethDstConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethDstConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethDstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethDstConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethDstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
-
-
-
}
}
public void setUp() throws Exception {
final NxmOfEthSrcBuilder nxmOfEthSrcBuilder = new NxmOfEthSrcBuilder()
.setMacAddress(MAC_ADDRESS);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthSrc(nxmOfEthSrcBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
ethSrcConvertor = new EthSrcConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = ethSrcConvertor.convert(extension);
- Assert.assertEquals(MAC_ADDRESS, ((EthSrcCaseValue)matchEntry.getMatchEntryValue()).getEthSrcValues().getMacAddress());
+ final MatchEntry converted = ethSrcConvertor.convert(extension);
+ Assert.assertEquals(MAC_ADDRESS, ((EthSrcCaseValue)converted.getMatchEntryValue())
+ .getEthSrcValues().getMacAddress());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(ethSrcCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethSrcConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethSrcConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(MAC_ADDRESS,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethSrcConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethSrcConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfEthSrc().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethSrcConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethSrcConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfEthSrc().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethSrcConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethSrcConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmOfEthSrc().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
}
}
final NxmOfEthTypeBuilder nxmOfEthTypeBuilder = new NxmOfEthTypeBuilder()
.setValue(1);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthType(nxmOfEthTypeBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
ethTypeConvertor = new EthTypeConvertor();
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = ethTypeConvertor.convert(extension);
- Assert.assertEquals(1, ((EthTypeCaseValue)matchEntry.getMatchEntryValue()).getEthTypeValues().getValue().intValue());
+ final MatchEntry converted = ethTypeConvertor.convert(extension);
+ Assert.assertEquals(1, ((EthTypeCaseValue)converted.getMatchEntryValue())
+ .getEthTypeValues().getValue().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(ethTypeCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethTypeConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethTypeConvertor
+ .convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthType()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethTypeConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethTypeConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethTypeConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethTypeConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethTypeConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethTypeConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfEthType()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
}
}
public void setUp() throws Exception {
final NxmNxNshc1Builder nxmNxNshc1Builder = new NxmNxNshc1Builder()
.setValue(1L);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNshc1(nxmNxNshc1Builder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
nshc1Convertor = new Nshc1Convertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = nshc1Convertor.convert(extension);
- Assert.assertEquals(1, ((Nshc1CaseValue)matchEntry.getMatchEntryValue()).getNshc1Values().getNshc().intValue());
+ final MatchEntry converted = nshc1Convertor.convert(extension);
+ Assert.assertEquals(1, ((Nshc1CaseValue)converted.getMatchEntryValue()).getNshc1Values().getNshc().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(nshc1CaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc1Convertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxNshc1().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc1Convertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc1()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc1Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc1Convertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxNshc1().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc1Convertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxNshc1().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc1Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc1Convertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxNshc1().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc1Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxNshc1().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc1Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc1Convertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxNshc1().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc1Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc1()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc1Key.class);
}
-
}
public void setUp() throws Exception {
final NxmNxNshc2Builder nxmNxNshc2Builder = new NxmNxNshc2Builder()
.setValue(1L);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNshc2(nxmNxNshc2Builder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
nshc2Convertor = new Nshc2Convertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = nshc2Convertor.convert(extension);
- Assert.assertEquals(1, ((Nshc2CaseValue)matchEntry.getMatchEntryValue()).getNshc2Values().getNshc().intValue());
+ final MatchEntry converted = nshc2Convertor.convert(extension);
+ Assert.assertEquals(1, ((Nshc2CaseValue)converted.getMatchEntryValue()).getNshc2Values().getNshc().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(nshc2CaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc2Convertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc2Convertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc2()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc2Convertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc2Convertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxNshc2().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc2Convertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc2Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxNshc2().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc2Convertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc2Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc2()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
}
-
-
}
public void setUp() throws Exception {
final NxmNxNshc3Builder nxmNxNshc3Builder = new NxmNxNshc3Builder()
.setValue(1L);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNshc3(nxmNxNshc3Builder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
nshc3Convertor = new Nshc3Convertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = nshc3Convertor.convert(extension);
- Assert.assertEquals(1, ((Nshc3CaseValue)matchEntry.getMatchEntryValue()).getNshc3Values().getNshc().intValue());
+ final MatchEntry converted = nshc3Convertor.convert(extension);
+ Assert.assertEquals(1, ((Nshc3CaseValue)converted.getMatchEntryValue()).getNshc3Values().getNshc().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(nshc3CaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc3Convertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc3Convertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc3()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc3Convertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc3Convertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxNshc3().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc3Convertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc3Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxNshc3().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc3Convertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc3Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc3()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
}
-
}
public void setUp() throws Exception {
final NxmNxNshc4Builder nxmNxNshc4Builder = new NxmNxNshc4Builder()
.setValue(1L);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNshc4(nxmNxNshc4Builder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
nshc4Convertor = new Nshc4Convertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = nshc4Convertor.convert(extension);
- Assert.assertEquals(1, ((Nshc4CaseValue)matchEntry.getMatchEntryValue()).getNshc4Values().getNshc().intValue());
+ final MatchEntry converted = nshc4Convertor.convert(extension);
+ Assert.assertEquals(1, ((Nshc4CaseValue)converted.getMatchEntryValue()).getNshc4Values().getNshc().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(nshc4CaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc4Convertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc4Convertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc4()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc4Convertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc4Convertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxNshc4().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc4Convertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc4Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxNshc4().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc4Convertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc4Convertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc4()
+ .getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
}
}
public void setUp() throws Exception {
final NxmNxNsiBuilder nxmNxNsiBuilder = new NxmNxNsiBuilder()
.setNsi((short)1);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNsi(nxmNxNsiBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
nsiConvertor = new NsiConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = nsiConvertor.convert(extension);
- Assert.assertEquals(1, ((NsiCaseValue)matchEntry.getMatchEntryValue()).getNsiValues().getNsi().intValue());
+ final MatchEntry converted = nsiConvertor.convert(extension);
+ Assert.assertEquals(1, ((NsiCaseValue)converted.getMatchEntryValue()).getNsiValues().getNsi().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(nsiCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nsiConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nsiConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(1,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nsiConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nsiConvertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxNsi().getNsi().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nsiConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nsiConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNsi()
+ .getNsi().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nsiConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nsiConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNsi()
+ .getNsi().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
}
-
}
public void setUp() throws Exception {
final NxmNxNspBuilder nxmNxNspBuilder = new NxmNxNspBuilder()
.setValue(Long.valueOf(1L));
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNsp(nxmNxNspBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
nspConvertor = new NspConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = nspConvertor.convert(extension);
- Assert.assertEquals(1, ((NspCaseValue)matchEntry.getMatchEntryValue()).getNspValues().getNsp().intValue());
+ final MatchEntry converted = nspConvertor.convert(extension);
+ Assert.assertEquals(1, ((NspCaseValue)converted.getMatchEntryValue()).getNspValues().getNsp().intValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(nspCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nspConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nspConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNsp()
+ .getValue().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nspConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nspConvertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxNsp().getValue().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nspConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nspConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNsp()
+ .getValue().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nspConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nspConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNsp()
+ .getValue().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
}
}
final NxmOfTcpDstBuilder nxmOfTcpDstBuilder = new NxmOfTcpDstBuilder()
.setMask(1)
.setPort(DEFAULT_PORT);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfTcpDst(nxmOfTcpDstBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
tcpDstConvertor = new TcpDstConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = tcpDstConvertor.convert(extension);
- Assert.assertEquals(1, ((TcpDstCaseValue)matchEntry.getMatchEntryValue()).getTcpDstValues().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((TcpDstCaseValue)matchEntry.getMatchEntryValue()).getTcpDstValues().getPort());
+ final MatchEntry converted = tcpDstConvertor.convert(extension);
+ Assert.assertEquals(1,
+ ((TcpDstCaseValue) converted.getMatchEntryValue()).getTcpDstValues().getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((TcpDstCaseValue) converted.getMatchEntryValue()).getTcpDstValues().getPort());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(tcpDstCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpDstConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpDstConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpDst()
+ .getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpDstConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfTcpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpDstConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfTcpDst().getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpDstConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpDstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfTcpDst().getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpDstConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpDstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpDst()
+ .getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
}
}
final NxmOfTcpSrcBuilder nxmOfTcpSrcBuilder = new NxmOfTcpSrcBuilder()
.setMask(1)
.setPort(DEFAULT_PORT);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfTcpSrc(nxmOfTcpSrcBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
tcpSrcConvertor = new TcpSrcConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = tcpSrcConvertor.convert(extension);
- Assert.assertEquals(1, ((TcpSrcCaseValue)matchEntry.getMatchEntryValue()).getTcpSrcValues().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((TcpSrcCaseValue)matchEntry.getMatchEntryValue()).getTcpSrcValues().getPort());
+ final MatchEntry converted = tcpSrcConvertor.convert(extension);
+ Assert.assertEquals(1,
+ ((TcpSrcCaseValue) converted.getMatchEntryValue()).getTcpSrcValues().getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((TcpSrcCaseValue) converted.getMatchEntryValue()).getTcpSrcValues().getPort());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(tcpSrcCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpSrcConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpSrcConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpSrc()
+ .getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpSrcConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfTcpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpSrcConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfTcpSrc().getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpSrcConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpSrcConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmOfTcpSrc().getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpSrcConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpSrcConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc()
+ .getMask().intValue());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
}
}
public void setUp() throws Exception {
final NxmNxTunIpv4DstBuilder nxmNxTunIpv4DstBuilder = new NxmNxTunIpv4DstBuilder()
.setIpv4Address(IPV4_ADDRESS);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxTunIpv4Dst(nxmNxTunIpv4DstBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
tunIPv4DstConvertor = new TunIPv4DstConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = tunIPv4DstConvertor.convert(extension);
- Assert.assertEquals(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS), ((TunIpv4DstCaseValue)matchEntry.getMatchEntryValue()).getTunIpv4DstValues().getValue().longValue());
+ final MatchEntry converted = tunIPv4DstConvertor.convert(extension);
+ Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS),
+ ((TunIpv4DstCaseValue)converted.getMatchEntryValue()).getTunIpv4DstValues().getValue().longValue());
}
@Test
public void testConvert1() throws Exception {
final TunIpv4DstValuesBuilder tunIpv4DstValuesBuilder = new TunIpv4DstValuesBuilder()
- .setValue(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS));
+ .setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final TunIpv4DstCaseValueBuilder tunIpv4DstCaseValueBuilder = new TunIpv4DstCaseValueBuilder()
.setTunIpv4DstValues(tunIpv4DstValuesBuilder.build());
when(matchEntry.getMatchEntryValue()).thenReturn(tunIpv4DstCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIPv4DstConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject())
+ .getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
}
-
}
public void setUp() throws Exception {
final NxmNxTunIpv4SrcBuilder nxmNxTunIpv4SrcBuilder = new NxmNxTunIpv4SrcBuilder()
.setIpv4Address(IPV4_ADDRESS);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxTunIpv4Src(nxmNxTunIpv4SrcBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
tunIPv4DstConvertor = new TunIPv4SrcConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = tunIPv4DstConvertor.convert(extension);
- Assert.assertEquals(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS), ((TunIpv4SrcCaseValue)matchEntry.getMatchEntryValue()).getTunIpv4SrcValues().getValue().longValue());
+ final MatchEntry converted = tunIPv4DstConvertor.convert(extension);
+ Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS),
+ ((TunIpv4SrcCaseValue) converted.getMatchEntryValue()).getTunIpv4SrcValues().getValue().longValue());
}
@Test
public void testConvert1() throws Exception {
final TunIpv4SrcValuesBuilder tunIpv4SrcValuesBuilder = new TunIpv4SrcValuesBuilder()
- .setValue(IpConverter.Ipv4AddressToLong(IPV4_ADDRESS));
+ .setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final TunIpv4SrcCaseValueBuilder tunIpv4SrcCaseValueBuilder = new TunIpv4SrcCaseValueBuilder()
.setTunIpv4SrcValues(tunIpv4SrcValuesBuilder.build());
when(matchEntry.getMatchEntryValue()).thenReturn(tunIpv4SrcCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIPv4DstConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxTunIpv4Src().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject())
+ .getNxmNxTunIpv4Src().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4SrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxTunIpv4Src().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmNxTunIpv4Src().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4SrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxTunIpv4Src().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject())
+ .getNxmNxTunIpv4Src().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4SrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxTunIpv4Src().getIpv4Address());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIPv4DstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject())
+ .getNxmNxTunIpv4Src().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4SrcKey.class);
}
-
}
public void setUp() throws Exception {
final NxmNxTunIdBuilder nxmNxTunIdBuilder = new NxmNxTunIdBuilder()
.setValue(BigInteger.ONE);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxTunId(nxmNxTunIdBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
tunIdConvertor = new TunIdConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = tunIdConvertor.convert(extension);
- Assert.assertEquals(BigInteger.ONE, ((TunIdCaseValue)matchEntry.getMatchEntryValue()).getTunIdValues().getValue());
+ final MatchEntry converted = tunIdConvertor.convert(extension);
+ Assert.assertEquals(BigInteger.ONE, ((TunIdCaseValue)converted.getMatchEntryValue())
+ .getTunIdValues().getValue());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(tunIdCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIdConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmNxTunId().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIdConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(BigInteger.TEN,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIdConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmNxTunId().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIdConvertor.convert(matchEntry,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(BigInteger.TEN,
+ ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxTunId()
+ .getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIdConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmNxTunId().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIdConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(BigInteger.TEN,
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIdConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(BigInteger.TEN, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmNxTunId().getValue());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIdConvertor.convert(matchEntry,
+ MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(BigInteger.TEN,
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
}
-
}
final NxmOfUdpDstBuilder nxmOfUdpDstBuilder = new NxmOfUdpDstBuilder()
.setMask(1)
.setPort(DEFAULT_PORT);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfUdpDst(nxmOfUdpDstBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
udpDstConvertor = new UdpDstConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = udpDstConvertor.convert(extension);
- Assert.assertEquals(Integer.valueOf(1), ((UdpDstCaseValue)matchEntry.getMatchEntryValue()).getUdpDstValues().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((UdpDstCaseValue)matchEntry.getMatchEntryValue()).getUdpDstValues().getPort());
+ final MatchEntry converted = udpDstConvertor.convert(extension);
+ Assert.assertEquals(Integer.valueOf(1),
+ ((UdpDstCaseValue) converted.getMatchEntryValue()).getUdpDstValues().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((UdpDstCaseValue) converted.getMatchEntryValue()).getUdpDstValues().getPort());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(udpDstCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = udpDstConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = udpDstConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = udpDstConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfUdpDst().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfUdpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = udpDstConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpDst()
+ .getMask());
+ Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfUdpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = udpDstConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = udpDstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = udpDstConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfUdpDst().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfUdpDst().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = udpDstConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpDst().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class);
}
-
}
final NxmOfUdpSrcBuilder nxmOfUdpSrcBuilder = new NxmOfUdpSrcBuilder()
.setMask(1)
.setPort(DEFAULT_PORT);
- final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
+ final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder =
+ new NxAugMatchNodesNodeTableFlowBuilder();
nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfUdpSrc(nxmOfUdpSrcBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
- when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
+ when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any()))
+ .thenReturn(extensionAugmentation);
udpSrcConvertor = new UdpSrcConvertor();
}
@Test
public void testConvert() throws Exception {
- final MatchEntry matchEntry = udpSrcConvertor.convert(extension);
- Assert.assertEquals(Integer.valueOf(1), ((UdpSrcCaseValue)matchEntry.getMatchEntryValue()).getUdpSrcValues().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((UdpSrcCaseValue)matchEntry.getMatchEntryValue()).getUdpSrcValues().getPort());
+ final MatchEntry converted = udpSrcConvertor.convert(extension);
+ Assert.assertEquals(Integer.valueOf(1),
+ ((UdpSrcCaseValue) converted.getMatchEntryValue()).getUdpSrcValues().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((UdpSrcCaseValue) converted.getMatchEntryValue()).getUdpSrcValues().getPort());
}
@Test
when(matchEntry.getMatchEntryValue()).thenReturn(udpSrcCaseValue);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = udpSrcConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = udpSrcConvertor.convert(matchEntry,
+ MatchPath.PACKET_RECEIVED_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = udpSrcConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = udpSrcConvertor
+ .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc()
+ .getMask());
+ Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject())
+ .getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = udpSrcConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = udpSrcConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
- final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = udpSrcConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
- Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getMask());
- Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getPort());
+ final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = udpSrcConvertor
+ .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
+ Assert.assertEquals(Integer.valueOf(2),
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getMask());
+ Assert.assertEquals(DEFAULT_PORT,
+ ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
}
-
}
/**
* Stores common constants for ONF approved extensions.
*/
-public abstract class OnfConstants {
+public interface OnfConstants {
- /** Experimenter ID of ONF approved extensions */
- public static final long ONF_EXPERIMENTER_ID = 0x4F4E4600;
- /** ONF_ET_BUNDLE_CONTROL message type */
- public static final int ONF_ET_BUNDLE_CONTROL = 2300;
- /** ONF_ET_BUNDLE_ADD_MESSAGE message type */
- public static final int ONF_ET_BUNDLE_ADD_MESSAGE = 2301;
+ /** Experimenter ID of ONF approved extensions. */
+ long ONF_EXPERIMENTER_ID = 0x4F4E4600;
+ /** ONF_ET_BUNDLE_CONTROL message type. */
+ int ONF_ET_BUNDLE_CONTROL = 2300;
+
+ /** ONF_ET_BUNDLE_ADD_MESSAGE message type. */
+ int ONF_ET_BUNDLE_ADD_MESSAGE = 2301;
}
private final SwitchConnectionProvider switchConnectionProvider;
private final ExtensionConverterRegistrator converterRegistrator;
- private static final BundleControlConverter bundleControlConverter = new BundleControlConverter();
- private static final BundleAddMessageConverter bundleAddMessageConverter = new BundleAddMessageConverter();
+ private static final BundleControlConverter BUNDLE_CONTROL_CONVERTER = new BundleControlConverter();
+ private static final BundleAddMessageConverter BUNDLE_ADD_MESSAGE_CONVERTER = new BundleAddMessageConverter();
public OnfExtensionProvider(final SwitchConnectionProvider switchConnectionProvider,
final OpenFlowPluginExtensionRegistratorProvider converterRegistrator) {
private void registerConverters() {
converterRegistrator.registerMessageConvertor(
- new TypeVersionKey<>(BundleControlSal.class, OFConstants.OFP_VERSION_1_3), bundleControlConverter);
+ new TypeVersionKey<>(BundleControlSal.class, OFConstants.OFP_VERSION_1_3), BUNDLE_CONTROL_CONVERTER);
converterRegistrator.registerMessageConvertor(
- new MessageTypeKey<>(OFConstants.OFP_VERSION_1_3, BundleControlOnf.class), bundleControlConverter);
+ new MessageTypeKey<>(OFConstants.OFP_VERSION_1_3, BundleControlOnf.class), BUNDLE_CONTROL_CONVERTER);
converterRegistrator.registerMessageConvertor(
- new TypeVersionKey<>(BundleAddMessageSal.class, OFConstants.OFP_VERSION_1_3), bundleAddMessageConverter);
+ new TypeVersionKey<>(BundleAddMessageSal.class, OFConstants.OFP_VERSION_1_3),
+ BUNDLE_ADD_MESSAGE_CONVERTER);
converterRegistrator.registerMessageConvertor(
- new MessageTypeKey<>(OFConstants.OFP_VERSION_1_3, BundleAddMessageOnf.class), bundleAddMessageConverter);
+ new MessageTypeKey<>(OFConstants.OFP_VERSION_1_3, BundleAddMessageOnf.class),
+ BUNDLE_ADD_MESSAGE_CONVERTER);
}
}
ConvertorMessageFromOFJava<BundleAddMessageOnf, MessagePath>,
BundleMessageDataInjector {
- private static final ConvertorExecutor converterExecutor = ConvertorManagerFactory.createDefaultManager();
+ private static final ConvertorExecutor CONVERTER_EXECUTOR = ConvertorManagerFactory.createDefaultManager();
private long xid;
private NodeRef node;
final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
data.setDatapathId(digDatapathId(node));
- if (innerMessage.getImplementedInterface().equals(BundleAddFlowCase.class) ||
- innerMessage.getImplementedInterface().equals(BundleUpdateFlowCase.class) ||
- innerMessage.getImplementedInterface().equals(BundleRemoveFlowCase.class)) {
+ if (innerMessage.getImplementedInterface().equals(BundleAddFlowCase.class)
+ || innerMessage.getImplementedInterface().equals(BundleUpdateFlowCase.class)
+ || innerMessage.getImplementedInterface().equals(BundleRemoveFlowCase.class)) {
dataBuilder.setBundleInnerMessage(convertBundleFlowCase(innerMessage, data));
- } else if (innerMessage.getImplementedInterface().equals(BundleAddGroupCase.class) ||
- innerMessage.getImplementedInterface().equals(BundleUpdateGroupCase.class) ||
- innerMessage.getImplementedInterface().equals(BundleRemoveGroupCase.class)) {
+ } else if (innerMessage.getImplementedInterface().equals(BundleAddGroupCase.class)
+ || innerMessage.getImplementedInterface().equals(BundleUpdateGroupCase.class)
+ || innerMessage.getImplementedInterface().equals(BundleRemoveGroupCase.class)) {
dataBuilder.setBundleInnerMessage(convertBundleGroupCase(innerMessage, data));
} else if (innerMessage.getImplementedInterface().equals(BundleUpdatePortCase.class)) {
dataBuilder.setBundleInnerMessage(convertBundlePortCase(innerMessage, data));
return new BundleAddMessageOnfBuilder().setOnfAddMessageGroupingData(dataBuilder.build()).build();
}
- private BundleFlowModCase convertBundleFlowCase(final BundleInnerMessage messageCase, final VersionDatapathIdConvertorData data) throws ConversionException {
+ @Override
+ public BundleAddMessageSal convert(final BundleAddMessageOnf input, final MessagePath path)
+ throws ConversionException {
+ return new BundleAddMessageSalBuilder()
+ .setSalAddMessageData(new SalAddMessageDataBuilder(input.getOnfAddMessageGroupingData())
+ .build())
+ .build();
+ }
+
+ private BundleFlowModCase convertBundleFlowCase(final BundleInnerMessage messageCase,
+ final VersionDatapathIdConvertorData data) throws ConversionException {
Optional<List<FlowModInputBuilder>> flowModInputs = Optional.empty();
final Class clazz = messageCase.getImplementedInterface();
if (clazz.equals(BundleAddFlowCase.class)) {
- flowModInputs = converterExecutor.convert(new AddFlowInputBuilder(((BundleAddFlowCase)messageCase).getAddFlowCaseData()).build(), data);
+ flowModInputs = CONVERTER_EXECUTOR.convert(
+ new AddFlowInputBuilder(((BundleAddFlowCase) messageCase).getAddFlowCaseData()).build(), data);
} else if (clazz.equals(BundleUpdateFlowCase.class)) {
- flowModInputs = converterExecutor.convert(new UpdatedFlowBuilder(((BundleUpdateFlowCase)messageCase).getUpdateFlowCaseData()).build(), data);
+ flowModInputs = CONVERTER_EXECUTOR.convert(
+ new UpdatedFlowBuilder(((BundleUpdateFlowCase) messageCase).getUpdateFlowCaseData()).build(), data);
} else if (clazz.equals(BundleRemoveFlowCase.class)) {
- flowModInputs = converterExecutor.convert(new RemoveFlowInputBuilder(((BundleRemoveFlowCase)messageCase).getRemoveFlowCaseData()).build(), data);
+ flowModInputs = CONVERTER_EXECUTOR.convert(
+ new RemoveFlowInputBuilder(((BundleRemoveFlowCase) messageCase).getRemoveFlowCaseData()).build(),
+ data);
}
if (flowModInputs.isPresent()) {
return new BundleFlowModCaseBuilder()
.setFlowModCaseData(
new FlowModCaseDataBuilder(
- (flowModInputs
+ flowModInputs
.get()
.get(0)
- .setXid(xid))
+ .setXid(xid)
.build())
.build())
.build();
} else {
- throw new ConversionException("BundleFlowCase conversion unsuccessful - not able to convert to multiple flows.");
+ throw new ConversionException(
+ "BundleFlowCase conversion unsuccessful - not able to convert to multiple flows.");
}
} else {
throw new ConversionException("BundleFlowCase conversion unsuccessful.");
}
}
- private BundleGroupModCase convertBundleGroupCase(final BundleInnerMessage messageCase, final VersionDatapathIdConvertorData data) throws ConversionException {
+ private BundleGroupModCase convertBundleGroupCase(final BundleInnerMessage messageCase,
+ final VersionDatapathIdConvertorData data) throws ConversionException {
Optional<GroupModInputBuilder> groupModInput = Optional.empty();
final Class clazz = messageCase.getImplementedInterface();
if (clazz.equals(BundleAddGroupCase.class)) {
- groupModInput = converterExecutor.convert(new AddGroupInputBuilder(((BundleAddGroupCase)messageCase).getAddGroupCaseData()).build(), data);
+ groupModInput = CONVERTER_EXECUTOR.convert(
+ new AddGroupInputBuilder(((BundleAddGroupCase) messageCase).getAddGroupCaseData()).build(), data);
} else if (clazz.equals(BundleUpdateGroupCase.class)) {
- groupModInput = converterExecutor.convert(new UpdatedGroupBuilder(((BundleUpdateGroupCase)messageCase).getUpdateGroupCaseData()).build(), data);
+ groupModInput = CONVERTER_EXECUTOR.convert(
+ new UpdatedGroupBuilder(((BundleUpdateGroupCase) messageCase).getUpdateGroupCaseData()).build(),
+ data);
} else if (clazz.equals(BundleRemoveGroupCase.class)) {
- groupModInput = converterExecutor.convert(new RemoveGroupInputBuilder(((BundleRemoveGroupCase)messageCase).getRemoveGroupCaseData()).build(), data);
+ groupModInput = CONVERTER_EXECUTOR.convert(
+ new RemoveGroupInputBuilder(((BundleRemoveGroupCase) messageCase).getRemoveGroupCaseData()).build(),
+ data);
}
if (groupModInput.isPresent()) {
}
}
- private BundlePortModCase convertBundlePortCase(final BundleInnerMessage messageCase, final VersionDatapathIdConvertorData data) throws ConversionException {
+ private BundlePortModCase convertBundlePortCase(final BundleInnerMessage messageCase,
+ final VersionDatapathIdConvertorData data) throws ConversionException {
Optional<PortModInput> portModInput = Optional.empty();
- final Class clazz = messageCase.getImplementedInterface();
+ final Class<?> clazz = messageCase.getImplementedInterface();
if (clazz.equals(BundleUpdatePortCase.class)) {
- portModInput = converterExecutor.convert(new PortBuilder(((BundleUpdatePortCase)messageCase).getUpdatePortCaseData().getPort().getPort().get(0)).build(), data);
+ portModInput = CONVERTER_EXECUTOR.convert(new PortBuilder(
+ ((BundleUpdatePortCase) messageCase).getUpdatePortCaseData().getPort().getPort().get(0)).build(),
+ data);
}
if (portModInput.isPresent()) {
public void setNode(NodeRef node) {
this.node = node;
}
-
- @Override
- public BundleAddMessageSal convert(final BundleAddMessageOnf input, final MessagePath path) throws ConversionException {
- return new BundleAddMessageSalBuilder()
- .setSalAddMessageData(new SalAddMessageDataBuilder(input.getOnfAddMessageGroupingData())
- .build())
- .build();
- }
}
package org.opendaylight.openflowplugin.extension.onf.converter;
-import org.opendaylight.openflowplugin.extension.api.ConvertorMessageFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConverterMessageToOFJava;
+import org.opendaylight.openflowplugin.extension.api.ConvertorMessageFromOFJava;
import org.opendaylight.openflowplugin.extension.api.path.MessagePath;
import org.opendaylight.openflowplugin.extension.onf.OnfConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
@Override
public BundleControlOnf
convert(final BundleControlSal experimenterMessageCase) {
- return new BundleControlOnfBuilder()
- .setOnfControlGroupingData(new OnfControlGroupingDataBuilder(experimenterMessageCase.getSalControlData()).build())
- .build();
+ return new BundleControlOnfBuilder().setOnfControlGroupingData(
+ new OnfControlGroupingDataBuilder(experimenterMessageCase.getSalControlData()).build()).build();
}
@Override
}
private static BundleFlags createBundleFlags(final int flags) {
- Boolean isAtomic = (flags & (1 << 0)) != 0;
- Boolean isOrdered = (flags & (1 << 1)) != 0;
+ Boolean isAtomic = (flags & 1 << 0) != 0;
+ Boolean isOrdered = (flags & 1 << 1) != 0;
return new BundleFlags(isAtomic, isOrdered);
}
OFDeserializer<BundlePropertyExperimenterData> deserializer = deserializerRegistry.getDeserializer(
new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, experimenterId, expType,
BundlePropertyExperimenterData.class));
- experimenterProperty.setBundlePropertyExperimenterData(deserializer.deserialize(message.readBytes(length - 12)));
+ experimenterProperty.setBundlePropertyExperimenterData(
+ deserializer.deserialize(message.readBytes(length - 12)));
return new BundlePropertyBuilder().setType(BundlePropertyType.ONFETBPTEXPERIMENTER)
.setBundlePropertyEntry(experimenterProperty.build())
}
@Override
- public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
- this.deserializerRegistry = deserializerRegistry;
+ public void injectDeserializerRegistry(DeserializerRegistry registry) {
+ this.deserializerRegistry = registry;
}
}
protected SerializerRegistry serializerRegistry;
@Override
- public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
- this.serializerRegistry = serializerRegistry;
+ public void injectSerializerRegistry(SerializerRegistry registry) {
+ this.serializerRegistry = registry;
}
static void writeBundleFlags(final BundleFlags bundleFlags, final ByteBuf outBuffer) {
for (BundleProperty property : properties) {
BundlePropertyType type = property.getType();
if (type != null && type.equals(BundlePropertyType.ONFETBPTEXPERIMENTER)) {
- int startIndex = outBuffer.writerIndex();
+ final int startIndex = outBuffer.writerIndex();
outBuffer.writeShort(type.getIntValue());
int lengthIndex = outBuffer.writerIndex();
outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
- writeBundleExperimenterProperty((BundlePropertyExperimenter)property.getBundlePropertyEntry(), outBuffer);
+ writeBundleExperimenterProperty((BundlePropertyExperimenter)property.getBundlePropertyEntry(),
+ outBuffer);
outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
} else {
LOG.warn("Trying to serialize unknown bundle property (type: {}), skipping",
private static short fillBitMask(final boolean... values) {
short bitmask = 0;
- short i = 0;
+ short index = 0;
for (boolean v : values) {
if (v) {
- bitmask |= 1 << i;
+ bitmask |= 1 << index;
}
- ++i;
+ ++index;
}
return bitmask;
}
-
}
private static byte[] hexStringToBytes(final String hexSrc) {
List<String> byteChips = Lists.newArrayList(HEXSTRING_SPLITTER.split(hexSrc));
byte[] result = new byte[byteChips.size()];
- int i = 0;
+ int index = 0;
for (String chip : byteChips) {
- result[i] = (byte) Short.parseShort(chip, 16);
- i++;
+ result[index] = (byte) Short.parseShort(chip, 16);
+ index++;
}
return result;
}
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.openflowplugin.extension.onf.BundleTestUtils;
@Test
public void testConvertAddFlowCase() throws Exception {
- testConvert(new BundleAddFlowCaseBuilder().setAddFlowCaseData(new AddFlowCaseDataBuilder().build()).build(), BundleFlowModCase.class);
+ testConvert(new BundleAddFlowCaseBuilder().setAddFlowCaseData(new AddFlowCaseDataBuilder().build()).build(),
+ BundleFlowModCase.class);
}
@Test
public void testConvertUpdateFlowCase() throws Exception {
- testConvert(new BundleUpdateFlowCaseBuilder().setUpdateFlowCaseData(new UpdateFlowCaseDataBuilder().build()).build(), BundleFlowModCase.class);
+ testConvert(new BundleUpdateFlowCaseBuilder().setUpdateFlowCaseData(new UpdateFlowCaseDataBuilder().build())
+ .build(), BundleFlowModCase.class);
}
@Test
public void testConvertRemoveFlowCase() throws Exception {
- testConvert(new BundleRemoveFlowCaseBuilder().setRemoveFlowCaseData(new RemoveFlowCaseDataBuilder().build()).build(), BundleFlowModCase.class);
+ testConvert(new BundleRemoveFlowCaseBuilder().setRemoveFlowCaseData(new RemoveFlowCaseDataBuilder().build())
+ .build(), BundleFlowModCase.class);
}
@Test
public void testConvertAddGroupCase() throws Exception {
- testConvert(new BundleAddGroupCaseBuilder().setAddGroupCaseData(new AddGroupCaseDataBuilder().setGroupId(GROUP_ID).build()).build(), BundleGroupModCase.class);
+ testConvert(
+ new BundleAddGroupCaseBuilder()
+ .setAddGroupCaseData(new AddGroupCaseDataBuilder().setGroupId(GROUP_ID).build()).build(),
+ BundleGroupModCase.class);
}
@Test
public void testConvertUpdateGroupCase() throws Exception {
- testConvert(new BundleUpdateGroupCaseBuilder().setUpdateGroupCaseData(new UpdateGroupCaseDataBuilder().setGroupId(GROUP_ID).build()).build(), BundleGroupModCase.class);
+ testConvert(
+ new BundleUpdateGroupCaseBuilder()
+ .setUpdateGroupCaseData(new UpdateGroupCaseDataBuilder().setGroupId(GROUP_ID).build()).build(),
+ BundleGroupModCase.class);
}
@Test
public void testConvertRemoveGroupCase() throws Exception {
- testConvert(new BundleRemoveGroupCaseBuilder().setRemoveGroupCaseData(new RemoveGroupCaseDataBuilder().setGroupId(GROUP_ID).build()).build(), BundleGroupModCase.class);
+ testConvert(
+ new BundleRemoveGroupCaseBuilder()
+ .setRemoveGroupCaseData(new RemoveGroupCaseDataBuilder().setGroupId(GROUP_ID).build()).build(),
+ BundleGroupModCase.class);
}
@Test
testConvert(new BundleUpdatePortCaseBuilder()
.setUpdatePortCaseData(new UpdatePortCaseDataBuilder()
.setPort(new PortBuilder()
- .setPort(Collections.singletonList(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder()
+ .setPort(Collections.singletonList(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow
+ .types.port.rev130925.port.mod.port.PortBuilder()
.setConfiguration(Mockito.mock(PortConfig.class))
.setAdvertisedFeatures(Mockito.mock(PortFeatures.class))
.setPortNumber(Mockito.mock(PortNumberUni.class))
}
private void testConvert(final boolean withProperty) throws Exception {
- final BundleInnerMessage message = new BundleAddFlowCaseBuilder().setAddFlowCaseData(new AddFlowCaseDataBuilder().build()).build();
+ final BundleInnerMessage message = new BundleAddFlowCaseBuilder()
+ .setAddFlowCaseData(new AddFlowCaseDataBuilder().build()).build();
testConvert(message, BundleFlowModCase.class, withProperty);
}
- private void testConvert(final BundleInnerMessage message, Class clazz, final boolean withProperty) throws Exception {
+ private void testConvert(final BundleInnerMessage message, Class clazz, final boolean withProperty)
+ throws Exception {
final BundleAddMessageSal original = createMessage(withProperty, message);
final BundleAddMessageOnf converted = converter.convert(original);
- Assert.assertEquals("Wrong BundleId", new BundleId(original.getSalAddMessageData().getBundleId().getValue()), converted.getOnfAddMessageGroupingData().getBundleId());
- Assert.assertEquals("Wrong flags", new BundleFlags(original.getSalAddMessageData().getFlags().isAtomic(), original.getSalAddMessageData().getFlags().isOrdered()), converted.getOnfAddMessageGroupingData().getFlags());
- Assert.assertEquals("Wrong inner message conversion", clazz, converted.getOnfAddMessageGroupingData().getBundleInnerMessage().getImplementedInterface());
+ Assert.assertEquals("Wrong BundleId", new BundleId(original.getSalAddMessageData().getBundleId().getValue()),
+ converted.getOnfAddMessageGroupingData().getBundleId());
+ Assert.assertEquals("Wrong flags",
+ new BundleFlags(original.getSalAddMessageData().getFlags().isAtomic(),
+ original.getSalAddMessageData().getFlags().isOrdered()),
+ converted.getOnfAddMessageGroupingData().getFlags());
+ Assert.assertEquals("Wrong inner message conversion", clazz,
+ converted.getOnfAddMessageGroupingData().getBundleInnerMessage().getImplementedInterface());
if (withProperty) {
- final BundlePropertyExperimenter originalProperty = (BundlePropertyExperimenter) original.getSalAddMessageData().getBundleProperty().get(0).getBundlePropertyEntry();
- final BundlePropertyExperimenter convertedProperty = ((BundlePropertyExperimenter) converted.getOnfAddMessageGroupingData().getBundleProperty().get(0).getBundlePropertyEntry());
- Assert.assertEquals("Wrong property ExperimenterId", new ExperimenterId(originalProperty.getExperimenter()), convertedProperty.getExperimenter());
- Assert.assertEquals("Wrong property experimenter type", originalProperty.getExpType(), convertedProperty.getExpType());
- Assert.assertEquals("Wrong property data", originalProperty.getBundlePropertyExperimenterData(), convertedProperty.getBundlePropertyExperimenterData());
+ final BundlePropertyExperimenter originalProperty = (BundlePropertyExperimenter) original
+ .getSalAddMessageData().getBundleProperty().get(0).getBundlePropertyEntry();
+ final BundlePropertyExperimenter convertedProperty = (BundlePropertyExperimenter) converted
+ .getOnfAddMessageGroupingData().getBundleProperty().get(0).getBundlePropertyEntry();
+ Assert.assertEquals("Wrong property ExperimenterId", new ExperimenterId(originalProperty.getExperimenter()),
+ convertedProperty.getExperimenter());
+ Assert.assertEquals("Wrong property experimenter type", originalProperty.getExpType(),
+ convertedProperty.getExpType());
+ Assert.assertEquals("Wrong property data", originalProperty.getBundlePropertyExperimenterData(),
+ convertedProperty.getBundlePropertyExperimenterData());
} else {
- Assert.assertTrue("Properties not empty", converted.getOnfAddMessageGroupingData().getBundleProperty().isEmpty());
+ Assert.assertTrue("Properties not empty",
+ converted.getOnfAddMessageGroupingData().getBundleProperty().isEmpty());
}
}
- private static BundleAddMessageSal createMessage(final boolean withProperty, final BundleInnerMessage innerMessage) {
+ private static BundleAddMessageSal createMessage(final boolean withProperty,
+ final BundleInnerMessage innerMessage) {
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
dataBuilder.setBundleId(new BundleId(1L));
dataBuilder.setFlags(new BundleFlags(true, false));
List<BundleProperty> properties = new ArrayList<>();
if (withProperty) {
- properties.add(BundleTestUtils.createExperimenterProperty(Mockito.mock(BundlePropertyExperimenterData.class)));
+ properties.add(
+ BundleTestUtils.createExperimenterProperty(Mockito.mock(BundlePropertyExperimenterData.class)));
}
dataBuilder.setBundleProperty(properties);
dataBuilder.setBundleInnerMessage(innerMessage);
return new BundleAddMessageSalBuilder().setSalAddMessageData(dataBuilder.build()).build();
}
-}
\ No newline at end of file
+}
.getBundleProperty()
.get(0)
.getBundlePropertyEntry();
- final BundlePropertyExperimenter convertedProperty = ((BundlePropertyExperimenter) ofjMessage
+ final BundlePropertyExperimenter convertedProperty = (BundlePropertyExperimenter) ofjMessage
.getOnfControlGroupingData()
.getBundleProperty()
.get(0)
- .getBundlePropertyEntry());
- Assert.assertEquals("Wrong property ExperimenterId", new ExperimenterId(originalProperty.getExperimenter()), convertedProperty.getExperimenter());
- Assert.assertEquals("Wrong property experimenter type", originalProperty.getExpType(), convertedProperty.getExpType());
- Assert.assertEquals("Wrong property data", originalProperty.getBundlePropertyExperimenterData(), convertedProperty.getBundlePropertyExperimenterData());
+ .getBundlePropertyEntry();
+ Assert.assertEquals("Wrong property ExperimenterId", new ExperimenterId(originalProperty.getExperimenter()),
+ convertedProperty.getExperimenter());
+ Assert.assertEquals("Wrong property experimenter type", originalProperty.getExpType(),
+ convertedProperty.getExpType());
+ Assert.assertEquals("Wrong property data", originalProperty.getBundlePropertyExperimenterData(),
+ convertedProperty.getBundlePropertyExperimenterData());
} else {
Assert.assertTrue("Properties not empty",
ofjMessage
dataBuilder.setFlags(new BundleFlags(true, false));
List<BundleProperty> properties = new ArrayList<>();
if (withProperty) {
- properties.add(BundleTestUtils.createExperimenterProperty(Mockito.mock(BundlePropertyExperimenterData.class)));
+ properties.add(BundleTestUtils.createExperimenterProperty(
+ Mockito.mock(BundlePropertyExperimenterData.class)));
}
dataBuilder.setBundleProperty(properties);
return new BundleControlSalBuilder().setSalControlData(dataBuilder.build()).build();
dataBuilder.setFlags(new BundleFlags(false, false));
List<BundleProperty> properties = new ArrayList<>();
if (withProperty) {
- properties.add(BundleTestUtils.createExperimenterProperty(Mockito.mock(BundlePropertyExperimenterData.class)));
+ properties.add(BundleTestUtils.createExperimenterProperty(
+ Mockito.mock(BundlePropertyExperimenterData.class)));
}
dataBuilder.setBundleProperty(properties);
return new BundleControlOnfBuilder().setOnfControlGroupingData(dataBuilder.build()).build();
}
-
}
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
-import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
import org.opendaylight.openflowplugin.extension.onf.BundleTestUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleControlType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags;
dataBuilder.setFlags(new BundleFlags(true, true));
if (withProperty) {
- dataBuilder.setBundleProperty((new ArrayList<>(Collections.singleton(
- BundleTestUtils.createExperimenterProperty(propertyExperimenterData)))));
+ dataBuilder.setBundleProperty(new ArrayList<>(Collections.singleton(
+ BundleTestUtils.createExperimenterProperty(propertyExperimenterData))));
Mockito.when(registry.getSerializer(Matchers.any())).thenReturn(propertySerializer);
((SerializerRegistryInjector) factory).injectSerializerRegistry(registry);
}
Assert.assertEquals("Wrong type", BundleControlType.ONFBCTOPENREQUEST.getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong flags", 3, out.readUnsignedShort());
if (withProperty) {
- Assert.assertEquals("Wrong property type", BundlePropertyType.ONFETBPTEXPERIMENTER.getIntValue(), out.readUnsignedShort());
- int length = out.readUnsignedShort();
+ Assert.assertEquals("Wrong property type", BundlePropertyType.ONFETBPTEXPERIMENTER.getIntValue(),
+ out.readUnsignedShort());
+ out.readUnsignedShort(); // length
Assert.assertEquals("Wrong experimenter ID", 1, out.readUnsignedInt());
Assert.assertEquals("Wrong experimenter type", 2, out.readUnsignedInt());
Mockito.verify(propertySerializer, Mockito.times(1)).serialize(propertyExperimenterData, out);
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
}
-
-}
\ No newline at end of file
+}
-/**\r
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.\r
- * \r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowplugin.extension.test;\r
-\r
-import java.math.BigInteger;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.concurrent.Future;\r
-\r
-import org.opendaylight.openflowplugin.extension.api.AugmentTuple;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg0;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxRegCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestFlowInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestService;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;\r
-\r
-import com.google.common.util.concurrent.Futures;\r
-\r
-/**\r
- * @author msunal\r
- *\r
- */\r
-public class Test implements TestService {\r
- \r
- private SalFlowService flowService;\r
-\r
-\r
- @Override\r
- public Future<RpcResult<Void>> testFlow(TestFlowInput input) {\r
- AddFlowInputBuilder flow = new AddFlowInputBuilder();\r
- flow.setPriority(2);\r
- flow.setMatch(createMatchBld().build());\r
- flow.setInstructions(createDecNwTtlInstructionsBld().build());\r
- flow.setBarrier(Boolean.FALSE);\r
- BigInteger value = BigInteger.valueOf(10L);\r
- flow.setCookie(new FlowCookie(value));\r
- flow.setCookieMask(new FlowCookie(value));\r
- flow.setHardTimeout(0);\r
- flow.setIdleTimeout(0);\r
- flow.setInstallHw(false);\r
- flow.setStrict(false);\r
- flow.setContainerName(null);\r
- flow.setFlags(new FlowModFlags(false, false, false, false, true));\r
- flow.setTableId((short) 0);\r
-\r
- flow.setFlowName("NiciraFLOW");\r
- \r
- // Construct the flow instance id\r
- final InstanceIdentifier<Node> flowInstanceId = InstanceIdentifier\r
- .builder(Nodes.class) // File under nodes\r
- .child(Node.class, new NodeKey(new NodeId("openflow:1"))).build(); // A particular node identified by nodeKey\r
- flow.setNode(new NodeRef(flowInstanceId));\r
- \r
- pushFlowViaRpc(flow.build());\r
- \r
- return Futures.immediateFuture(RpcResultBuilder.<Void>status(true).build());\r
- }\r
- \r
- /**\r
- * @param addFlowInput\r
- */\r
- private void pushFlowViaRpc(AddFlowInput addFlowInput) {\r
- flowService.addFlow(addFlowInput);\r
- }\r
-\r
- /**\r
- * @param flowService the flowService to set\r
- */\r
- public void setFlowService(SalFlowService flowService) {\r
- this.flowService = flowService;\r
- }\r
- \r
- private static MatchBuilder createMatchBld() {\r
- MatchBuilder match = new MatchBuilder();\r
- Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();\r
- Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");\r
- ipv4Match.setIpv4Destination(prefix);\r
- Ipv4Match i4m = ipv4Match.build();\r
- match.setLayer3Match(i4m);\r
-\r
- EthernetMatchBuilder eth = new EthernetMatchBuilder();\r
- EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();\r
- ethTypeBuilder.setType(new EtherType(0x0800L));\r
- eth.setEthernetType(ethTypeBuilder.build());\r
- match.setEthernetMatch(eth.build());\r
- \r
-// AugmentTuple<Match> extAugmentWrapper = createNxMatchAugment();\r
-// match.addAugmentation(extAugmentWrapper.getAugmentationClass(), extAugmentWrapper.getAugmentationObject());\r
- \r
- return match;\r
- }\r
- \r
- private static AugmentTuple<Match> createNxMatchAugment() {\r
- // TODO add example\r
- return null;\r
- }\r
-\r
- private static InstructionsBuilder createDecNwTtlInstructionsBld() {\r
- // Add our drop action to a list\r
- List<Action> actionList = new ArrayList<Action>();\r
- actionList.add(createOFAction(0).build());\r
- actionList.add(createNxActionBld(1).build());\r
- \r
- // Create an Apply Action\r
- ApplyActionsBuilder aab = new ApplyActionsBuilder();\r
- aab.setAction(actionList);\r
- \r
- // Wrap our Apply Action in an Instruction\r
- InstructionBuilder ib = new InstructionBuilder();\r
- ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());\r
- ib.setKey(new InstructionKey(0));\r
- ib.setOrder(0);\r
-\r
- // Put our Instruction in a list of Instructions\r
- InstructionsBuilder isb = new InstructionsBuilder();\r
- List<Instruction> instructions = new ArrayList<Instruction>();\r
- instructions.add(ib.build());\r
- ib.setKey(new InstructionKey(0));\r
- isb.setInstruction(instructions);\r
- return isb;\r
- }\r
-\r
- /**\r
- * @param actionKeyVal \r
- * @return\r
- */\r
- private static ActionBuilder createOFAction(int actionKeyVal) {\r
- DecNwTtlBuilder ta = new DecNwTtlBuilder();\r
- DecNwTtl decNwTtl = ta.build();\r
- ActionBuilder ab = new ActionBuilder();\r
- ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());\r
- ab.setKey(new ActionKey(actionKeyVal));\r
- return ab;\r
- }\r
-\r
- /**\r
- * @param actionKeyVal TODO\r
- * @return\r
- */\r
- private static ActionBuilder createNxActionBld(int actionKeyVal) {\r
- // vendor part\r
- DstNxRegCaseBuilder nxRegCaseBld = new DstNxRegCaseBuilder().setNxReg(NxmNxReg0.class);\r
- DstBuilder dstBld = new DstBuilder()\r
- .setDstChoice(nxRegCaseBld.build())\r
- .setStart(0)\r
- .setEnd(5);\r
- NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();\r
- nxRegLoadBuilder.setDst(dstBld.build());\r
- nxRegLoadBuilder.setValue(BigInteger.valueOf(55L));\r
- NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder topNxActionCaseBld = new NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder();\r
- topNxActionCaseBld.setNxRegLoad(nxRegLoadBuilder.build());\r
- \r
- // base part\r
- ActionBuilder abExt = new ActionBuilder();\r
- abExt.setKey(new ActionKey(actionKeyVal));\r
- abExt.setAction(topNxActionCaseBld.build());\r
- return abExt;\r
- }\r
- \r
-\r
-}\r
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowplugin.extension.test;
+
+import com.google.common.util.concurrent.Futures;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg0;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxRegCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
+/**
+ * Implementation of TestService.
+ *
+ * @author msunal
+ */
+public class Test implements TestService {
+
+ private SalFlowService flowService;
+
+
+ @Override
+ public Future<RpcResult<Void>> testFlow(TestFlowInput input) {
+ AddFlowInputBuilder flow = new AddFlowInputBuilder();
+ flow.setPriority(2);
+ flow.setMatch(createMatchBld().build());
+ flow.setInstructions(createDecNwTtlInstructionsBld().build());
+ flow.setBarrier(Boolean.FALSE);
+ BigInteger value = BigInteger.valueOf(10L);
+ flow.setCookie(new FlowCookie(value));
+ flow.setCookieMask(new FlowCookie(value));
+ flow.setHardTimeout(0);
+ flow.setIdleTimeout(0);
+ flow.setInstallHw(false);
+ flow.setStrict(false);
+ flow.setContainerName(null);
+ flow.setFlags(new FlowModFlags(false, false, false, false, true));
+ flow.setTableId((short) 0);
+
+ flow.setFlowName("NiciraFLOW");
+
+ // Construct the flow instance id
+ final InstanceIdentifier<Node> flowInstanceId = InstanceIdentifier
+ .builder(Nodes.class) // File under nodes
+ // A particular node identified by nodeKey
+ .child(Node.class, new NodeKey(new NodeId("openflow:1"))).build();
+ flow.setNode(new NodeRef(flowInstanceId));
+
+ pushFlowViaRpc(flow.build());
+
+ return Futures.immediateFuture(RpcResultBuilder.<Void>status(true).build());
+ }
+
+ private void pushFlowViaRpc(AddFlowInput addFlowInput) {
+ flowService.addFlow(addFlowInput);
+ }
+
+ public void setFlowService(SalFlowService flowService) {
+ this.flowService = flowService;
+ }
+
+ private static MatchBuilder createMatchBld() {
+ MatchBuilder match = new MatchBuilder();
+ Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
+ Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
+ ipv4Match.setIpv4Destination(prefix);
+ Ipv4Match i4m = ipv4Match.build();
+ match.setLayer3Match(i4m);
+
+ EthernetMatchBuilder eth = new EthernetMatchBuilder();
+ EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+ ethTypeBuilder.setType(new EtherType(0x0800L));
+ eth.setEthernetType(ethTypeBuilder.build());
+ match.setEthernetMatch(eth.build());
+
+// AugmentTuple<Match> extAugmentWrapper = createNxMatchAugment();
+// match.addAugmentation(extAugmentWrapper.getAugmentationClass(), extAugmentWrapper.getAugmentationObject());
+
+ return match;
+ }
+
+ private static AugmentTuple<Match> createNxMatchAugment() {
+ // TODO add example
+ return null;
+ }
+
+ private static InstructionsBuilder createDecNwTtlInstructionsBld() {
+ // Add our drop action to a list
+ List<Action> actionList = new ArrayList<>();
+ actionList.add(createOFAction(0).build());
+ actionList.add(createNxActionBld(1).build());
+
+ // Create an Apply Action
+ ApplyActionsBuilder aab = new ApplyActionsBuilder();
+ aab.setAction(actionList);
+
+ // Wrap our Apply Action in an Instruction
+ InstructionBuilder ib = new InstructionBuilder();
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+ ib.setKey(new InstructionKey(0));
+ ib.setOrder(0);
+
+ // Put our Instruction in a list of Instructions
+ InstructionsBuilder isb = new InstructionsBuilder();
+ List<Instruction> instructions = new ArrayList<>();
+ instructions.add(ib.build());
+ ib.setKey(new InstructionKey(0));
+ isb.setInstruction(instructions);
+ return isb;
+ }
+
+ private static ActionBuilder createOFAction(int actionKeyVal) {
+ DecNwTtlBuilder ta = new DecNwTtlBuilder();
+ DecNwTtl decNwTtl = ta.build();
+ ActionBuilder ab = new ActionBuilder();
+ ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
+ ab.setKey(new ActionKey(actionKeyVal));
+ return ab;
+ }
+
+ private static ActionBuilder createNxActionBld(int actionKeyVal) {
+ // vendor part
+ DstNxRegCaseBuilder nxRegCaseBld = new DstNxRegCaseBuilder().setNxReg(NxmNxReg0.class);
+ DstBuilder dstBld = new DstBuilder()
+ .setDstChoice(nxRegCaseBld.build())
+ .setStart(0)
+ .setEnd(5);
+ NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
+ nxRegLoadBuilder.setDst(dstBld.build());
+ nxRegLoadBuilder.setValue(BigInteger.valueOf(55L));
+ NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder topNxActionCaseBld =
+ new NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder();
+ topNxActionCaseBld.setNxRegLoad(nxRegLoadBuilder.build());
+
+ // base part
+ ActionBuilder abExt = new ActionBuilder();
+ abExt.setKey(new ActionKey(actionKeyVal));
+ abExt.setAction(topNxActionCaseBld.build());
+ return abExt;
+ }
+}
final ConvertorExecutor convertorExecutor) {
FlowStatsResponseConvertorData flowData = new FlowStatsResponseConvertorData(data.getVersion());
flowData.setDatapathId(data.getDatapathId());
- flowData.setMatchPath(MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ flowData.setMatchPath(MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
MultipartReplyFlowStatsBuilder message = new MultipartReplyFlowStatsBuilder();
MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) msg.getMultipartReplyBody();
MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_LENGTH,
Match.class,
- MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
private DeserializerRegistry registry;
private static final MessageCodeKey MATCH_KEY = new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_VALUE, Match.class,
- MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
private DeserializerRegistry registry;
final int startIndex = message.readerIndex();
int offset = 0;
- while ((message.readerIndex() - startIndex) < length) {
+ while (message.readerIndex() - startIndex < length) {
final int type = message.getUnsignedShort(message.readerIndex());
OFDeserializer<Instruction> deserializer = null;
deserializer = registry.getDeserializer(
new MessageCodeActionExperimenterKey(
EncodeConstants.OF13_VERSION_ID, type, Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ ActionPath.INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS,
null));
} else if (InstructionConstants.WRITE_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
new MessageCodeActionExperimenterKey(
EncodeConstants.OF13_VERSION_ID, type, Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS,
null));
} else {
Long expId = null;
}
private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
- final Boolean ofp_FF_SendFlowRem = (input & (1 << 0)) > 0;
- final Boolean ofp_FF_CheckOverlap = (input & (1 << 1)) > 0;
- final Boolean ofp_FF_ResetCounts = (input & (1 << 2)) > 0;
- final Boolean ofp_FF_NoPktCounts = (input & (1 << 3)) > 0;
- final Boolean ofp_FF_NoBytCounts = (input & (1 << 4)) > 0;
+ final Boolean ofp_FF_SendFlowRem = (input & 1 << 0) > 0;
+ final Boolean ofp_FF_CheckOverlap = (input & 1 << 1) > 0;
+ final Boolean ofp_FF_ResetCounts = (input & 1 << 2) > 0;
+ final Boolean ofp_FF_NoPktCounts = (input & 1 << 3) > 0;
+ final Boolean ofp_FF_NoBytCounts = (input & 1 << 4) > 0;
return new FlowModFlags(ofp_FF_CheckOverlap, ofp_FF_NoBytCounts, ofp_FF_NoPktCounts, ofp_FF_ResetCounts,
ofp_FF_SendFlowRem);
}
final int bucketLength = length - BUCKETS_HEADER_LENGTH;
int offset = 0;
- while ((message.readerIndex() - startIndex) < bucketLength) {
+ while (message.readerIndex() - startIndex < bucketLength) {
actions.add(new ActionBuilder()
.setKey(new ActionKey(offset))
.setOrder(offset)
.setAction(ActionUtil.readAction(EncodeConstants.OF13_VERSION_ID, message, registry,
- ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION))
+ ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION))
.build());
offset++;
private static final byte PADDING_IN_PACKET_IN_HEADER = 2;
private static final MessageCodeKey MATCH_KEY = new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_VALUE, Match.class,
- MatchPath.PACKETINMESSAGE_MATCH);
+ MatchPath.PACKET_IN_MESSAGE_MATCH);
private DeserializerRegistry registry;
private static final MessageCodeKey MATCH_KEY = new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_VALUE, Match.class,
- MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
private static final byte PADDING_IN_FLOW_STATS_HEADER_01 = 1;
private static final byte PADDING_IN_FLOW_STATS_HEADER_02 = 4;
final int startIndex = itemMessage.readerIndex();
int offset = 0;
- while ((itemMessage.readerIndex() - startIndex) < length) {
+ while (itemMessage.readerIndex() - startIndex < length) {
instructions.add(new InstructionBuilder()
.setKey(new InstructionKey(offset))
.setOrder(offset)
}
private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
- final Boolean ofp_FF_SendFlowRem = (input & (1)) > 0;
- final Boolean ofp_FF_CheckOverlap = (input & (1 << 1)) > 0;
- final Boolean ofp_FF_ResetCounts = (input & (1 << 2)) > 0;
- final Boolean ofp_FF_NoPktCounts = (input & (1 << 3)) > 0;
- final Boolean ofp_FF_NoBytCounts = (input & (1 << 4)) > 0;
+ final Boolean ofp_FF_SendFlowRem = (input & 1) > 0;
+ final Boolean ofp_FF_CheckOverlap = (input & 1 << 1) > 0;
+ final Boolean ofp_FF_ResetCounts = (input & 1 << 2) > 0;
+ final Boolean ofp_FF_NoPktCounts = (input & 1 << 3) > 0;
+ final Boolean ofp_FF_NoBytCounts = (input & 1 << 4) > 0;
return new FlowModFlags(ofp_FF_CheckOverlap, ofp_FF_NoBytCounts, ofp_FF_NoPktCounts, ofp_FF_ResetCounts,
ofp_FF_SendFlowRem);
}
final int bucketLength = bucketsLength - BUCKETS_HEADER_LENGTH;
int offset = 0;
- while ((message.readerIndex() - startIndex) < bucketLength) {
+ while (message.readerIndex() - startIndex < bucketLength) {
actions.add(new ActionBuilder()
.setKey(new ActionKey(offset))
.setOrder(offset)
.setAction(ActionUtil.readAction(EncodeConstants.OF13_VERSION_ID, message, registry,
- ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION))
+ ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION))
.build());
offset++;
final int startIndex = message.readerIndex();
- while ((message.readerIndex() - startIndex) < length) {
+ while (message.readerIndex() - startIndex < length) {
MATCH_FIELD_DESERIALIZER
.deserialize(message)
.map(matchFields::add)
final int startIndex = message.readerIndex();
int offset = 0;
- while ((message.readerIndex() - startIndex) < length) {
+ while (message.readerIndex() - startIndex < length) {
try {
instructions.add(new InstructionBuilder()
.setKey(new InstructionKey(offset))
final int startIndex = message.readerIndex();
int offset = 0;
- while ((message.readerIndex() - startIndex) < length) {
+ while (message.readerIndex() - startIndex < length) {
try {
actions.add(new ActionBuilder()
.setKey(new ActionKey(offset))
.setOrder(offset)
.setAction(ActionUtil.readActionHeader(EncodeConstants.OF13_VERSION_ID, message, registry,
- ActionPath
- .FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION))
+ ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS))
.build());
offset++;
deserializer = registry.getDeserializer(
new MessageCodeActionExperimenterKey(
version, type, Instruction.class,
- ActionPath
- .FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION,
+ ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS,
null));
} else if (InstructionConstants.WRITE_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
new MessageCodeActionExperimenterKey(
version, type, Instruction.class,
- ActionPath
- .FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION,
+ ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS,
null));
} else {
Long expId = null;
deserializer = registry.getDeserializer(
new MessageCodeActionExperimenterKey(
version, type, Instruction.class,
- ActionPath
- .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ ActionPath.INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS,
null));
} else if (InstructionConstants.WRITE_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
new MessageCodeActionExperimenterKey(
version, type, Instruction.class,
- ActionPath
- .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS,
null));
} else {
Long expId = null;
final ConvertorExecutor convertorExecutor) {
final FlowStatsResponseConvertorData data = new FlowStatsResponseConvertorData(ofVersion.getVersion());
data.setDatapathId(deviceInfo.getDatapathId());
- data.setMatchPath(MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ data.setMatchPath(MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
final FlowsStatisticsUpdateBuilder notification = new FlowsStatisticsUpdateBuilder();
final List<FlowAndStatisticsMapList> statsList = new ArrayList<>();
notification.setId(deviceInfo.getNodeId());
super(requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
data = new FlowStatsResponseConvertorData(getVersion());
data.setDatapathId(getDatapathId());
- data.setMatchPath(MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH);
+ data.setMatchPath(MatchPath.FLOWS_STATISTICS_RPC_MATCH);
}
@Override
final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match>
matchExtensionWrap = MatchExtensionHelper
.processAllExtensions(input.getMatch().getMatchEntry(), OpenflowVersion.get(input.getVersion()),
- MatchPath.PACKETRECEIVED_MATCH);
+ MatchPath.PACKET_RECEIVED_MATCH);
if (matchExtensionWrap != null) {
matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(),
protected void init() {
deserializer = getRegistry().getDeserializer(
new MessageCodeActionExperimenterKey(EncodeConstants.OF13_VERSION_ID, getType(), Instruction.class,
- ActionPath
- .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ ActionPath.INVENTORY_FLOWNODE_TABLE_APPLY_ACTIONS,
null));
}
protected void init() {
deserializer = getRegistry().getDeserializer(
new MessageCodeActionExperimenterKey(EncodeConstants.OF13_VERSION_ID, getType(), Instruction.class,
- ActionPath
- .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS,
null));
}
deserializer = getRegistry().getDeserializer(new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_LENGTH,
Match.class,
- MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH));
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH));
}
private void deserializeAlreadyFilledCase(ByteBuf inBuffer) {
AugmentTuple<EXT_POINT> augmentTuple = null;
if (!extensionsList.isEmpty()) {
switch (matchPath) {
- case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_UPDATE_MATCH:
GeneralAugMatchNotifUpdateFlowStatsBuilder generalExtMatchAugBld1 = new GeneralAugMatchNotifUpdateFlowStatsBuilder();
generalExtMatchAugBld1.setExtensionList(extensionsList);
augmentTuple = (AugmentTuple<EXT_POINT>)
- new AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match>(
+ new AugmentTuple<>(
GeneralAugMatchNotifUpdateFlowStats.class, generalExtMatchAugBld1.build());
break;
- case PACKETRECEIVED_MATCH:
+ case PACKET_RECEIVED_MATCH:
GeneralAugMatchNotifPacketInBuilder generalExtMatchAugBld2 = new GeneralAugMatchNotifPacketInBuilder();
generalExtMatchAugBld2.setExtensionList(extensionsList);
augmentTuple = (AugmentTuple<EXT_POINT>)
- new AugmentTuple<Match>(GeneralAugMatchNotifPacketIn.class, generalExtMatchAugBld2.build());
+ new AugmentTuple<>(GeneralAugMatchNotifPacketIn.class, generalExtMatchAugBld2.build());
break;
- case PACKETINMESSAGE_MATCH:
+ case PACKET_IN_MESSAGE_MATCH:
GeneralAugMatchPacketInMessageBuilder generalExtMatchAugBld5 = new GeneralAugMatchPacketInMessageBuilder();
generalExtMatchAugBld5.setExtensionList(extensionsList);
augmentTuple = (AugmentTuple<EXT_POINT>)
- new AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.in.message
- .Match>(GeneralAugMatchPacketInMessage.class, generalExtMatchAugBld5.build());
+ new AugmentTuple<>(GeneralAugMatchPacketInMessage.class, generalExtMatchAugBld5.build());
break;
- case SWITCHFLOWREMOVED_MATCH:
+ case SWITCH_FLOW_REMOVED_MATCH:
GeneralAugMatchNotifSwitchFlowRemovedBuilder generalExtMatchAugBld3 = new GeneralAugMatchNotifSwitchFlowRemovedBuilder();
generalExtMatchAugBld3.setExtensionList(extensionsList);
augmentTuple = (AugmentTuple<EXT_POINT>)
- new AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.mod.removed.Match>(
+ new AugmentTuple<>(
GeneralAugMatchNotifSwitchFlowRemoved.class, generalExtMatchAugBld3.build());
break;
- case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+ case FLOWS_STATISTICS_RPC_MATCH:
GeneralAugMatchRpcOutputFlowStatsBuilder generalExtMatchAugBld4 = new GeneralAugMatchRpcOutputFlowStatsBuilder();
generalExtMatchAugBld4.setExtensionList(extensionsList);
augmentTuple = (AugmentTuple<EXT_POINT>)
- new AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match>(
+ new AugmentTuple<>(
GeneralAugMatchRpcOutputFlowStats.class, generalExtMatchAugBld4.build());
break;
default:
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStatsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* Converts GroupDesc message from library to MD SAL defined GroupDescStats
private org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets toSALBucketsDesc(List<BucketsList> bucketDescStats, short version) {
final ActionResponseConvertorData data = new ActionResponseConvertorData(version);
- data.setActionPath(ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+ data.setActionPath(ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder salBucketsDesc =
new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder();
return convertedSALGroupsDesc;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* Converts Openflow 1.3+ specific instructions to MD-SAL format flow instruction
for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.
Instruction switchInst : source) {
if (switchInst.getInstructionChoice() instanceof ApplyActionsCase) {
- ApplyActionsCase actionsInstruction = ((ApplyActionsCase) switchInst.getInstructionChoice());
+ ApplyActionsCase actionsInstruction = (ApplyActionsCase) switchInst.getInstructionChoice();
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
- actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final Optional<List<Action>> actions = getConvertorExecutor().convert(
actionsInstruction.getApplyActions().getAction(), actionResponseConvertorData);
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
salInstruction = clearActionsCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof GotoTableCase) {
- GotoTableCase gotoTableCase = ((GotoTableCase) switchInst.getInstructionChoice());
+ GotoTableCase gotoTableCase = (GotoTableCase) switchInst.getInstructionChoice();
GoToTableCaseBuilder goToTableCaseBuilder = new GoToTableCaseBuilder();
GoToTableBuilder goToTableBuilder = new GoToTableBuilder();
salInstruction = goToTableCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof MeterCase) {
- MeterCase meterIdInstruction = ((MeterCase) switchInst.getInstructionChoice());
+ MeterCase meterIdInstruction = (MeterCase) switchInst.getInstructionChoice();
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
salInstruction = meterCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof WriteActionsCase) {
- WriteActionsCase writeActionsCase = ((WriteActionsCase) switchInst.getInstructionChoice());
+ WriteActionsCase writeActionsCase = (WriteActionsCase) switchInst.getInstructionChoice();
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
- actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final Optional<List<Action>> actions = getConvertorExecutor().convert(
writeActionsCase.getWriteActions().getAction(), actionResponseConvertorData);
salInstruction = writeActionsCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase writeMetadataCase =
- ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) switchInst.getInstructionChoice());
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) switchInst.getInstructionChoice();
WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
writeMetadataBuilder.setMetadata(new BigInteger(OFConstants.SIGNUM_UNSIGNED, writeMetadataCase.getWriteMetadata().getMetadata()));
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* Converts flow related statistics messages coming from openflow switch to MD-SAL messages.
final short version,
final Short ipProtocol) {
ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(version);
- actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
actionResponseConvertorData.setIpProtocol(ipProtocol);
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
@Before
public void setup() {
OFSessionUtil.getSessionManager().setExtensionConverterProvider(extensionConverterProvider);
- when(extensionConverterProvider.getActionConverter(any(MessageTypeKey.class))).thenReturn(new ConvertorActionFromOFJava<DataContainer, AugmentationPath>() {
- @Override
- public Action convert(DataContainer input, AugmentationPath path) {
- return new MockAction();
- }
- });
+ when(extensionConverterProvider.getActionConverter(any(MessageTypeKey.class))).thenReturn((ConvertorActionFromOFJava<DataContainer, AugmentationPath>) (input, path) -> new MockAction());
}
@Test
experimenterBuilder.setExperimenter(new ExperimenterId(42L));
experimenterIdCaseBuilder.setExperimenter(experimenterBuilder.build());
actionBuilder.setActionChoice(experimenterIdCaseBuilder.build());
- Action action = ActionExtensionHelper.processAlienAction(actionBuilder.build(), OpenflowVersion.OF13, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ Action action = ActionExtensionHelper.processAlienAction(actionBuilder.build(), OpenflowVersion.OF13,
+ ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
assertNotNull(action);
assertEquals(MockAction.class, action.getImplementedInterface());
}
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.when;
+
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
@Before
public void setup() {
OFSessionUtil.getSessionManager().setExtensionConverterProvider(extensionConverterProvider);
- when(extensionConverterProvider.getConverter(key)).thenReturn(new ConvertorFromOFJava<DataContainer, AugmentationPath>() {
- @Override
- public ExtensionAugment<? extends Augmentation<Extension>> convert(final DataContainer input, final AugmentationPath path) {
- MockAugmentation mockAugmentation = new MockAugmentation();
- return new ExtensionAugment<MockAugmentation>(MockAugmentation.class, mockAugmentation, MockExtensionKey.class);
- }
+ when(extensionConverterProvider.getConverter(key)).thenReturn((ConvertorFromOFJava<DataContainer, AugmentationPath>) (input, path) -> {
+ MockAugmentation mockAugmentation = new MockAugmentation();
+ return new ExtensionAugment<>(MockAugmentation.class, mockAugmentation, MockExtensionKey.class);
});
}
public void testProcessAllExtensions() {
List<MatchEntry> matchEntries = createMatchEntrieses();
- AugmentTuple augmentTuple = MatchExtensionHelper.processAllExtensions(matchEntries, OpenflowVersion.OF13, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ AugmentTuple augmentTuple = MatchExtensionHelper.processAllExtensions(matchEntries, OpenflowVersion.OF13,
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
assertNotNull(augmentTuple);
- augmentTuple = MatchExtensionHelper.processAllExtensions(matchEntries, OpenflowVersion.OF13, MatchPath.PACKETRECEIVED_MATCH);
+ augmentTuple = MatchExtensionHelper.processAllExtensions(matchEntries, OpenflowVersion.OF13,
+ MatchPath.PACKET_RECEIVED_MATCH);
assertNotNull(augmentTuple);
- augmentTuple = MatchExtensionHelper.processAllExtensions(matchEntries, OpenflowVersion.OF13, MatchPath.SWITCHFLOWREMOVED_MATCH);
+ augmentTuple = MatchExtensionHelper.processAllExtensions(matchEntries, OpenflowVersion.OF13,
+ MatchPath.SWITCH_FLOW_REMOVED_MATCH);
assertNotNull(augmentTuple);
}
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action;\r
-\r
-import java.math.BigInteger;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Optional;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowplugin.api.OFConstants;\r
-import org.opendaylight.openflowplugin.extension.api.path.ActionPath;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpVersion;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlDstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlSrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTosCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpDstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanPcpCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionConvertorV10Test {\r
- private ConvertorManager convertorManager;\r
-\r
- @Before\r
- public void setUp() {\r
- convertorManager = ConvertorManagerFactory.createDefaultManager();\r
- }\r
-\r
- /**\r
- * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)}}\r
- */\r
- @Test\r
- public void testGetActions() {\r
- List<Action> salActions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- SetVlanPcpActionCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpActionCaseBuilder();\r
- SetVlanPcpActionBuilder pcpBuilder = new SetVlanPcpActionBuilder();\r
- pcpBuilder.setVlanPcp(new VlanPcp((short) 7));\r
- vlanPcpCaseBuilder.setSetVlanPcpAction(pcpBuilder.build());\r
- actionBuilder.setAction(vlanPcpCaseBuilder.build());\r
- actionBuilder.setOrder(0);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- StripVlanActionCaseBuilder stripCaseBuilder = new StripVlanActionCaseBuilder();\r
- StripVlanActionBuilder stripBuilder = new StripVlanActionBuilder();\r
- stripCaseBuilder.setStripVlanAction(stripBuilder.build());\r
- actionBuilder.setAction(stripCaseBuilder.build());\r
- actionBuilder.setOrder(1);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetDlDstActionCaseBuilder dlDstCaseBuilder = new SetDlDstActionCaseBuilder();\r
- SetDlDstActionBuilder dlDstBuilder = new SetDlDstActionBuilder();\r
- dlDstBuilder.setAddress(new MacAddress("00:00:00:00:00:06"));\r
- dlDstCaseBuilder.setSetDlDstAction(dlDstBuilder.build());\r
- actionBuilder.setAction(dlDstCaseBuilder.build());\r
- actionBuilder.setOrder(2);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetDlSrcActionCaseBuilder dlSrcCaseBuilder = new SetDlSrcActionCaseBuilder();\r
- SetDlSrcActionBuilder dlSrcBuilder = new SetDlSrcActionBuilder();\r
- dlSrcBuilder.setAddress(new MacAddress("00:00:00:00:00:05"));\r
- dlSrcCaseBuilder.setSetDlSrcAction(dlSrcBuilder.build());\r
- actionBuilder.setAction(dlSrcCaseBuilder.build());\r
- actionBuilder.setOrder(3);\r
- salActions.add(actionBuilder.build());\r
- \r
- actionBuilder = new ActionBuilder();\r
- SetNwSrcActionCaseBuilder nwSrcCaseBuilder = new SetNwSrcActionCaseBuilder();\r
- SetNwSrcActionBuilder nwSrcBuilder = new SetNwSrcActionBuilder();\r
- Ipv4Builder ipv4Builder = new Ipv4Builder();\r
- /* Use prefix which is correct in canonical representation in test */\r
- ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.0/24"));\r
- nwSrcBuilder.setAddress(ipv4Builder.build());\r
- nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());\r
- actionBuilder.setAction(nwSrcCaseBuilder.build());\r
- actionBuilder.setOrder(4);\r
- salActions.add(actionBuilder.build());\r
- \r
- actionBuilder = new ActionBuilder();\r
- SetNwDstActionCaseBuilder nwDstCaseBuilder = new SetNwDstActionCaseBuilder();\r
- SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();\r
- ipv4Builder = new Ipv4Builder();\r
- ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.2/32"));\r
- nwDstBuilder.setAddress(ipv4Builder.build());\r
- nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());\r
- actionBuilder.setAction(nwDstCaseBuilder.build());\r
- actionBuilder.setOrder(5);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetTpSrcActionCaseBuilder tpSrcCaseBuilder = new SetTpSrcActionCaseBuilder();\r
- SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();\r
- tpSrcBuilder.setPort(new PortNumber(54));\r
- tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());\r
- actionBuilder.setAction(tpSrcCaseBuilder.build());\r
- actionBuilder.setOrder(6);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetTpDstActionCaseBuilder tpDstCaseBuilder = new SetTpDstActionCaseBuilder();\r
- SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();\r
- tpDstBuilder.setPort(new PortNumber(45));\r
- tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());\r
- actionBuilder.setAction(tpDstCaseBuilder.build());\r
- actionBuilder.setOrder(7);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetNwTosActionCaseBuilder tosCaseBuilder = new SetNwTosActionCaseBuilder();\r
- SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();\r
- tosBuilder.setTos(18);\r
- tosCaseBuilder.setSetNwTosAction(tosBuilder.build());\r
- actionBuilder.setAction(tosCaseBuilder.build());\r
- actionBuilder.setOrder(8);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetVlanIdActionCaseBuilder vlanIdCaseBuilder = new SetVlanIdActionCaseBuilder();\r
- SetVlanIdActionBuilder vlanIdBuilder = new SetVlanIdActionBuilder();\r
- vlanIdBuilder.setVlanId(new VlanId(22));\r
- vlanIdCaseBuilder.setSetVlanIdAction(vlanIdBuilder.build());\r
- actionBuilder.setAction(vlanIdCaseBuilder.build());\r
- actionBuilder.setOrder(9);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- PopVlanActionCaseBuilder popVlanActionCaseBuilder = new PopVlanActionCaseBuilder();\r
- actionBuilder.setAction(popVlanActionCaseBuilder.build());\r
- actionBuilder.setOrder(10);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();\r
- SetFieldBuilder setFieldBuilder = new SetFieldBuilder();\r
- VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();\r
- vlanMatchBuilder.setVlanId(new VlanIdBuilder().setVlanId(new VlanId(22)).build());\r
- setFieldBuilder.setVlanMatch(vlanMatchBuilder.build());\r
- setFieldCaseBuilder.setSetField(setFieldBuilder.build());\r
- actionBuilder.setAction(setFieldCaseBuilder.build());\r
- actionBuilder.setOrder(11);\r
- salActions.add(actionBuilder.build());\r
- \r
- IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProto(IpVersion.Ipv4);\r
- MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());\r
- FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());\r
- Flow flow = flowBld.build();\r
-\r
- ActionConvertorData data = new ActionConvertorData(OFConstants.OFP_VERSION_1_0);\r
- data.setDatapathId(new BigInteger("42"));\r
- data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));\r
-\r
- Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> actionsOptional =\r
- convertorManager.convert(salActions, data);\r
-\r
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = actionsOptional.orElse(Collections.emptyList());\r
- \r
- Assert.assertEquals("Wrong number of actions", 12, actions.size());\r
- \r
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action action = actions.get(0);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetVlanPcpCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetVlanPcpCase setVlanPcpCase = (SetVlanPcpCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong vlan pcp", 7, setVlanPcpCase.getSetVlanPcpAction().getVlanPcp().intValue());\r
- \r
- action = actions.get(1);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.StripVlanCase", action.getActionChoice().getImplementedInterface().getName());\r
- \r
- action = actions.get(2);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetDlDstCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetDlDstCase setDlDstCase = (SetDlDstCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong dl dst", "00:00:00:00:00:06", setDlDstCase.getSetDlDstAction().getDlDstAddress().getValue());\r
- \r
- action = actions.get(3);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetDlSrcCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetDlSrcCase setDlSrcCase = (SetDlSrcCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong dl src", "00:00:00:00:00:05", setDlSrcCase.getSetDlSrcAction().getDlSrcAddress().getValue());\r
- \r
- action = actions.get(4);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetNwSrcCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetNwSrcCase setNwSrcCase = (SetNwSrcCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong nw src", "10.0.0.0", setNwSrcCase.getSetNwSrcAction().getIpAddress().getValue());\r
- \r
- action = actions.get(5);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetNwDstCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetNwDstCase setNwDstCase = (SetNwDstCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong nw dst", "10.0.0.2", setNwDstCase.getSetNwDstAction().getIpAddress().getValue());\r
- \r
- action = actions.get(6);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetTpSrcCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetTpSrcCase setTpSrcCase = (SetTpSrcCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong tp src", 54, setTpSrcCase.getSetTpSrcAction().getPort().getValue().intValue());\r
- \r
- action = actions.get(7);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetTpDstCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetTpDstCase setTpDstCase = (SetTpDstCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong tp dst", 45, setTpDstCase.getSetTpDstAction().getPort().getValue().intValue());\r
- \r
- action = actions.get(8);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetNwTosCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetNwTosCase setNwTosCase = (SetNwTosCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong nw tos", 18, setNwTosCase.getSetNwTosAction().getNwTos().intValue());\r
- \r
- action = actions.get(9);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetVlanVidCase", action.getActionChoice().getImplementedInterface().getName());\r
- SetVlanVidCase setVlanVidCase = (SetVlanVidCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong vlan id", 22, setVlanVidCase.getSetVlanVidAction().getVlanVid().intValue());\r
-\r
- action = actions.get(10);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.StripVlanCase", action.getActionChoice().getImplementedInterface().getName());\r
-\r
- action = actions.get(11);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetVlanVidCase", action.getActionChoice().getImplementedInterface().getName());\r
- setVlanVidCase = (SetVlanVidCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong vlan id", 22, setVlanVidCase.getSetVlanVidAction().getVlanVid().intValue());\r
- }\r
-\r
- /**\r
- * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData)}}\r
- */\r
- @Test\r
- public void testToMDSalActions() {\r
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = new ArrayList<>();\r
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder actionbuilder = \r
- new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder();\r
-\r
- OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();\r
- OutputActionBuilder outputBuilder = new OutputActionBuilder();\r
- outputBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber(14L));\r
- outputBuilder.setMaxLength(555);\r
- caseBuilder.setOutputAction(outputBuilder.build());\r
- actionbuilder.setActionChoice(caseBuilder.build());\r
- actions.add(actionbuilder.build());\r
-\r
- ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_0);\r
- data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
-\r
- Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action>> mdSalActionsOptional =\r
- convertorManager.convert(\r
- actions, data);\r
-\r
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());\r
-\r
- Assert.assertEquals("Wrong number of output actions", 1, mdSalActions.size());\r
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = mdSalActions.get(0);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.OutputActionCase", action.getImplementedInterface().getName());\r
- OutputActionCase outputAction = (OutputActionCase) action;\r
- Assert.assertEquals("Wrong output port", "14", outputAction.getOutputAction().getOutputNodeConnector().getValue());\r
- Assert.assertEquals("Wrong max length", 555, outputAction.getOutputAction().getMaxLength().intValue());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpVersion;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTosCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanPcpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionConvertorV10Test {
+ private ConvertorManager convertorManager;
+
+ @Before
+ public void setUp() {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
+ }
+
+ /**
+ * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)}}
+ */
+ @Test
+ public void testGetActions() {
+ List<Action> salActions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ SetVlanPcpActionCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpActionCaseBuilder();
+ SetVlanPcpActionBuilder pcpBuilder = new SetVlanPcpActionBuilder();
+ pcpBuilder.setVlanPcp(new VlanPcp((short) 7));
+ vlanPcpCaseBuilder.setSetVlanPcpAction(pcpBuilder.build());
+ actionBuilder.setAction(vlanPcpCaseBuilder.build());
+ actionBuilder.setOrder(0);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ StripVlanActionCaseBuilder stripCaseBuilder = new StripVlanActionCaseBuilder();
+ StripVlanActionBuilder stripBuilder = new StripVlanActionBuilder();
+ stripCaseBuilder.setStripVlanAction(stripBuilder.build());
+ actionBuilder.setAction(stripCaseBuilder.build());
+ actionBuilder.setOrder(1);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetDlDstActionCaseBuilder dlDstCaseBuilder = new SetDlDstActionCaseBuilder();
+ SetDlDstActionBuilder dlDstBuilder = new SetDlDstActionBuilder();
+ dlDstBuilder.setAddress(new MacAddress("00:00:00:00:00:06"));
+ dlDstCaseBuilder.setSetDlDstAction(dlDstBuilder.build());
+ actionBuilder.setAction(dlDstCaseBuilder.build());
+ actionBuilder.setOrder(2);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetDlSrcActionCaseBuilder dlSrcCaseBuilder = new SetDlSrcActionCaseBuilder();
+ SetDlSrcActionBuilder dlSrcBuilder = new SetDlSrcActionBuilder();
+ dlSrcBuilder.setAddress(new MacAddress("00:00:00:00:00:05"));
+ dlSrcCaseBuilder.setSetDlSrcAction(dlSrcBuilder.build());
+ actionBuilder.setAction(dlSrcCaseBuilder.build());
+ actionBuilder.setOrder(3);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetNwSrcActionCaseBuilder nwSrcCaseBuilder = new SetNwSrcActionCaseBuilder();
+ SetNwSrcActionBuilder nwSrcBuilder = new SetNwSrcActionBuilder();
+ Ipv4Builder ipv4Builder = new Ipv4Builder();
+ /* Use prefix which is correct in canonical representation in test */
+ ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.0/24"));
+ nwSrcBuilder.setAddress(ipv4Builder.build());
+ nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());
+ actionBuilder.setAction(nwSrcCaseBuilder.build());
+ actionBuilder.setOrder(4);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetNwDstActionCaseBuilder nwDstCaseBuilder = new SetNwDstActionCaseBuilder();
+ SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
+ ipv4Builder = new Ipv4Builder();
+ ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.2/32"));
+ nwDstBuilder.setAddress(ipv4Builder.build());
+ nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
+ actionBuilder.setAction(nwDstCaseBuilder.build());
+ actionBuilder.setOrder(5);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetTpSrcActionCaseBuilder tpSrcCaseBuilder = new SetTpSrcActionCaseBuilder();
+ SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
+ tpSrcBuilder.setPort(new PortNumber(54));
+ tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
+ actionBuilder.setAction(tpSrcCaseBuilder.build());
+ actionBuilder.setOrder(6);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetTpDstActionCaseBuilder tpDstCaseBuilder = new SetTpDstActionCaseBuilder();
+ SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();
+ tpDstBuilder.setPort(new PortNumber(45));
+ tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());
+ actionBuilder.setAction(tpDstCaseBuilder.build());
+ actionBuilder.setOrder(7);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetNwTosActionCaseBuilder tosCaseBuilder = new SetNwTosActionCaseBuilder();
+ SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();
+ tosBuilder.setTos(18);
+ tosCaseBuilder.setSetNwTosAction(tosBuilder.build());
+ actionBuilder.setAction(tosCaseBuilder.build());
+ actionBuilder.setOrder(8);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetVlanIdActionCaseBuilder vlanIdCaseBuilder = new SetVlanIdActionCaseBuilder();
+ SetVlanIdActionBuilder vlanIdBuilder = new SetVlanIdActionBuilder();
+ vlanIdBuilder.setVlanId(new VlanId(22));
+ vlanIdCaseBuilder.setSetVlanIdAction(vlanIdBuilder.build());
+ actionBuilder.setAction(vlanIdCaseBuilder.build());
+ actionBuilder.setOrder(9);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ PopVlanActionCaseBuilder popVlanActionCaseBuilder = new PopVlanActionCaseBuilder();
+ actionBuilder.setAction(popVlanActionCaseBuilder.build());
+ actionBuilder.setOrder(10);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
+ SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+ VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
+ vlanMatchBuilder.setVlanId(new VlanIdBuilder().setVlanId(new VlanId(22)).build());
+ setFieldBuilder.setVlanMatch(vlanMatchBuilder.build());
+ setFieldCaseBuilder.setSetField(setFieldBuilder.build());
+ actionBuilder.setAction(setFieldCaseBuilder.build());
+ actionBuilder.setOrder(11);
+ salActions.add(actionBuilder.build());
+
+ IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProto(IpVersion.Ipv4);
+ MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());
+ FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());
+ Flow flow = flowBld.build();
+
+ ActionConvertorData data = new ActionConvertorData(OFConstants.OFP_VERSION_1_0);
+ data.setDatapathId(new BigInteger("42"));
+ data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));
+
+ Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> actionsOptional =
+ convertorManager.convert(salActions, data);
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = actionsOptional.orElse(Collections.emptyList());
+
+ Assert.assertEquals("Wrong number of actions", 12, actions.size());
+
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action action = actions.get(0);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetVlanPcpCase", action.getActionChoice().getImplementedInterface().getName());
+ SetVlanPcpCase setVlanPcpCase = (SetVlanPcpCase) action.getActionChoice();
+ Assert.assertEquals("Wrong vlan pcp", 7, setVlanPcpCase.getSetVlanPcpAction().getVlanPcp().intValue());
+
+ action = actions.get(1);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.StripVlanCase", action.getActionChoice().getImplementedInterface().getName());
+
+ action = actions.get(2);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetDlDstCase", action.getActionChoice().getImplementedInterface().getName());
+ SetDlDstCase setDlDstCase = (SetDlDstCase) action.getActionChoice();
+ Assert.assertEquals("Wrong dl dst", "00:00:00:00:00:06", setDlDstCase.getSetDlDstAction().getDlDstAddress().getValue());
+
+ action = actions.get(3);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetDlSrcCase", action.getActionChoice().getImplementedInterface().getName());
+ SetDlSrcCase setDlSrcCase = (SetDlSrcCase) action.getActionChoice();
+ Assert.assertEquals("Wrong dl src", "00:00:00:00:00:05", setDlSrcCase.getSetDlSrcAction().getDlSrcAddress().getValue());
+
+ action = actions.get(4);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetNwSrcCase", action.getActionChoice().getImplementedInterface().getName());
+ SetNwSrcCase setNwSrcCase = (SetNwSrcCase) action.getActionChoice();
+ Assert.assertEquals("Wrong nw src", "10.0.0.0", setNwSrcCase.getSetNwSrcAction().getIpAddress().getValue());
+
+ action = actions.get(5);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetNwDstCase", action.getActionChoice().getImplementedInterface().getName());
+ SetNwDstCase setNwDstCase = (SetNwDstCase) action.getActionChoice();
+ Assert.assertEquals("Wrong nw dst", "10.0.0.2", setNwDstCase.getSetNwDstAction().getIpAddress().getValue());
+
+ action = actions.get(6);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetTpSrcCase", action.getActionChoice().getImplementedInterface().getName());
+ SetTpSrcCase setTpSrcCase = (SetTpSrcCase) action.getActionChoice();
+ Assert.assertEquals("Wrong tp src", 54, setTpSrcCase.getSetTpSrcAction().getPort().getValue().intValue());
+
+ action = actions.get(7);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetTpDstCase", action.getActionChoice().getImplementedInterface().getName());
+ SetTpDstCase setTpDstCase = (SetTpDstCase) action.getActionChoice();
+ Assert.assertEquals("Wrong tp dst", 45, setTpDstCase.getSetTpDstAction().getPort().getValue().intValue());
+
+ action = actions.get(8);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetNwTosCase", action.getActionChoice().getImplementedInterface().getName());
+ SetNwTosCase setNwTosCase = (SetNwTosCase) action.getActionChoice();
+ Assert.assertEquals("Wrong nw tos", 18, setNwTosCase.getSetNwTosAction().getNwTos().intValue());
+
+ action = actions.get(9);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetVlanVidCase", action.getActionChoice().getImplementedInterface().getName());
+ SetVlanVidCase setVlanVidCase = (SetVlanVidCase) action.getActionChoice();
+ Assert.assertEquals("Wrong vlan id", 22, setVlanVidCase.getSetVlanVidAction().getVlanVid().intValue());
+
+ action = actions.get(10);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.StripVlanCase", action.getActionChoice().getImplementedInterface().getName());
+
+ action = actions.get(11);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetVlanVidCase", action.getActionChoice().getImplementedInterface().getName());
+ setVlanVidCase = (SetVlanVidCase) action.getActionChoice();
+ Assert.assertEquals("Wrong vlan id", 22, setVlanVidCase.getSetVlanVidAction().getVlanVid().intValue());
+ }
+
+ /**
+ * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData)}}
+ */
+ @Test
+ public void testToMDSalActions() {
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = new ArrayList<>();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder actionbuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder();
+
+ OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
+ OutputActionBuilder outputBuilder = new OutputActionBuilder();
+ outputBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber(14L));
+ outputBuilder.setMaxLength(555);
+ caseBuilder.setOutputAction(outputBuilder.build());
+ actionbuilder.setActionChoice(caseBuilder.build());
+ actions.add(actionbuilder.build());
+
+ ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_0);
+ data.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
+
+ Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+ .Action>> mdSalActionsOptional =
+ convertorManager.convert(
+ actions, data);
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+ .Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());
+
+ Assert.assertEquals("Wrong number of output actions", 1, mdSalActions.size());
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = mdSalActions.get(0);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.OutputActionCase", action.getImplementedInterface().getName());
+ OutputActionCase outputAction = (OutputActionCase) action;
+ Assert.assertEquals("Wrong output port", "14", outputAction.getOutputAction().getOutputNodeConnector().getValue());
+ Assert.assertEquals("Wrong max length", 555, outputAction.getOutputAction().getMaxLength().intValue());
+ }
+}
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action;\r
-\r
-import java.math.BigInteger;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Optional;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowplugin.api.OFConstants;\r
-import org.opendaylight.openflowplugin.extension.api.path.ActionPath;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.StripVlanCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.group._case.GroupActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.mpls._case.PushMplsActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.pbb._case.PushPbbActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.mpls.ttl._case.SetMplsTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.queue._case.SetQueueActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthDstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthSrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6DstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class ActionConvertorV13Test {\r
- private ConvertorManager convertorManager;\r
-\r
- @Before\r
- public void setUp() {\r
- convertorManager = ConvertorManagerFactory.createDefaultManager();\r
- }\r
-\r
- /**\r
- * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData)}}\r
- */\r
- @Test\r
- public void testToMDSalActions() {\r
- List<Action> actions = new ArrayList<>();\r
- ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_3);\r
- data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
-\r
- Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action>> mdSalActions = convertorManager.convert(actions, data);\r
-\r
- Assert.assertEquals("Wrong number of output actions", 0, mdSalActions.orElse(Collections.emptyList()).size());\r
- }\r
-\r
- /**\r
- * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)}}\r
- */\r
- //@Test\r
- public void testToMDSalActions2() {\r
- List<Action> actions = new ArrayList<>();\r
-\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();\r
- OutputActionBuilder outputBuilder = new OutputActionBuilder();\r
- outputBuilder.setPort(new PortNumber(42L));\r
- outputBuilder.setMaxLength(52);\r
- caseBuilder.setOutputAction(outputBuilder.build());\r
- actionBuilder.setActionChoice(caseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new CopyTtlOutCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new CopyTtlInCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetMplsTtlCaseBuilder setMplsTtlCaseBuilder = new SetMplsTtlCaseBuilder();\r
- SetMplsTtlActionBuilder setMplsTtlBuilder = new SetMplsTtlActionBuilder();\r
- setMplsTtlBuilder.setMplsTtl((short) 4);\r
- setMplsTtlCaseBuilder.setSetMplsTtlAction(setMplsTtlBuilder.build());\r
- actionBuilder.setActionChoice(setMplsTtlCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new DecMplsTtlCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();\r
- PushVlanActionBuilder pushVlanBuilder = new PushVlanActionBuilder();\r
- pushVlanBuilder.setEthertype(new EtherType(new EtherType(16)));\r
- pushVlanCaseBuilder.setPushVlanAction(pushVlanBuilder.build());\r
- actionBuilder.setActionChoice(pushVlanCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new PopVlanCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- PushMplsCaseBuilder pushMplsCaseBuilder = new PushMplsCaseBuilder();\r
- PushMplsActionBuilder pushMplsBuilder = new PushMplsActionBuilder();\r
- pushMplsBuilder.setEthertype(new EtherType(new EtherType(17)));\r
- pushMplsCaseBuilder.setPushMplsAction(pushMplsBuilder.build());\r
- actionBuilder.setActionChoice(pushMplsCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();\r
- PopMplsActionBuilder popMplsBuilder = new PopMplsActionBuilder();\r
- popMplsBuilder.setEthertype(new EtherType(new EtherType(18)));\r
- popMplsCaseBuilder.setPopMplsAction(popMplsBuilder.build());\r
- actionBuilder.setActionChoice(popMplsCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetQueueCaseBuilder setQueueCaseBuilder = new SetQueueCaseBuilder();\r
- SetQueueActionBuilder setQueueBuilder = new SetQueueActionBuilder();\r
- setQueueBuilder.setQueueId(1234L);\r
- setQueueCaseBuilder.setSetQueueAction(setQueueBuilder.build());\r
- actionBuilder.setActionChoice(setQueueCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- GroupCaseBuilder groupCaseBuilder = new GroupCaseBuilder();\r
- GroupActionBuilder groupActionBuilder = new GroupActionBuilder();\r
- groupActionBuilder.setGroupId(555L);\r
- groupCaseBuilder.setGroupAction(groupActionBuilder.build());\r
- actionBuilder.setActionChoice(groupCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();\r
- SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();\r
- nwTtlBuilder.setNwTtl((short) 8);\r
- nwTtlCaseBuilder.setSetNwTtlAction(nwTtlBuilder.build());\r
- actionBuilder.setActionChoice(nwTtlCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new DecNwTtlCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();\r
- SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();\r
- List<MatchEntry> entries = new ArrayList<>();\r
- MatchEntryBuilder matchBuilder = new MatchEntryBuilder();\r
- matchBuilder.setOxmClass(OpenflowBasicClass.class);\r
- matchBuilder.setOxmMatchField(InPort.class);\r
- matchBuilder.setHasMask(false);\r
- InPortCaseBuilder inPortCaseBuilder = new InPortCaseBuilder();\r
- InPortBuilder inPortBuilder = new InPortBuilder();\r
- inPortBuilder.setPortNumber(new PortNumber(1L));\r
- inPortCaseBuilder.setInPort(inPortBuilder.build());\r
- matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());\r
- entries.add(matchBuilder.build());\r
- setFieldBuilder.setMatchEntry(entries);\r
- setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());\r
- actionBuilder.setActionChoice(setFieldCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();\r
- PushPbbActionBuilder pushPbbBuilder = new PushPbbActionBuilder();\r
- pushPbbBuilder.setEthertype(new EtherType(new EtherType(19)));\r
- pushPbbCaseBuilder.setPushPbbAction(pushPbbBuilder.build());\r
- actionBuilder.setActionChoice(pushPbbCaseBuilder.build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new PopPbbCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- // Add some unsupported actions and check if they are missing from results\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new SetNwDstCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setActionChoice(new StripVlanCaseBuilder().build());\r
- actions.add(actionBuilder.build());\r
-\r
- ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_3);\r
- data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
-\r
- Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action>> mdSalActionsOptional = convertorManager.convert(actions, data);\r
-\r
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());\r
-\r
- Assert.assertEquals("Wrong number of output actions", 16, mdSalActions.size());\r
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = mdSalActions.get(0);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.OutputActionCase", action.getImplementedInterface().getName());\r
- OutputActionCase output = (OutputActionCase) action;\r
- Assert.assertEquals("Wrong output port", "42", output.getOutputAction().getOutputNodeConnector().getValue());\r
- Assert.assertEquals("Wrong max length", 52, output.getOutputAction().getMaxLength().intValue());\r
- action = mdSalActions.get(1);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.CopyTtlOutCase", action.getImplementedInterface().getName());\r
- action = mdSalActions.get(2);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.CopyTtlInCase", action.getImplementedInterface().getName());\r
- action = mdSalActions.get(3);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.SetMplsTtlActionCase", action.getImplementedInterface().getName());\r
- SetMplsTtlActionCase setMplsTtl = (SetMplsTtlActionCase) action;\r
- Assert.assertEquals("Wrong mpls ttl", 4, setMplsTtl.getSetMplsTtlAction().getMplsTtl().intValue());\r
- action = mdSalActions.get(4);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.DecMplsTtlCase", action.getImplementedInterface().getName());\r
- action = mdSalActions.get(5);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.PushVlanActionCase", action.getImplementedInterface().getName());\r
- PushVlanActionCase pushVlan = (PushVlanActionCase) action;\r
- Assert.assertEquals("Wrong ethertype", 16, pushVlan.getPushVlanAction().getEthernetType().intValue());\r
- action = mdSalActions.get(6);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.PopVlanActionCase", action.getImplementedInterface().getName());\r
- action = mdSalActions.get(7);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.PushMplsActionCase", action.getImplementedInterface().getName());\r
- PushMplsActionCase pushMpls = (PushMplsActionCase) action;\r
- Assert.assertEquals("Wrong ethertype", 17, pushMpls.getPushMplsAction().getEthernetType().intValue());\r
- action = mdSalActions.get(8);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.PopMplsActionCase", action.getImplementedInterface().getName());\r
- PopMplsActionCase popMpls = (PopMplsActionCase) action;\r
- Assert.assertEquals("Wrong ethertype", 18, popMpls.getPopMplsAction().getEthernetType().intValue());\r
- action = mdSalActions.get(9);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.SetQueueActionCase", action.getImplementedInterface().getName());\r
- SetQueueActionCase setQueue = (SetQueueActionCase) action;\r
- Assert.assertEquals("Wrong queue-id", 1234, setQueue.getSetQueueAction().getQueueId().intValue());\r
- action = mdSalActions.get(10);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.GroupActionCase", action.getImplementedInterface().getName());\r
- GroupActionCase groupAction = (GroupActionCase) action;\r
- Assert.assertEquals("Wrong group-id", 555, groupAction.getGroupAction().getGroupId().intValue());\r
- action = mdSalActions.get(11);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.SetNwTtlActionCase", action.getImplementedInterface().getName());\r
- SetNwTtlActionCase setNwTtl = (SetNwTtlActionCase) action;\r
- Assert.assertEquals("Wrong nw ttl", 8, setNwTtl.getSetNwTtlAction().getNwTtl().intValue());\r
- action = mdSalActions.get(12);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.DecNwTtlCase", action.getImplementedInterface().getName());\r
- action = mdSalActions.get(13);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.SetFieldCase", action.getImplementedInterface().getName());\r
- SetFieldCase setField = (SetFieldCase) action;\r
- Assert.assertEquals("Wrong in port", "openflow:null:1", setField.getSetField().getInPort().getValue());\r
- action = mdSalActions.get(14);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.PushPbbActionCase", action.getImplementedInterface().getName());\r
- PushPbbActionCase pushPbb = (PushPbbActionCase) action;\r
- Assert.assertEquals("Wrong ethertype", 19, pushPbb.getPushPbbAction().getEthernetType().intValue());\r
- action = mdSalActions.get(15);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"\r
- + ".rev131112.action.action.PopPbbActionCase", action.getImplementedInterface().getName());\r
- }\r
-\r
- /**\r
- * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)} }\r
- */\r
- @Test\r
- public void testGetActions() {\r
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list\r
- .Action> salActions = new ArrayList<>();\r
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list\r
- .ActionBuilder actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
-\r
- SetVlanPcpActionCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpActionCaseBuilder();\r
- SetVlanPcpActionBuilder pcpBuilder = new SetVlanPcpActionBuilder();\r
- pcpBuilder.setVlanPcp(new VlanPcp((short) 7));\r
- vlanPcpCaseBuilder.setSetVlanPcpAction(pcpBuilder.build());\r
- actionBuilder.setAction(vlanPcpCaseBuilder.build());\r
- actionBuilder.setOrder(0);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- StripVlanActionCaseBuilder stripCaseBuilder = new StripVlanActionCaseBuilder();\r
- StripVlanActionBuilder stripBuilder = new StripVlanActionBuilder();\r
- stripCaseBuilder.setStripVlanAction(stripBuilder.build());\r
- actionBuilder.setAction(stripCaseBuilder.build());\r
- actionBuilder.setOrder(1);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetDlDstActionCaseBuilder dlDstCaseBuilder = new SetDlDstActionCaseBuilder();\r
- SetDlDstActionBuilder dlDstBuilder = new SetDlDstActionBuilder();\r
- dlDstBuilder.setAddress(new MacAddress("00:00:00:00:00:06"));\r
- dlDstCaseBuilder.setSetDlDstAction(dlDstBuilder.build());\r
- actionBuilder.setAction(dlDstCaseBuilder.build());\r
- actionBuilder.setOrder(2);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetDlSrcActionCaseBuilder dlSrcCaseBuilder = new SetDlSrcActionCaseBuilder();\r
- SetDlSrcActionBuilder dlSrcBuilder = new SetDlSrcActionBuilder();\r
- dlSrcBuilder.setAddress(new MacAddress("00:00:00:00:00:05"));\r
- dlSrcCaseBuilder.setSetDlSrcAction(dlSrcBuilder.build());\r
- actionBuilder.setAction(dlSrcCaseBuilder.build());\r
- actionBuilder.setOrder(3);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetNwSrcActionCaseBuilder nwSrcCaseBuilder = new SetNwSrcActionCaseBuilder();\r
- SetNwSrcActionBuilder nwSrcBuilder = new SetNwSrcActionBuilder();\r
- Ipv4Builder ipv4Builder = new Ipv4Builder();\r
- /* Correct canonical form for v4 prefix!!! */\r
- ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.0/24"));\r
- nwSrcBuilder.setAddress(ipv4Builder.build());\r
- nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());\r
- actionBuilder.setAction(nwSrcCaseBuilder.build());\r
- actionBuilder.setOrder(4);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetNwDstActionCaseBuilder nwDstCaseBuilder = new SetNwDstActionCaseBuilder();\r
- SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();\r
- ipv4Builder = new Ipv4Builder();\r
- ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.2/32"));\r
- nwDstBuilder.setAddress(ipv4Builder.build());\r
- nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());\r
- actionBuilder.setAction(nwDstCaseBuilder.build());\r
- actionBuilder.setOrder(5);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetTpSrcActionCaseBuilder tpSrcCaseBuilder = new SetTpSrcActionCaseBuilder();\r
- SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();\r
- tpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types\r
- .rev130715.PortNumber(54));\r
- tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());\r
- actionBuilder.setAction(tpSrcCaseBuilder.build());\r
- actionBuilder.setOrder(6);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetTpDstActionCaseBuilder tpDstCaseBuilder = new SetTpDstActionCaseBuilder();\r
- SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();\r
- tpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types\r
- .rev130715.PortNumber(45));\r
- tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());\r
- actionBuilder.setAction(tpDstCaseBuilder.build());\r
- actionBuilder.setOrder(7);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetNwTosActionCaseBuilder tosCaseBuilder = new SetNwTosActionCaseBuilder();\r
- SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();\r
- tosBuilder.setTos(16);\r
- tosCaseBuilder.setSetNwTosAction(tosBuilder.build());\r
- actionBuilder.setAction(tosCaseBuilder.build());\r
- actionBuilder.setOrder(8);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- SetVlanIdActionCaseBuilder vlanIdCaseBuilder = new SetVlanIdActionCaseBuilder();\r
- SetVlanIdActionBuilder vlanIdBuilder = new SetVlanIdActionBuilder();\r
- vlanIdBuilder.setVlanId(new VlanId(22));\r
- vlanIdCaseBuilder.setSetVlanIdAction(vlanIdBuilder.build());\r
- actionBuilder.setAction(vlanIdCaseBuilder.build());\r
- actionBuilder.setOrder(9);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- nwSrcCaseBuilder = new SetNwSrcActionCaseBuilder();\r
- nwSrcBuilder = new SetNwSrcActionBuilder();\r
- Ipv6Builder ipv6Builder = new Ipv6Builder();\r
- /* Use canonical form, 00:00:0000 is not a valid v6 notation */\r
- ipv6Builder.setIpv6Address(new Ipv6Prefix("::5/128"));\r
- nwSrcBuilder.setAddress(ipv6Builder.build());\r
- nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());\r
- actionBuilder.setAction(nwSrcCaseBuilder.build());\r
- actionBuilder.setOrder(10);\r
- salActions.add(actionBuilder.build());\r
-\r
- actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112\r
- .action.list.ActionBuilder();\r
- nwDstCaseBuilder = new SetNwDstActionCaseBuilder();\r
- nwDstBuilder = new SetNwDstActionBuilder();\r
- ipv6Builder = new Ipv6Builder();\r
- /* Use canonical form, 00:00:0006/64 is not a valid v6 notation - this equates to ::/64 */\r
- ipv6Builder.setIpv6Address(new Ipv6Prefix("::/64"));\r
- nwDstBuilder.setAddress(ipv6Builder.build());\r
- nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());\r
- actionBuilder.setAction(nwDstCaseBuilder.build());\r
- actionBuilder.setOrder(11);\r
- salActions.add(actionBuilder.build());\r
-\r
- IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProtocol((short) 6);\r
- MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());\r
- FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());\r
- Flow flow = flowBld.build();\r
-\r
- ActionConvertorData data = new ActionConvertorData(OFConstants.OFP_VERSION_1_3);\r
- data.setDatapathId(new BigInteger("42"));\r
- data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));\r
-\r
- Optional<List<Action>> actionsOptional = convertorManager.convert(salActions, data);\r
- List<Action> actions = actionsOptional.orElse(Collections.emptyList());\r
-\r
- Assert.assertEquals("Wrong number of actions", 12, actions.size());\r
- Action action = actions.get(0);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- MatchEntry entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);;\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp.class, false);\r
- Assert.assertEquals("Wrong vlan pcp", 7, ((VlanPcpCase) entry.getMatchEntryValue()).getVlanPcp().getVlanPcp()\r
- .intValue());\r
-\r
- action = actions.get(1);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid.class, false);\r
- Assert.assertEquals("Wrong vlan vid", 0, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid().getVlanVid()\r
- .intValue());\r
- Assert.assertEquals("Wrong cfi bit", true, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid().isCfiBit());\r
-\r
- action = actions.get(2);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthDst.class, false);\r
- Assert.assertEquals("Wrong dl dst", "00:00:00:00:00:06", ((EthDstCase) entry.getMatchEntryValue()).getEthDst()\r
- .getMacAddress().getValue());\r
-\r
- action = actions.get(3);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthSrc.class, false);\r
- Assert.assertEquals("Wrong dl src", "00:00:00:00:00:05", ((EthSrcCase) entry.getMatchEntryValue()).getEthSrc()\r
- .getMacAddress().getValue());\r
-\r
- action = actions.get(4);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Src.class, false);\r
- Assert.assertEquals("Wrong ipv4 src", "10.0.0.0", ((Ipv4SrcCase) entry.getMatchEntryValue()).getIpv4Src()\r
- .getIpv4Address().getValue());\r
-\r
- action = actions.get(5);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Dst.class, false);\r
- Assert.assertEquals("Wrong ipv4 dst", "10.0.0.2", ((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst()\r
- .getIpv4Address().getValue());\r
-\r
- action = actions.get(6);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpSrc.class, false);\r
- Assert.assertEquals("Wrong tcp src", 54, ((TcpSrcCase) entry.getMatchEntryValue()).getTcpSrc()\r
- .getPort().getValue().intValue());\r
-\r
- action = actions.get(7);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);;\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpDst.class, false);\r
- Assert.assertEquals("Wrong tcp dst", 45, ((TcpDstCase) entry.getMatchEntryValue()).getTcpDst()\r
- .getPort().getValue().intValue());\r
-\r
- action = actions.get(8);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp.class, false);\r
- Assert.assertEquals("Wrong ip dscp", 4, ((IpDscpCase) entry.getMatchEntryValue()).getIpDscp()\r
- .getDscp().getValue().intValue());\r
-\r
- action = actions.get(9);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid.class, false);\r
- Assert.assertEquals("Wrong vlan id", 22, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid()\r
- .getVlanVid().intValue());\r
- Assert.assertEquals("Wrong cfi bit", true, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid()\r
- .isCfiBit());\r
-\r
- action = actions.get(10);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Src.class, false);\r
- Assert.assertEquals("Wrong ipv6 src", "::5",\r
- ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getIpv6Address().getValue());\r
-\r
- action = actions.get(11);\r
- setFieldCase =\r
- (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());\r
- entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);\r
- checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Dst.class, false);\r
- Assert.assertEquals("Wrong ipv6 dst", "::",\r
- ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getIpv6Address().getValue());\r
- }\r
-\r
- private static void checkEntryHeader(MatchEntry entry, Class<? extends MatchField> field, boolean hasMask) {\r
- Assert.assertEquals("Wrong oxm class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong oxm field", field, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong hasMask", hasMask, entry.isHasMask());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.StripVlanCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.group._case.GroupActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.mpls._case.PushMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.pbb._case.PushPbbActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.mpls.ttl._case.SetMplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.queue._case.SetQueueActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6DstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;
+
+/**
+ * @author michal.polkorab
+ */
+public class ActionConvertorV13Test {
+ private ConvertorManager convertorManager;
+
+ @Before
+ public void setUp() {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
+ }
+
+ /**
+ * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData)}}
+ */
+ @Test
+ public void testToMDSalActions() {
+ List<Action> actions = new ArrayList<>();
+ ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_3);
+ data.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
+
+ Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+ .Action>> mdSalActions = convertorManager.convert(actions, data);
+
+ Assert.assertEquals("Wrong number of output actions", 0, mdSalActions.orElse(Collections.emptyList()).size());
+ }
+
+ /**
+ * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)}}
+ */
+ //@Test
+ public void testToMDSalActions2() {
+ List<Action> actions = new ArrayList<>();
+
+ ActionBuilder actionBuilder = new ActionBuilder();
+ OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
+ OutputActionBuilder outputBuilder = new OutputActionBuilder();
+ outputBuilder.setPort(new PortNumber(42L));
+ outputBuilder.setMaxLength(52);
+ caseBuilder.setOutputAction(outputBuilder.build());
+ actionBuilder.setActionChoice(caseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new CopyTtlOutCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new CopyTtlInCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetMplsTtlCaseBuilder setMplsTtlCaseBuilder = new SetMplsTtlCaseBuilder();
+ SetMplsTtlActionBuilder setMplsTtlBuilder = new SetMplsTtlActionBuilder();
+ setMplsTtlBuilder.setMplsTtl((short) 4);
+ setMplsTtlCaseBuilder.setSetMplsTtlAction(setMplsTtlBuilder.build());
+ actionBuilder.setActionChoice(setMplsTtlCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new DecMplsTtlCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
+ PushVlanActionBuilder pushVlanBuilder = new PushVlanActionBuilder();
+ pushVlanBuilder.setEthertype(new EtherType(new EtherType(16)));
+ pushVlanCaseBuilder.setPushVlanAction(pushVlanBuilder.build());
+ actionBuilder.setActionChoice(pushVlanCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new PopVlanCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ PushMplsCaseBuilder pushMplsCaseBuilder = new PushMplsCaseBuilder();
+ PushMplsActionBuilder pushMplsBuilder = new PushMplsActionBuilder();
+ pushMplsBuilder.setEthertype(new EtherType(new EtherType(17)));
+ pushMplsCaseBuilder.setPushMplsAction(pushMplsBuilder.build());
+ actionBuilder.setActionChoice(pushMplsCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
+ PopMplsActionBuilder popMplsBuilder = new PopMplsActionBuilder();
+ popMplsBuilder.setEthertype(new EtherType(new EtherType(18)));
+ popMplsCaseBuilder.setPopMplsAction(popMplsBuilder.build());
+ actionBuilder.setActionChoice(popMplsCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetQueueCaseBuilder setQueueCaseBuilder = new SetQueueCaseBuilder();
+ SetQueueActionBuilder setQueueBuilder = new SetQueueActionBuilder();
+ setQueueBuilder.setQueueId(1234L);
+ setQueueCaseBuilder.setSetQueueAction(setQueueBuilder.build());
+ actionBuilder.setActionChoice(setQueueCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ GroupCaseBuilder groupCaseBuilder = new GroupCaseBuilder();
+ GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
+ groupActionBuilder.setGroupId(555L);
+ groupCaseBuilder.setGroupAction(groupActionBuilder.build());
+ actionBuilder.setActionChoice(groupCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();
+ SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();
+ nwTtlBuilder.setNwTtl((short) 8);
+ nwTtlCaseBuilder.setSetNwTtlAction(nwTtlBuilder.build());
+ actionBuilder.setActionChoice(nwTtlCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new DecNwTtlCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
+ SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
+ List<MatchEntry> entries = new ArrayList<>();
+ MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
+ matchBuilder.setOxmClass(OpenflowBasicClass.class);
+ matchBuilder.setOxmMatchField(InPort.class);
+ matchBuilder.setHasMask(false);
+ InPortCaseBuilder inPortCaseBuilder = new InPortCaseBuilder();
+ InPortBuilder inPortBuilder = new InPortBuilder();
+ inPortBuilder.setPortNumber(new PortNumber(1L));
+ inPortCaseBuilder.setInPort(inPortBuilder.build());
+ matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());
+ entries.add(matchBuilder.build());
+ setFieldBuilder.setMatchEntry(entries);
+ setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
+ actionBuilder.setActionChoice(setFieldCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
+ PushPbbActionBuilder pushPbbBuilder = new PushPbbActionBuilder();
+ pushPbbBuilder.setEthertype(new EtherType(new EtherType(19)));
+ pushPbbCaseBuilder.setPushPbbAction(pushPbbBuilder.build());
+ actionBuilder.setActionChoice(pushPbbCaseBuilder.build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new PopPbbCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ // Add some unsupported actions and check if they are missing from results
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new SetNwDstCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new StripVlanCaseBuilder().build());
+ actions.add(actionBuilder.build());
+
+ ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_3);
+ data.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
+
+ Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+ .Action>> mdSalActionsOptional = convertorManager.convert(actions, data);
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+ .Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());
+
+ Assert.assertEquals("Wrong number of output actions", 16, mdSalActions.size());
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = mdSalActions.get(0);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.OutputActionCase", action.getImplementedInterface().getName());
+ OutputActionCase output = (OutputActionCase) action;
+ Assert.assertEquals("Wrong output port", "42", output.getOutputAction().getOutputNodeConnector().getValue());
+ Assert.assertEquals("Wrong max length", 52, output.getOutputAction().getMaxLength().intValue());
+ action = mdSalActions.get(1);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.CopyTtlOutCase", action.getImplementedInterface().getName());
+ action = mdSalActions.get(2);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.CopyTtlInCase", action.getImplementedInterface().getName());
+ action = mdSalActions.get(3);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.SetMplsTtlActionCase", action.getImplementedInterface().getName());
+ SetMplsTtlActionCase setMplsTtl = (SetMplsTtlActionCase) action;
+ Assert.assertEquals("Wrong mpls ttl", 4, setMplsTtl.getSetMplsTtlAction().getMplsTtl().intValue());
+ action = mdSalActions.get(4);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.DecMplsTtlCase", action.getImplementedInterface().getName());
+ action = mdSalActions.get(5);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.PushVlanActionCase", action.getImplementedInterface().getName());
+ PushVlanActionCase pushVlan = (PushVlanActionCase) action;
+ Assert.assertEquals("Wrong ethertype", 16, pushVlan.getPushVlanAction().getEthernetType().intValue());
+ action = mdSalActions.get(6);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.PopVlanActionCase", action.getImplementedInterface().getName());
+ action = mdSalActions.get(7);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.PushMplsActionCase", action.getImplementedInterface().getName());
+ PushMplsActionCase pushMpls = (PushMplsActionCase) action;
+ Assert.assertEquals("Wrong ethertype", 17, pushMpls.getPushMplsAction().getEthernetType().intValue());
+ action = mdSalActions.get(8);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.PopMplsActionCase", action.getImplementedInterface().getName());
+ PopMplsActionCase popMpls = (PopMplsActionCase) action;
+ Assert.assertEquals("Wrong ethertype", 18, popMpls.getPopMplsAction().getEthernetType().intValue());
+ action = mdSalActions.get(9);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.SetQueueActionCase", action.getImplementedInterface().getName());
+ SetQueueActionCase setQueue = (SetQueueActionCase) action;
+ Assert.assertEquals("Wrong queue-id", 1234, setQueue.getSetQueueAction().getQueueId().intValue());
+ action = mdSalActions.get(10);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.GroupActionCase", action.getImplementedInterface().getName());
+ GroupActionCase groupAction = (GroupActionCase) action;
+ Assert.assertEquals("Wrong group-id", 555, groupAction.getGroupAction().getGroupId().intValue());
+ action = mdSalActions.get(11);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.SetNwTtlActionCase", action.getImplementedInterface().getName());
+ SetNwTtlActionCase setNwTtl = (SetNwTtlActionCase) action;
+ Assert.assertEquals("Wrong nw ttl", 8, setNwTtl.getSetNwTtlAction().getNwTtl().intValue());
+ action = mdSalActions.get(12);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.DecNwTtlCase", action.getImplementedInterface().getName());
+ action = mdSalActions.get(13);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.SetFieldCase", action.getImplementedInterface().getName());
+ SetFieldCase setField = (SetFieldCase) action;
+ Assert.assertEquals("Wrong in port", "openflow:null:1", setField.getSetField().getInPort().getValue());
+ action = mdSalActions.get(14);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.PushPbbActionCase", action.getImplementedInterface().getName());
+ PushPbbActionCase pushPbb = (PushPbbActionCase) action;
+ Assert.assertEquals("Wrong ethertype", 19, pushPbb.getPushPbbAction().getEthernetType().intValue());
+ action = mdSalActions.get(15);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types"
+ + ".rev131112.action.action.PopPbbActionCase", action.getImplementedInterface().getName());
+ }
+
+ /**
+ * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)} }
+ */
+ @Test
+ public void testGetActions() {
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
+ .Action> salActions = new ArrayList<>();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
+ .ActionBuilder actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+
+ SetVlanPcpActionCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpActionCaseBuilder();
+ SetVlanPcpActionBuilder pcpBuilder = new SetVlanPcpActionBuilder();
+ pcpBuilder.setVlanPcp(new VlanPcp((short) 7));
+ vlanPcpCaseBuilder.setSetVlanPcpAction(pcpBuilder.build());
+ actionBuilder.setAction(vlanPcpCaseBuilder.build());
+ actionBuilder.setOrder(0);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ StripVlanActionCaseBuilder stripCaseBuilder = new StripVlanActionCaseBuilder();
+ StripVlanActionBuilder stripBuilder = new StripVlanActionBuilder();
+ stripCaseBuilder.setStripVlanAction(stripBuilder.build());
+ actionBuilder.setAction(stripCaseBuilder.build());
+ actionBuilder.setOrder(1);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetDlDstActionCaseBuilder dlDstCaseBuilder = new SetDlDstActionCaseBuilder();
+ SetDlDstActionBuilder dlDstBuilder = new SetDlDstActionBuilder();
+ dlDstBuilder.setAddress(new MacAddress("00:00:00:00:00:06"));
+ dlDstCaseBuilder.setSetDlDstAction(dlDstBuilder.build());
+ actionBuilder.setAction(dlDstCaseBuilder.build());
+ actionBuilder.setOrder(2);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetDlSrcActionCaseBuilder dlSrcCaseBuilder = new SetDlSrcActionCaseBuilder();
+ SetDlSrcActionBuilder dlSrcBuilder = new SetDlSrcActionBuilder();
+ dlSrcBuilder.setAddress(new MacAddress("00:00:00:00:00:05"));
+ dlSrcCaseBuilder.setSetDlSrcAction(dlSrcBuilder.build());
+ actionBuilder.setAction(dlSrcCaseBuilder.build());
+ actionBuilder.setOrder(3);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetNwSrcActionCaseBuilder nwSrcCaseBuilder = new SetNwSrcActionCaseBuilder();
+ SetNwSrcActionBuilder nwSrcBuilder = new SetNwSrcActionBuilder();
+ Ipv4Builder ipv4Builder = new Ipv4Builder();
+ /* Correct canonical form for v4 prefix!!! */
+ ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.0/24"));
+ nwSrcBuilder.setAddress(ipv4Builder.build());
+ nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());
+ actionBuilder.setAction(nwSrcCaseBuilder.build());
+ actionBuilder.setOrder(4);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetNwDstActionCaseBuilder nwDstCaseBuilder = new SetNwDstActionCaseBuilder();
+ SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
+ ipv4Builder = new Ipv4Builder();
+ ipv4Builder.setIpv4Address(new Ipv4Prefix("10.0.0.2/32"));
+ nwDstBuilder.setAddress(ipv4Builder.build());
+ nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
+ actionBuilder.setAction(nwDstCaseBuilder.build());
+ actionBuilder.setOrder(5);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetTpSrcActionCaseBuilder tpSrcCaseBuilder = new SetTpSrcActionCaseBuilder();
+ SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
+ tpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types
+ .rev130715.PortNumber(54));
+ tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
+ actionBuilder.setAction(tpSrcCaseBuilder.build());
+ actionBuilder.setOrder(6);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetTpDstActionCaseBuilder tpDstCaseBuilder = new SetTpDstActionCaseBuilder();
+ SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();
+ tpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types
+ .rev130715.PortNumber(45));
+ tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());
+ actionBuilder.setAction(tpDstCaseBuilder.build());
+ actionBuilder.setOrder(7);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetNwTosActionCaseBuilder tosCaseBuilder = new SetNwTosActionCaseBuilder();
+ SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();
+ tosBuilder.setTos(16);
+ tosCaseBuilder.setSetNwTosAction(tosBuilder.build());
+ actionBuilder.setAction(tosCaseBuilder.build());
+ actionBuilder.setOrder(8);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ SetVlanIdActionCaseBuilder vlanIdCaseBuilder = new SetVlanIdActionCaseBuilder();
+ SetVlanIdActionBuilder vlanIdBuilder = new SetVlanIdActionBuilder();
+ vlanIdBuilder.setVlanId(new VlanId(22));
+ vlanIdCaseBuilder.setSetVlanIdAction(vlanIdBuilder.build());
+ actionBuilder.setAction(vlanIdCaseBuilder.build());
+ actionBuilder.setOrder(9);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ nwSrcCaseBuilder = new SetNwSrcActionCaseBuilder();
+ nwSrcBuilder = new SetNwSrcActionBuilder();
+ Ipv6Builder ipv6Builder = new Ipv6Builder();
+ /* Use canonical form, 00:00:0000 is not a valid v6 notation */
+ ipv6Builder.setIpv6Address(new Ipv6Prefix("::5/128"));
+ nwSrcBuilder.setAddress(ipv6Builder.build());
+ nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());
+ actionBuilder.setAction(nwSrcCaseBuilder.build());
+ actionBuilder.setOrder(10);
+ salActions.add(actionBuilder.build());
+
+ actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.ActionBuilder();
+ nwDstCaseBuilder = new SetNwDstActionCaseBuilder();
+ nwDstBuilder = new SetNwDstActionBuilder();
+ ipv6Builder = new Ipv6Builder();
+ /* Use canonical form, 00:00:0006/64 is not a valid v6 notation - this equates to ::/64 */
+ ipv6Builder.setIpv6Address(new Ipv6Prefix("::/64"));
+ nwDstBuilder.setAddress(ipv6Builder.build());
+ nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
+ actionBuilder.setAction(nwDstCaseBuilder.build());
+ actionBuilder.setOrder(11);
+ salActions.add(actionBuilder.build());
+
+ IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProtocol((short) 6);
+ MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());
+ FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());
+ Flow flow = flowBld.build();
+
+ ActionConvertorData data = new ActionConvertorData(OFConstants.OFP_VERSION_1_3);
+ data.setDatapathId(new BigInteger("42"));
+ data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));
+
+ Optional<List<Action>> actionsOptional = convertorManager.convert(salActions, data);
+ List<Action> actions = actionsOptional.orElse(Collections.emptyList());
+
+ Assert.assertEquals("Wrong number of actions", 12, actions.size());
+ Action action = actions.get(0);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ MatchEntry entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);;
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp.class, false);
+ Assert.assertEquals("Wrong vlan pcp", 7, ((VlanPcpCase) entry.getMatchEntryValue()).getVlanPcp().getVlanPcp()
+ .intValue());
+
+ action = actions.get(1);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid.class, false);
+ Assert.assertEquals("Wrong vlan vid", 0, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid().getVlanVid()
+ .intValue());
+ Assert.assertEquals("Wrong cfi bit", true, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid().isCfiBit());
+
+ action = actions.get(2);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthDst.class, false);
+ Assert.assertEquals("Wrong dl dst", "00:00:00:00:00:06", ((EthDstCase) entry.getMatchEntryValue()).getEthDst()
+ .getMacAddress().getValue());
+
+ action = actions.get(3);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthSrc.class, false);
+ Assert.assertEquals("Wrong dl src", "00:00:00:00:00:05", ((EthSrcCase) entry.getMatchEntryValue()).getEthSrc()
+ .getMacAddress().getValue());
+
+ action = actions.get(4);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Src.class, false);
+ Assert.assertEquals("Wrong ipv4 src", "10.0.0.0", ((Ipv4SrcCase) entry.getMatchEntryValue()).getIpv4Src()
+ .getIpv4Address().getValue());
+
+ action = actions.get(5);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Dst.class, false);
+ Assert.assertEquals("Wrong ipv4 dst", "10.0.0.2", ((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst()
+ .getIpv4Address().getValue());
+
+ action = actions.get(6);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpSrc.class, false);
+ Assert.assertEquals("Wrong tcp src", 54, ((TcpSrcCase) entry.getMatchEntryValue()).getTcpSrc()
+ .getPort().getValue().intValue());
+
+ action = actions.get(7);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);;
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpDst.class, false);
+ Assert.assertEquals("Wrong tcp dst", 45, ((TcpDstCase) entry.getMatchEntryValue()).getTcpDst()
+ .getPort().getValue().intValue());
+
+ action = actions.get(8);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp.class, false);
+ Assert.assertEquals("Wrong ip dscp", 4, ((IpDscpCase) entry.getMatchEntryValue()).getIpDscp()
+ .getDscp().getValue().intValue());
+
+ action = actions.get(9);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid.class, false);
+ Assert.assertEquals("Wrong vlan id", 22, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid()
+ .getVlanVid().intValue());
+ Assert.assertEquals("Wrong cfi bit", true, ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid()
+ .isCfiBit());
+
+ action = actions.get(10);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Src.class, false);
+ Assert.assertEquals("Wrong ipv6 src", "::5",
+ ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getIpv6Address().getValue());
+
+ action = actions.get(11);
+ setFieldCase =
+ (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) action.getActionChoice();
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".action.rev150203.action.grouping.action.choice.SetFieldCase", action.getActionChoice().getImplementedInterface().getName());
+ entry = setFieldCase.getSetFieldAction().getMatchEntry().get(0);
+ checkEntryHeader(entry, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Dst.class, false);
+ Assert.assertEquals("Wrong ipv6 dst", "::",
+ ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getIpv6Address().getValue());
+ }
+
+ private static void checkEntryHeader(MatchEntry entry, Class<? extends MatchField> field, boolean hasMask) {
+ Assert.assertEquals("Wrong oxm class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong oxm field", field, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong hasMask", hasMask, entry.isHasMask());
+ }
+}