-/*\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.openflowjava.protocol.api.connection;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface ThreadConfiguration {\r
-\r
- /**\r
- * @return desired number of workerThreads processing the Openflow I/O\r
- */\r
- int getWorkerThreadCount();\r
-\r
- /**\r
- * @return desired number of bossThreads registering incomming Openflow connections\r
- */\r
- int getBossThreadCount();\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.openflowjava.protocol.api.connection;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public interface ThreadConfiguration {
+
+ /**
+ * @return desired number of workerThreads processing the Openflow I/O
+ */
+ int getWorkerThreadCount();
+
+ /**
+ * @return desired number of bossThreads registering incomming Openflow connections
+ */
+ int getBossThreadCount();
+}
-/*\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.openflowjava.protocol.api.connection;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface TlsConfiguration {\r
-\r
- /**\r
- * @return keystore location\r
- */\r
- String getTlsKeystore();\r
- \r
- /**\r
- * @return keystore type\r
- */\r
- KeystoreType getTlsKeystoreType();\r
- \r
- /**\r
- * @return truststore location\r
- */\r
- String getTlsTruststore();\r
- \r
- /**\r
- * @return truststore type\r
- */\r
- KeystoreType getTlsTruststoreType();\r
-\r
- /**\r
- * @return keystore path type (CLASSPATH or PATH)\r
- */\r
- PathType getTlsKeystorePathType();\r
-\r
- /**\r
- * @return truststore path type (CLASSPATH or PATH)\r
- */\r
- PathType getTlsTruststorePathType();\r
-\r
- /**\r
- * @return password protecting specified keystore\r
- */\r
- String getKeystorePassword();\r
-\r
- /**\r
- * @return password protecting certificate\r
- */\r
- String getCertificatePassword();\r
-\r
- /**\r
- * @return password protecting specified truststore\r
- */\r
- String getTruststorePassword();\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.openflowjava.protocol.api.connection;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public interface TlsConfiguration {
+
+ /**
+ * @return keystore location
+ */
+ String getTlsKeystore();
+
+ /**
+ * @return keystore type
+ */
+ KeystoreType getTlsKeystoreType();
+
+ /**
+ * @return truststore location
+ */
+ String getTlsTruststore();
+
+ /**
+ * @return truststore type
+ */
+ KeystoreType getTlsTruststoreType();
+
+ /**
+ * @return keystore path type (CLASSPATH or PATH)
+ */
+ PathType getTlsKeystorePathType();
+
+ /**
+ * @return truststore path type (CLASSPATH or PATH)
+ */
+ PathType getTlsTruststorePathType();
+
+ /**
+ * @return password protecting specified keystore
+ */
+ String getKeystorePassword();
+
+ /**
+ * @return password protecting certificate
+ */
+ String getCertificatePassword();
+
+ /**
+ * @return password protecting specified truststore
+ */
+ String getTruststorePassword();
+}
-/*\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.openflowjava.protocol.api.connection;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-\r
-/**\r
- * Class is used only for testing purposes - passwords are hardcoded\r
- * @author michal.polkorab\r
- */\r
-public class TlsConfigurationImpl implements TlsConfiguration {\r
-\r
- private KeystoreType trustStoreType;\r
- private String trustStore;\r
- private KeystoreType keyStoreType;\r
- private String keyStore;\r
- private PathType keystorePathType;\r
- private PathType truststorePathType;\r
-\r
- /**\r
- * Default constructor\r
- * @param trustStoreType JKS or PKCS12\r
- * @param trustStore path to trustStore file\r
- * @param trustStorePathType truststore path type (classpath or path)\r
- * @param keyStoreType JKS or PKCS12\r
- * @param keyStore path to keyStore file\r
- * @param keyStorePathType keystore path type (classpath or path)\r
- */\r
- public TlsConfigurationImpl(KeystoreType trustStoreType, String trustStore,\r
- PathType trustStorePathType, KeystoreType keyStoreType,\r
- String keyStore, PathType keyStorePathType) {\r
- this.trustStoreType = trustStoreType;\r
- this.trustStore = trustStore;\r
- this.truststorePathType = trustStorePathType;\r
- this.keyStoreType = keyStoreType;\r
- this.keyStore = keyStore;\r
- this.keystorePathType = keyStorePathType;\r
- }\r
-\r
- @Override\r
- public KeystoreType getTlsTruststoreType() {\r
- return trustStoreType;\r
- }\r
-\r
- @Override\r
- public String getTlsTruststore() {\r
- return trustStore;\r
- }\r
-\r
- @Override\r
- public KeystoreType getTlsKeystoreType() {\r
- return keyStoreType;\r
- }\r
-\r
- @Override\r
- public String getTlsKeystore() {\r
- return keyStore;\r
- }\r
-\r
- @Override\r
- public PathType getTlsKeystorePathType() {\r
- return keystorePathType;\r
- }\r
-\r
- @Override\r
- public PathType getTlsTruststorePathType() {\r
- return truststorePathType;\r
- }\r
-\r
- @Override\r
- public String getKeystorePassword() {\r
- return "opendaylight";\r
- }\r
-\r
- @Override\r
- public String getCertificatePassword() {\r
- return "opendaylight";\r
- }\r
-\r
- @Override\r
- public String getTruststorePassword() {\r
- return "opendaylight";\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.openflowjava.protocol.api.connection;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+/**
+ * Class is used only for testing purposes - passwords are hardcoded
+ * @author michal.polkorab
+ */
+public class TlsConfigurationImpl implements TlsConfiguration {
+
+ private KeystoreType trustStoreType;
+ private String trustStore;
+ private KeystoreType keyStoreType;
+ private String keyStore;
+ private PathType keystorePathType;
+ private PathType truststorePathType;
+
+ /**
+ * Default constructor
+ * @param trustStoreType JKS or PKCS12
+ * @param trustStore path to trustStore file
+ * @param trustStorePathType truststore path type (classpath or path)
+ * @param keyStoreType JKS or PKCS12
+ * @param keyStore path to keyStore file
+ * @param keyStorePathType keystore path type (classpath or path)
+ */
+ public TlsConfigurationImpl(KeystoreType trustStoreType, String trustStore,
+ PathType trustStorePathType, KeystoreType keyStoreType,
+ String keyStore, PathType keyStorePathType) {
+ this.trustStoreType = trustStoreType;
+ this.trustStore = trustStore;
+ this.truststorePathType = trustStorePathType;
+ this.keyStoreType = keyStoreType;
+ this.keyStore = keyStore;
+ this.keystorePathType = keyStorePathType;
+ }
+
+ @Override
+ public KeystoreType getTlsTruststoreType() {
+ return trustStoreType;
+ }
+
+ @Override
+ public String getTlsTruststore() {
+ return trustStore;
+ }
+
+ @Override
+ public KeystoreType getTlsKeystoreType() {
+ return keyStoreType;
+ }
+
+ @Override
+ public String getTlsKeystore() {
+ return keyStore;
+ }
+
+ @Override
+ public PathType getTlsKeystorePathType() {
+ return keystorePathType;
+ }
+
+ @Override
+ public PathType getTlsTruststorePathType() {
+ return truststorePathType;
+ }
+
+ @Override
+ public String getKeystorePassword() {
+ return "opendaylight";
+ }
+
+ @Override
+ public String getCertificatePassword() {
+ return "opendaylight";
+ }
+
+ @Override
+ public String getTruststorePassword() {
+ return "opendaylight";
+ }
+}
-/*\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.openflowjava.protocol.api.extensibility;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
-\r
-/**\r
- * Provides methods for deserialization part of extensibility.\r
- * In case of handling multiple multiple structures of same type (actions,\r
- * instructions, match entries, ... ) which are differentiated by\r
- * vendor / experimenter subtype, vendor has to switch / choose between\r
- * these subtypes. <br />\r
- * \r
- * This has to be done in this way because of experimenter headers, which\r
- * provide only vendor / experimenter ID. Subtype position may be different\r
- * for different vendors (or not present at all) - that's why vendor has to\r
- * handle it in his own implementations.\r
- * @author michal.polkorab\r
- */\r
-public interface DeserializerExtensionProvider {\r
-\r
- /**\r
- * Unregisters custom deserializer\r
- * @param key used for deserializer lookup\r
- * @return true if deserializer was removed,\r
- * false if no deserializer was found under specified key\r
- */\r
- boolean unregisterDeserializer(ExperimenterDeserializerKey key);\r
-\r
- /**\r
- * Registers action deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerActionDeserializer(ExperimenterActionDeserializerKey key,\r
- OFGeneralDeserializer deserializer);\r
-\r
- /**\r
- * Registers instruction deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key,\r
- OFGeneralDeserializer deserializer);\r
-\r
- /**\r
- * Registers match entry deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerMatchEntryDeserializer(MatchEntryDeserializerKey key,\r
- OFGeneralDeserializer deserializer);\r
-\r
- /**\r
- * Registers error message deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerErrorDeserializer(ExperimenterIdDeserializerKey key,\r
- OFDeserializer<ErrorMessage> deserializer);\r
-\r
- /**\r
- * Registers experimenter (vendor) message deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,\r
- OFDeserializer<ExperimenterMessage> deserializer);\r
-\r
- /**\r
- * Registers multipart-reply (stats) message deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,\r
- OFDeserializer<MultipartReplyMessage> deserializer);\r
-\r
- /**\r
- * Registers multipart-reply table-features message deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key,\r
- OFGeneralDeserializer deserializer);\r
-\r
- /**\r
- * Registers meter band deserializer (used in multipart-reply meter-config)\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key,\r
- OFDeserializer<MeterBandExperimenterCase> deserializer);\r
-\r
- /**\r
- * Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key,\r
- OFDeserializer<QueueProperty> deserializer);\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.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
+
+/**
+ * Provides methods for deserialization part of extensibility.
+ * In case of handling multiple multiple structures of same type (actions,
+ * instructions, match entries, ... ) which are differentiated by
+ * vendor / experimenter subtype, vendor has to switch / choose between
+ * these subtypes. <br />
+ *
+ * This has to be done in this way because of experimenter headers, which
+ * provide only vendor / experimenter ID. Subtype position may be different
+ * for different vendors (or not present at all) - that's why vendor has to
+ * handle it in his own implementations.
+ * @author michal.polkorab
+ */
+public interface DeserializerExtensionProvider {
+
+ /**
+ * Unregisters custom deserializer
+ * @param key used for deserializer lookup
+ * @return true if deserializer was removed,
+ * false if no deserializer was found under specified key
+ */
+ boolean unregisterDeserializer(ExperimenterDeserializerKey key);
+
+ /**
+ * Registers action deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerActionDeserializer(ExperimenterActionDeserializerKey key,
+ OFGeneralDeserializer deserializer);
+
+ /**
+ * Registers instruction deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key,
+ OFGeneralDeserializer deserializer);
+
+ /**
+ * Registers match entry deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerMatchEntryDeserializer(MatchEntryDeserializerKey key,
+ OFGeneralDeserializer deserializer);
+
+ /**
+ * Registers error message deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerErrorDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<ErrorMessage> deserializer);
+
+ /**
+ * Registers experimenter (vendor) message deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<ExperimenterMessage> deserializer);
+
+ /**
+ * Registers multipart-reply (stats) message deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<MultipartReplyMessage> deserializer);
+
+ /**
+ * Registers multipart-reply table-features message deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key,
+ OFGeneralDeserializer deserializer);
+
+ /**
+ * Registers meter band deserializer (used in multipart-reply meter-config)
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<MeterBandExperimenterCase> deserializer);
+
+ /**
+ * Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<QueueProperty> deserializer);
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface DeserializerRegistry {\r
-\r
- /**\r
- * Initializes deserializers\r
- */\r
- void init();\r
-\r
- /**\r
- * @param key used for deserializer lookup\r
- * @return deserializer found\r
- */\r
- <SERIALIZERTYPE extends OFGeneralDeserializer>\r
- SERIALIZERTYPE getDeserializer(MessageCodeKey key);\r
-\r
- /**\r
- * Registers deserializer.\r
- * Throws IllegalStateException when there is\r
- * a deserializer already registered under given key.\r
- * \r
- * If the deserializer implements {@link DeserializerRegistryInjector} interface,\r
- * the deserializer is injected with DeserializerRegistry instance.\r
- * \r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- */\r
- void registerDeserializer(MessageCodeKey key,\r
- OFGeneralDeserializer deserializer);\r
-\r
- /**\r
- * Unregisters deserializer\r
- * @param key used for deserializer lookup\r
- * @param deserializer deserializer instance\r
- * @return true if deserializer was removed,\r
- * false if no deserializer was found under specified key\r
- */\r
- boolean unregisterDeserializer(MessageCodeKey key);\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public interface DeserializerRegistry {
+
+ /**
+ * Initializes deserializers
+ */
+ void init();
+
+ /**
+ * @param key used for deserializer lookup
+ * @return deserializer found
+ */
+ <SERIALIZERTYPE extends OFGeneralDeserializer>
+ SERIALIZERTYPE getDeserializer(MessageCodeKey key);
+
+ /**
+ * Registers deserializer.
+ * Throws IllegalStateException when there is
+ * a deserializer already registered under given key.
+ *
+ * If the deserializer implements {@link DeserializerRegistryInjector} interface,
+ * the deserializer is injected with DeserializerRegistry instance.
+ *
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerDeserializer(MessageCodeKey key,
+ OFGeneralDeserializer deserializer);
+
+ /**
+ * Unregisters deserializer
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ * @return true if deserializer was removed,
+ * false if no deserializer was found under specified key
+ */
+ boolean unregisterDeserializer(MessageCodeKey key);
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * Injects registry\r
- * @author michal.polkorab\r
- */\r
-public interface DeserializerRegistryInjector {\r
-\r
- /**\r
- * Injects deserializer registry into deserializer\r
- * @param deserializerRegistry\r
- */\r
- void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry);\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+/**
+ * Injects registry
+ * @author michal.polkorab
+ */
+public interface DeserializerRegistryInjector {
+
+ /**
+ * Injects deserializer registry into deserializer
+ * @param deserializerRegistry
+ */
+ void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry);
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class EnhancedMessageCodeKey extends MessageCodeKey {\r
-\r
- private int msgType2;\r
-\r
- /**\r
- * Constructor\r
- * @param version wire protocol version\r
- * @param value used as distinguisher\r
- * @param value2 used as detailed distinguisher\r
- * @param clazz class of object that is going to be deserialized\r
- */\r
- public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {\r
- super(version, value, clazz);\r
- this.msgType2 = value2;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + msgType2;\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;\r
- if (msgType2 != other.msgType2) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " msgType2: " + msgType2;\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class EnhancedMessageCodeKey extends MessageCodeKey {
+
+ private int msgType2;
+
+ /**
+ * Constructor
+ * @param version wire protocol version
+ * @param value used as distinguisher
+ * @param value2 used as detailed distinguisher
+ * @param clazz class of object that is going to be deserialized
+ */
+ public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {
+ super(version, value, clazz);
+ this.msgType2 = value2;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + msgType2;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;
+ if (msgType2 != other.msgType2) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " msgType2: " + msgType2;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-/**\r
- * More specific key for {@link SerializerRegistry}\r
- * @author michal.polkorab\r
- * @param <E> main type\r
- * @param <F> specific type\r
- */\r
-public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {\r
-\r
- private final Class<F> msgType2;\r
-\r
- /**\r
- * @param msgVersion\r
- * @param msgType\r
- * @param msgType2\r
- */\r
- public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {\r
- super(msgVersion, msgType);\r
- this.msgType2 = msgType2;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());\r
- return result;\r
- }\r
- \r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- @SuppressWarnings("rawtypes")\r
- EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;\r
- if (msgType2 == null) {\r
- if (other.msgType2 != null) {\r
- return false;\r
- }\r
- } else if (!msgType2.getName().equals(other.msgType2.getName())) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " msgType2: " + msgType2.getName();\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+
+/**
+ * More specific key for {@link SerializerRegistry}
+ * @author michal.polkorab
+ * @param <E> main type
+ * @param <F> specific type
+ */
+public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {
+
+ private final Class<F> msgType2;
+
+ /**
+ * @param msgVersion
+ * @param msgType
+ * @param msgType2
+ */
+ public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {
+ super(msgVersion, msgType);
+ this.msgType2 = msgType2;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ @SuppressWarnings("rawtypes")
+ EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;
+ if (msgType2 == null) {
+ if (other.msgType2 != null) {
+ return false;
+ }
+ } else if (!msgType2.getName().equals(other.msgType2.getName())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " msgType2: " + msgType2.getName();
+ }
}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <E> \r
- */\r
-public interface HeaderDeserializer<E extends DataObject> extends OFGeneralDeserializer {\r
-\r
- /**\r
- * Deserializes byte message headers\r
- * \r
- * @param rawMessage message as bytes in ByteBuf\r
- * @return POJO/DTO\r
- */\r
- E deserializeHeader(ByteBuf rawMessage);\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ * @param <E>
+ */
+public interface HeaderDeserializer<E extends DataObject> extends OFGeneralDeserializer {
+
+ /**
+ * Deserializes byte message headers
+ *
+ * @param rawMessage message as bytes in ByteBuf
+ * @return POJO/DTO
+ */
+ E deserializeHeader(ByteBuf rawMessage);
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-/**\r
- * Does only-header serialization (such as oxm_ids, action_ids, instruction_ids)\r
- * @author michal.polkorab\r
- * @param <SERIALIZER_TYPE>\r
- */\r
-public interface HeaderSerializer<SERIALIZER_TYPE extends DataObject> extends OFGeneralSerializer {\r
-\r
- /**\r
- * Serializes object headers (e.g. for Multipart message - Table Features)\r
- * @param input object whose headers should be serialized\r
- * @param outBuffer output buffer\r
- */\r
- void serializeHeader(SERIALIZER_TYPE input, ByteBuf outBuffer);\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import io.netty.buffer.ByteBuf;
+
+/**
+ * Does only-header serialization (such as oxm_ids, action_ids, instruction_ids)
+ * @author michal.polkorab
+ * @param <SERIALIZER_TYPE>
+ */
+public interface HeaderSerializer<SERIALIZER_TYPE extends DataObject> extends OFGeneralSerializer {
+
+ /**
+ * Serializes object headers (e.g. for Multipart message - Table Features)
+ * @param input object whose headers should be serialized
+ * @param outBuffer output buffer
+ */
+ void serializeHeader(SERIALIZER_TYPE input, ByteBuf outBuffer);
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class MessageCodeKey {\r
-\r
- private short msgVersion;\r
- private int msgType;\r
- private Class<?> clazz;\r
-\r
- /**\r
- * Constructor\r
- * @param version wire protocol version\r
- * @param value used as distinguisher (read from binary data / buffer)\r
- * @param clazz class of object that is going to be deserialized\r
- */\r
- public MessageCodeKey(short version, int value, Class<?> clazz) {\r
- this.msgVersion = version;\r
- this.msgType = value;\r
- this.clazz = clazz;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());\r
- result = prime * result + msgType;\r
- result = prime * result + msgVersion;\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (obj == null) {\r
- return false;\r
- }\r
- if (!(obj instanceof MessageCodeKey)) {\r
- return false;\r
- }\r
- MessageCodeKey other = (MessageCodeKey) obj;\r
- if (clazz == null) {\r
- if (other.clazz != null) {\r
- return false;\r
- }\r
- } else if (!clazz.equals(other.clazz)) {\r
- return false;\r
- }\r
- if (msgType != other.msgType) {\r
- return false;\r
- }\r
- if (msgVersion != other.msgVersion) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+/**
+ * @author michal.polkorab
+ */
+public class MessageCodeKey {
+
+ private short msgVersion;
+ private int msgType;
+ private Class<?> clazz;
+
+ /**
+ * Constructor
+ * @param version wire protocol version
+ * @param value used as distinguisher (read from binary data / buffer)
+ * @param clazz class of object that is going to be deserialized
+ */
+ public MessageCodeKey(short version, int value, Class<?> clazz) {
+ this.msgVersion = version;
+ this.msgType = value;
+ this.clazz = clazz;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
+ result = prime * result + msgType;
+ result = prime * result + msgVersion;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof MessageCodeKey)) {
+ return false;
+ }
+ MessageCodeKey other = (MessageCodeKey) obj;
+ if (clazz == null) {
+ if (other.clazz != null) {
+ return false;
+ }
+ } else if (!clazz.equals(other.clazz)) {
+ return false;
+ }
+ if (msgType != other.msgType) {
+ return false;
+ }
+ if (msgVersion != other.msgVersion) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public interface OFGeneralDeserializer {\r
-\r
- // empty unifying interface\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+
+/**
+ * @author michal.polkorab
+ */
+public interface OFGeneralDeserializer {
+
+ // empty unifying interface
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * Unifying superinterface\r
- * @author michal.polkorab\r
- * */\r
-public interface OFGeneralSerializer {\r
-\r
- // empty unifying superinterface\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+/**
+ * Unifying superinterface
+ * @author michal.polkorab
+ * */
+public interface OFGeneralSerializer {
+
+ // empty unifying superinterface
+}
-/*\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.openflowjava.protocol.api.extensibility;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-\r
-/**\r
- * Provides methods for serialization part of extensibility.\r
- * In case of handling multiple structures of same type (actions,\r
- * instructions, match entries, ... ) which are differentiated by\r
- * vendor / experimenter subtype, vendor has to switch / choose between\r
- * these subtypes. <br />\r
- * \r
- * This has to be done in this way because of unknown augmentations\r
- * - that's why vendor has to handle it in his own implementations.\r
- * @author michal.polkorab\r
- */\r
-public interface SerializerExtensionProvider {\r
-\r
- /**\r
- * Unregisters custom serializer\r
- * @param key used for serializer lookup\r
- * @return true if serializer was removed,\r
- * false if no serializer was found under specified key\r
- */\r
- boolean unregisterSerializer(ExperimenterSerializerKey key);\r
-\r
- /**\r
- * Registers action serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- void registerActionSerializer(ExperimenterActionSerializerKey key,\r
- OFGeneralSerializer serializer);\r
-\r
- /**\r
- * Registers instruction serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- void registerInstructionSerializer(ExperimenterInstructionSerializerKey key,\r
- OFGeneralSerializer serializer);\r
-\r
- /**\r
- * Registers match entry serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- <OXMCLASS extends OxmClassBase, OXMTYPE extends MatchField> void registerMatchEntrySerializer(\r
- MatchEntrySerializerKey<OXMCLASS, OXMTYPE> key,OFGeneralSerializer serializer);\r
-\r
- /**\r
- * Registers experimenter (vendor) message serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<ExperimenterInput> key,\r
- OFSerializer<ExperimenterInput> serializer);\r
-\r
- /**\r
- * Registers multipart-request (stats-request) serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> key,\r
- OFSerializer<MultipartRequestExperimenterCase> serializer);\r
-\r
- /**\r
- * Registers multipart-request table-features serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key,\r
- OFGeneralSerializer serializer);\r
-\r
- /**\r
- * Registers meter band serializer (used in meter-mod messages)\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key,\r
- OFSerializer<MeterBandExperimenterCase> serializer);\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.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+
+/**
+ * Provides methods for serialization part of extensibility.
+ * In case of handling multiple structures of same type (actions,
+ * instructions, match entries, ... ) which are differentiated by
+ * vendor / experimenter subtype, vendor has to switch / choose between
+ * these subtypes. <br />
+ *
+ * This has to be done in this way because of unknown augmentations
+ * - that's why vendor has to handle it in his own implementations.
+ * @author michal.polkorab
+ */
+public interface SerializerExtensionProvider {
+
+ /**
+ * Unregisters custom serializer
+ * @param key used for serializer lookup
+ * @return true if serializer was removed,
+ * false if no serializer was found under specified key
+ */
+ boolean unregisterSerializer(ExperimenterSerializerKey key);
+
+ /**
+ * Registers action serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerActionSerializer(ExperimenterActionSerializerKey key,
+ OFGeneralSerializer serializer);
+
+ /**
+ * Registers instruction serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerInstructionSerializer(ExperimenterInstructionSerializerKey key,
+ OFGeneralSerializer serializer);
+
+ /**
+ * Registers match entry serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ <OXMCLASS extends OxmClassBase, OXMTYPE extends MatchField> void registerMatchEntrySerializer(
+ MatchEntrySerializerKey<OXMCLASS, OXMTYPE> key,OFGeneralSerializer serializer);
+
+ /**
+ * Registers experimenter (vendor) message serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<ExperimenterInput> key,
+ OFSerializer<ExperimenterInput> serializer);
+
+ /**
+ * Registers multipart-request (stats-request) serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> key,
+ OFSerializer<MultipartRequestExperimenterCase> serializer);
+
+ /**
+ * Registers multipart-request table-features serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key,
+ OFGeneralSerializer serializer);
+
+ /**
+ * Registers meter band serializer (used in meter-mod messages)
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key,
+ OFSerializer<MeterBandExperimenterCase> serializer);
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-\r
-\r
-/**\r
- * Stores and handles serializers \r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface SerializerRegistry {\r
-\r
- /**\r
- * Serializer registry provisioning\r
- */\r
- public void init();\r
-\r
- /**\r
- * @param msgTypeKey lookup key\r
- * @return serializer or NullPointerException if no serializer was found\r
- */\r
- <KEYTYPE, SERIALIZERTYPE extends OFGeneralSerializer> SERIALIZERTYPE \r
- getSerializer(MessageTypeKey<KEYTYPE> msgTypeKey);\r
-\r
- /**\r
- * Registers serializer\r
- * Throws IllegalStateException when there is\r
- * a serializer already registered under given key.\r
- * \r
- * If the serializer implements {@link SerializerRegistryInjector} interface,\r
- * the serializer is injected with SerializerRegistry instance.\r
- * \r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- */\r
- <KEYTYPE> void registerSerializer(MessageTypeKey<KEYTYPE> key,\r
- OFGeneralSerializer serializer);\r
-\r
- /**\r
- * Unregisters serializer\r
- * @param key used for serializer lookup\r
- * @param serializer serializer implementation\r
- * @return true if serializer was removed,\r
- * false if no serializer was found under specified key\r
- */\r
- <KEYTYPE> boolean unregisterSerializer(MessageTypeKey<KEYTYPE> key);\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+
+
+
+/**
+ * Stores and handles serializers
+ * @author michal.polkorab
+ *
+ */
+public interface SerializerRegistry {
+
+ /**
+ * Serializer registry provisioning
+ */
+ public void init();
+
+ /**
+ * @param msgTypeKey lookup key
+ * @return serializer or NullPointerException if no serializer was found
+ */
+ <KEYTYPE, SERIALIZERTYPE extends OFGeneralSerializer> SERIALIZERTYPE
+ getSerializer(MessageTypeKey<KEYTYPE> msgTypeKey);
+
+ /**
+ * Registers serializer
+ * Throws IllegalStateException when there is
+ * a serializer already registered under given key.
+ *
+ * If the serializer implements {@link SerializerRegistryInjector} interface,
+ * the serializer is injected with SerializerRegistry instance.
+ *
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ <KEYTYPE> void registerSerializer(MessageTypeKey<KEYTYPE> key,
+ OFGeneralSerializer serializer);
+
+ /**
+ * Unregisters serializer
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ * @return true if serializer was removed,
+ * false if no serializer was found under specified key
+ */
+ <KEYTYPE> boolean unregisterSerializer(MessageTypeKey<KEYTYPE> key);
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * Serializer registry injector\r
- * @author michal.polkorab\r
- */\r
-public interface SerializerRegistryInjector {\r
-\r
- /**\r
- * Injects serializer registry\r
- * @param serializerRegistry registry instance\r
- */\r
- void injectSerializerRegistry(SerializerRegistry serializerRegistry);\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.extensibility;
+
+/**
+ * Serializer registry injector
+ * @author michal.polkorab
+ */
+public interface SerializerRegistryInjector {
+
+ /**
+ * Injects serializer registry
+ * @param serializerRegistry registry instance
+ */
+ void injectSerializerRegistry(SerializerRegistry serializerRegistry);
+
+}
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionDeserializerKey extends MessageCodeKey {\r
-\r
- private Long experimenterId;\r
- /**\r
- * @param version protocol wire version\r
- * @param type action type\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public ActionDeserializerKey(short version,\r
- int type, Long experimenterId) {\r
- super(version, type, Action.class);\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (!(obj instanceof ActionDeserializerKey)) {\r
- return false;\r
- }\r
- ActionDeserializerKey other = (ActionDeserializerKey) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionDeserializerKey extends MessageCodeKey {
+
+ private Long experimenterId;
+ /**
+ * @param version protocol wire version
+ * @param type action type
+ * @param experimenterId experimenter / vendor ID
+ */
+ public ActionDeserializerKey(short version,
+ int type, Long experimenterId) {
+ super(version, type, Action.class);
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ActionDeserializerKey)) {
+ return false;
+ }
+ ActionDeserializerKey other = (ActionDeserializerKey) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <TYPE> action type\r
- */\r
-public class ActionSerializerKey<TYPE extends ActionBase> extends MessageTypeKey<Action> {\r
-\r
- private Class<TYPE> actionType;\r
- private Long experimenterId;\r
-\r
- /**\r
- * @param msgVersion protocol wire version\r
- * @param actionType type of action\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public ActionSerializerKey(short msgVersion, Class<TYPE> actionType,\r
- Long experimenterId) {\r
- super(msgVersion, Action.class);\r
- this.actionType = actionType;\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- ActionSerializerKey<?> other = (ActionSerializerKey<?>) obj;\r
- if (actionType == null) {\r
- if (other.actionType != null) {\r
- return false;\r
- }\r
- } else if (!actionType.equals(other.actionType)) {\r
- return false;\r
- }\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ * @param <TYPE> action type
+ */
+public class ActionSerializerKey<TYPE extends ActionBase> extends MessageTypeKey<Action> {
+
+ private Class<TYPE> actionType;
+ private Long experimenterId;
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param actionType type of action
+ * @param experimenterId experimenter / vendor ID
+ */
+ public ActionSerializerKey(short msgVersion, Class<TYPE> actionType,
+ Long experimenterId) {
+ super(msgVersion, Action.class);
+ this.actionType = actionType;
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ActionSerializerKey<?> other = (ActionSerializerKey<?>) obj;
+ if (actionType == null) {
+ if (other.actionType != null) {
+ return false;
+ }
+ } else if (!actionType.equals(other.actionType)) {
+ return false;
+ }
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionDeserializerKey extends MessageCodeKey {\r
-\r
- private Long experimenterId;\r
- /**\r
- * @param version protocol wire version\r
- * @param type instruction type\r
- * @param experimenterId \r
- */\r
- public InstructionDeserializerKey(short version, int type,\r
- Long experimenterId) {\r
- super(version, type, Instruction.class);\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (!(obj instanceof InstructionDeserializerKey)) {\r
- return false;\r
- }\r
- InstructionDeserializerKey other = (InstructionDeserializerKey) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionDeserializerKey extends MessageCodeKey {
+
+ private Long experimenterId;
+ /**
+ * @param version protocol wire version
+ * @param type instruction type
+ * @param experimenterId
+ */
+ public InstructionDeserializerKey(short version, int type,
+ Long experimenterId) {
+ super(version, type, Instruction.class);
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof InstructionDeserializerKey)) {
+ return false;
+ }
+ InstructionDeserializerKey other = (InstructionDeserializerKey) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <TYPE> action type\r
- */\r
-public class InstructionSerializerKey<TYPE extends InstructionBase>\r
- extends MessageTypeKey<Instruction>{\r
-\r
- private Class<TYPE> instructionType;\r
- private Long experimenterId;\r
-\r
- /**\r
- * @param msgVersion protocol wire version\r
- * @param objectType class of serialized object (Instruction.class)\r
- * @param instructionType type of instruction\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public InstructionSerializerKey(short msgVersion, Class<TYPE> instructionType,\r
- Long experimenterId) {\r
- super(msgVersion, Instruction.class);\r
- this.instructionType = instructionType;\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (!(obj instanceof InstructionSerializerKey)) {\r
- return false;\r
- }\r
- InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- if (instructionType == null) {\r
- if (other.instructionType != null) {\r
- return false;\r
- }\r
- } else if (!instructionType.equals(other.instructionType)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " instructionType type: " + instructionType.getName()\r
- + " vendorID: " + experimenterId;\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.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ * @param <TYPE> action type
+ */
+public class InstructionSerializerKey<TYPE extends InstructionBase>
+ extends MessageTypeKey<Instruction>{
+
+ private Class<TYPE> instructionType;
+ private Long experimenterId;
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param objectType class of serialized object (Instruction.class)
+ * @param instructionType type of instruction
+ * @param experimenterId experimenter / vendor ID
+ */
+ public InstructionSerializerKey(short msgVersion, Class<TYPE> instructionType,
+ Long experimenterId) {
+ super(msgVersion, Instruction.class);
+ this.instructionType = instructionType;
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof InstructionSerializerKey)) {
+ return false;
+ }
+ InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ if (instructionType == null) {
+ if (other.instructionType != null) {
+ return false;
+ }
+ } else if (!instructionType.equals(other.instructionType)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " instructionType type: " + instructionType.getName()
+ + " vendorID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MatchEntryDeserializerKey extends MessageCodeKey\r
- implements ExperimenterDeserializerKey {\r
-\r
- private int oxmField;\r
- private Long experimenterId;\r
-\r
- /**\r
- * @param version protocol wire version\r
- * @param oxmClass oxm_class (see specification)\r
- * @param oxmField oxm_field (see specification)\r
- */\r
- public MatchEntryDeserializerKey(short version,\r
- int oxmClass, int oxmField) {\r
- super(version, oxmClass, MatchEntries.class);\r
- this.oxmField = oxmField;\r
- }\r
-\r
- /**\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public void setExperimenterId(Long experimenterId) {\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- result = prime * result + oxmField;\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- MatchEntryDeserializerKey other = (MatchEntryDeserializerKey) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- if (oxmField != other.oxmField) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " oxm_field: " + oxmField + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MatchEntryDeserializerKey extends MessageCodeKey
+ implements ExperimenterDeserializerKey {
+
+ private int oxmField;
+ private Long experimenterId;
+
+ /**
+ * @param version protocol wire version
+ * @param oxmClass oxm_class (see specification)
+ * @param oxmField oxm_field (see specification)
+ */
+ public MatchEntryDeserializerKey(short version,
+ int oxmClass, int oxmField) {
+ super(version, oxmClass, MatchEntries.class);
+ this.oxmField = oxmField;
+ }
+
+ /**
+ * @param experimenterId experimenter / vendor ID
+ */
+ public void setExperimenterId(Long experimenterId) {
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + oxmField;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ MatchEntryDeserializerKey other = (MatchEntryDeserializerKey) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ if (oxmField != other.oxmField) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " oxm_field: " + oxmField + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <OXM_CLASS> oxm_class (see specification)\r
- * @param <OXM_FIELD> oxm_field (see specification)\r
- */\r
-public final class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>\r
- extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey {\r
-\r
- private Class<OXM_CLASS> oxmClass;\r
- private Class<OXM_FIELD> oxmField;\r
- private Long experimenterId;\r
-\r
- /**\r
- * @param msgVersion protocol wire version\r
- * @param objectType class of serialized object\r
- * @param oxmClass oxm_class (see specification)\r
- * @param oxmField oxm_field (see specification)\r
- */\r
- public MatchEntrySerializerKey(short msgVersion, Class<OXM_CLASS> oxmClass,\r
- Class<OXM_FIELD> oxmField) {\r
- super(msgVersion, MatchEntries.class);\r
- this.oxmClass = oxmClass;\r
- this.oxmField = oxmField;\r
- }\r
-\r
- /**\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public void setExperimenterId(Long experimenterId) {\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());\r
- result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- MatchEntrySerializerKey<?, ?> other = (MatchEntrySerializerKey<?, ?>) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- if (oxmClass == null) {\r
- if (other.oxmClass != null) {\r
- return false;\r
- }\r
- } else if (!oxmClass.equals(other.oxmClass)) {\r
- return false;\r
- }\r
- if (oxmField == null) {\r
- if (other.oxmField != null) {\r
- return false;\r
- }\r
- } else if (!oxmField.equals(other.oxmField)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " oxm_class: " + oxmClass.getName() + " oxm_field: "\r
- + oxmField.getName() + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ * @param <OXM_CLASS> oxm_class (see specification)
+ * @param <OXM_FIELD> oxm_field (see specification)
+ */
+public final class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>
+ extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey {
+
+ private Class<OXM_CLASS> oxmClass;
+ private Class<OXM_FIELD> oxmField;
+ private Long experimenterId;
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param objectType class of serialized object
+ * @param oxmClass oxm_class (see specification)
+ * @param oxmField oxm_field (see specification)
+ */
+ public MatchEntrySerializerKey(short msgVersion, Class<OXM_CLASS> oxmClass,
+ Class<OXM_FIELD> oxmField) {
+ super(msgVersion, MatchEntries.class);
+ this.oxmClass = oxmClass;
+ this.oxmField = oxmField;
+ }
+
+ /**
+ * @param experimenterId experimenter / vendor ID
+ */
+ public void setExperimenterId(Long experimenterId) {
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());
+ result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ MatchEntrySerializerKey<?, ?> other = (MatchEntrySerializerKey<?, ?>) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ if (oxmClass == null) {
+ if (other.oxmClass != null) {
+ return false;
+ }
+ } else if (!oxmClass.equals(other.oxmClass)) {
+ return false;
+ }
+ if (oxmField == null) {
+ if (other.oxmField != null) {
+ return false;
+ }
+ } else if (!oxmField.equals(other.oxmField)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " oxm_class: " + oxmClass.getName() + " oxm_field: "
+ + oxmField.getName() + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ExperimenterActionDeserializerKey extends ActionDeserializerKey \r
- implements ExperimenterDeserializerKey {\r
-\r
- /**\r
- * @param version protocol wire version\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public ExperimenterActionDeserializerKey(short version, Long experimenterId) {\r
- super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ExperimenterActionDeserializerKey extends ActionDeserializerKey
+ implements ExperimenterDeserializerKey {
+
+ /**
+ * @param version protocol wire version
+ * @param experimenterId experimenter / vendor ID
+ */
+ public ExperimenterActionDeserializerKey(short version, Long experimenterId) {
+ super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);
+ }
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public final class ExperimenterActionSerializerKey extends ActionSerializerKey<Experimenter> \r
- implements ExperimenterSerializerKey {\r
-\r
- private Class<? extends ExperimenterActionSubType> actionSubType;\r
-\r
- /**\r
- * @param msgVersion protocol wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @param actionSubType vendor defined subtype\r
- */\r
- public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {\r
- super(msgVersion, Experimenter.class, experimenterId);\r
- this.actionSubType = actionSubType;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((actionSubType == null) ? 0 : actionSubType.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- ExperimenterActionSerializerKey other = (ExperimenterActionSerializerKey) obj;\r
- if (actionSubType == null) {\r
- if (other.actionSubType != null) {\r
- return false;\r
- }\r
- } else if (!actionSubType.equals(other.actionSubType)) {\r
- return false;\r
- }\r
- return true;\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
+
+/**
+ * @author michal.polkorab
+ */
+public final class ExperimenterActionSerializerKey extends ActionSerializerKey<Experimenter>
+ implements ExperimenterSerializerKey {
+
+ private Class<? extends ExperimenterActionSubType> actionSubType;
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param experimenterId experimenter / vendor ID
+ * @param actionSubType vendor defined subtype
+ */
+ public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {
+ super(msgVersion, Experimenter.class, experimenterId);
+ this.actionSubType = actionSubType;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((actionSubType == null) ? 0 : actionSubType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ExperimenterActionSerializerKey other = (ExperimenterActionSerializerKey) obj;
+ if (actionSubType == null) {
+ if (other.actionSubType != null) {
+ return false;
+ }
+ } else if (!actionSubType.equals(other.actionSubType)) {
+ return false;
+ }
+ return true;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-/**\r
- * Marker interface - marks keys appropriate for experimenter deserializer registration\r
- * @author michal.polkorab\r
- */\r
-public interface ExperimenterDeserializerKey {\r
- // only empty marker interface - to ease extensions registration\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.openflowjava.protocol.api.keys.experimenter;
+
+/**
+ * Marker interface - marks keys appropriate for experimenter deserializer registration
+ * @author michal.polkorab
+ */
+public interface ExperimenterDeserializerKey {
+ // only empty marker interface - to ease extensions registration
+}
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ExperimenterIdDeserializerKey extends MessageCodeKey \r
- implements ExperimenterDeserializerKey {\r
-\r
- private Long experimenterId;\r
-\r
- /**\r
- * @param version protocol wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @param objectClass class of created object\r
- */\r
- public <E extends DataObject> ExperimenterIdDeserializerKey(short version,\r
- Long experimenterId, Class<E> objectClass) {\r
- super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- \r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (!(obj instanceof ExperimenterIdDeserializerKey)) {\r
- return false;\r
- }\r
- ExperimenterIdDeserializerKey other = (ExperimenterIdDeserializerKey) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ExperimenterIdDeserializerKey extends MessageCodeKey
+ implements ExperimenterDeserializerKey {
+
+ private Long experimenterId;
+
+ /**
+ * @param version protocol wire version
+ * @param experimenterId experimenter / vendor ID
+ * @param objectClass class of created object
+ */
+ public <E extends DataObject> ExperimenterIdDeserializerKey(short version,
+ Long experimenterId, Class<E> objectClass) {
+ super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);
+ this.experimenterId = experimenterId;
+ }
+
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ExperimenterIdDeserializerKey)) {
+ return false;
+ }
+ ExperimenterIdDeserializerKey other = (ExperimenterIdDeserializerKey) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <TYPE> class of object to be serialized\r
- */\r
-public class ExperimenterIdSerializerKey<TYPE extends DataObject> extends MessageTypeKey<TYPE>\r
- implements ExperimenterSerializerKey {\r
-\r
- private Long experimenterId;\r
-\r
- /**\r
- * @param msgVersion protocol wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @param objectClass class of object to be serialized\r
- */\r
- public ExperimenterIdSerializerKey(short msgVersion,\r
- Long experimenterId, Class<TYPE> objectClass) {\r
- super(msgVersion, objectClass);\r
- this.experimenterId = experimenterId;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = super.hashCode();\r
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (!super.equals(obj)) {\r
- return false;\r
- }\r
- if (!(obj instanceof ExperimenterIdSerializerKey)) {\r
- return false;\r
- }\r
- ExperimenterIdSerializerKey<?> other = (ExperimenterIdSerializerKey<?>) obj;\r
- if (experimenterId == null) {\r
- if (other.experimenterId != null) {\r
- return false;\r
- }\r
- } else if (!experimenterId.equals(other.experimenterId)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return super.toString() + " experimenterID: " + experimenterId;\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ * @param <TYPE> class of object to be serialized
+ */
+public class ExperimenterIdSerializerKey<TYPE extends DataObject> extends MessageTypeKey<TYPE>
+ implements ExperimenterSerializerKey {
+
+ private Long experimenterId;
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param experimenterId experimenter / vendor ID
+ * @param objectClass class of object to be serialized
+ */
+ public ExperimenterIdSerializerKey(short msgVersion,
+ Long experimenterId, Class<TYPE> objectClass) {
+ super(msgVersion, objectClass);
+ this.experimenterId = experimenterId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ExperimenterIdSerializerKey)) {
+ return false;
+ }
+ ExperimenterIdSerializerKey<?> other = (ExperimenterIdSerializerKey<?>) obj;
+ if (experimenterId == null) {
+ if (other.experimenterId != null) {
+ return false;
+ }
+ } else if (!experimenterId.equals(other.experimenterId)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " experimenterID: " + experimenterId;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ExperimenterInstructionDeserializerKey extends InstructionDeserializerKey\r
- implements ExperimenterDeserializerKey {\r
-\r
- /**\r
- * @param version protocol wire version\r
- * @param experimenterId \r
- */\r
- public ExperimenterInstructionDeserializerKey(short version, Long experimenterId) {\r
- super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ExperimenterInstructionDeserializerKey extends InstructionDeserializerKey
+ implements ExperimenterDeserializerKey {
+
+ /**
+ * @param version protocol wire version
+ * @param experimenterId
+ */
+ public ExperimenterInstructionDeserializerKey(short version, Long experimenterId) {
+ super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);
+ }
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public final class ExperimenterInstructionSerializerKey extends InstructionSerializerKey<Experimenter>\r
- implements ExperimenterSerializerKey {\r
-\r
- /**\r
- * @param msgVersion protocol wire version\r
- * @param experimenterId experimenter / vendor ID\r
- */\r
- public ExperimenterInstructionSerializerKey(short msgVersion, Long experimenterId) {\r
- super(msgVersion, Experimenter.class, experimenterId);\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;
+
+/**
+ * @author michal.polkorab
+ */
+public final class ExperimenterInstructionSerializerKey extends InstructionSerializerKey<Experimenter>
+ implements ExperimenterSerializerKey {
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param experimenterId experimenter / vendor ID
+ */
+ public ExperimenterInstructionSerializerKey(short msgVersion, Long experimenterId) {
+ super(msgVersion, Experimenter.class, experimenterId);
+ }
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-/**\r
- * Marker interface - marks keys appropriate for experimenter serializer registration\r
- * @author michal.polkorab\r
- */\r
-public interface ExperimenterSerializerKey {\r
- // only empty marker interface - to ease extensions registration\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.openflowjava.protocol.api.keys.experimenter;
+
+/**
+ * Marker interface - marks keys appropriate for experimenter serializer registration
+ * @author michal.polkorab
+ */
+public interface ExperimenterSerializerKey {
+ // only empty marker interface - to ease extensions registration
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.api.util;\r
-\r
-/**\r
- * Stores oxm_match constants\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OxmMatchConstants {\r
-\r
- /** Backward compatibility with NXM */\r
- public static final int NXM_0_CLASS = 0x0000;\r
- /** Backward compatibility with NXM */\r
- public static final int NXM_1_CLASS = 0x0001;\r
- /** Basic class for OpenFlow */\r
- public static final int OPENFLOW_BASIC_CLASS = 0x8000;\r
- /** Experimenter class */\r
- public static final int EXPERIMENTER_CLASS = 0xFFFF;\r
-\r
- /** Switch input port */\r
- public static final int IN_PORT = 0;\r
- /** Switch physical input port */\r
- public static final int IN_PHY_PORT = 1;\r
- /** Metadata passed between tables */\r
- public static final int METADATA = 2;\r
- /** Ethernet destination address */\r
- public static final int ETH_DST = 3;\r
- /** Ethernet source address */\r
- public static final int ETH_SRC = 4;\r
- /** Ethernet frame type */\r
- public static final int ETH_TYPE = 5;\r
- /** VLAN id. */\r
- public static final int VLAN_VID = 6;\r
- /** VLAN priority. */\r
- public static final int VLAN_PCP = 7;\r
- /** IP DSCP (6 bits in ToS field). */\r
- public static final int IP_DSCP = 8;\r
- /** IP ECN (2 bits in ToS field). */\r
- public static final int IP_ECN = 9;\r
- /** IP protocol. */\r
- public static final int IP_PROTO = 10;\r
- /** IPv4 source address. */\r
- public static final int IPV4_SRC = 11;\r
- /** IPv4 destination address. */\r
- public static final int IPV4_DST = 12;\r
- /** TCP source port. */\r
- public static final int TCP_SRC = 13;\r
- /** TCP destination port. */\r
- public static final int TCP_DST = 14;\r
- /** UDP source port. */\r
- public static final int UDP_SRC = 15;\r
- /** UDP destination port. */\r
- public static final int UDP_DST = 16;\r
- /** SCTP source port. */\r
- public static final int SCTP_SRC = 17;\r
- /** SCTP destination port. */\r
- public static final int SCTP_DST = 18;\r
- /** ICMP type. */\r
- public static final int ICMPV4_TYPE = 19;\r
- /** ICMP code. */\r
- public static final int ICMPV4_CODE = 20;\r
- /** ARP opcode. */\r
- public static final int ARP_OP = 21;\r
- /** ARP source IPv4 address. */\r
- public static final int ARP_SPA = 22;\r
- /** ARP target IPv4 address. */\r
- public static final int ARP_TPA = 23;\r
- /** ARP source hardware address. */\r
- public static final int ARP_SHA = 24;\r
- /** ARP target hardware address. */\r
- public static final int ARP_THA = 25;\r
- /** IPv6 source address. */\r
- public static final int IPV6_SRC = 26;\r
- /** IPv6 destination address. */\r
- public static final int IPV6_DST = 27;\r
- /** IPv6 Flow Label */\r
- public static final int IPV6_FLABEL = 28;\r
- /** ICMPv6 type. */\r
- public static final int ICMPV6_TYPE = 29;\r
- /** ICMPv6 code. */\r
- public static final int ICMPV6_CODE = 30;\r
- /** Target address for ND. */\r
- public static final int IPV6_ND_TARGET = 31;\r
- /** Source link-layer for ND. */\r
- public static final int IPV6_ND_SLL = 32;\r
- /** Target link-layer for ND. */\r
- public static final int IPV6_ND_TLL = 33;\r
- /** MPLS label. */\r
- public static final int MPLS_LABEL = 34;\r
- /** MPLS TC. */\r
- public static final int MPLS_TC = 35;\r
- /** MPLS BoS bit. */\r
- public static final int MPLS_BOS = 36;\r
- /** PBB I-SID. */\r
- public static final int PBB_ISID = 37;\r
- /** Logical Port Metadata. */\r
- public static final int TUNNEL_ID = 38;\r
- /** IPv6 Extension Header pseudo-field */\r
- public static final int IPV6_EXTHDR = 39;\r
-\r
- /**\r
- * OFPXMC_NXM_1 class Constants\r
- */\r
-\r
- /** NXM IPv4 Tunnel Endpoint Source */\r
- public static final int NXM_NX_TUN_IPV4_SRC = 31;\r
- /** NXM IPv4 Tunnel Endpoint Destination */\r
- public static final int NXM_NX_TUN_IPV4_DST = 32;\r
- /** NXM TCP_Flag value */\r
- public static final int NXM_NX_TCP_FLAG = 34;\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.api.util;
+
+/**
+ * Stores oxm_match constants
+ * @author michal.polkorab
+ *
+ */
+public abstract class OxmMatchConstants {
+
+ /** Backward compatibility with NXM */
+ public static final int NXM_0_CLASS = 0x0000;
+ /** Backward compatibility with NXM */
+ public static final int NXM_1_CLASS = 0x0001;
+ /** Basic class for OpenFlow */
+ public static final int OPENFLOW_BASIC_CLASS = 0x8000;
+ /** Experimenter class */
+ public static final int EXPERIMENTER_CLASS = 0xFFFF;
+
+ /** Switch input port */
+ public static final int IN_PORT = 0;
+ /** Switch physical input port */
+ public static final int IN_PHY_PORT = 1;
+ /** Metadata passed between tables */
+ public static final int METADATA = 2;
+ /** Ethernet destination address */
+ public static final int ETH_DST = 3;
+ /** Ethernet source address */
+ public static final int ETH_SRC = 4;
+ /** Ethernet frame type */
+ public static final int ETH_TYPE = 5;
+ /** VLAN id. */
+ public static final int VLAN_VID = 6;
+ /** VLAN priority. */
+ public static final int VLAN_PCP = 7;
+ /** IP DSCP (6 bits in ToS field). */
+ public static final int IP_DSCP = 8;
+ /** IP ECN (2 bits in ToS field). */
+ public static final int IP_ECN = 9;
+ /** IP protocol. */
+ public static final int IP_PROTO = 10;
+ /** IPv4 source address. */
+ public static final int IPV4_SRC = 11;
+ /** IPv4 destination address. */
+ public static final int IPV4_DST = 12;
+ /** TCP source port. */
+ public static final int TCP_SRC = 13;
+ /** TCP destination port. */
+ public static final int TCP_DST = 14;
+ /** UDP source port. */
+ public static final int UDP_SRC = 15;
+ /** UDP destination port. */
+ public static final int UDP_DST = 16;
+ /** SCTP source port. */
+ public static final int SCTP_SRC = 17;
+ /** SCTP destination port. */
+ public static final int SCTP_DST = 18;
+ /** ICMP type. */
+ public static final int ICMPV4_TYPE = 19;
+ /** ICMP code. */
+ public static final int ICMPV4_CODE = 20;
+ /** ARP opcode. */
+ public static final int ARP_OP = 21;
+ /** ARP source IPv4 address. */
+ public static final int ARP_SPA = 22;
+ /** ARP target IPv4 address. */
+ public static final int ARP_TPA = 23;
+ /** ARP source hardware address. */
+ public static final int ARP_SHA = 24;
+ /** ARP target hardware address. */
+ public static final int ARP_THA = 25;
+ /** IPv6 source address. */
+ public static final int IPV6_SRC = 26;
+ /** IPv6 destination address. */
+ public static final int IPV6_DST = 27;
+ /** IPv6 Flow Label */
+ public static final int IPV6_FLABEL = 28;
+ /** ICMPv6 type. */
+ public static final int ICMPV6_TYPE = 29;
+ /** ICMPv6 code. */
+ public static final int ICMPV6_CODE = 30;
+ /** Target address for ND. */
+ public static final int IPV6_ND_TARGET = 31;
+ /** Source link-layer for ND. */
+ public static final int IPV6_ND_SLL = 32;
+ /** Target link-layer for ND. */
+ public static final int IPV6_ND_TLL = 33;
+ /** MPLS label. */
+ public static final int MPLS_LABEL = 34;
+ /** MPLS TC. */
+ public static final int MPLS_TC = 35;
+ /** MPLS BoS bit. */
+ public static final int MPLS_BOS = 36;
+ /** PBB I-SID. */
+ public static final int PBB_ISID = 37;
+ /** Logical Port Metadata. */
+ public static final int TUNNEL_ID = 38;
+ /** IPv6 Extension Header pseudo-field */
+ public static final int IPV6_EXTHDR = 39;
+
+ /**
+ * OFPXMC_NXM_1 class Constants
+ */
+
+ /** NXM IPv4 Tunnel Endpoint Source */
+ public static final int NXM_NX_TUN_IPV4_SRC = 31;
+ /** NXM IPv4 Tunnel Endpoint Destination */
+ public static final int NXM_NX_TUN_IPV4_DST = 32;
+ /** NXM TCP_Flag value */
+ public static final int NXM_NX_TCP_FLAG = 34;
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
- module openflow-augments {\r
- namespace "urn:opendaylight:openflow:augments";\r
- prefix "aug";\r
- \r
- import yang-ext {prefix ext;}\r
- import ietf-inet-types {prefix inet;}\r
- import ietf-yang-types {prefix yang;}\r
-\r
- import openflow-types {prefix oft;}\r
- import openflow-protocol {prefix ofproto;}\r
- import openflow-action {prefix ofaction;}\r
- import openflow-instruction {prefix ofinstruction;}\r
- import openflow-extensible-match {prefix oxm;}\r
-\r
- revision "2013-10-02" {\r
- description "OpenFlow 1.3 - augments model. \r
- Please visit \r
- https://wiki.opendaylight.org/view/File:OpenFlow_Protocol_Library_-_Project_documentation.pdf\r
- - Augmentation Tables chapter";\r
- }\r
-\r
-// OFP_MATCH AUGMENTS\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "port-number-match-entry";\r
- leaf port-number {\r
- type oft:port-number;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "metadata-match-entry";\r
- leaf metadata {\r
- type binary;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "mask-match-entry";\r
- leaf mask {\r
- type binary;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "mac-address-match-entry";\r
- leaf mac-address {\r
- type yang:mac-address;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "eth-type-match-entry";\r
- leaf eth-type {\r
- type oft:ether-type;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "vlan-vid-match-entry";\r
- leaf vlan-vid {\r
- type uint16;\r
- }\r
- leaf cfi-bit {\r
- type boolean;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "vlan-pcp-match-entry";\r
- leaf vlan-pcp {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "dscp-match-entry";\r
- leaf dscp {\r
- type inet:dscp;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "ecn-match-entry";\r
- leaf ecn {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "protocol-number-match-entry";\r
- leaf protocol-number {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "port-match-entry";\r
- leaf port {\r
- type inet:port-number;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "icmpv4-type-match-entry";\r
- leaf icmpv4-type {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "icmpv4-code-match-entry";\r
- leaf icmpv4-code {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "op-code-match-entry";\r
- leaf op-code {\r
- type uint16;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "ipv6-flabel-match-entry";\r
- leaf ipv6-flabel {\r
- type inet:ipv6-flow-label;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "icmpv6-type-match-entry";\r
- leaf icmpv6-type {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "icmpv6-code-match-entry";\r
- leaf icmpv6-code {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "ipv6-address-match-entry";\r
- leaf ipv6-address {\r
- type inet:ipv6-address;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "ipv4-address-match-entry";\r
- leaf ipv4-address {\r
- type inet:ipv4-address;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "mpls-label-match-entry";\r
- leaf mpls-label {\r
- type uint32;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "tc-match-entry";\r
- leaf tc {\r
- type uint8;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "bos-match-entry";\r
- leaf bos {\r
- type boolean;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "isid-match-entry";\r
- leaf isid {\r
- type uint32;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "pseudo-field-match-entry";\r
- leaf pseudo-field {\r
- type oft:ipv6-exthdr-flags;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "experimenter-id-match-entry";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "tcp-flag-match-entry";\r
- leaf tcp-flag {\r
- type uint16;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "tunnel-ipv4-dst-match-entry";\r
- leaf tunnel-ipv4-dst {\r
- type inet:ipv4-address;\r
- }\r
- }\r
- augment "/oxm:oxm-container/oxm:match-entries" {\r
- ext:augment-identifier "tunnel-ipv4-src-match-entry";\r
- leaf tunnel-ipv4-src {\r
- type inet:ipv4-address;\r
- }\r
- }\r
-\r
-// OFP_ACTION AUGMENTS\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "port-action";\r
- leaf port {\r
- type oft:port-number;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "max-length-action";\r
- leaf max-length {\r
- type uint16;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "mpls-ttl-action";\r
- leaf mpls-ttl {\r
- type uint8;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "ethertype-action";\r
- leaf ethertype {\r
- type oft:ether-type;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "queue-id-action";\r
- leaf queue-id {\r
- type uint32;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "group-id-action";\r
- leaf group-id {\r
- type uint32;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "nw-ttl-action";\r
- leaf nw-ttl {\r
- type uint8;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "oxm-fields-action";\r
- uses oxm:oxm-fields-grouping;\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "experimenter-id-action";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- leaf sub-type {\r
- type identityref {\r
- base ofaction:experimenter-action-sub-type;\r
- }\r
- }\r
- }\r
- // OF1.0 structures\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "vlan-vid-action";\r
- leaf vlan-vid {\r
- type uint16;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "vlan-pcp-action";\r
- leaf vlan-pcp {\r
- type uint8;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "dl-address-action";\r
- leaf dl-address {\r
- type yang:mac-address;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "nw-tos-action";\r
- leaf nw-tos {\r
- type uint8;\r
- }\r
- }\r
- augment "/ofaction:actions-container/ofaction:action" {\r
- ext:augment-identifier "ip-address-action";\r
- leaf ip-address {\r
- type inet:ipv4-address;\r
- }\r
- }\r
-\r
-// OFP_TABLE_FEATURES_PROPERTIES AUGMENTS\r
- augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
- ext:augment-identifier "instruction-related-table-feature-property";\r
- uses ofinstruction:instructions-grouping;\r
- }\r
- augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
- ext:augment-identifier "next-table-related-table-feature-property";\r
- list next-table-ids {\r
- config false;\r
- leaf table-id {\r
- type uint8;\r
- }\r
- }\r
- }\r
- augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
- ext:augment-identifier "action-related-table-feature-property";\r
- uses ofaction:actions-grouping;\r
- }\r
- augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
- ext:augment-identifier "oxm-related-table-feature-property";\r
- uses oxm:oxm-fields-grouping;\r
- }\r
- augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
- ext:augment-identifier "experimenter-id-table-feature-property";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- leaf exp-type {\r
- type uint32;\r
- }\r
- }\r
-\r
-// OFP_INSTRUCTION AUGMENTS\r
- augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
- ext:augment-identifier "table-id-instruction";\r
- leaf table-id {\r
- type uint8;\r
- }\r
- }\r
- augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
- ext:augment-identifier "metadata-instruction";\r
- leaf metadata {\r
- type binary;\r
- }\r
- leaf metadata-mask {\r
- type binary;\r
- }\r
- }\r
- augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
- ext:augment-identifier "actions-instruction";\r
- uses ofaction:actions-grouping;\r
- }\r
- augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
- ext:augment-identifier "meter-id-instruction";\r
- leaf meter-id {\r
- type uint32;\r
- }\r
- }\r
- augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
- ext:augment-identifier "experimenter-id-instruction";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- }\r
- \r
-// OFP_QUEUE_PROP AUGMENTS\r
- augment "/ofproto:queue-prop-container/ofproto:queue-property" {\r
- ext:augment-identifier "rate-queue-property";\r
- leaf rate {\r
- type uint16;\r
- }\r
- }\r
- augment "/ofproto:queue-prop-container/ofproto:queue-property" {\r
- ext:augment-identifier "experimenter-id-queue-property";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- }\r
- \r
-// OFP_ERROR_AUGMENTS (only experimenter till OpenFlow v1.3)\r
- augment "/ofproto:error-message" {\r
- ext:augment-identifier "experimenter-id-error";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- }\r
-\r
-// OFP_MULTIPART AUGMENTS\r
- augment "/ofproto:multipart-request/input/ofproto:multipart-request-body/ofproto:multipart-request-experimenter-case/ofproto:multipart-request-experimenter" {\r
- ext:augment-identifier "experimenter-id-multipart-request";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- leaf exp-type {\r
- type uint32;\r
- }\r
- }\r
- augment "/ofproto:multipart-reply-message/ofproto:multipart-reply-body/ofproto:multipart-reply-experimenter-case/ofproto:multipart-reply-experimenter" {\r
- ext:augment-identifier "experimenter-id-multipart-reply";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- leaf exp-type {\r
- type uint32;\r
- }\r
- }\r
-\r
-// OFP_METER_BAND AUGMENTS\r
- augment "/ofproto:meter-band-container/ofproto:meter-band/ofproto:meter-band-experimenter-case/ofproto:meter-band-experimenter" {\r
- ext:augment-identifier "experimenter-id-meter-band";\r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- }\r
+/*
+ * Copyright (c) 2013 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
+ */
+
+ module openflow-augments {
+ namespace "urn:opendaylight:openflow:augments";
+ prefix "aug";
+
+ import yang-ext {prefix ext;}
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+
+ import openflow-types {prefix oft;}
+ import openflow-protocol {prefix ofproto;}
+ import openflow-action {prefix ofaction;}
+ import openflow-instruction {prefix ofinstruction;}
+ import openflow-extensible-match {prefix oxm;}
+
+ revision "2013-10-02" {
+ description "OpenFlow 1.3 - augments model.
+ Please visit
+ https://wiki.opendaylight.org/view/File:OpenFlow_Protocol_Library_-_Project_documentation.pdf
+ - Augmentation Tables chapter";
+ }
+
+// OFP_MATCH AUGMENTS
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "port-number-match-entry";
+ leaf port-number {
+ type oft:port-number;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "metadata-match-entry";
+ leaf metadata {
+ type binary;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "mask-match-entry";
+ leaf mask {
+ type binary;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "mac-address-match-entry";
+ leaf mac-address {
+ type yang:mac-address;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "eth-type-match-entry";
+ leaf eth-type {
+ type oft:ether-type;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "vlan-vid-match-entry";
+ leaf vlan-vid {
+ type uint16;
+ }
+ leaf cfi-bit {
+ type boolean;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "vlan-pcp-match-entry";
+ leaf vlan-pcp {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "dscp-match-entry";
+ leaf dscp {
+ type inet:dscp;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "ecn-match-entry";
+ leaf ecn {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "protocol-number-match-entry";
+ leaf protocol-number {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "port-match-entry";
+ leaf port {
+ type inet:port-number;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "icmpv4-type-match-entry";
+ leaf icmpv4-type {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "icmpv4-code-match-entry";
+ leaf icmpv4-code {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "op-code-match-entry";
+ leaf op-code {
+ type uint16;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "ipv6-flabel-match-entry";
+ leaf ipv6-flabel {
+ type inet:ipv6-flow-label;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "icmpv6-type-match-entry";
+ leaf icmpv6-type {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "icmpv6-code-match-entry";
+ leaf icmpv6-code {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "ipv6-address-match-entry";
+ leaf ipv6-address {
+ type inet:ipv6-address;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "ipv4-address-match-entry";
+ leaf ipv4-address {
+ type inet:ipv4-address;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "mpls-label-match-entry";
+ leaf mpls-label {
+ type uint32;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "tc-match-entry";
+ leaf tc {
+ type uint8;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "bos-match-entry";
+ leaf bos {
+ type boolean;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "isid-match-entry";
+ leaf isid {
+ type uint32;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "pseudo-field-match-entry";
+ leaf pseudo-field {
+ type oft:ipv6-exthdr-flags;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "experimenter-id-match-entry";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "tcp-flag-match-entry";
+ leaf tcp-flag {
+ type uint16;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "tunnel-ipv4-dst-match-entry";
+ leaf tunnel-ipv4-dst {
+ type inet:ipv4-address;
+ }
+ }
+ augment "/oxm:oxm-container/oxm:match-entries" {
+ ext:augment-identifier "tunnel-ipv4-src-match-entry";
+ leaf tunnel-ipv4-src {
+ type inet:ipv4-address;
+ }
+ }
+
+// OFP_ACTION AUGMENTS
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "port-action";
+ leaf port {
+ type oft:port-number;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "max-length-action";
+ leaf max-length {
+ type uint16;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "mpls-ttl-action";
+ leaf mpls-ttl {
+ type uint8;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "ethertype-action";
+ leaf ethertype {
+ type oft:ether-type;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "queue-id-action";
+ leaf queue-id {
+ type uint32;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "group-id-action";
+ leaf group-id {
+ type uint32;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "nw-ttl-action";
+ leaf nw-ttl {
+ type uint8;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "oxm-fields-action";
+ uses oxm:oxm-fields-grouping;
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "experimenter-id-action";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ leaf sub-type {
+ type identityref {
+ base ofaction:experimenter-action-sub-type;
+ }
+ }
+ }
+ // OF1.0 structures
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "vlan-vid-action";
+ leaf vlan-vid {
+ type uint16;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "vlan-pcp-action";
+ leaf vlan-pcp {
+ type uint8;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "dl-address-action";
+ leaf dl-address {
+ type yang:mac-address;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "nw-tos-action";
+ leaf nw-tos {
+ type uint8;
+ }
+ }
+ augment "/ofaction:actions-container/ofaction:action" {
+ ext:augment-identifier "ip-address-action";
+ leaf ip-address {
+ type inet:ipv4-address;
+ }
+ }
+
+// OFP_TABLE_FEATURES_PROPERTIES AUGMENTS
+ augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+ ext:augment-identifier "instruction-related-table-feature-property";
+ uses ofinstruction:instructions-grouping;
+ }
+ augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+ ext:augment-identifier "next-table-related-table-feature-property";
+ list next-table-ids {
+ config false;
+ leaf table-id {
+ type uint8;
+ }
+ }
+ }
+ augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+ ext:augment-identifier "action-related-table-feature-property";
+ uses ofaction:actions-grouping;
+ }
+ augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+ ext:augment-identifier "oxm-related-table-feature-property";
+ uses oxm:oxm-fields-grouping;
+ }
+ augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+ ext:augment-identifier "experimenter-id-table-feature-property";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ leaf exp-type {
+ type uint32;
+ }
+ }
+
+// OFP_INSTRUCTION AUGMENTS
+ augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+ ext:augment-identifier "table-id-instruction";
+ leaf table-id {
+ type uint8;
+ }
+ }
+ augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+ ext:augment-identifier "metadata-instruction";
+ leaf metadata {
+ type binary;
+ }
+ leaf metadata-mask {
+ type binary;
+ }
+ }
+ augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+ ext:augment-identifier "actions-instruction";
+ uses ofaction:actions-grouping;
+ }
+ augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+ ext:augment-identifier "meter-id-instruction";
+ leaf meter-id {
+ type uint32;
+ }
+ }
+ augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+ ext:augment-identifier "experimenter-id-instruction";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ }
+
+// OFP_QUEUE_PROP AUGMENTS
+ augment "/ofproto:queue-prop-container/ofproto:queue-property" {
+ ext:augment-identifier "rate-queue-property";
+ leaf rate {
+ type uint16;
+ }
+ }
+ augment "/ofproto:queue-prop-container/ofproto:queue-property" {
+ ext:augment-identifier "experimenter-id-queue-property";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ }
+
+// OFP_ERROR_AUGMENTS (only experimenter till OpenFlow v1.3)
+ augment "/ofproto:error-message" {
+ ext:augment-identifier "experimenter-id-error";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ }
+
+// OFP_MULTIPART AUGMENTS
+ augment "/ofproto:multipart-request/input/ofproto:multipart-request-body/ofproto:multipart-request-experimenter-case/ofproto:multipart-request-experimenter" {
+ ext:augment-identifier "experimenter-id-multipart-request";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ leaf exp-type {
+ type uint32;
+ }
+ }
+ augment "/ofproto:multipart-reply-message/ofproto:multipart-reply-body/ofproto:multipart-reply-experimenter-case/ofproto:multipart-reply-experimenter" {
+ ext:augment-identifier "experimenter-id-multipart-reply";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ leaf exp-type {
+ type uint32;
+ }
+ }
+
+// OFP_METER_BAND AUGMENTS
+ augment "/ofproto:meter-band-container/ofproto:meter-band/ofproto:meter-band-experimenter-case/ofproto:meter-band-experimenter" {
+ ext:augment-identifier "experimenter-id-meter-band";
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ }
}
\ No newline at end of file
-/*\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
- module openflow-configuration {\r
- namespace "urn:opendaylight:openflow:config";\r
- prefix "of-config";\r
-\r
- revision "2014-06-30" {\r
- description "Library configuration classes";\r
- }\r
-\r
- typedef path-type {\r
- type enumeration {\r
- enum CLASSPATH {\r
- value 0; \r
- description "Keystore file is located on classpath.";\r
- }\r
- enum PATH {\r
- value 1; \r
- description "Keystore file is located on absolute or relative path.";\r
- }\r
- }\r
- }\r
-\r
- typedef keystore-type {\r
- type enumeration {\r
- enum JKS {\r
- value 0; \r
- description "Keystore type - JKS.";\r
- }\r
- enum PKCS12 {\r
- value 1; \r
- description "Keystore type - PKCS12.";\r
- }\r
- }\r
- }\r
-\r
- typedef transport-protocol {\r
- type enumeration {\r
- enum TCP {\r
- value 0;\r
- description "Communication over TCP protocol.";\r
- }\r
- enum TLS {\r
- value 1;\r
- description "Communication over TLS protocol.";\r
- }\r
- enum UDP {\r
- value 2;\r
- description "Communication over UDP protocol.";\r
- }\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
+ */
+
+ module openflow-configuration {
+ namespace "urn:opendaylight:openflow:config";
+ prefix "of-config";
+
+ revision "2014-06-30" {
+ description "Library configuration classes";
+ }
+
+ typedef path-type {
+ type enumeration {
+ enum CLASSPATH {
+ value 0;
+ description "Keystore file is located on classpath.";
+ }
+ enum PATH {
+ value 1;
+ description "Keystore file is located on absolute or relative path.";
+ }
+ }
+ }
+
+ typedef keystore-type {
+ type enumeration {
+ enum JKS {
+ value 0;
+ description "Keystore type - JKS.";
+ }
+ enum PKCS12 {
+ value 1;
+ description "Keystore type - PKCS12.";
+ }
+ }
+ }
+
+ typedef transport-protocol {
+ type enumeration {
+ enum TCP {
+ value 0;
+ description "Communication over TCP protocol.";
+ }
+ enum TLS {
+ value 1;
+ description "Communication over TLS protocol.";
+ }
+ enum UDP {
+ value 2;
+ description "Communication over UDP protocol.";
+ }
+ }
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
- module openflow-protocol {\r
- namespace "urn:opendaylight:openflow:protocol";\r
- prefix "ofproto";\r
-\r
- import ietf-yang-types {prefix yang;}\r
- \r
- import openflow-types {prefix oft;}\r
- import openflow-extensible-match { prefix oxm;}\r
- import openflow-instruction { prefix ofinstruction;}\r
- import openflow-action {prefix ofaction;}\r
-\r
- revision "2013-07-31" {\r
- description "OpenFlow 1.3 - protocol objects model";\r
- }\r
-\r
- // Generic Structures\r
- grouping port-grouping {\r
- reference "ofp_port";\r
- leaf port-no {\r
- type uint32;\r
- }\r
- leaf hw-addr {\r
- type yang:mac-address;\r
- }\r
- leaf name {\r
- type string;\r
- }\r
- leaf config {\r
- description "Bitmap of OFPPC_* flags.";\r
- type oft:port-config;\r
- }\r
- leaf state {\r
- description "Bitmap of OFPPS_* flags.";\r
- type oft:port-state;\r
- }\r
- leaf current-features {\r
- description "Current features.";\r
- type oft:port-features;\r
- }\r
- leaf advertised-features {\r
- description "Features being advertised by the port.";\r
- type oft:port-features;\r
- }\r
- leaf supported-features {\r
- description "Features supported by the port.";\r
- type oft:port-features;\r
- }\r
- leaf peer-features {\r
- description "Features advertised by peer.";\r
- type oft:port-features; \r
- }\r
- leaf curr-speed {\r
- description "Current port bitrate in kbps.";\r
- type uint32;\r
- units "kbps";\r
- }\r
- leaf max-speed {\r
- description "Max port bitrate in kbps";\r
- type uint32;\r
- units "kbps";\r
- }\r
-\r
- // OF1.0 structures\r
- leaf config-v10 {\r
- type oft:port-config-v10;\r
- }\r
- leaf state-v10 { \r
- type oft:port-state-v10;\r
- }\r
- leaf current-features-v10 {\r
- description "Current features.";\r
- type oft:port-features-v10;\r
- }\r
- leaf advertised-features-v10 {\r
- description "Features being advertised by the port.";\r
- type oft:port-features-v10;\r
- }\r
- leaf supported-features-v10 {\r
- description "Features supported by the port.";\r
- type oft:port-features-v10;\r
- }\r
- leaf peer-features-v10 { \r
- description "Features advertised by peer.";\r
- type oft:port-features-v10; \r
- }\r
- }\r
-\r
- grouping buckets-grouping {\r
- list buckets-list {\r
- uses bucket-grouping;\r
- }\r
- }\r
-\r
- grouping bucket-grouping {\r
- description "Bucket for use in groups.";\r
- leaf weight {\r
- description "Relative weight of bucket. Only\r
- defined for select groups.";\r
- type uint16;\r
- }\r
- leaf watch-port {\r
- description "Port whose state affects whether this\r
- bucket is live. Only required for fast\r
- failover groups.";\r
- type oft:port-number;\r
- }\r
- leaf watch-group {\r
- description "Group whose state affects whether this\r
- bucket is live. Only required for fast\r
- failover groups.";\r
- type uint32;\r
- }\r
-\r
- uses ofaction:actions-grouping;\r
- }\r
- \r
- container table-features-properties-container {\r
- uses table-features-properties-grouping;\r
- }\r
-\r
- grouping table-features-properties-grouping {\r
- list table-feature-properties {\r
- config false;\r
- leaf type {\r
- type oft:table-features-prop-type;\r
- }\r
- }\r
- }\r
-\r
- // # MESSAGE Structures\r
- /* Immutable messages. */\r
- grouping ofHeader {\r
- reference "ofp_header struct in Openflow Switch 1.3 Spec";\r
- leaf version {\r
- type uint8;\r
- description "OpenFlow version";\r
- }\r
- leaf xid {\r
- type uint32;\r
- description "Transaction ID";\r
- }\r
- }\r
- grouping ofHelloElementHeader {\r
- reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec";\r
- leaf type {\r
- type oft:hello-element-type;\r
- //reference "OpenFlow Header element type - OFPHET_*";\r
- }\r
- }\r
- grouping hello {\r
- reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";\r
- /* Symmetric message */\r
- uses ofHeader;\r
- \r
- list elements {\r
- uses ofHelloElementHeader;\r
- \r
- leaf-list version-bitmap {\r
- type boolean;\r
- }\r
- }\r
- }\r
- grouping error {\r
- reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";\r
- /* Symmetric message */\r
- uses ofHeader;\r
- \r
- leaf type {\r
- type uint16;\r
- }\r
- leaf code {\r
- type uint16;\r
- }\r
- leaf type-string {\r
- type string;\r
- }\r
- leaf code-string {\r
- type string;\r
- }\r
- leaf data {\r
- type binary; \r
- }\r
- }\r
- grouping echo-request {\r
- reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Symmetric message */\r
- uses ofHeader;\r
- \r
- leaf data {\r
- type binary;\r
- }\r
- }\r
- grouping echo-reply {\r
- reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Symmetric message */\r
- uses ofHeader;\r
- \r
- leaf data {\r
- type binary;\r
- }\r
- }\r
- grouping experimenter {\r
- reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";\r
- /* Symmetric message */\r
- uses ofHeader;\r
- \r
- leaf experimenter {\r
- type oft:experimenter-id;\r
- }\r
- leaf exp_type {\r
- type uint32;\r
- }\r
- }\r
- /* Switch configuration messages. */\r
- grouping features-request {\r
- reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- uses ofHeader;\r
- }\r
- grouping features-reply {\r
- reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- uses ofHeader;\r
- \r
- leaf datapathId {\r
- type uint64;\r
- }\r
- leaf buffers {\r
- type uint32;\r
- }\r
- leaf tables {\r
- type uint8;\r
- }\r
- leaf auxiliaryId {\r
- type uint8;\r
- }\r
- leaf capabilities {\r
- type oft:capabilities;\r
- }\r
- leaf reserved {\r
- type uint32;\r
- }\r
- // OF1.0 structures\r
- leaf capabilities-v10 {\r
- type oft:capabilities-v10;\r
- }\r
- leaf actions-v10 {\r
- type oft:action-type-v10;\r
- }\r
- list phy-port {\r
- uses port-grouping;\r
- }\r
- }\r
- grouping get-config-request {\r
- reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- uses ofHeader;\r
- }\r
- grouping get-config-reply {\r
- reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- uses ofHeader;\r
- \r
- leaf flags {\r
- type oft:switch-config-flag;\r
- }\r
- leaf miss-send-len {\r
- type uint16;\r
- }\r
- }\r
- grouping set-config {\r
- reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- \r
- leaf flags {\r
- type oft:switch-config-flag;\r
- }\r
- leaf miss-send-len {\r
- type uint16;\r
- }\r
- }\r
- /* Asynchronous messages. */\r
- grouping packet-in {\r
- reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";\r
- /* Async message */\r
- \r
- uses ofHeader;\r
- \r
- leaf buffer-id {\r
- // ID assigned by datapath.\r
- type uint32;\r
- }\r
- leaf total-len {\r
- // Full length of frame.\r
- type uint16;\r
- }\r
- leaf reason {\r
- // Reason packet is being sent (one of OFPR_*) \r
- type oft:packet-in-reason;\r
- }\r
- leaf table-id {\r
- // ID of the table that was looked up\r
- type oft:table-id;\r
- }\r
- leaf cookie {\r
- // Cookie of the flow entry that was looked up.\r
- type uint64;\r
- }\r
- uses oxm:match-grouping;\r
-\r
- leaf data {\r
- type binary;\r
- }\r
- \r
- // OF1.0 structures\r
- leaf in-port {\r
- type uint16;\r
- }\r
- }\r
- grouping flow-removed {\r
- reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";\r
- /* Async message */\r
- uses ofHeader;\r
- \r
- leaf cookie {\r
- type uint64;\r
- }\r
- leaf priority {\r
- type uint16;\r
- }\r
- leaf reason {\r
- type oft:flow-removed-reason;\r
- }\r
- leaf table-id {\r
- type oft:table-id;\r
- }\r
- leaf duration-sec {\r
- type uint32;\r
- }\r
- leaf duration-nsec {\r
- type uint32;\r
- }\r
- leaf idle-timeout {\r
- type uint16;\r
- }\r
- leaf hard-timeout {\r
- type uint16;\r
- }\r
- leaf packet-count {\r
- type uint64;\r
- }\r
- leaf byte-count {\r
- type uint64;\r
- }\r
- uses oxm:match-grouping;\r
- \r
- // OF1.0 structures\r
- uses oxm:match-v10-grouping;\r
- } \r
- grouping port-status {\r
- reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";\r
- \r
- uses ofHeader;\r
- \r
- uses port-grouping;\r
- \r
- leaf reason {\r
- type oft:port-reason;\r
- }\r
- }\r
- /* Controller command messages. */\r
- grouping packet-out {\r
- reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- \r
- uses ofaction:actions-grouping;\r
- \r
- leaf data {\r
- type binary;\r
- }\r
- leaf buffer-id {\r
- type uint32;\r
- }\r
- leaf in-port {\r
- type oft:port-number;\r
- }\r
- } \r
- grouping flow-mod {\r
- reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- \r
- leaf cookie {\r
- type uint64;\r
- }\r
- leaf cookie-mask {\r
- type uint64;\r
- }\r
- leaf table-id {\r
- type oft:table-id;\r
- }\r
- leaf command {\r
- type oft:flow-mod-command;\r
- }\r
- leaf idle-timeout {\r
- type uint16;\r
- }\r
- leaf hard-timeout {\r
- type uint16;\r
- }\r
- leaf priority {\r
- type uint16;\r
- }\r
- leaf buffer-id {\r
- type uint32;\r
- }\r
- leaf out-port {\r
- type oft:port-number;\r
- }\r
- leaf out-group {\r
- type uint32;\r
- }\r
- leaf flags {\r
- type oft:flow-mod-flags;\r
- }\r
- uses oxm:match-grouping;\r
- \r
- uses ofinstruction:instructions-grouping;\r
- \r
- // OF1.0 structures\r
- leaf flags-v10 {\r
- type oft:flow-mod-flags-v10;\r
- }\r
- uses oxm:match-v10-grouping;\r
- uses ofaction:actions-grouping;\r
- } \r
- grouping group-mod {\r
- reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- \r
- leaf command {\r
- type oft:group-mod-command;\r
- }\r
- leaf type {\r
- type oft:group-type;\r
- }\r
- leaf group-id {\r
- type oft:group-id;\r
- }\r
- \r
- uses buckets-grouping;\r
- }\r
- \r
- grouping port-mod {\r
- reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf port-no {\r
- type oft:port-number;\r
- }\r
- leaf hw-address {\r
- type yang:mac-address;\r
- } \r
- leaf config {\r
- type oft:port-config;\r
- } \r
- leaf mask {\r
- type oft:port-config;\r
- }\r
- leaf advertise {\r
- type oft:port-features;\r
- }\r
- // OF1.0 structures\r
- leaf config-v10 {\r
- type oft:port-config-v10;\r
- }\r
- leaf mask-v10 {\r
- type oft:port-config-v10;\r
- }\r
- leaf advertise-v10 {\r
- type oft:port-features-v10;\r
- }\r
- } \r
- grouping table-mod {\r
- reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf table-id {\r
- type oft:table-id;\r
- }\r
- leaf config {\r
- type oft:table-config;\r
- }\r
- } \r
- \r
- /* Multipart messages. */\r
- grouping multipart-request {\r
- reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf type {\r
- type oft:multipart-type;\r
- }\r
- leaf flags {\r
- type oft:multipart-request-flags;\r
- }\r
- choice multipart-request-body {\r
- case multipart-request-desc-case {\r
- container multipart-request-desc {\r
- leaf empty {\r
- type empty;\r
- }\r
- }\r
- }\r
- case multipart-request-flow-case {\r
- container multipart-request-flow {\r
- leaf table-id {\r
- type uint8;\r
- }\r
- leaf out-port {\r
- type uint32;\r
- }\r
- leaf out-group {\r
- type uint32;\r
- }\r
- leaf cookie {\r
- type uint64;\r
- }\r
- leaf cookie-mask {\r
- type uint64;\r
- }\r
- uses oxm:match-grouping;\r
- \r
- // OF1.0 structures\r
- uses oxm:match-v10-grouping;\r
- }\r
- }\r
- case multipart-request-aggregate-case {\r
- container multipart-request-aggregate {\r
- leaf table-id {\r
- type uint8;\r
- }\r
- leaf out-port {\r
- type uint32;\r
- }\r
- leaf out-group {\r
- type uint32;\r
- }\r
- leaf cookie {\r
- type uint64;\r
- }\r
- leaf cookie-mask {\r
- type uint64;\r
- }\r
- uses oxm:match-grouping;\r
- \r
- // OF1.0 structures\r
- uses oxm:match-v10-grouping;\r
- }\r
- }\r
- case multipart-request-table-case {\r
- container multipart-request-table {\r
- leaf empty {\r
- type empty;\r
- }\r
- }\r
- }\r
- case multipart-request-port-stats-case {\r
- container multipart-request-port-stats {\r
- leaf port-no {\r
- type uint32;\r
- }\r
- }\r
- }\r
- case multipart-request-queue-case {\r
- container multipart-request-queue {\r
- leaf port-no {\r
- type uint32;\r
- }\r
- leaf queue-id {\r
- type uint32;\r
- }\r
- }\r
- }\r
- case multipart-request-group-case {\r
- container multipart-request-group {\r
- leaf group-id {\r
- type oft:group-id;\r
- }\r
- }\r
- }\r
- case multipart-request-group-desc-case {\r
- container multipart-request-group-desc {\r
- leaf empty {\r
- type empty;\r
- }\r
- }\r
- }\r
- case multipart-request-group-features-case {\r
- container multipart-request-group-features {\r
- leaf empty {\r
- type empty;\r
- }\r
- }\r
- }\r
- case multipart-request-meter-case {\r
- container multipart-request-meter {\r
- leaf meter-id {\r
- type oft:meter-id;\r
- }\r
- }\r
- }\r
- case multipart-request-meter-config-case {\r
- container multipart-request-meter-config {\r
- leaf meter-id {\r
- type oft:meter-id;\r
- }\r
- }\r
- }\r
- case multipart-request-meter-features-case {\r
- container multipart-request-meter-features {\r
- leaf empty {\r
- type empty;\r
- }\r
- }\r
- }\r
- case multipart-request-table-features-case {\r
- container multipart-request-table-features {\r
- list table-features {\r
- leaf table-id {\r
- type uint8;\r
- }\r
- leaf name {\r
- type string;\r
- }\r
- leaf metadata-match {\r
- type uint64;\r
- }\r
- leaf metadata-write {\r
- type uint64;\r
- }\r
- leaf config {\r
- type oft:table-config;\r
- }\r
- leaf max-entries {\r
- type uint32;\r
- }\r
- uses table-features-properties-grouping;\r
- }\r
- }\r
- }\r
- case multipart-request-port-desc-case {\r
- container multipart-request-port-desc {\r
- leaf empty {\r
- type empty;\r
- }\r
- }\r
- }\r
- case multipart-request-experimenter-case {\r
- container multipart-request-experimenter {\r
- // empty body - used for experimenter augmentation\r
- }\r
- }\r
- }\r
- } \r
- grouping multipart-reply {\r
- reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf type {\r
- type oft:multipart-type;\r
- }\r
- leaf flags {\r
- type oft:multipart-request-flags;\r
- }\r
- choice multipart-reply-body {\r
- case multipart-reply-desc-case {\r
- container multipart-reply-desc {\r
- leaf mfr_desc {\r
- type string;\r
- }\r
- leaf hw_desc {\r
- type string;\r
- }\r
- leaf sw_desc {\r
- type string;\r
- }\r
- leaf serial_num {\r
- type string;\r
- }\r
- leaf dp_desc {\r
- type string;\r
- }\r
- }\r
- }\r
- case multipart-reply-flow-case {\r
- container multipart-reply-flow {\r
- list flow-stats {\r
- leaf table-id {\r
- type uint8;\r
- }\r
- leaf duration-sec {\r
- type uint32;\r
- }\r
- leaf duration-nsec {\r
- type uint32;\r
- }\r
- leaf priority {\r
- type uint16;\r
- }\r
- leaf idle-timeout {\r
- type uint16;\r
- }\r
- leaf hard-timeout {\r
- type uint16;\r
- }\r
- leaf flags {\r
- type oft:flow-mod-flags;\r
- }\r
- leaf cookie {\r
- type uint64;\r
- }\r
- leaf packet-count {\r
- type uint64;\r
- }\r
- leaf byte-count {\r
- type uint64;\r
- }\r
- uses oxm:match-grouping;\r
- \r
- uses ofinstruction:instructions-grouping;\r
- \r
- // OF1.0 structures\r
- uses oxm:match-v10-grouping;\r
- uses ofaction:actions-grouping;\r
- }\r
- }\r
- }\r
- case multipart-reply-aggregate-case {\r
- container multipart-reply-aggregate {\r
- leaf packet-count {\r
- type uint64;\r
- }\r
- leaf byte-count {\r
- type uint64;\r
- }\r
- leaf flow-count {\r
- type uint32;\r
- }\r
- }\r
- }\r
- case multipart-reply-table-case {\r
- container multipart-reply-table {\r
- list table-stats {\r
- leaf table-id {\r
- type uint8;\r
- }\r
- leaf active-count {\r
- type uint32;\r
- }\r
- leaf lookup-count {\r
- type uint64;\r
- }\r
- leaf matched-count {\r
- type uint64;\r
- }\r
- \r
- // OF1.0 structures\r
- leaf name {\r
- type string;\r
- }\r
- leaf wildcards {\r
- type oft:flow-wildcards-v10;\r
- }\r
- leaf nw-src-mask {\r
- type uint8;\r
- }\r
- leaf nw-dst-mask {\r
- type uint8;\r
- }\r
- leaf max-entries {\r
- type uint32;\r
- }\r
- }\r
- }\r
- }\r
- case multipart-reply-port-stats-case {\r
- container multipart-reply-port-stats {\r
- list port-stats {\r
- leaf port-no {\r
- type uint32;\r
- }\r
- leaf rx-packets {\r
- type uint64;\r
- }\r
- leaf tx-packets {\r
- type uint64;\r
- }\r
- leaf rx-bytes {\r
- type uint64;\r
- }\r
- leaf tx-bytes {\r
- type uint64;\r
- }\r
- leaf rx-dropped {\r
- type uint64;\r
- }\r
- leaf tx-dropped {\r
- type uint64;\r
- }\r
- leaf rx-errors {\r
- type uint64;\r
- }\r
- leaf tx-errors {\r
- type uint64;\r
- }\r
- leaf rx-frame-err {\r
- type uint64;\r
- }\r
- leaf rx-over-err {\r
- type uint64;\r
- }\r
- leaf rx-crc-err {\r
- type uint64;\r
- }\r
- leaf collisions {\r
- type uint64;\r
- }\r
- leaf duration-sec {\r
- type uint32;\r
- }\r
- leaf duration-nsec {\r
- type uint32;\r
- }\r
- }\r
- }\r
- }\r
- case multipart-reply-queue-case {\r
- container multipart-reply-queue {\r
- list queue-stats {\r
- leaf port-no {\r
- type uint32;\r
- }\r
- leaf queue-id {\r
- type uint32;\r
- }\r
- leaf tx-bytes {\r
- type uint64;\r
- }\r
- leaf tx-packets {\r
- type uint64;\r
- }\r
- leaf tx-errors {\r
- type uint64;\r
- }\r
- leaf duration-sec {\r
- type uint32;\r
- }\r
- leaf duration-nsec {\r
- type uint32;\r
- }\r
- }\r
- }\r
- }\r
- case multipart-reply-group-case {\r
- container multipart-reply-group {\r
- list group-stats {\r
- leaf group-id {\r
- type oft:group-id;\r
- }\r
- leaf ref-count {\r
- type uint32;\r
- }\r
- leaf packet-count {\r
- type uint64;\r
- }\r
- leaf byte-count {\r
- type uint64;\r
- }\r
- leaf duration-sec {\r
- type uint32;\r
- }\r
- leaf duration-nsec {\r
- type uint32;\r
- }\r
- list bucket-stats {\r
- leaf packet-count {\r
- type uint64;\r
- }\r
- leaf byte-count {\r
- type uint64;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- case multipart-reply-group-desc-case {\r
- container multipart-reply-group-desc {\r
- list group-desc {\r
- leaf type {\r
- type oft:group-type;\r
- }\r
- leaf group-id {\r
- type oft:group-id;\r
- }\r
- uses buckets-grouping;\r
- }\r
- }\r
- }\r
- case multipart-reply-group-features-case {\r
- container multipart-reply-group-features {\r
- leaf types {\r
- type oft:group-types;\r
- }\r
- leaf capabilities {\r
- type oft:group-capabilities;\r
- }\r
- leaf-list max_groups {\r
- type uint32;\r
- }\r
- leaf-list actions-bitmap {\r
- type oft:action-type;\r
- }\r
- }\r
- }\r
- case multipart-reply-meter-case {\r
- container multipart-reply-meter {\r
- list meter-stats {\r
- leaf meter-id {\r
- type oft:meter-id;\r
- }\r
- leaf flow-count {\r
- type uint32;\r
- }\r
- leaf packet-in-count {\r
- type uint64;\r
- }\r
- leaf byte-in-count {\r
- type uint64;\r
- }\r
- leaf duration-sec {\r
- type uint32;\r
- }\r
- leaf duration-nsec {\r
- type uint32;\r
- }\r
- list meter-band-stats {\r
- leaf packet-band-count {\r
- type uint64;\r
- }\r
- leaf byte-band-count {\r
- type uint64;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- case multipart-reply-meter-config-case {\r
- container multipart-reply-meter-config {\r
- list meter-config {\r
- leaf flags {\r
- type oft:meter-flags;\r
- }\r
- leaf meter-id {\r
- type oft:meter-id;\r
- }\r
- list bands {\r
- uses meter-band-header;\r
- }\r
- }\r
- }\r
- }\r
- case multipart-reply-meter-features-case {\r
- container multipart-reply-meter-features {\r
- leaf max-meter {\r
- type uint32;\r
- }\r
- leaf band-types {\r
- type oft:meter-band-type-bitmap;\r
- }\r
- leaf capabilities {\r
- type oft:meter-flags;\r
- }\r
- leaf max-bands {\r
- type uint8;\r
- }\r
- leaf max-color {\r
- type uint8;\r
- }\r
- }\r
- }\r
- case multipart-reply-table-features-case {\r
- container multipart-reply-table-features {\r
- list table-features {\r
- leaf table-id {\r
- type uint8;\r
- }\r
- leaf name {\r
- type string;\r
- }\r
- leaf metadata-match {\r
- type binary;\r
- }\r
- leaf metadata-write {\r
- type binary;\r
- }\r
- leaf config {\r
- type oft:table-config;\r
- } \r
- leaf max-entries {\r
- type uint32;\r
- }\r
- uses table-features-properties-grouping;\r
- }\r
- }\r
- }\r
- case multipart-reply-port-desc-case {\r
- container multipart-reply-port-desc {\r
- list ports {\r
- uses port-grouping;\r
- }\r
- }\r
- }\r
- case multipart-reply-experimenter-case {\r
- container multipart-reply-experimenter {\r
- // empty body - used for experimenter augmentation\r
- }\r
- }\r
- }\r
- } \r
- /* Barrier messages. */\r
- grouping barrier-request {\r
- reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- uses ofHeader;\r
- } \r
- grouping barrier-reply {\r
- reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- uses ofHeader;\r
- } \r
- /* Queue Configuration messages. */\r
- grouping queue-get-config-request {\r
- reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- \r
- leaf port {\r
- type oft:port-number;\r
- }\r
- } \r
- grouping queue-get-config-reply {\r
- reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf port {\r
- type oft:port-number;\r
- }\r
- list queues {\r
- uses packet-queue;\r
- }\r
- }\r
- grouping packet-queue {\r
- leaf queue-id {\r
- type oft:queue-id;\r
- }\r
- leaf port {\r
- type oft:port-number;\r
- }\r
- uses queue-property-header;\r
- }\r
- container queue-prop-container {\r
- uses queue-property-header;\r
- }\r
- grouping queue-property-header {\r
- list queue-property {\r
- config false;\r
- leaf property {\r
- type oft:queue-properties;\r
- }\r
- }\r
- }\r
- /* Controller role change request messages. */\r
- grouping role-request {\r
- reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- \r
- leaf role {\r
- type oft:controller-role;\r
- }\r
- leaf generation-id {\r
- type uint64;\r
- }\r
- } \r
- grouping role-reply {\r
- reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf role {\r
- type oft:controller-role;\r
- }\r
- leaf generation-id {\r
- type uint64;\r
- }\r
- } \r
- /* Asynchronous message configuration. */\r
- grouping get-async-request {\r
- reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- } \r
- grouping get-async-reply {\r
- reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- uses async-body-grouping;\r
- } \r
- grouping set-async {\r
- reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
- \r
- uses ofHeader;\r
- uses async-body-grouping;\r
- }\r
- \r
- grouping async-body-grouping {\r
- list packet-in-mask {\r
- leaf-list mask {\r
- type oft:packet-in-reason;\r
- }\r
- }\r
- list port-status-mask {\r
- leaf-list mask {\r
- type oft:port-reason;\r
- }\r
- }\r
- list flow-removed-mask {\r
- leaf-list mask {\r
- type oft:flow-removed-reason;\r
- }\r
- }\r
- }\r
- /* Meters and rate limiters configuration messages. */\r
- grouping meter-mod {\r
- reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";\r
- /* Controller/switch message */\r
-\r
- uses ofHeader;\r
- \r
- leaf command {\r
- type oft:meter-mod-command;\r
- } \r
- leaf flags {\r
- type oft:meter-flags;\r
- }\r
- leaf meter-id {\r
- type oft:meter-id;\r
- }\r
- list bands {\r
- uses meter-band-header;\r
- }\r
- }\r
- \r
- container meter-band-container {\r
- uses meter-band-header;\r
- }\r
- grouping meter-band-header {\r
- choice meter-band {\r
- case meter-band-drop-case {\r
- container meter-band-drop {\r
- uses meter-band-commons;\r
- }\r
- }\r
- case meter-band-dscp-remark-case {\r
- container meter-band-dscp-remark {\r
- uses meter-band-commons;\r
- leaf prec-level {\r
- type uint8;\r
- }\r
- }\r
- }\r
- case meter-band-experimenter-case {\r
- container meter-band-experimenter {\r
- uses meter-band-commons;\r
- }\r
- }\r
- }\r
- }\r
- \r
- grouping meter-band-commons {\r
- leaf type {\r
- type oft:meter-band-type;\r
- }\r
- leaf rate {\r
- type uint32;\r
- }\r
- leaf burst-size {\r
- type uint32;\r
- }\r
- }\r
-\r
- /* Immutable messages. */\r
- notification hello-message {\r
- uses hello;\r
- reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";\r
- \r
- /* Symmetric message */\r
- }\r
- notification error-message {\r
- uses error;\r
- reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";\r
- \r
- /* Symmetric message */\r
- }\r
- notification echo-request-message {\r
- uses echo-request;\r
- reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";\r
- \r
- /* Symmetric message */\r
- }\r
- notification experimenter-message {\r
- uses experimenter;\r
- reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";\r
- // TODO:: does switch send this when understood experimenter msg from lib?\r
- /* Symmetric message */\r
- }\r
- // # Notification and RPCs\r
- /* Symmetric RPC. */\r
- rpc echo {\r
- input {\r
- uses echo-request;\r
- }\r
- /* Controller/switch message */\r
- output {\r
- uses echo-reply;\r
- }\r
- }\r
- \r
- rpc echo-reply {\r
- input {\r
- uses echo-reply;\r
- }\r
- }\r
- \r
- rpc hello {\r
- input {\r
- uses hello;\r
- }\r
- }\r
- \r
- rpc experimenter {\r
- input {\r
- uses experimenter;\r
- }\r
- }\r
-\r
- /* Switch configuration messages. */\r
- rpc get-features {\r
- input {\r
- uses features-request;\r
- }\r
- /* Controller/switch message */\r
- output {\r
- uses features-reply;\r
- }\r
- }\r
- \r
- rpc get-config {\r
- input {\r
- uses get-config-request;\r
- }\r
- output {\r
- uses get-config-reply;\r
- }\r
- /* Controller/switch message */\r
- }\r
- \r
- rpc set-config {\r
- input {\r
- uses set-config;\r
- } \r
- /* Controller/switch message */\r
- }\r
- /* Asynchronous messages. */\r
- notification packet-in-message {\r
- uses packet-in;\r
- \r
- /* Async message */\r
- }\r
- notification flow-removed-message {\r
- uses flow-removed;\r
- \r
- /* Async message */\r
- } \r
- notification port-status-message {\r
- uses port-status;\r
- \r
- } /* Async message */\r
-\r
- /* Controller command messages. */\r
- rpc packet-out {\r
- input {\r
- uses packet-out;\r
- }\r
- /* Controller/switch message */\r
- } \r
- rpc flow-mod {\r
- input {\r
- uses flow-mod;\r
- }\r
- /* Controller/switch message */\r
- } \r
- rpc group-mod {\r
- input {\r
- uses group-mod;\r
- }\r
- /* Controller/switch message */\r
- } \r
- rpc port-mod {\r
- input {\r
- uses port-mod;\r
- }\r
- } /* Controller/switch message */\r
- \r
- rpc table-mod {\r
- input {\r
- uses table-mod;\r
- }\r
- } /* Controller/switch message */\r
-\r
- /* Multipart messages. */\r
-\r
- rpc multipart-request {\r
- input {\r
- uses multipart-request;\r
- }\r
- }\r
-\r
- /* Controller/switch message */\r
- notification multipart-reply-message {\r
- uses multipart-reply;\r
- // notification because of multiple following responses\r
- } /* Controller/switch message */\r
- \r
-\r
- /* Barrier messages. */\r
- rpc barrier {\r
- input {\r
- uses barrier-request;\r
- }\r
- output {\r
- uses barrier-reply;\r
- }\r
- }\r
- /* Queue Configuration messages. */\r
- rpc get-queue-config {\r
- input {\r
- uses queue-get-config-request;\r
- }\r
- output {\r
- uses queue-get-config-reply;\r
- }\r
- } \r
-\r
- /* Controller role change request messages. */\r
- rpc role-request {\r
- input {\r
- uses role-request;\r
- }\r
- output {\r
- uses role-reply;\r
- }\r
- } /* Controller/switch message */\r
- \r
- /* Asynchronous message configuration. */\r
- rpc get-async {\r
- input {\r
- uses get-async-request;\r
- }\r
- output {\r
- uses get-async-reply;\r
- }\r
- } \r
- /* Controller/switch message */\r
- rpc set-async {\r
- input { \r
- uses set-async;\r
- }\r
- \r
- } \r
- /* Meters and rate limiters configuration messages. */\r
- rpc meter-mod {\r
- input {\r
- uses meter-mod;\r
- }\r
- } /* Controller/switch message */\r
+/*
+ * Copyright (c) 2013 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
+ */
+
+ module openflow-protocol {
+ namespace "urn:opendaylight:openflow:protocol";
+ prefix "ofproto";
+
+ import ietf-yang-types {prefix yang;}
+
+ import openflow-types {prefix oft;}
+ import openflow-extensible-match { prefix oxm;}
+ import openflow-instruction { prefix ofinstruction;}
+ import openflow-action {prefix ofaction;}
+
+ revision "2013-07-31" {
+ description "OpenFlow 1.3 - protocol objects model";
+ }
+
+ // Generic Structures
+ grouping port-grouping {
+ reference "ofp_port";
+ leaf port-no {
+ type uint32;
+ }
+ leaf hw-addr {
+ type yang:mac-address;
+ }
+ leaf name {
+ type string;
+ }
+ leaf config {
+ description "Bitmap of OFPPC_* flags.";
+ type oft:port-config;
+ }
+ leaf state {
+ description "Bitmap of OFPPS_* flags.";
+ type oft:port-state;
+ }
+ leaf current-features {
+ description "Current features.";
+ type oft:port-features;
+ }
+ leaf advertised-features {
+ description "Features being advertised by the port.";
+ type oft:port-features;
+ }
+ leaf supported-features {
+ description "Features supported by the port.";
+ type oft:port-features;
+ }
+ leaf peer-features {
+ description "Features advertised by peer.";
+ type oft:port-features;
+ }
+ leaf curr-speed {
+ description "Current port bitrate in kbps.";
+ type uint32;
+ units "kbps";
+ }
+ leaf max-speed {
+ description "Max port bitrate in kbps";
+ type uint32;
+ units "kbps";
+ }
+
+ // OF1.0 structures
+ leaf config-v10 {
+ type oft:port-config-v10;
+ }
+ leaf state-v10 {
+ type oft:port-state-v10;
+ }
+ leaf current-features-v10 {
+ description "Current features.";
+ type oft:port-features-v10;
+ }
+ leaf advertised-features-v10 {
+ description "Features being advertised by the port.";
+ type oft:port-features-v10;
+ }
+ leaf supported-features-v10 {
+ description "Features supported by the port.";
+ type oft:port-features-v10;
+ }
+ leaf peer-features-v10 {
+ description "Features advertised by peer.";
+ type oft:port-features-v10;
+ }
+ }
+
+ grouping buckets-grouping {
+ list buckets-list {
+ uses bucket-grouping;
+ }
+ }
+
+ grouping bucket-grouping {
+ description "Bucket for use in groups.";
+ leaf weight {
+ description "Relative weight of bucket. Only
+ defined for select groups.";
+ type uint16;
+ }
+ leaf watch-port {
+ description "Port whose state affects whether this
+ bucket is live. Only required for fast
+ failover groups.";
+ type oft:port-number;
+ }
+ leaf watch-group {
+ description "Group whose state affects whether this
+ bucket is live. Only required for fast
+ failover groups.";
+ type uint32;
+ }
+
+ uses ofaction:actions-grouping;
+ }
+
+ container table-features-properties-container {
+ uses table-features-properties-grouping;
+ }
+
+ grouping table-features-properties-grouping {
+ list table-feature-properties {
+ config false;
+ leaf type {
+ type oft:table-features-prop-type;
+ }
+ }
+ }
+
+ // # MESSAGE Structures
+ /* Immutable messages. */
+ grouping ofHeader {
+ reference "ofp_header struct in Openflow Switch 1.3 Spec";
+ leaf version {
+ type uint8;
+ description "OpenFlow version";
+ }
+ leaf xid {
+ type uint32;
+ description "Transaction ID";
+ }
+ }
+ grouping ofHelloElementHeader {
+ reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec";
+ leaf type {
+ type oft:hello-element-type;
+ //reference "OpenFlow Header element type - OFPHET_*";
+ }
+ }
+ grouping hello {
+ reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
+ /* Symmetric message */
+ uses ofHeader;
+
+ list elements {
+ uses ofHelloElementHeader;
+
+ leaf-list version-bitmap {
+ type boolean;
+ }
+ }
+ }
+ grouping error {
+ reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
+ /* Symmetric message */
+ uses ofHeader;
+
+ leaf type {
+ type uint16;
+ }
+ leaf code {
+ type uint16;
+ }
+ leaf type-string {
+ type string;
+ }
+ leaf code-string {
+ type string;
+ }
+ leaf data {
+ type binary;
+ }
+ }
+ grouping echo-request {
+ reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Symmetric message */
+ uses ofHeader;
+
+ leaf data {
+ type binary;
+ }
+ }
+ grouping echo-reply {
+ reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec";
+ /* Symmetric message */
+ uses ofHeader;
+
+ leaf data {
+ type binary;
+ }
+ }
+ grouping experimenter {
+ reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
+ /* Symmetric message */
+ uses ofHeader;
+
+ leaf experimenter {
+ type oft:experimenter-id;
+ }
+ leaf exp_type {
+ type uint32;
+ }
+ }
+ /* Switch configuration messages. */
+ grouping features-request {
+ reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+ uses ofHeader;
+ }
+ grouping features-reply {
+ reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+ uses ofHeader;
+
+ leaf datapathId {
+ type uint64;
+ }
+ leaf buffers {
+ type uint32;
+ }
+ leaf tables {
+ type uint8;
+ }
+ leaf auxiliaryId {
+ type uint8;
+ }
+ leaf capabilities {
+ type oft:capabilities;
+ }
+ leaf reserved {
+ type uint32;
+ }
+ // OF1.0 structures
+ leaf capabilities-v10 {
+ type oft:capabilities-v10;
+ }
+ leaf actions-v10 {
+ type oft:action-type-v10;
+ }
+ list phy-port {
+ uses port-grouping;
+ }
+ }
+ grouping get-config-request {
+ reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+ uses ofHeader;
+ }
+ grouping get-config-reply {
+ reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+ uses ofHeader;
+
+ leaf flags {
+ type oft:switch-config-flag;
+ }
+ leaf miss-send-len {
+ type uint16;
+ }
+ }
+ grouping set-config {
+ reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf flags {
+ type oft:switch-config-flag;
+ }
+ leaf miss-send-len {
+ type uint16;
+ }
+ }
+ /* Asynchronous messages. */
+ grouping packet-in {
+ reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";
+ /* Async message */
+
+ uses ofHeader;
+
+ leaf buffer-id {
+ // ID assigned by datapath.
+ type uint32;
+ }
+ leaf total-len {
+ // Full length of frame.
+ type uint16;
+ }
+ leaf reason {
+ // Reason packet is being sent (one of OFPR_*)
+ type oft:packet-in-reason;
+ }
+ leaf table-id {
+ // ID of the table that was looked up
+ type oft:table-id;
+ }
+ leaf cookie {
+ // Cookie of the flow entry that was looked up.
+ type uint64;
+ }
+ uses oxm:match-grouping;
+
+ leaf data {
+ type binary;
+ }
+
+ // OF1.0 structures
+ leaf in-port {
+ type uint16;
+ }
+ }
+ grouping flow-removed {
+ reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";
+ /* Async message */
+ uses ofHeader;
+
+ leaf cookie {
+ type uint64;
+ }
+ leaf priority {
+ type uint16;
+ }
+ leaf reason {
+ type oft:flow-removed-reason;
+ }
+ leaf table-id {
+ type oft:table-id;
+ }
+ leaf duration-sec {
+ type uint32;
+ }
+ leaf duration-nsec {
+ type uint32;
+ }
+ leaf idle-timeout {
+ type uint16;
+ }
+ leaf hard-timeout {
+ type uint16;
+ }
+ leaf packet-count {
+ type uint64;
+ }
+ leaf byte-count {
+ type uint64;
+ }
+ uses oxm:match-grouping;
+
+ // OF1.0 structures
+ uses oxm:match-v10-grouping;
+ }
+ grouping port-status {
+ reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";
+
+ uses ofHeader;
+
+ uses port-grouping;
+
+ leaf reason {
+ type oft:port-reason;
+ }
+ }
+ /* Controller command messages. */
+ grouping packet-out {
+ reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ uses ofaction:actions-grouping;
+
+ leaf data {
+ type binary;
+ }
+ leaf buffer-id {
+ type uint32;
+ }
+ leaf in-port {
+ type oft:port-number;
+ }
+ }
+ grouping flow-mod {
+ reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf cookie {
+ type uint64;
+ }
+ leaf cookie-mask {
+ type uint64;
+ }
+ leaf table-id {
+ type oft:table-id;
+ }
+ leaf command {
+ type oft:flow-mod-command;
+ }
+ leaf idle-timeout {
+ type uint16;
+ }
+ leaf hard-timeout {
+ type uint16;
+ }
+ leaf priority {
+ type uint16;
+ }
+ leaf buffer-id {
+ type uint32;
+ }
+ leaf out-port {
+ type oft:port-number;
+ }
+ leaf out-group {
+ type uint32;
+ }
+ leaf flags {
+ type oft:flow-mod-flags;
+ }
+ uses oxm:match-grouping;
+
+ uses ofinstruction:instructions-grouping;
+
+ // OF1.0 structures
+ leaf flags-v10 {
+ type oft:flow-mod-flags-v10;
+ }
+ uses oxm:match-v10-grouping;
+ uses ofaction:actions-grouping;
+ }
+ grouping group-mod {
+ reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf command {
+ type oft:group-mod-command;
+ }
+ leaf type {
+ type oft:group-type;
+ }
+ leaf group-id {
+ type oft:group-id;
+ }
+
+ uses buckets-grouping;
+ }
+
+ grouping port-mod {
+ reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf port-no {
+ type oft:port-number;
+ }
+ leaf hw-address {
+ type yang:mac-address;
+ }
+ leaf config {
+ type oft:port-config;
+ }
+ leaf mask {
+ type oft:port-config;
+ }
+ leaf advertise {
+ type oft:port-features;
+ }
+ // OF1.0 structures
+ leaf config-v10 {
+ type oft:port-config-v10;
+ }
+ leaf mask-v10 {
+ type oft:port-config-v10;
+ }
+ leaf advertise-v10 {
+ type oft:port-features-v10;
+ }
+ }
+ grouping table-mod {
+ reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf table-id {
+ type oft:table-id;
+ }
+ leaf config {
+ type oft:table-config;
+ }
+ }
+
+ /* Multipart messages. */
+ grouping multipart-request {
+ reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf type {
+ type oft:multipart-type;
+ }
+ leaf flags {
+ type oft:multipart-request-flags;
+ }
+ choice multipart-request-body {
+ case multipart-request-desc-case {
+ container multipart-request-desc {
+ leaf empty {
+ type empty;
+ }
+ }
+ }
+ case multipart-request-flow-case {
+ container multipart-request-flow {
+ leaf table-id {
+ type uint8;
+ }
+ leaf out-port {
+ type uint32;
+ }
+ leaf out-group {
+ type uint32;
+ }
+ leaf cookie {
+ type uint64;
+ }
+ leaf cookie-mask {
+ type uint64;
+ }
+ uses oxm:match-grouping;
+
+ // OF1.0 structures
+ uses oxm:match-v10-grouping;
+ }
+ }
+ case multipart-request-aggregate-case {
+ container multipart-request-aggregate {
+ leaf table-id {
+ type uint8;
+ }
+ leaf out-port {
+ type uint32;
+ }
+ leaf out-group {
+ type uint32;
+ }
+ leaf cookie {
+ type uint64;
+ }
+ leaf cookie-mask {
+ type uint64;
+ }
+ uses oxm:match-grouping;
+
+ // OF1.0 structures
+ uses oxm:match-v10-grouping;
+ }
+ }
+ case multipart-request-table-case {
+ container multipart-request-table {
+ leaf empty {
+ type empty;
+ }
+ }
+ }
+ case multipart-request-port-stats-case {
+ container multipart-request-port-stats {
+ leaf port-no {
+ type uint32;
+ }
+ }
+ }
+ case multipart-request-queue-case {
+ container multipart-request-queue {
+ leaf port-no {
+ type uint32;
+ }
+ leaf queue-id {
+ type uint32;
+ }
+ }
+ }
+ case multipart-request-group-case {
+ container multipart-request-group {
+ leaf group-id {
+ type oft:group-id;
+ }
+ }
+ }
+ case multipart-request-group-desc-case {
+ container multipart-request-group-desc {
+ leaf empty {
+ type empty;
+ }
+ }
+ }
+ case multipart-request-group-features-case {
+ container multipart-request-group-features {
+ leaf empty {
+ type empty;
+ }
+ }
+ }
+ case multipart-request-meter-case {
+ container multipart-request-meter {
+ leaf meter-id {
+ type oft:meter-id;
+ }
+ }
+ }
+ case multipart-request-meter-config-case {
+ container multipart-request-meter-config {
+ leaf meter-id {
+ type oft:meter-id;
+ }
+ }
+ }
+ case multipart-request-meter-features-case {
+ container multipart-request-meter-features {
+ leaf empty {
+ type empty;
+ }
+ }
+ }
+ case multipart-request-table-features-case {
+ container multipart-request-table-features {
+ list table-features {
+ leaf table-id {
+ type uint8;
+ }
+ leaf name {
+ type string;
+ }
+ leaf metadata-match {
+ type uint64;
+ }
+ leaf metadata-write {
+ type uint64;
+ }
+ leaf config {
+ type oft:table-config;
+ }
+ leaf max-entries {
+ type uint32;
+ }
+ uses table-features-properties-grouping;
+ }
+ }
+ }
+ case multipart-request-port-desc-case {
+ container multipart-request-port-desc {
+ leaf empty {
+ type empty;
+ }
+ }
+ }
+ case multipart-request-experimenter-case {
+ container multipart-request-experimenter {
+ // empty body - used for experimenter augmentation
+ }
+ }
+ }
+ }
+ grouping multipart-reply {
+ reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf type {
+ type oft:multipart-type;
+ }
+ leaf flags {
+ type oft:multipart-request-flags;
+ }
+ choice multipart-reply-body {
+ case multipart-reply-desc-case {
+ container multipart-reply-desc {
+ leaf mfr_desc {
+ type string;
+ }
+ leaf hw_desc {
+ type string;
+ }
+ leaf sw_desc {
+ type string;
+ }
+ leaf serial_num {
+ type string;
+ }
+ leaf dp_desc {
+ type string;
+ }
+ }
+ }
+ case multipart-reply-flow-case {
+ container multipart-reply-flow {
+ list flow-stats {
+ leaf table-id {
+ type uint8;
+ }
+ leaf duration-sec {
+ type uint32;
+ }
+ leaf duration-nsec {
+ type uint32;
+ }
+ leaf priority {
+ type uint16;
+ }
+ leaf idle-timeout {
+ type uint16;
+ }
+ leaf hard-timeout {
+ type uint16;
+ }
+ leaf flags {
+ type oft:flow-mod-flags;
+ }
+ leaf cookie {
+ type uint64;
+ }
+ leaf packet-count {
+ type uint64;
+ }
+ leaf byte-count {
+ type uint64;
+ }
+ uses oxm:match-grouping;
+
+ uses ofinstruction:instructions-grouping;
+
+ // OF1.0 structures
+ uses oxm:match-v10-grouping;
+ uses ofaction:actions-grouping;
+ }
+ }
+ }
+ case multipart-reply-aggregate-case {
+ container multipart-reply-aggregate {
+ leaf packet-count {
+ type uint64;
+ }
+ leaf byte-count {
+ type uint64;
+ }
+ leaf flow-count {
+ type uint32;
+ }
+ }
+ }
+ case multipart-reply-table-case {
+ container multipart-reply-table {
+ list table-stats {
+ leaf table-id {
+ type uint8;
+ }
+ leaf active-count {
+ type uint32;
+ }
+ leaf lookup-count {
+ type uint64;
+ }
+ leaf matched-count {
+ type uint64;
+ }
+
+ // OF1.0 structures
+ leaf name {
+ type string;
+ }
+ leaf wildcards {
+ type oft:flow-wildcards-v10;
+ }
+ leaf nw-src-mask {
+ type uint8;
+ }
+ leaf nw-dst-mask {
+ type uint8;
+ }
+ leaf max-entries {
+ type uint32;
+ }
+ }
+ }
+ }
+ case multipart-reply-port-stats-case {
+ container multipart-reply-port-stats {
+ list port-stats {
+ leaf port-no {
+ type uint32;
+ }
+ leaf rx-packets {
+ type uint64;
+ }
+ leaf tx-packets {
+ type uint64;
+ }
+ leaf rx-bytes {
+ type uint64;
+ }
+ leaf tx-bytes {
+ type uint64;
+ }
+ leaf rx-dropped {
+ type uint64;
+ }
+ leaf tx-dropped {
+ type uint64;
+ }
+ leaf rx-errors {
+ type uint64;
+ }
+ leaf tx-errors {
+ type uint64;
+ }
+ leaf rx-frame-err {
+ type uint64;
+ }
+ leaf rx-over-err {
+ type uint64;
+ }
+ leaf rx-crc-err {
+ type uint64;
+ }
+ leaf collisions {
+ type uint64;
+ }
+ leaf duration-sec {
+ type uint32;
+ }
+ leaf duration-nsec {
+ type uint32;
+ }
+ }
+ }
+ }
+ case multipart-reply-queue-case {
+ container multipart-reply-queue {
+ list queue-stats {
+ leaf port-no {
+ type uint32;
+ }
+ leaf queue-id {
+ type uint32;
+ }
+ leaf tx-bytes {
+ type uint64;
+ }
+ leaf tx-packets {
+ type uint64;
+ }
+ leaf tx-errors {
+ type uint64;
+ }
+ leaf duration-sec {
+ type uint32;
+ }
+ leaf duration-nsec {
+ type uint32;
+ }
+ }
+ }
+ }
+ case multipart-reply-group-case {
+ container multipart-reply-group {
+ list group-stats {
+ leaf group-id {
+ type oft:group-id;
+ }
+ leaf ref-count {
+ type uint32;
+ }
+ leaf packet-count {
+ type uint64;
+ }
+ leaf byte-count {
+ type uint64;
+ }
+ leaf duration-sec {
+ type uint32;
+ }
+ leaf duration-nsec {
+ type uint32;
+ }
+ list bucket-stats {
+ leaf packet-count {
+ type uint64;
+ }
+ leaf byte-count {
+ type uint64;
+ }
+ }
+ }
+ }
+ }
+ case multipart-reply-group-desc-case {
+ container multipart-reply-group-desc {
+ list group-desc {
+ leaf type {
+ type oft:group-type;
+ }
+ leaf group-id {
+ type oft:group-id;
+ }
+ uses buckets-grouping;
+ }
+ }
+ }
+ case multipart-reply-group-features-case {
+ container multipart-reply-group-features {
+ leaf types {
+ type oft:group-types;
+ }
+ leaf capabilities {
+ type oft:group-capabilities;
+ }
+ leaf-list max_groups {
+ type uint32;
+ }
+ leaf-list actions-bitmap {
+ type oft:action-type;
+ }
+ }
+ }
+ case multipart-reply-meter-case {
+ container multipart-reply-meter {
+ list meter-stats {
+ leaf meter-id {
+ type oft:meter-id;
+ }
+ leaf flow-count {
+ type uint32;
+ }
+ leaf packet-in-count {
+ type uint64;
+ }
+ leaf byte-in-count {
+ type uint64;
+ }
+ leaf duration-sec {
+ type uint32;
+ }
+ leaf duration-nsec {
+ type uint32;
+ }
+ list meter-band-stats {
+ leaf packet-band-count {
+ type uint64;
+ }
+ leaf byte-band-count {
+ type uint64;
+ }
+ }
+ }
+ }
+ }
+ case multipart-reply-meter-config-case {
+ container multipart-reply-meter-config {
+ list meter-config {
+ leaf flags {
+ type oft:meter-flags;
+ }
+ leaf meter-id {
+ type oft:meter-id;
+ }
+ list bands {
+ uses meter-band-header;
+ }
+ }
+ }
+ }
+ case multipart-reply-meter-features-case {
+ container multipart-reply-meter-features {
+ leaf max-meter {
+ type uint32;
+ }
+ leaf band-types {
+ type oft:meter-band-type-bitmap;
+ }
+ leaf capabilities {
+ type oft:meter-flags;
+ }
+ leaf max-bands {
+ type uint8;
+ }
+ leaf max-color {
+ type uint8;
+ }
+ }
+ }
+ case multipart-reply-table-features-case {
+ container multipart-reply-table-features {
+ list table-features {
+ leaf table-id {
+ type uint8;
+ }
+ leaf name {
+ type string;
+ }
+ leaf metadata-match {
+ type binary;
+ }
+ leaf metadata-write {
+ type binary;
+ }
+ leaf config {
+ type oft:table-config;
+ }
+ leaf max-entries {
+ type uint32;
+ }
+ uses table-features-properties-grouping;
+ }
+ }
+ }
+ case multipart-reply-port-desc-case {
+ container multipart-reply-port-desc {
+ list ports {
+ uses port-grouping;
+ }
+ }
+ }
+ case multipart-reply-experimenter-case {
+ container multipart-reply-experimenter {
+ // empty body - used for experimenter augmentation
+ }
+ }
+ }
+ }
+ /* Barrier messages. */
+ grouping barrier-request {
+ reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+ uses ofHeader;
+ }
+ grouping barrier-reply {
+ reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+ uses ofHeader;
+ }
+ /* Queue Configuration messages. */
+ grouping queue-get-config-request {
+ reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf port {
+ type oft:port-number;
+ }
+ }
+ grouping queue-get-config-reply {
+ reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf port {
+ type oft:port-number;
+ }
+ list queues {
+ uses packet-queue;
+ }
+ }
+ grouping packet-queue {
+ leaf queue-id {
+ type oft:queue-id;
+ }
+ leaf port {
+ type oft:port-number;
+ }
+ uses queue-property-header;
+ }
+ container queue-prop-container {
+ uses queue-property-header;
+ }
+ grouping queue-property-header {
+ list queue-property {
+ config false;
+ leaf property {
+ type oft:queue-properties;
+ }
+ }
+ }
+ /* Controller role change request messages. */
+ grouping role-request {
+ reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf role {
+ type oft:controller-role;
+ }
+ leaf generation-id {
+ type uint64;
+ }
+ }
+ grouping role-reply {
+ reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf role {
+ type oft:controller-role;
+ }
+ leaf generation-id {
+ type uint64;
+ }
+ }
+ /* Asynchronous message configuration. */
+ grouping get-async-request {
+ reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+ }
+ grouping get-async-reply {
+ reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+ uses async-body-grouping;
+ }
+ grouping set-async {
+ reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+ uses async-body-grouping;
+ }
+
+ grouping async-body-grouping {
+ list packet-in-mask {
+ leaf-list mask {
+ type oft:packet-in-reason;
+ }
+ }
+ list port-status-mask {
+ leaf-list mask {
+ type oft:port-reason;
+ }
+ }
+ list flow-removed-mask {
+ leaf-list mask {
+ type oft:flow-removed-reason;
+ }
+ }
+ }
+ /* Meters and rate limiters configuration messages. */
+ grouping meter-mod {
+ reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";
+ /* Controller/switch message */
+
+ uses ofHeader;
+
+ leaf command {
+ type oft:meter-mod-command;
+ }
+ leaf flags {
+ type oft:meter-flags;
+ }
+ leaf meter-id {
+ type oft:meter-id;
+ }
+ list bands {
+ uses meter-band-header;
+ }
+ }
+
+ container meter-band-container {
+ uses meter-band-header;
+ }
+ grouping meter-band-header {
+ choice meter-band {
+ case meter-band-drop-case {
+ container meter-band-drop {
+ uses meter-band-commons;
+ }
+ }
+ case meter-band-dscp-remark-case {
+ container meter-band-dscp-remark {
+ uses meter-band-commons;
+ leaf prec-level {
+ type uint8;
+ }
+ }
+ }
+ case meter-band-experimenter-case {
+ container meter-band-experimenter {
+ uses meter-band-commons;
+ }
+ }
+ }
+ }
+
+ grouping meter-band-commons {
+ leaf type {
+ type oft:meter-band-type;
+ }
+ leaf rate {
+ type uint32;
+ }
+ leaf burst-size {
+ type uint32;
+ }
+ }
+
+ /* Immutable messages. */
+ notification hello-message {
+ uses hello;
+ reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
+
+ /* Symmetric message */
+ }
+ notification error-message {
+ uses error;
+ reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
+
+ /* Symmetric message */
+ }
+ notification echo-request-message {
+ uses echo-request;
+ reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
+
+ /* Symmetric message */
+ }
+ notification experimenter-message {
+ uses experimenter;
+ reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
+ // TODO:: does switch send this when understood experimenter msg from lib?
+ /* Symmetric message */
+ }
+ // # Notification and RPCs
+ /* Symmetric RPC. */
+ rpc echo {
+ input {
+ uses echo-request;
+ }
+ /* Controller/switch message */
+ output {
+ uses echo-reply;
+ }
+ }
+
+ rpc echo-reply {
+ input {
+ uses echo-reply;
+ }
+ }
+
+ rpc hello {
+ input {
+ uses hello;
+ }
+ }
+
+ rpc experimenter {
+ input {
+ uses experimenter;
+ }
+ }
+
+ /* Switch configuration messages. */
+ rpc get-features {
+ input {
+ uses features-request;
+ }
+ /* Controller/switch message */
+ output {
+ uses features-reply;
+ }
+ }
+
+ rpc get-config {
+ input {
+ uses get-config-request;
+ }
+ output {
+ uses get-config-reply;
+ }
+ /* Controller/switch message */
+ }
+
+ rpc set-config {
+ input {
+ uses set-config;
+ }
+ /* Controller/switch message */
+ }
+ /* Asynchronous messages. */
+ notification packet-in-message {
+ uses packet-in;
+
+ /* Async message */
+ }
+ notification flow-removed-message {
+ uses flow-removed;
+
+ /* Async message */
+ }
+ notification port-status-message {
+ uses port-status;
+
+ } /* Async message */
+
+ /* Controller command messages. */
+ rpc packet-out {
+ input {
+ uses packet-out;
+ }
+ /* Controller/switch message */
+ }
+ rpc flow-mod {
+ input {
+ uses flow-mod;
+ }
+ /* Controller/switch message */
+ }
+ rpc group-mod {
+ input {
+ uses group-mod;
+ }
+ /* Controller/switch message */
+ }
+ rpc port-mod {
+ input {
+ uses port-mod;
+ }
+ } /* Controller/switch message */
+
+ rpc table-mod {
+ input {
+ uses table-mod;
+ }
+ } /* Controller/switch message */
+
+ /* Multipart messages. */
+
+ rpc multipart-request {
+ input {
+ uses multipart-request;
+ }
+ }
+
+ /* Controller/switch message */
+ notification multipart-reply-message {
+ uses multipart-reply;
+ // notification because of multiple following responses
+ } /* Controller/switch message */
+
+
+ /* Barrier messages. */
+ rpc barrier {
+ input {
+ uses barrier-request;
+ }
+ output {
+ uses barrier-reply;
+ }
+ }
+ /* Queue Configuration messages. */
+ rpc get-queue-config {
+ input {
+ uses queue-get-config-request;
+ }
+ output {
+ uses queue-get-config-reply;
+ }
+ }
+
+ /* Controller role change request messages. */
+ rpc role-request {
+ input {
+ uses role-request;
+ }
+ output {
+ uses role-reply;
+ }
+ } /* Controller/switch message */
+
+ /* Asynchronous message configuration. */
+ rpc get-async {
+ input {
+ uses get-async-request;
+ }
+ output {
+ uses get-async-reply;
+ }
+ }
+ /* Controller/switch message */
+ rpc set-async {
+ input {
+ uses set-async;
+ }
+
+ }
+ /* Meters and rate limiters configuration messages. */
+ rpc meter-mod {
+ input {
+ uses meter-mod;
+ }
+ } /* Controller/switch message */
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.connection;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TlsConfigurationImplTest {\r
-\r
- /**\r
- * Test correct TlsConfigurationImpl creation\r
- */\r
- @Test\r
- public void test() {\r
- TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,\r
- "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH);\r
- assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());\r
- assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());\r
- assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());\r
- assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());\r
- assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());\r
- assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());\r
- assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());\r
- assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());\r
- assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());\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.openflowjava.protocol.api.connection;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TlsConfigurationImplTest {
+
+ /**
+ * Test correct TlsConfigurationImpl creation
+ */
+ @Test
+ public void test() {
+ TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,
+ "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH);
+ assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
+ assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());
+ assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());
+ assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());
+ assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());
+ assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());
+ assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());
+ assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());
+ assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.extensibility;\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.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class EnhancedMessageCodeKeyTest {\r
-\r
- /**\r
- * Test EnhancedMessageCodeKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- EnhancedMessageCodeKey key1 =\r
- new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
- EnhancedMessageCodeKey key2 =\r
- new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, 8, BarrierInput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierOutput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, 8, BarrierInput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 16, BarrierInput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test EnhancedMessageTypeKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- EnhancedMessageCodeKey key1 =\r
- new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
- \r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
- }\r
-\r
- /**\r
- * Test EnhancedMessageCodeKey toString()\r
- */\r
- @Test\r
- public void testToString() {\r
- EnhancedMessageCodeKey key1 =\r
- new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.protocol.rev130731.BarrierInput msgType: 4 msgType2: 8", key1.toString());\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.openflowjava.protocol.api.extensibility;
+
+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.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class EnhancedMessageCodeKeyTest {
+
+ /**
+ * Test EnhancedMessageCodeKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ EnhancedMessageCodeKey key1 =
+ new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+ EnhancedMessageCodeKey key2 =
+ new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, 8, BarrierInput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierOutput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, 8, BarrierInput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 16, BarrierInput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test EnhancedMessageTypeKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ EnhancedMessageCodeKey key1 =
+ new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+ }
+
+ /**
+ * Test EnhancedMessageCodeKey toString()
+ */
+ @Test
+ public void testToString() {
+ EnhancedMessageCodeKey key1 =
+ new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.protocol.rev130731.BarrierInput msgType: 4 msgType2: 8", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.extensibility;\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.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class EnhancedMessageTypeKeyTest {\r
-\r
- /**\r
- * Test EnhancedMessageTypeKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- EnhancedMessageTypeKey<?,?> key1 =\r
- new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
- EnhancedMessageTypeKey<?,?> key2 =\r
- new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, Output.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null, Output.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Instruction.class, Output.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, SetField.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test EnhancedMessageTypeKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- EnhancedMessageTypeKey<?,?> key1;\r
- EnhancedMessageTypeKey<?,?> key2;\r
- key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
- \r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
- \r
- key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, null);\r
- Assert.assertFalse("Wrong equal by msgType2.", key1.equals(key2));\r
- key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
- key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, SetField.class);\r
- Assert.assertFalse("Wrong equal by msgType2 class name.", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test EnhancedMessageTypeKey toString()\r
- */\r
- @Test\r
- public void testToString() {\r
- EnhancedMessageTypeKey<?,?> key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,\r
- Action.class, Output.class);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.actions.grouping.Action msgType2: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.common.action.rev130731.Output", key1.toString());\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.openflowjava.protocol.api.extensibility;
+
+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.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class EnhancedMessageTypeKeyTest {
+
+ /**
+ * Test EnhancedMessageTypeKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ EnhancedMessageTypeKey<?,?> key1 =
+ new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+ EnhancedMessageTypeKey<?,?> key2 =
+ new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, Output.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null, Output.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Instruction.class, Output.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, SetField.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test EnhancedMessageTypeKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ EnhancedMessageTypeKey<?,?> key1;
+ EnhancedMessageTypeKey<?,?> key2;
+ key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+ key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, null);
+ Assert.assertFalse("Wrong equal by msgType2.", key1.equals(key2));
+ key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, SetField.class);
+ Assert.assertFalse("Wrong equal by msgType2 class name.", key1.equals(key2));
+ }
+
+ /**
+ * Test EnhancedMessageTypeKey toString()
+ */
+ @Test
+ public void testToString() {
+ EnhancedMessageTypeKey<?,?> key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,
+ Action.class, Output.class);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.actions.grouping.Action msgType2: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.common.action.rev130731.Output", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.extensibility;\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.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MessageCodeKeyTest {\r
-\r
- /**\r
- * Test MessageCodeKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- MessageCodeKey key1 =\r
- new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
- MessageCodeKey key2 =\r
- new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, BarrierInput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierOutput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, BarrierInput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
-\r
- /**\r
- * Test MessageCodeKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to null.", key1.equals(null));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-\r
- key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
- MessageCodeKey key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
- Assert.assertFalse("Wrong equal by clazz.", key1.equals(key2));\r
-\r
- key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
- Assert.assertTrue("Wrong equal by clazz.", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test MessageCodeKey toString()\r
- */\r
- @Test\r
- public void testToString() {\r
- MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.protocol.rev130731.BarrierInput msgType: 4", key1.toString());\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.openflowjava.protocol.api.extensibility;
+
+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.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MessageCodeKeyTest {
+
+ /**
+ * Test MessageCodeKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ MessageCodeKey key1 =
+ new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+ MessageCodeKey key2 =
+ new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, BarrierInput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierOutput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, BarrierInput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test MessageCodeKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to null.", key1.equals(null));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+ key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);
+ MessageCodeKey key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+ Assert.assertFalse("Wrong equal by clazz.", key1.equals(key2));
+
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);
+ Assert.assertTrue("Wrong equal by clazz.", key1.equals(key2));
+ }
+
+ /**
+ * Test MessageCodeKey toString()
+ */
+ @Test
+ public void testToString() {
+ MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.protocol.rev130731.BarrierInput msgType: 4", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.extensibility;\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.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MessageTypeKeyTest {\r
-\r
- /**\r
- * Test MessageTypeKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- MessageTypeKey<?> key1 =\r
- new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
- MessageTypeKey<?> key2 =\r
- new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, BarrierInput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierOutput.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
-\r
- /**\r
- * Test MessageTypeKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- MessageTypeKey<?> key1;\r
- MessageTypeKey<?> key2; \r
- key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to null.", key1.equals(null));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-\r
- key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
- key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
- Assert.assertFalse("Wrong equal by msgType.", key1.equals(key2));\r
-\r
- key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
- Assert.assertTrue("Wrong equal by msgType.", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test MessageTypeKey toString()\r
- */\r
- @Test\r
- public void testToString() {\r
- MessageTypeKey<?> key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.protocol.rev130731.BarrierInput", key1.toString());\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.openflowjava.protocol.api.extensibility;
+
+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.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MessageTypeKeyTest {
+
+ /**
+ * Test MessageTypeKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ MessageTypeKey<?> key1 =
+ new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+ MessageTypeKey<?> key2 =
+ new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, BarrierInput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierOutput.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test MessageTypeKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ MessageTypeKey<?> key1;
+ MessageTypeKey<?> key2;
+ key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to null.", key1.equals(null));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+ key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
+ key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+ Assert.assertFalse("Wrong equal by msgType.", key1.equals(key2));
+
+ key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
+ Assert.assertTrue("Wrong equal by msgType.", key1.equals(key2));
+ }
+
+ /**
+ * Test MessageTypeKey toString()
+ */
+ @Test
+ public void testToString() {
+ MessageTypeKey<?> key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.protocol.rev130731.BarrierInput", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionDeserializerKeyTest {\r
-\r
- /**\r
- * Test ActionDeserializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
- ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test ActionDeserializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals(){\r
- ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
- ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
-\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
- Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
- key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
- Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test InstructionDeserializerKey toString()\r
- */\r
- @Test\r
- public void testToString(){\r
- ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.common.action.rev130731.actions.grouping.Action msgType: 11"\r
- + " experimenterID: null", key1.toString());\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.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionDeserializerKeyTest {
+
+ /**
+ * Test ActionDeserializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+ ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test ActionDeserializerKey equals - additional test
+ */
+ @Test
+ public void testEquals(){
+ ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+ ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+ Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+ Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+ }
+
+ /**
+ * Test InstructionDeserializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.common.action.rev130731.actions.grouping.Action msgType: 11"
+ + " experimenterID: null", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\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.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionSerializerKeyTest {\r
-\r
- /**\r
- * Test ActionSerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ActionSerializerKey<CopyTtlIn> key1 =\r
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
- ActionSerializerKey<?> key2 =\r
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOut.class, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlIn.class, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test ActionSerializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals(){\r
- ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
- ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
- \r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));\r
- \r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
- Assert.assertTrue("Wrong equal by action type", key1.equals(key2));\r
- key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
- Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
- Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test ActionSerializerKey toString()\r
- */\r
- @Test\r
- public void testToString(){\r
- ActionSerializerKey<CopyTtlIn> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.actions.grouping.Action action type: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.common.action.rev130731.CopyTtlIn experimenterID: 42", key1.toString());\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.openflowjava.protocol.api.keys;
+
+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.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionSerializerKeyTest {
+
+ /**
+ * Test ActionSerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ActionSerializerKey<CopyTtlIn> key1 =
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+ ActionSerializerKey<?> key2 =
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOut.class, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlIn.class, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test ActionSerializerKey equals - additional test
+ */
+ @Test
+ public void testEquals(){
+ ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));
+
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ Assert.assertTrue("Wrong equal by action type", key1.equals(key2));
+ key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+ Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+ Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+ }
+
+ /**
+ * Test ActionSerializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ ActionSerializerKey<CopyTtlIn> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.actions.grouping.Action action type: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.common.action.rev130731.CopyTtlIn experimenterID: 42", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionDeserializerKeyTest {\r
-\r
- /**\r
- * Test InstructionDeserializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
- InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test InstructionDeserializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals(){\r
- InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
- InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 24L);\r
-\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
- Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
- key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
- Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test InstructionDeserializerKey toString()\r
- */\r
- @Test\r
- public void testToString(){\r
- InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction msgType: 11"\r
- + " experimenterID: null", key1.toString());\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.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionDeserializerKeyTest {
+
+ /**
+ * Test InstructionDeserializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+ InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test InstructionDeserializerKey equals - additional test
+ */
+ @Test
+ public void testEquals(){
+ InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+ InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 24L);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+ Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+ Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+ }
+
+ /**
+ * Test InstructionDeserializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction msgType: 11"
+ + " experimenterID: null", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\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.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionSerializerKeyTest {\r
-\r
- /**\r
- * Test InstructionSerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- InstructionSerializerKey<?> key1 =\r
- new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
- InstructionSerializerKey<?> key2 =\r
- new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, WriteActions.class, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ApplyActions.class, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test InstructionSerializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals(){\r
- InstructionSerializerKey<?> key1 =\r
- new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
- InstructionSerializerKey<?> key2 =\r
- new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-\r
- key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);\r
- Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));\r
-\r
- key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
- key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
- Assert.assertTrue("Wrong equal by instructionType.", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test InstructionSerializerKey toString()\r
- */\r
- @Test\r
- public void testToString(){\r
- InstructionSerializerKey<?> key1 =\r
- new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction"\r
- + " instructionType type: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
- + ".instruction.rev130731.ApplyActions vendorID: 42", key1.toString());\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.openflowjava.protocol.api.keys;
+
+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.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionSerializerKeyTest {
+
+ /**
+ * Test InstructionSerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ InstructionSerializerKey<?> key1 =
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+ InstructionSerializerKey<?> key2 =
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, WriteActions.class, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ApplyActions.class, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test InstructionSerializerKey equals - additional test
+ */
+ @Test
+ public void testEquals(){
+ InstructionSerializerKey<?> key1 =
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+ InstructionSerializerKey<?> key2 =
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+ key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);
+ Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+
+ key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ Assert.assertTrue("Wrong equal by instructionType.", key1.equals(key2));
+ }
+
+ /**
+ * Test InstructionSerializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ InstructionSerializerKey<?> key1 =
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction"
+ + " instructionType type: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+ + ".instruction.rev130731.ApplyActions vendorID: 42", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchEntryDeserializerKeyTest {\r
-\r
- /**\r
- * Test MatchEntryDeserializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
- MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 0);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
- key2.setExperimenterId(158L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
- key2.setExperimenterId(158L);\r
- key1.setExperimenterId(158L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test MatchEntryDeserializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
- MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
- \r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
- \r
- Long expId1=123456L;\r
- Long expId2=654321L;\r
- key1.setExperimenterId(null);\r
- key2.setExperimenterId(expId2);\r
- Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));\r
- \r
- key1.setExperimenterId(expId1);\r
- Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));\r
- Assert.assertFalse("Wrong equals with different object class", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test MatchEntryDeserializerKey toString()\r
- */\r
- @Test\r
- public void testToString(){\r
- MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries msgType: 32768 oxm_field: 42"\r
- + " experimenterID: null", key1.toString());\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.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchEntryDeserializerKeyTest {
+
+ /**
+ * Test MatchEntryDeserializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+ MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 0);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
+ key2.setExperimenterId(158L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+ key2.setExperimenterId(158L);
+ key1.setExperimenterId(158L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test MatchEntryDeserializerKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+ MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+ Long expId1=123456L;
+ Long expId2=654321L;
+ key1.setExperimenterId(null);
+ key2.setExperimenterId(expId2);
+ Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));
+
+ key1.setExperimenterId(expId1);
+ Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));
+ Assert.assertFalse("Wrong equals with different object class", key1.equals(key2));
+ }
+
+ /**
+ * Test MatchEntryDeserializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries msgType: 32768 oxm_field: 42"
+ + " experimenterID: null", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys;\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.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchEntrySerializerKeyTest {\r
-\r
- /**\r
- * Test MatchEntrySerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>\r
- (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
- MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>\r
- (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- OpenflowBasicClass.class, InPhyPort.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- Nxm0Class.class, InPort.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- OpenflowBasicClass.class, InPhyPort.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- OpenflowBasicClass.class, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- null, InPhyPort.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2.setExperimenterId(42L);\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test MatchEntrySerializerKey equals - additional test \r
- */\r
- @Test\r
- public void testEquals(){\r
- MatchEntrySerializerKey<?, ?> key1;\r
- MatchEntrySerializerKey<?, ?> key2;\r
- key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
- \r
- Long expId1 = 987654331L;\r
- Long expId2 = 123456789L;\r
- \r
- key1.setExperimenterId(null);\r
- key2.setExperimenterId(expId2);\r
- Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
- key1.setExperimenterId(expId1);\r
- Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
- key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);\r
- key1.setExperimenterId(expId2);\r
- Assert.assertFalse("Wrong equal by oxmClass", key1.equals(key2));\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);\r
- key2.setExperimenterId(expId2);\r
- Assert.assertTrue("Wrong equal by oxmClass", key1.equals(key2));\r
- key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);\r
- key1.setExperimenterId(expId2);\r
- Assert.assertFalse("Wrong equal by oxmField", key1.equals(key2));\r
- key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);\r
- key2.setExperimenterId(expId2);\r
- Assert.assertTrue("Wrong equal by oxmField", key1.equals(key2));\r
- }\r
-\r
- /**\r
- * Test MatchEntrySerializerKey toString()\r
- */\r
- @Test\r
- public void testToString(){\r
- MatchEntrySerializerKey<?, ?> key1;\r
- key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
-\r
- Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries oxm_class: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.oxm.rev130731.OpenflowBasicClass oxm_field: org.opendaylight.yang.gen.v1.urn"\r
- + ".opendaylight.openflow.oxm.rev130731.InPort experimenterID: null", key1.toString());\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.openflowjava.protocol.api.keys;
+
+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.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchEntrySerializerKeyTest {
+
+ /**
+ * Test MatchEntrySerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>
+ (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>
+ (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ OpenflowBasicClass.class, InPhyPort.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ Nxm0Class.class, InPort.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ OpenflowBasicClass.class, InPhyPort.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ OpenflowBasicClass.class, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ null, InPhyPort.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2.setExperimenterId(42L);
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test MatchEntrySerializerKey equals - additional test
+ */
+ @Test
+ public void testEquals(){
+ MatchEntrySerializerKey<?, ?> key1;
+ MatchEntrySerializerKey<?, ?> key2;
+ key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+ Long expId1 = 987654331L;
+ Long expId2 = 123456789L;
+
+ key1.setExperimenterId(null);
+ key2.setExperimenterId(expId2);
+ Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+ key1.setExperimenterId(expId1);
+ Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+ key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);
+ key1.setExperimenterId(expId2);
+ Assert.assertFalse("Wrong equal by oxmClass", key1.equals(key2));
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);
+ key2.setExperimenterId(expId2);
+ Assert.assertTrue("Wrong equal by oxmClass", key1.equals(key2));
+ key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);
+ key1.setExperimenterId(expId2);
+ Assert.assertFalse("Wrong equal by oxmField", key1.equals(key2));
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);
+ key2.setExperimenterId(expId2);
+ Assert.assertTrue("Wrong equal by oxmField", key1.equals(key2));
+ }
+
+ /**
+ * Test MatchEntrySerializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ MatchEntrySerializerKey<?, ?> key1;
+ key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries oxm_class: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.oxm.rev130731.OpenflowBasicClass oxm_field: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.oxm.rev130731.InPort experimenterID: null", key1.toString());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterActionDeserializerKeyTest {\r
-\r
- /**\r
- * Test ExperimenterActionDeserializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterActionDeserializerKey key1 =\r
- new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- ExperimenterActionDeserializerKey key2 =\r
- new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterActionDeserializerKeyTest {
+
+ /**
+ * Test ExperimenterActionDeserializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ExperimenterActionDeserializerKey key1 =
+ new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ ExperimenterActionDeserializerKey key2 =
+ new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\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.common.action.rev130731.ExperimenterActionSubType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterActionSerializerKeyTest {\r
-\r
-\r
- /**\r
- * Test ExperimenterActionSerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterActionSerializerKey key1 =\r
- new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
- ExperimenterActionSerializerKey key2 =\r
- new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
-\r
- @Test\r
- public void testEquals() {\r
- ExperimenterActionSerializerKey key1;\r
- ExperimenterActionSerializerKey key2;\r
- key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);\r
- Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));\r
- key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
- Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));\r
- }\r
-\r
- \r
- private static class TestSubType extends ExperimenterActionSubType {\r
- // empty class - only used in test for comparation\r
- }\r
-\r
- private static class TestSubType2 extends ExperimenterActionSubType {\r
- // empty class - only used in test for comparation\r
- }\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.openflowjava.protocol.api.keys.experimenter;
+
+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.common.action.rev130731.ExperimenterActionSubType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterActionSerializerKeyTest {
+
+
+ /**
+ * Test ExperimenterActionSerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ExperimenterActionSerializerKey key1 =
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ ExperimenterActionSerializerKey key2 =
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ @Test
+ public void testEquals() {
+ ExperimenterActionSerializerKey key1;
+ ExperimenterActionSerializerKey key2;
+ key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);
+ Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
+ key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
+ }
+
+
+ private static class TestSubType extends ExperimenterActionSubType {
+ // empty class - only used in test for comparation
+ }
+
+ private static class TestSubType2 extends ExperimenterActionSubType {
+ // empty class - only used in test for comparation
+ }
+
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterIdDeserializerKeyTest {\r
-\r
- /**\r
- * Test ExperimenterIdDeserializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterIdDeserializerKey key1 =\r
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
- ExperimenterIdDeserializerKey key2 =\r
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
-\r
- /**\r
- * Test ExperimenterIdDeserializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- ExperimenterIdDeserializerKey key1 =\r
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));\r
- ExperimenterIdDeserializerKey key2 =\r
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterIdDeserializerKeyTest {
+
+ /**
+ * Test ExperimenterIdDeserializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ExperimenterIdDeserializerKey key1 =
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ ExperimenterIdDeserializerKey key2 =
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test ExperimenterIdDeserializerKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ ExperimenterIdDeserializerKey key1 =
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
+ ExperimenterIdDeserializerKey key2 =
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+ }
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterIdSerializerKeyTest {\r
-\r
- /**\r
- * Test ExperimenterIdSerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterIdSerializerKey<?> key1 =\r
- new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
- ExperimenterIdSerializerKey<?> key2 =\r
- new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test ExperimenterIdSerializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals() {\r
- ExperimenterIdSerializerKey<?> key1 =\r
- new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- MessageTypeKey<?>mk = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));\r
- ExperimenterIdSerializerKey<?> key2 =\r
- new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
- Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterIdSerializerKeyTest {
+
+ /**
+ * Test ExperimenterIdSerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ExperimenterIdSerializerKey<?> key1 =
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ ExperimenterIdSerializerKey<?> key2 =
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test ExperimenterIdSerializerKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ ExperimenterIdSerializerKey<?> key1 =
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ MessageTypeKey<?>mk = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
+ ExperimenterIdSerializerKey<?> key2 =
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+ }
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterInstructionDeserializerKeyTest {\r
-\r
- /**\r
- * Test ExperimenterInstructionDeserializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterInstructionDeserializerKey key1 =\r
- new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- ExperimenterInstructionDeserializerKey key2 =\r
- new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterInstructionDeserializerKeyTest {
+
+ /**
+ * Test ExperimenterInstructionDeserializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ExperimenterInstructionDeserializerKey key1 =
+ new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ ExperimenterInstructionDeserializerKey key2 =
+ new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterInstructionSerializerKeyTest {\r
-\r
- /**\r
- * Test ExperimenterInstructionSerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterInstructionSerializerKey key1 =\r
- new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- ExperimenterInstructionSerializerKey key2 =\r
- new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
- key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\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.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterInstructionSerializerKeyTest {
+
+ /**
+ * Test ExperimenterInstructionSerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ExperimenterInstructionSerializerKey key1 =
+ new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ ExperimenterInstructionSerializerKey key2 =
+ new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ChannelInitializerFactory {\r
-\r
- private long switchIdleTimeOut;\r
- private DeserializationFactory deserializationFactory;\r
- private SerializationFactory serializationFactory;\r
- private TlsConfiguration tlsConfig;\r
- private SwitchConnectionHandler switchConnectionHandler;\r
- \r
- /**\r
- * @return PublishingChannelInitializer that initializes new channels\r
- */\r
- public TcpChannelInitializer createPublishingChannelInitializer() {\r
- TcpChannelInitializer initializer = new TcpChannelInitializer();\r
- initializer.setSwitchIdleTimeout(switchIdleTimeOut);\r
- initializer.setDeserializationFactory(deserializationFactory);\r
- initializer.setSerializationFactory(serializationFactory);\r
- initializer.setTlsConfiguration(tlsConfig);\r
- initializer.setSwitchConnectionHandler(switchConnectionHandler);\r
- return initializer;\r
- }\r
-\r
- /**\r
- * @return PublishingChannelInitializer that initializes new channels\r
- */\r
- public UdpChannelInitializer createUdpChannelInitializer() {\r
- UdpChannelInitializer initializer = new UdpChannelInitializer();\r
- initializer.setSwitchIdleTimeout(switchIdleTimeOut);\r
- initializer.setDeserializationFactory(deserializationFactory);\r
- initializer.setSerializationFactory(serializationFactory);\r
- initializer.setSwitchConnectionHandler(switchConnectionHandler);\r
- return initializer;\r
- }\r
-\r
- /**\r
- * @param switchIdleTimeOut\r
- */\r
- public void setSwitchIdleTimeout(long switchIdleTimeOut) {\r
- this.switchIdleTimeOut = switchIdleTimeOut;\r
- }\r
-\r
- /**\r
- * @param deserializationFactory\r
- */\r
- public void setDeserializationFactory(DeserializationFactory deserializationFactory) {\r
- this.deserializationFactory = deserializationFactory;\r
- }\r
-\r
- /**\r
- * @param serializationFactory\r
- */\r
- public void setSerializationFactory(SerializationFactory serializationFactory) {\r
- this.serializationFactory = serializationFactory;\r
- }\r
-\r
- /**\r
- * @param tlsConfig\r
- */\r
- public void setTlsConfig(TlsConfiguration tlsConfig) {\r
- this.tlsConfig = tlsConfig;\r
- }\r
-\r
- /**\r
- * @param switchConnectionHandler\r
- */\r
- public void setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler) {\r
- this.switchConnectionHandler = switchConnectionHandler;\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.openflowjava.protocol.impl.core;
+
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ChannelInitializerFactory {
+
+ private long switchIdleTimeOut;
+ private DeserializationFactory deserializationFactory;
+ private SerializationFactory serializationFactory;
+ private TlsConfiguration tlsConfig;
+ private SwitchConnectionHandler switchConnectionHandler;
+
+ /**
+ * @return PublishingChannelInitializer that initializes new channels
+ */
+ public TcpChannelInitializer createPublishingChannelInitializer() {
+ TcpChannelInitializer initializer = new TcpChannelInitializer();
+ initializer.setSwitchIdleTimeout(switchIdleTimeOut);
+ initializer.setDeserializationFactory(deserializationFactory);
+ initializer.setSerializationFactory(serializationFactory);
+ initializer.setTlsConfiguration(tlsConfig);
+ initializer.setSwitchConnectionHandler(switchConnectionHandler);
+ return initializer;
+ }
+
+ /**
+ * @return PublishingChannelInitializer that initializes new channels
+ */
+ public UdpChannelInitializer createUdpChannelInitializer() {
+ UdpChannelInitializer initializer = new UdpChannelInitializer();
+ initializer.setSwitchIdleTimeout(switchIdleTimeOut);
+ initializer.setDeserializationFactory(deserializationFactory);
+ initializer.setSerializationFactory(serializationFactory);
+ initializer.setSwitchConnectionHandler(switchConnectionHandler);
+ return initializer;
+ }
+
+ /**
+ * @param switchIdleTimeOut
+ */
+ public void setSwitchIdleTimeout(long switchIdleTimeOut) {
+ this.switchIdleTimeOut = switchIdleTimeOut;
+ }
+
+ /**
+ * @param deserializationFactory
+ */
+ public void setDeserializationFactory(DeserializationFactory deserializationFactory) {
+ this.deserializationFactory = deserializationFactory;
+ }
+
+ /**
+ * @param serializationFactory
+ */
+ public void setSerializationFactory(SerializationFactory serializationFactory) {
+ this.serializationFactory = serializationFactory;
+ }
+
+ /**
+ * @param tlsConfig
+ */
+ public void setTlsConfig(TlsConfiguration tlsConfig) {
+ this.tlsConfig = tlsConfig;
+ }
+
+ /**
+ * @param switchConnectionHandler
+ */
+ public void setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler) {
+ this.switchConnectionHandler = switchConnectionHandler;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.SimpleChannelInboundHandler;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketDecoder extends SimpleChannelInboundHandler<VersionMessageUdpWrapper>{\r
-\r
- private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketDecoder.class);\r
- private DeserializationFactory deserializationFactory;\r
-\r
- @Override\r
- public void channelRead0(ChannelHandlerContext ctx, VersionMessageUdpWrapper msg)\r
- throws Exception {\r
- if (LOGGER.isDebugEnabled()) {\r
- LOGGER.debug("UdpVersionMessageWrapper received");\r
- LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));\r
- }\r
- DataObject dataObject = null;\r
- try {\r
- dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(),msg.getVersion());\r
- if (dataObject == null) {\r
- LOGGER.warn("Translated POJO is null");\r
- } else {\r
- MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.getAddress());\r
- consumer.consume(dataObject);\r
- }\r
- } catch(Exception e) {\r
- LOGGER.warn("Message deserialization failed");\r
- LOGGER.warn(e.getMessage(), e);\r
- // TODO: delegate exception to allow easier deserialization\r
- // debugging / deserialization problem awareness\r
- } finally {\r
- msg.getMessageBuffer().release();\r
- }\r
- }\r
-\r
- /**\r
- * @param deserializationFactory\r
- */\r
- public void setDeserializationFactory(DeserializationFactory deserializationFactory) {\r
- this.deserializationFactory = deserializationFactory;\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.openflowjava.protocol.impl.core;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.SimpleChannelInboundHandler;
+
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketDecoder extends SimpleChannelInboundHandler<VersionMessageUdpWrapper>{
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketDecoder.class);
+ private DeserializationFactory deserializationFactory;
+
+ @Override
+ public void channelRead0(ChannelHandlerContext ctx, VersionMessageUdpWrapper msg)
+ throws Exception {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("UdpVersionMessageWrapper received");
+ LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));
+ }
+ DataObject dataObject = null;
+ try {
+ dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(),msg.getVersion());
+ if (dataObject == null) {
+ LOGGER.warn("Translated POJO is null");
+ } else {
+ MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.getAddress());
+ consumer.consume(dataObject);
+ }
+ } catch(Exception e) {
+ LOGGER.warn("Message deserialization failed");
+ LOGGER.warn(e.getMessage(), e);
+ // TODO: delegate exception to allow easier deserialization
+ // debugging / deserialization problem awareness
+ } finally {
+ msg.getMessageBuffer().release();
+ }
+ }
+
+ /**
+ * @param deserializationFactory
+ */
+ public void setDeserializationFactory(DeserializationFactory deserializationFactory) {
+ this.deserializationFactory = deserializationFactory;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.socket.DatagramPacket;\r
-import io.netty.handler.codec.MessageToMessageEncoder;\r
-import io.netty.util.concurrent.Future;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketEncoder extends MessageToMessageEncoder<UdpMessageListenerWrapper> {\r
-\r
- private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketEncoder.class);\r
- private SerializationFactory serializationFactory;\r
-\r
- @Override\r
- protected void encode(ChannelHandlerContext ctx,\r
- UdpMessageListenerWrapper wrapper, List<Object> out) throws Exception {\r
- LOGGER.trace("Encoding");\r
- try {\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializationFactory.messageToBuffer(wrapper.getMsg().getVersion(), buffer, wrapper.getMsg());\r
- out.add(new DatagramPacket(buffer, wrapper.getAddress()));\r
- } catch(Exception e) {\r
- LOGGER.warn("Message serialization failed: {}", e.getMessage());\r
- Future<Void> newFailedFuture = ctx.newFailedFuture(e);\r
- wrapper.getListener().operationComplete(newFailedFuture);\r
- return;\r
- }\r
- }\r
-\r
- /**\r
- * @param serializationFactory\r
- */\r
- public void setSerializationFactory(SerializationFactory serializationFactory) {\r
- this.serializationFactory = serializationFactory;\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.openflowjava.protocol.impl.core;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.socket.DatagramPacket;
+import io.netty.handler.codec.MessageToMessageEncoder;
+import io.netty.util.concurrent.Future;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketEncoder extends MessageToMessageEncoder<UdpMessageListenerWrapper> {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketEncoder.class);
+ private SerializationFactory serializationFactory;
+
+ @Override
+ protected void encode(ChannelHandlerContext ctx,
+ UdpMessageListenerWrapper wrapper, List<Object> out) throws Exception {
+ LOGGER.trace("Encoding");
+ try {
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializationFactory.messageToBuffer(wrapper.getMsg().getVersion(), buffer, wrapper.getMsg());
+ out.add(new DatagramPacket(buffer, wrapper.getAddress()));
+ } catch(Exception e) {
+ LOGGER.warn("Message serialization failed: {}", e.getMessage());
+ Future<Void> newFailedFuture = ctx.newFailedFuture(e);
+ wrapper.getListener().operationComplete(newFailedFuture);
+ return;
+ }
+ }
+
+ /**
+ * @param serializationFactory
+ */
+ public void setSerializationFactory(SerializationFactory serializationFactory) {
+ this.serializationFactory = serializationFactory;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.socket.DatagramPacket;\r
-import io.netty.handler.codec.MessageToMessageDecoder;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactoryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionFacade;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketHandler extends MessageToMessageDecoder<DatagramPacket> {\r
-\r
- private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketHandler.class);\r
-\r
- /** Length of OpenFlow 1.3 header */\r
- public static final byte LENGTH_OF_HEADER = 8;\r
- private static final byte LENGTH_INDEX_IN_HEADER = 2;\r
- private ConnectionAdapterFactory adapterFactory = new ConnectionAdapterFactoryImpl();\r
- private SwitchConnectionHandler connectionHandler;\r
-\r
- /**\r
- * Default constructor\r
- * @param sch the switchConnectionHandler that decides\r
- * what to do with incomming message / channel\r
- */\r
- public OFDatagramPacketHandler(SwitchConnectionHandler sch) {\r
- this.connectionHandler = sch;\r
- }\r
-\r
- @Override\r
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {\r
- LOGGER.warn("Unexpected exception from downstream.", cause);\r
- LOGGER.warn("Closing connection.");\r
- ctx.close();\r
- }\r
-\r
- @Override\r
- protected void decode(ChannelHandlerContext ctx, DatagramPacket msg,\r
- List<Object> out) throws Exception {\r
- LOGGER.debug("OFDatagramPacketFramer");\r
- MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.sender());\r
- if (consumer == null) {\r
- ConnectionFacade connectionFacade =\r
- adapterFactory.createConnectionFacade(ctx.channel(), msg.sender());\r
- connectionHandler.onSwitchConnected(connectionFacade);\r
- connectionFacade.checkListeners();\r
- UdpConnectionMap.addConnection(msg.sender(), connectionFacade);\r
- }\r
- ByteBuf bb = msg.content();\r
- int readableBytes = bb.readableBytes();\r
- if (readableBytes < LENGTH_OF_HEADER) {\r
- if (LOGGER.isDebugEnabled()) {\r
- LOGGER.debug("skipping bytebuf - too few bytes for header: " + readableBytes + " < " + LENGTH_OF_HEADER );\r
- LOGGER.debug("bb: " + ByteBufUtils.byteBufToHexString(bb));\r
- }\r
- return;\r
- }\r
-\r
- int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER);\r
- LOGGER.debug("length of actual message: {}", length);\r
- \r
- if (readableBytes < length) {\r
- if (LOGGER.isDebugEnabled()) {\r
- LOGGER.debug("skipping bytebuf - too few bytes for msg: " +\r
- readableBytes + " < " + length);\r
- LOGGER.debug("bytebuffer: " + ByteBufUtils.byteBufToHexString(bb));\r
- }\r
- return;\r
- }\r
- LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1));\r
-\r
- \r
- byte version = bb.readByte();\r
- if ((version == EncodeConstants.OF13_VERSION_ID) || (version == EncodeConstants.OF10_VERSION_ID)) {\r
- LOGGER.debug("detected version: " + version);\r
- ByteBuf messageBuffer = bb.slice();\r
- out.add(new VersionMessageUdpWrapper(version, messageBuffer, msg.sender()));\r
- messageBuffer.retain();\r
- } else {\r
- LOGGER.warn("detected version: " + version + " - currently not supported");\r
- }\r
- bb.skipBytes(bb.readableBytes());\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.openflowjava.protocol.impl.core;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.socket.DatagramPacket;
+import io.netty.handler.codec.MessageToMessageDecoder;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactory;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactoryImpl;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionFacade;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketHandler extends MessageToMessageDecoder<DatagramPacket> {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketHandler.class);
+
+ /** Length of OpenFlow 1.3 header */
+ public static final byte LENGTH_OF_HEADER = 8;
+ private static final byte LENGTH_INDEX_IN_HEADER = 2;
+ private ConnectionAdapterFactory adapterFactory = new ConnectionAdapterFactoryImpl();
+ private SwitchConnectionHandler connectionHandler;
+
+ /**
+ * Default constructor
+ * @param sch the switchConnectionHandler that decides
+ * what to do with incomming message / channel
+ */
+ public OFDatagramPacketHandler(SwitchConnectionHandler sch) {
+ this.connectionHandler = sch;
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
+ LOGGER.warn("Unexpected exception from downstream.", cause);
+ LOGGER.warn("Closing connection.");
+ ctx.close();
+ }
+
+ @Override
+ protected void decode(ChannelHandlerContext ctx, DatagramPacket msg,
+ List<Object> out) throws Exception {
+ LOGGER.debug("OFDatagramPacketFramer");
+ MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.sender());
+ if (consumer == null) {
+ ConnectionFacade connectionFacade =
+ adapterFactory.createConnectionFacade(ctx.channel(), msg.sender());
+ connectionHandler.onSwitchConnected(connectionFacade);
+ connectionFacade.checkListeners();
+ UdpConnectionMap.addConnection(msg.sender(), connectionFacade);
+ }
+ ByteBuf bb = msg.content();
+ int readableBytes = bb.readableBytes();
+ if (readableBytes < LENGTH_OF_HEADER) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("skipping bytebuf - too few bytes for header: " + readableBytes + " < " + LENGTH_OF_HEADER );
+ LOGGER.debug("bb: " + ByteBufUtils.byteBufToHexString(bb));
+ }
+ return;
+ }
+
+ int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER);
+ LOGGER.debug("length of actual message: {}", length);
+
+ if (readableBytes < length) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("skipping bytebuf - too few bytes for msg: " +
+ readableBytes + " < " + length);
+ LOGGER.debug("bytebuffer: " + ByteBufUtils.byteBufToHexString(bb));
+ }
+ return;
+ }
+ LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1));
+
+
+ byte version = bb.readByte();
+ if ((version == EncodeConstants.OF13_VERSION_ID) || (version == EncodeConstants.OF10_VERSION_ID)) {
+ LOGGER.debug("detected version: " + version);
+ ByteBuf messageBuffer = bb.slice();
+ out.add(new VersionMessageUdpWrapper(version, messageBuffer, msg.sender()));
+ messageBuffer.retain();
+ } else {
+ LOGGER.warn("detected version: " + version + " - currently not supported");
+ }
+ bb.skipBytes(bb.readableBytes());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-/**\r
- * Stores names of handlers used in pipeline.\r
- * \r
- * @author michal.polkorab\r
- */\r
-public enum PipelineHandlers {\r
-\r
- /**\r
- * Detects switch idle state\r
- */\r
- IDLE_HANDLER,\r
- /**\r
- * Component for handling TLS frames\r
- */\r
- SSL_HANDLER,\r
- /**\r
- * Decodes incoming messages into message frames\r
- */\r
- OF_FRAME_DECODER,\r
- /**\r
- * Detects version of incoming OpenFlow Protocol message\r
- */\r
- OF_VERSION_DETECTOR,\r
- /**\r
- * Transforms OpenFlow Protocol byte messages into POJOs\r
- */\r
- OF_DECODER,\r
- /**\r
- * Transforms POJOs into OpenFlow Protocol byte messages\r
- */\r
- OF_ENCODER,\r
- /**\r
- * Delegates translated POJOs into MessageConsumer\r
- */\r
- DELEGATING_INBOUND_HANDLER,\r
- /**\r
- * Performs efficient flushing\r
- */\r
- CHANNEL_OUTBOUNF_QUEUE,\r
- /**\r
- * Decodes incoming messages into message frames\r
- * and filters them based on version supported\r
- */\r
- OF_DATAGRAMPACKET_HANDLER,\r
- /**\r
- * Transforms OpenFlow Protocol datagram messages into POJOs\r
- */\r
- OF_DATAGRAMPACKET_DECODER,\r
- /**\r
- * Transforms POJOs into OpenFlow Protocol datagrams\r
- */\r
- OF_DATAGRAMPACKET_ENCODER\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.openflowjava.protocol.impl.core;
+
+/**
+ * Stores names of handlers used in pipeline.
+ *
+ * @author michal.polkorab
+ */
+public enum PipelineHandlers {
+
+ /**
+ * Detects switch idle state
+ */
+ IDLE_HANDLER,
+ /**
+ * Component for handling TLS frames
+ */
+ SSL_HANDLER,
+ /**
+ * Decodes incoming messages into message frames
+ */
+ OF_FRAME_DECODER,
+ /**
+ * Detects version of incoming OpenFlow Protocol message
+ */
+ OF_VERSION_DETECTOR,
+ /**
+ * Transforms OpenFlow Protocol byte messages into POJOs
+ */
+ OF_DECODER,
+ /**
+ * Transforms POJOs into OpenFlow Protocol byte messages
+ */
+ OF_ENCODER,
+ /**
+ * Delegates translated POJOs into MessageConsumer
+ */
+ DELEGATING_INBOUND_HANDLER,
+ /**
+ * Performs efficient flushing
+ */
+ CHANNEL_OUTBOUNF_QUEUE,
+ /**
+ * Decodes incoming messages into message frames
+ * and filters them based on version supported
+ */
+ OF_DATAGRAMPACKET_HANDLER,
+ /**
+ * Transforms OpenFlow Protocol datagram messages into POJOs
+ */
+ OF_DATAGRAMPACKET_DECODER,
+ /**
+ * Transforms POJOs into OpenFlow Protocol datagrams
+ */
+ OF_DATAGRAMPACKET_ENCODER
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.channel.Channel;\r
-import io.netty.channel.ChannelInitializer;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-\r
-/**\r
- * @param <CHANNEL_TYPE> Channel type\r
- * @author michal.polkorab\r
- */\r
-public abstract class ProtocolChannelInitializer<CHANNEL_TYPE extends Channel>\r
- extends ChannelInitializer<CHANNEL_TYPE> {\r
-\r
- private SwitchConnectionHandler switchConnectionHandler;\r
- private long switchIdleTimeout;\r
- private SerializationFactory serializationFactory;\r
- private DeserializationFactory deserializationFactory;\r
- private TlsConfiguration tlsConfiguration;\r
-\r
- /**\r
- * @param switchConnectionHandler the switchConnectionHandler to set\r
- */\r
- public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) {\r
- this.switchConnectionHandler = switchConnectionHandler;\r
- }\r
-\r
- /**\r
- * @param switchIdleTimeout the switchIdleTimeout to set\r
- */\r
- public void setSwitchIdleTimeout(final long switchIdleTimeout) {\r
- this.switchIdleTimeout = switchIdleTimeout;\r
- }\r
-\r
- /**\r
- * @param serializationFactory\r
- */\r
- public void setSerializationFactory(final SerializationFactory serializationFactory) {\r
- this.serializationFactory = serializationFactory;\r
- }\r
-\r
- /**\r
- * @param deserializationFactory\r
- */\r
- public void setDeserializationFactory(final DeserializationFactory deserializationFactory) {\r
- this.deserializationFactory = deserializationFactory;\r
- }\r
-\r
- /**\r
- * @param tlsConfiguration\r
- */\r
- public void setTlsConfiguration(TlsConfiguration tlsConfiguration) {\r
- this.tlsConfiguration = tlsConfiguration;\r
- }\r
-\r
- /**\r
- * @return switch connection handler\r
- */\r
- public SwitchConnectionHandler getSwitchConnectionHandler() {\r
- return switchConnectionHandler;\r
- }\r
-\r
- /**\r
- * @return switch idle timeout\r
- */\r
- public long getSwitchIdleTimeout() {\r
- return switchIdleTimeout;\r
- }\r
-\r
- /**\r
- * @return serialization factory\r
- */\r
- public SerializationFactory getSerializationFactory() {\r
- return serializationFactory;\r
- }\r
-\r
- /**\r
- * @return deserialization factory\r
- */\r
- public DeserializationFactory getDeserializationFactory() {\r
- return deserializationFactory;\r
- }\r
-\r
- /**\r
- * @return TLS configuration\r
- */\r
- public TlsConfiguration getTlsConfiguration() {\r
- return tlsConfiguration;\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.openflowjava.protocol.impl.core;
+
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelInitializer;
+
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+
+/**
+ * @param <CHANNEL_TYPE> Channel type
+ * @author michal.polkorab
+ */
+public abstract class ProtocolChannelInitializer<CHANNEL_TYPE extends Channel>
+ extends ChannelInitializer<CHANNEL_TYPE> {
+
+ private SwitchConnectionHandler switchConnectionHandler;
+ private long switchIdleTimeout;
+ private SerializationFactory serializationFactory;
+ private DeserializationFactory deserializationFactory;
+ private TlsConfiguration tlsConfiguration;
+
+ /**
+ * @param switchConnectionHandler the switchConnectionHandler to set
+ */
+ public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) {
+ this.switchConnectionHandler = switchConnectionHandler;
+ }
+
+ /**
+ * @param switchIdleTimeout the switchIdleTimeout to set
+ */
+ public void setSwitchIdleTimeout(final long switchIdleTimeout) {
+ this.switchIdleTimeout = switchIdleTimeout;
+ }
+
+ /**
+ * @param serializationFactory
+ */
+ public void setSerializationFactory(final SerializationFactory serializationFactory) {
+ this.serializationFactory = serializationFactory;
+ }
+
+ /**
+ * @param deserializationFactory
+ */
+ public void setDeserializationFactory(final DeserializationFactory deserializationFactory) {
+ this.deserializationFactory = deserializationFactory;
+ }
+
+ /**
+ * @param tlsConfiguration
+ */
+ public void setTlsConfiguration(TlsConfiguration tlsConfiguration) {
+ this.tlsConfiguration = tlsConfiguration;
+ }
+
+ /**
+ * @return switch connection handler
+ */
+ public SwitchConnectionHandler getSwitchConnectionHandler() {
+ return switchConnectionHandler;
+ }
+
+ /**
+ * @return switch idle timeout
+ */
+ public long getSwitchIdleTimeout() {
+ return switchIdleTimeout;
+ }
+
+ /**
+ * @return serialization factory
+ */
+ public SerializationFactory getSerializationFactory() {
+ return serializationFactory;
+ }
+
+ /**
+ * @return deserialization factory
+ */
+ public DeserializationFactory getDeserializationFactory() {
+ return deserializationFactory;
+ }
+
+ /**
+ * @return TLS configuration
+ */
+ public TlsConfiguration getTlsConfiguration() {
+ return tlsConfiguration;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.channel.socket.nio.NioDatagramChannel;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class UdpChannelInitializer extends ProtocolChannelInitializer<NioDatagramChannel> {\r
-\r
- @Override\r
- protected void initChannel(NioDatagramChannel ch) throws Exception {\r
- ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_HANDLER.name(),\r
- new OFDatagramPacketHandler(getSwitchConnectionHandler()));\r
- OFDatagramPacketDecoder ofDatagramPacketDecoder = new OFDatagramPacketDecoder();\r
- ofDatagramPacketDecoder.setDeserializationFactory(getDeserializationFactory());\r
- ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_DECODER.name(),\r
- ofDatagramPacketDecoder);\r
- OFDatagramPacketEncoder ofDatagramPacketEncoder = new OFDatagramPacketEncoder();\r
- ofDatagramPacketEncoder.setSerializationFactory(getSerializationFactory());\r
- ch.pipeline().addLast(PipelineHandlers.OF_ENCODER.name(), ofDatagramPacketEncoder);\r
-// connectionFacade.fireConnectionReadyNotification();\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.openflowjava.protocol.impl.core;
+
+import io.netty.channel.socket.nio.NioDatagramChannel;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class UdpChannelInitializer extends ProtocolChannelInitializer<NioDatagramChannel> {
+
+ @Override
+ protected void initChannel(NioDatagramChannel ch) throws Exception {
+ ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_HANDLER.name(),
+ new OFDatagramPacketHandler(getSwitchConnectionHandler()));
+ OFDatagramPacketDecoder ofDatagramPacketDecoder = new OFDatagramPacketDecoder();
+ ofDatagramPacketDecoder.setDeserializationFactory(getDeserializationFactory());
+ ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_DECODER.name(),
+ ofDatagramPacketDecoder);
+ OFDatagramPacketEncoder ofDatagramPacketEncoder = new OFDatagramPacketEncoder();
+ ofDatagramPacketEncoder.setSerializationFactory(getSerializationFactory());
+ ch.pipeline().addLast(PipelineHandlers.OF_ENCODER.name(), ofDatagramPacketEncoder);
+// connectionFacade.fireConnectionReadyNotification();
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import java.net.InetSocketAddress;\r
-import java.util.Map;\r
-import java.util.concurrent.ConcurrentHashMap;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;\r
-\r
-/**\r
- * As UDP communication is handled only by one channel, it is needed\r
- * to store MessageConsumers, so that we know which consumer handles which channel\r
-\r
- * @author michal.polkorab\r
- */\r
-public final class UdpConnectionMap {\r
-\r
- private static Map<InetSocketAddress, MessageConsumer> connectionMap = new ConcurrentHashMap<>();\r
-\r
- private UdpConnectionMap() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * @param address sender's address\r
- * @return corresponding MessageConsumer\r
- */\r
- public static MessageConsumer getMessageConsumer(InetSocketAddress address) {\r
- if(address == null){\r
- throw new IllegalArgumentException("Address can not be null");\r
- }\r
- return connectionMap.get(address);\r
- }\r
-\r
- /**\r
- * @param address sender's address\r
- * @param consumer MessageConsumer to be added / paired with specified address\r
- */\r
- public static void addConnection(InetSocketAddress address, MessageConsumer consumer) {\r
- if(address == null){\r
- throw new IllegalArgumentException("Address can not be null");\r
- }\r
- connectionMap.put(address, consumer);\r
- }\r
-\r
- /**\r
- * @param address sender's address\r
- */\r
- public static void removeConnection(InetSocketAddress address) {\r
- if(address == null){\r
- throw new IllegalArgumentException("Address can not be null");\r
- }\r
- connectionMap.remove(address);\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.openflowjava.protocol.impl.core;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
+
+/**
+ * As UDP communication is handled only by one channel, it is needed
+ * to store MessageConsumers, so that we know which consumer handles which channel
+
+ * @author michal.polkorab
+ */
+public final class UdpConnectionMap {
+
+ private static Map<InetSocketAddress, MessageConsumer> connectionMap = new ConcurrentHashMap<>();
+
+ private UdpConnectionMap() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * @param address sender's address
+ * @return corresponding MessageConsumer
+ */
+ public static MessageConsumer getMessageConsumer(InetSocketAddress address) {
+ if(address == null){
+ throw new IllegalArgumentException("Address can not be null");
+ }
+ return connectionMap.get(address);
+ }
+
+ /**
+ * @param address sender's address
+ * @param consumer MessageConsumer to be added / paired with specified address
+ */
+ public static void addConnection(InetSocketAddress address, MessageConsumer consumer) {
+ if(address == null){
+ throw new IllegalArgumentException("Address can not be null");
+ }
+ connectionMap.put(address, consumer);
+ }
+
+ /**
+ * @param address sender's address
+ */
+ public static void removeConnection(InetSocketAddress address) {
+ if(address == null){
+ throw new IllegalArgumentException("Address can not be null");
+ }
+ connectionMap.remove(address);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.bootstrap.Bootstrap;\r
-import io.netty.channel.ChannelFuture;\r
-import io.netty.channel.ChannelOption;\r
-import io.netty.channel.EventLoopGroup;\r
-import io.netty.channel.nio.NioEventLoopGroup;\r
-import io.netty.channel.socket.nio.NioDatagramChannel;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import java.net.InetAddress;\r
-import java.net.InetSocketAddress;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * Class implementing server over UDP for handling incoming connections.\r
- * \r
- * @author michal.polkorab\r
- */\r
-public final class UdpHandler implements ServerFacade {\r
-\r
- private static final Logger LOGGER = LoggerFactory\r
- .getLogger(UdpHandler.class);\r
- private int port;\r
- private EventLoopGroup group;\r
- private final InetAddress startupAddress;\r
- private final SettableFuture<Boolean> isOnlineFuture;\r
- private UdpChannelInitializer channelInitializer;\r
- private ThreadConfiguration threadConfig;\r
-\r
- /**\r
- * Constructor of UdpHandler that listens on selected port.\r
- *\r
- * @param port listening port of UdpHandler server\r
- */\r
- public UdpHandler(final int port) {\r
- this(null, port);\r
- }\r
-\r
- /**\r
- * Constructor of UdpHandler that listens on selected address and port.\r
- * @param address listening address of UdpHandler server\r
- * @param port listening port of UdpHandler server\r
- */\r
- public UdpHandler(final InetAddress address, final int port) {\r
- this.port = port;\r
- this.startupAddress = address;\r
- isOnlineFuture = SettableFuture.create();\r
- }\r
-\r
- @Override\r
- public void run() {\r
- if (threadConfig != null) {\r
- group = new NioEventLoopGroup(threadConfig.getWorkerThreadCount());\r
- } else {\r
- group = new NioEventLoopGroup();\r
- }\r
- final ChannelFuture f;\r
- try {\r
- Bootstrap b = new Bootstrap();\r
- b.group(group)\r
- .channel(NioDatagramChannel.class)\r
- .option(ChannelOption.SO_BROADCAST, false)\r
- .handler(channelInitializer);\r
-\r
- if (startupAddress != null) {\r
- f = b.bind(startupAddress.getHostAddress(), port).sync();\r
- } else {\r
- f = b.bind(port).sync();\r
- }\r
- } catch (InterruptedException e) {\r
- LOGGER.error("Interrupted while binding port {}", port, e);\r
- return;\r
- }\r
-\r
- try {\r
- InetSocketAddress isa = (InetSocketAddress) f.channel().localAddress();\r
- String address = isa.getHostString();\r
-\r
- // Update port, as it may have been specified as 0\r
- this.port = isa.getPort();\r
-\r
- LOGGER.debug("Address from udpHandler: {}", address);\r
- isOnlineFuture.set(true);\r
- LOGGER.info("Switch listener started and ready to accept incoming udp connections on port: {}", port);\r
- f.channel().closeFuture().sync();\r
- } catch (InterruptedException e) {\r
- LOGGER.error("Interrupted while waiting for port {} shutdown", port, e);\r
- } finally {\r
- shutdown();\r
- }\r
- }\r
-\r
- @Override\r
- public ListenableFuture<Boolean> shutdown() {\r
- final SettableFuture<Boolean> result = SettableFuture.create();\r
- group.shutdownGracefully().addListener(new GenericFutureListener<io.netty.util.concurrent.Future<Object>>() {\r
-\r
- @Override\r
- public void operationComplete(\r
- final io.netty.util.concurrent.Future<Object> downResult) throws Exception {\r
- result.set(downResult.isSuccess());\r
- if (downResult.cause() != null) {\r
- result.setException(downResult.cause());\r
- }\r
- }\r
-\r
- });\r
- return result;\r
- }\r
-\r
- @Override\r
- public ListenableFuture<Boolean> getIsOnlineFuture() {\r
- return isOnlineFuture;\r
- }\r
-\r
- /**\r
- * @return the port\r
- */\r
- public int getPort() {\r
- return port;\r
- }\r
-\r
- /**\r
- * @param channelInitializer\r
- */\r
- public void setChannelInitializer(UdpChannelInitializer channelInitializer) {\r
- this.channelInitializer = channelInitializer;\r
- }\r
-\r
- @Override\r
- public void setThreadConfig(ThreadConfiguration threadConfig) {\r
- this.threadConfig = threadConfig;\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.openflowjava.protocol.impl.core;
+
+import io.netty.bootstrap.Bootstrap;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.nio.NioDatagramChannel;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
+import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * Class implementing server over UDP for handling incoming connections.
+ *
+ * @author michal.polkorab
+ */
+public final class UdpHandler implements ServerFacade {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(UdpHandler.class);
+ private int port;
+ private EventLoopGroup group;
+ private final InetAddress startupAddress;
+ private final SettableFuture<Boolean> isOnlineFuture;
+ private UdpChannelInitializer channelInitializer;
+ private ThreadConfiguration threadConfig;
+
+ /**
+ * Constructor of UdpHandler that listens on selected port.
+ *
+ * @param port listening port of UdpHandler server
+ */
+ public UdpHandler(final int port) {
+ this(null, port);
+ }
+
+ /**
+ * Constructor of UdpHandler that listens on selected address and port.
+ * @param address listening address of UdpHandler server
+ * @param port listening port of UdpHandler server
+ */
+ public UdpHandler(final InetAddress address, final int port) {
+ this.port = port;
+ this.startupAddress = address;
+ isOnlineFuture = SettableFuture.create();
+ }
+
+ @Override
+ public void run() {
+ if (threadConfig != null) {
+ group = new NioEventLoopGroup(threadConfig.getWorkerThreadCount());
+ } else {
+ group = new NioEventLoopGroup();
+ }
+ final ChannelFuture f;
+ try {
+ Bootstrap b = new Bootstrap();
+ b.group(group)
+ .channel(NioDatagramChannel.class)
+ .option(ChannelOption.SO_BROADCAST, false)
+ .handler(channelInitializer);
+
+ if (startupAddress != null) {
+ f = b.bind(startupAddress.getHostAddress(), port).sync();
+ } else {
+ f = b.bind(port).sync();
+ }
+ } catch (InterruptedException e) {
+ LOGGER.error("Interrupted while binding port {}", port, e);
+ return;
+ }
+
+ try {
+ InetSocketAddress isa = (InetSocketAddress) f.channel().localAddress();
+ String address = isa.getHostString();
+
+ // Update port, as it may have been specified as 0
+ this.port = isa.getPort();
+
+ LOGGER.debug("Address from udpHandler: {}", address);
+ isOnlineFuture.set(true);
+ LOGGER.info("Switch listener started and ready to accept incoming udp connections on port: {}", port);
+ f.channel().closeFuture().sync();
+ } catch (InterruptedException e) {
+ LOGGER.error("Interrupted while waiting for port {} shutdown", port, e);
+ } finally {
+ shutdown();
+ }
+ }
+
+ @Override
+ public ListenableFuture<Boolean> shutdown() {
+ final SettableFuture<Boolean> result = SettableFuture.create();
+ group.shutdownGracefully().addListener(new GenericFutureListener<io.netty.util.concurrent.Future<Object>>() {
+
+ @Override
+ public void operationComplete(
+ final io.netty.util.concurrent.Future<Object> downResult) throws Exception {
+ result.set(downResult.isSuccess());
+ if (downResult.cause() != null) {
+ result.setException(downResult.cause());
+ }
+ }
+
+ });
+ return result;
+ }
+
+ @Override
+ public ListenableFuture<Boolean> getIsOnlineFuture() {
+ return isOnlineFuture;
+ }
+
+ /**
+ * @return the port
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * @param channelInitializer
+ */
+ public void setChannelInitializer(UdpChannelInitializer channelInitializer) {
+ this.channelInitializer = channelInitializer;
+ }
+
+ @Override
+ public void setThreadConfig(ThreadConfiguration threadConfig) {
+ this.threadConfig = threadConfig;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.net.InetSocketAddress;\r
-\r
-/**\r
- * Wraps received messages (includes version) and sender address\r
- \r
- * @author michal.polkorab\r
- */\r
-public class VersionMessageUdpWrapper extends VersionMessageWrapper {\r
-\r
- private InetSocketAddress address;\r
-\r
- /**\r
- * @param version Openflow wire version\r
- * @param messageBuffer ByteBuf containing binary message\r
- * @param address sender address\r
- */\r
- public VersionMessageUdpWrapper(short version, ByteBuf messageBuffer, InetSocketAddress address) {\r
- super(version, messageBuffer);\r
- this.address = address;\r
- }\r
-\r
- /**\r
- * @return sender address\r
- */\r
- public InetSocketAddress getAddress() {\r
- return address;\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.openflowjava.protocol.impl.core;
+
+import io.netty.buffer.ByteBuf;
+
+import java.net.InetSocketAddress;
+
+/**
+ * Wraps received messages (includes version) and sender address
+
+ * @author michal.polkorab
+ */
+public class VersionMessageUdpWrapper extends VersionMessageWrapper {
+
+ private InetSocketAddress address;
+
+ /**
+ * @param version Openflow wire version
+ * @param messageBuffer ByteBuf containing binary message
+ * @param address sender address
+ */
+ public VersionMessageUdpWrapper(short version, ByteBuf messageBuffer, InetSocketAddress address) {
+ super(version, messageBuffer);
+ this.address = address;
+ }
+
+ /**
+ * @return sender address
+ */
+ public InetSocketAddress getAddress() {
+ return address;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import io.netty.util.concurrent.Future;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-\r
-/**\r
- * Wraps outgoing message and includes listener attached to this message. This object\r
- * is sent to OFEncoder. When OFEncoder fails to serialize the message,\r
- * listener is filled with exception. The exception is then delegated to upper ODL layers. \r
- * @author michal.polkorab\r
- */\r
-public class MessageListenerWrapper {\r
-\r
- private OfHeader msg;\r
- private GenericFutureListener<Future<Void>> listener;\r
-\r
- /**\r
- * @param msg outgoing message\r
- * @param listener listener attached to channel.write(msg) Future\r
- */\r
- public MessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener) {\r
- this.msg = (OfHeader) msg;\r
- this.listener = listener;\r
- }\r
-\r
- /**\r
- * @return outgoing message (downstream)\r
- */\r
- public OfHeader getMsg() {\r
- return msg;\r
- }\r
-\r
- \r
- /**\r
- * @return listener listening on message sending success / failure\r
- */\r
- public GenericFutureListener<Future<Void>> getListener() {\r
- return listener;\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.openflowjava.protocol.impl.core.connection;
+
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+
+/**
+ * Wraps outgoing message and includes listener attached to this message. This object
+ * is sent to OFEncoder. When OFEncoder fails to serialize the message,
+ * listener is filled with exception. The exception is then delegated to upper ODL layers.
+ * @author michal.polkorab
+ */
+public class MessageListenerWrapper {
+
+ private OfHeader msg;
+ private GenericFutureListener<Future<Void>> listener;
+
+ /**
+ * @param msg outgoing message
+ * @param listener listener attached to channel.write(msg) Future
+ */
+ public MessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener) {
+ this.msg = (OfHeader) msg;
+ this.listener = listener;
+ }
+
+ /**
+ * @return outgoing message (downstream)
+ */
+ public OfHeader getMsg() {
+ return msg;
+ }
+
+
+ /**
+ * @return listener listening on message sending success / failure
+ */
+ public GenericFutureListener<Future<Void>> getListener() {
+ return listener;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import io.netty.util.concurrent.Future;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import java.net.InetSocketAddress;\r
-\r
-/**\r
- * Wraps outgoing message and includes listener attached to this message. This object\r
- * is sent to OFEncoder. When OFEncoder fails to serialize the message,\r
- * listener is filled with exception. The exception is then delegated to upper ODL layers.\r
- * This object is used for UDP communication - it also carries recipient address\r
- \r
- * @author michal.polkorab\r
- */\r
-public class UdpMessageListenerWrapper extends MessageListenerWrapper {\r
-\r
- private InetSocketAddress address;\r
-\r
- /**\r
- * @param msg message to be sent\r
- * @param listener listener attached to channel.write(msg) Future\r
- * @param address recipient's address\r
- */\r
- public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,\r
- InetSocketAddress address) {\r
- super(msg, listener);\r
- this.address = address;\r
- }\r
-\r
- /**\r
- * @return recipient address\r
- */\r
- public InetSocketAddress getAddress() {\r
- return address;\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.openflowjava.protocol.impl.core.connection;
+
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import java.net.InetSocketAddress;
+
+/**
+ * Wraps outgoing message and includes listener attached to this message. This object
+ * is sent to OFEncoder. When OFEncoder fails to serialize the message,
+ * listener is filled with exception. The exception is then delegated to upper ODL layers.
+ * This object is used for UDP communication - it also carries recipient address
+
+ * @author michal.polkorab
+ */
+public class UdpMessageListenerWrapper extends MessageListenerWrapper {
+
+ private InetSocketAddress address;
+
+ /**
+ * @param msg message to be sent
+ * @param listener listener attached to channel.write(msg) Future
+ * @param address recipient's address
+ */
+ public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,
+ InetSocketAddress address) {
+ super(msg, listener);
+ this.address = address;
+ }
+
+ /**
+ * @return recipient address
+ */
+ public InetSocketAddress getAddress() {
+ return address;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10EnqueueActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10OutputActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlDstActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlSrcActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwDstActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwSrcActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwTosActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpDstActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpSrcActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanPcpActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanVidActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10StripVlanActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlInActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlOutActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecMplsTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecNwTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13GroupActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13OutputActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopMplsActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopPbbActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopVlanActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushMplsActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushPbbActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushVlanActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetFieldActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetMplsTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetNwTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetQueueActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionDeserializerRegistryHelper;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ActionDeserializerInitializer {\r
-\r
- private ActionDeserializerInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers action deserializers\r
- * @param registry registry to be filled with deserializers\r
- */\r
- public static void registerDeserializers(DeserializerRegistry registry) {\r
- // register OF v1.0 action deserializers\r
- ActionDeserializerRegistryHelper helper = \r
- new ActionDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);\r
- helper.registerDeserializer(0, new OF10OutputActionDeserializer());\r
- helper.registerDeserializer(1, new OF10SetVlanVidActionDeserializer());\r
- helper.registerDeserializer(2, new OF10SetVlanPcpActionDeserializer());\r
- helper.registerDeserializer(3, new OF10StripVlanActionDeserializer());\r
- helper.registerDeserializer(4, new OF10SetDlSrcActionDeserializer());\r
- helper.registerDeserializer(5, new OF10SetDlDstActionDeserializer());\r
- helper.registerDeserializer(6, new OF10SetNwSrcActionDeserializer());\r
- helper.registerDeserializer(7, new OF10SetNwDstActionDeserializer());\r
- helper.registerDeserializer(8, new OF10SetNwTosActionDeserializer());\r
- helper.registerDeserializer(9, new OF10SetTpSrcActionDeserializer());\r
- helper.registerDeserializer(10, new OF10SetTpDstActionDeserializer());\r
- helper.registerDeserializer(11, new OF10EnqueueActionDeserializer());\r
- // register OF v1.3 action deserializers\r
- helper = new ActionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);\r
- helper.registerDeserializer(0, new OF13OutputActionDeserializer());\r
- helper.registerDeserializer(11, new OF13CopyTtlOutActionDeserializer());\r
- helper.registerDeserializer(12, new OF13CopyTtlInActionDeserializer());\r
- helper.registerDeserializer(15, new OF13SetMplsTtlActionDeserializer());\r
- helper.registerDeserializer(16, new OF13DecMplsTtlActionDeserializer());\r
- helper.registerDeserializer(17, new OF13PushVlanActionDeserializer());\r
- helper.registerDeserializer(18, new OF13PopVlanActionDeserializer());\r
- helper.registerDeserializer(19, new OF13PushMplsActionDeserializer());\r
- helper.registerDeserializer(20, new OF13PopMplsActionDeserializer());\r
- helper.registerDeserializer(21, new OF13SetQueueActionDeserializer());\r
- helper.registerDeserializer(22, new OF13GroupActionDeserializer());\r
- helper.registerDeserializer(23, new OF13SetNwTtlActionDeserializer());\r
- helper.registerDeserializer(24, new OF13DecNwTtlActionDeserializer());\r
- helper.registerDeserializer(25, new OF13SetFieldActionDeserializer());\r
- helper.registerDeserializer(26, new OF13PushPbbActionDeserializer());\r
- helper.registerDeserializer(27, new OF13PopPbbActionDeserializer());\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10EnqueueActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10OutputActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlDstActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlSrcActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwDstActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwSrcActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwTosActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpDstActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpSrcActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanPcpActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanVidActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10StripVlanActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlInActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlOutActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecMplsTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecNwTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13GroupActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13OutputActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopMplsActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopPbbActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopVlanActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushMplsActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushPbbActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushVlanActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetFieldActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetMplsTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetNwTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetQueueActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionDeserializerRegistryHelper;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ActionDeserializerInitializer {
+
+ private ActionDeserializerInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers action deserializers
+ * @param registry registry to be filled with deserializers
+ */
+ public static void registerDeserializers(DeserializerRegistry registry) {
+ // register OF v1.0 action deserializers
+ ActionDeserializerRegistryHelper helper =
+ new ActionDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);
+ helper.registerDeserializer(0, new OF10OutputActionDeserializer());
+ helper.registerDeserializer(1, new OF10SetVlanVidActionDeserializer());
+ helper.registerDeserializer(2, new OF10SetVlanPcpActionDeserializer());
+ helper.registerDeserializer(3, new OF10StripVlanActionDeserializer());
+ helper.registerDeserializer(4, new OF10SetDlSrcActionDeserializer());
+ helper.registerDeserializer(5, new OF10SetDlDstActionDeserializer());
+ helper.registerDeserializer(6, new OF10SetNwSrcActionDeserializer());
+ helper.registerDeserializer(7, new OF10SetNwDstActionDeserializer());
+ helper.registerDeserializer(8, new OF10SetNwTosActionDeserializer());
+ helper.registerDeserializer(9, new OF10SetTpSrcActionDeserializer());
+ helper.registerDeserializer(10, new OF10SetTpDstActionDeserializer());
+ helper.registerDeserializer(11, new OF10EnqueueActionDeserializer());
+ // register OF v1.3 action deserializers
+ helper = new ActionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
+ helper.registerDeserializer(0, new OF13OutputActionDeserializer());
+ helper.registerDeserializer(11, new OF13CopyTtlOutActionDeserializer());
+ helper.registerDeserializer(12, new OF13CopyTtlInActionDeserializer());
+ helper.registerDeserializer(15, new OF13SetMplsTtlActionDeserializer());
+ helper.registerDeserializer(16, new OF13DecMplsTtlActionDeserializer());
+ helper.registerDeserializer(17, new OF13PushVlanActionDeserializer());
+ helper.registerDeserializer(18, new OF13PopVlanActionDeserializer());
+ helper.registerDeserializer(19, new OF13PushMplsActionDeserializer());
+ helper.registerDeserializer(20, new OF13PopMplsActionDeserializer());
+ helper.registerDeserializer(21, new OF13SetQueueActionDeserializer());
+ helper.registerDeserializer(22, new OF13GroupActionDeserializer());
+ helper.registerDeserializer(23, new OF13SetNwTtlActionDeserializer());
+ helper.registerDeserializer(24, new OF13DecNwTtlActionDeserializer());
+ helper.registerDeserializer(25, new OF13SetFieldActionDeserializer());
+ helper.registerDeserializer(26, new OF13PushPbbActionDeserializer());
+ helper.registerDeserializer(27, new OF13PopPbbActionDeserializer());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ApplyActionsInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ClearActionsInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.GoToTableInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.MeterInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteActionsInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteMetadataInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionDeserializerRegistryHelper;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class InstructionDeserializerInitializer {\r
-\r
- private InstructionDeserializerInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers instruction deserializers\r
- * @param registry registry to be filled with deserializers\r
- */\r
- public static void registerDeserializers(DeserializerRegistry registry) {\r
- // register OF v1.3 instruction deserializers\r
- InstructionDeserializerRegistryHelper helper =\r
- new InstructionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);\r
- helper.registerDeserializer(1, new GoToTableInstructionDeserializer());\r
- helper.registerDeserializer(2, new WriteMetadataInstructionDeserializer());\r
- helper.registerDeserializer(3, new WriteActionsInstructionDeserializer());\r
- helper.registerDeserializer(4, new ApplyActionsInstructionDeserializer());\r
- helper.registerDeserializer(5, new ClearActionsInstructionDeserializer());\r
- helper.registerDeserializer(6, new MeterInstructionDeserializer());\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ApplyActionsInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ClearActionsInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.GoToTableInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.MeterInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteActionsInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteMetadataInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionDeserializerRegistryHelper;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class InstructionDeserializerInitializer {
+
+ private InstructionDeserializerInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers instruction deserializers
+ * @param registry registry to be filled with deserializers
+ */
+ public static void registerDeserializers(DeserializerRegistry registry) {
+ // register OF v1.3 instruction deserializers
+ InstructionDeserializerRegistryHelper helper =
+ new InstructionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
+ helper.registerDeserializer(1, new GoToTableInstructionDeserializer());
+ helper.registerDeserializer(2, new WriteMetadataInstructionDeserializer());
+ helper.registerDeserializer(3, new WriteActionsInstructionDeserializer());
+ helper.registerDeserializer(4, new ApplyActionsInstructionDeserializer());
+ helper.registerDeserializer(5, new ClearActionsInstructionDeserializer());
+ helper.registerDeserializer(6, new MeterInstructionDeserializer());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTcpFlagDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4DstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4SrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpOpDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpShaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpSpaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpThaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpTpaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthTypeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4CodeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4TypeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6CodeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6TypeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPhyPortDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPortDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpDscpDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpEcnDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpProtoDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4DstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4SrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6DstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6ExtHdrDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6FlabelDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdSllDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTargetDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTllDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6SrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMetadataDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsBosDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsLabelDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsTcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmPbbIsidDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTunnelIdDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanPcpDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.MatchEntryDeserializerRegistryHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MatchEntryDeserializerInitializer {\r
-\r
- private MatchEntryDeserializerInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers match entry deserializers\r
- * @param registry registry to be filled with deserializers\r
- */\r
- public static void registerMatchEntryDeserializers(DeserializerRegistry registry) {\r
- // register OpenflowBasicClass match entry deserializers\r
- MatchEntryDeserializerRegistryHelper helper =\r
- new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,\r
- OxmMatchConstants.OPENFLOW_BASIC_CLASS, registry);\r
- helper.register(OxmMatchConstants.IN_PORT, new OxmInPortDeserializer());\r
- helper.register(OxmMatchConstants.IN_PHY_PORT, new OxmInPhyPortDeserializer());\r
- helper.register(OxmMatchConstants.METADATA, new OxmMetadataDeserializer());\r
- helper.register(OxmMatchConstants.ETH_DST, new OxmEthDstDeserializer());\r
- helper.register(OxmMatchConstants.ETH_SRC, new OxmEthSrcDeserializer());\r
- helper.register(OxmMatchConstants.ETH_TYPE, new OxmEthTypeDeserializer());\r
- helper.register(OxmMatchConstants.VLAN_VID, new OxmVlanVidDeserializer());\r
- helper.register(OxmMatchConstants.VLAN_PCP, new OxmVlanPcpDeserializer());\r
- helper.register(OxmMatchConstants.IP_DSCP, new OxmIpDscpDeserializer());\r
- helper.register(OxmMatchConstants.IP_ECN, new OxmIpEcnDeserializer());\r
- helper.register(OxmMatchConstants.IP_PROTO, new OxmIpProtoDeserializer());\r
- helper.register(OxmMatchConstants.IPV4_SRC, new OxmIpv4SrcDeserializer());\r
- helper.register(OxmMatchConstants.IPV4_DST, new OxmIpv4DstDeserializer());\r
- helper.register(OxmMatchConstants.TCP_SRC, new OxmTcpSrcDeserializer());\r
- helper.register(OxmMatchConstants.TCP_DST, new OxmTcpDstDeserializer());\r
- helper.register(OxmMatchConstants.UDP_SRC, new OxmUdpSrcDeserializer());\r
- helper.register(OxmMatchConstants.UDP_DST, new OxmUdpDstDeserializer());\r
- helper.register(OxmMatchConstants.SCTP_SRC, new OxmSctpSrcDeserializer());\r
- helper.register(OxmMatchConstants.SCTP_DST, new OxmSctpDstDeserializer());\r
- helper.register(OxmMatchConstants.ICMPV4_TYPE, new OxmIcmpv4TypeDeserializer());\r
- helper.register(OxmMatchConstants.ICMPV4_CODE, new OxmIcmpv4CodeDeserializer());\r
- helper.register(OxmMatchConstants.ARP_OP, new OxmArpOpDeserializer());\r
- helper.register(OxmMatchConstants.ARP_SPA, new OxmArpSpaDeserializer());\r
- helper.register(OxmMatchConstants.ARP_TPA, new OxmArpTpaDeserializer());\r
- helper.register(OxmMatchConstants.ARP_SHA, new OxmArpShaDeserializer());\r
- helper.register(OxmMatchConstants.ARP_THA, new OxmArpThaDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_SRC, new OxmIpv6SrcDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_DST, new OxmIpv6DstDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_FLABEL, new OxmIpv6FlabelDeserializer());\r
- helper.register(OxmMatchConstants.ICMPV6_TYPE, new OxmIcmpv6TypeDeserializer());\r
- helper.register(OxmMatchConstants.ICMPV6_CODE, new OxmIcmpv6CodeDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_ND_TARGET, new OxmIpv6NdTargetDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_ND_SLL, new OxmIpv6NdSllDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_ND_TLL, new OxmIpv6NdTllDeserializer());\r
- helper.register(OxmMatchConstants.MPLS_LABEL, new OxmMplsLabelDeserializer());\r
- helper.register(OxmMatchConstants.MPLS_TC, new OxmMplsTcDeserializer());\r
- helper.register(OxmMatchConstants.MPLS_BOS, new OxmMplsBosDeserializer());\r
- helper.register(OxmMatchConstants.PBB_ISID, new OxmPbbIsidDeserializer());\r
- helper.register(OxmMatchConstants.TUNNEL_ID, new OxmTunnelIdDeserializer());\r
- helper.register(OxmMatchConstants.IPV6_EXTHDR, new OxmIpv6ExtHdrDeserializer());\r
-\r
- // Register NXM1Class match entry deserializers\r
- MatchEntryDeserializerRegistryHelper nxm1helper =\r
- new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,\r
- OxmMatchConstants.NXM_1_CLASS, registry);\r
- nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_SRC, new NxmTunnelIpv4SrcDeserializer());\r
- nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_DST, new NxmTunnelIpv4DstDeserializer());\r
- nxm1helper.register(OxmMatchConstants.NXM_NX_TCP_FLAG, new NxmTcpFlagDeserializer());\r
-\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTcpFlagDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4DstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4SrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpOpDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpShaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpSpaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpThaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpTpaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthTypeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4CodeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4TypeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6CodeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6TypeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPhyPortDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPortDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpDscpDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpEcnDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpProtoDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4DstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4SrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6DstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6ExtHdrDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6FlabelDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdSllDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTargetDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTllDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6SrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMetadataDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsBosDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsLabelDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsTcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmPbbIsidDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTunnelIdDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanPcpDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.MatchEntryDeserializerRegistryHelper;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MatchEntryDeserializerInitializer {
+
+ private MatchEntryDeserializerInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers match entry deserializers
+ * @param registry registry to be filled with deserializers
+ */
+ public static void registerMatchEntryDeserializers(DeserializerRegistry registry) {
+ // register OpenflowBasicClass match entry deserializers
+ MatchEntryDeserializerRegistryHelper helper =
+ new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,
+ OxmMatchConstants.OPENFLOW_BASIC_CLASS, registry);
+ helper.register(OxmMatchConstants.IN_PORT, new OxmInPortDeserializer());
+ helper.register(OxmMatchConstants.IN_PHY_PORT, new OxmInPhyPortDeserializer());
+ helper.register(OxmMatchConstants.METADATA, new OxmMetadataDeserializer());
+ helper.register(OxmMatchConstants.ETH_DST, new OxmEthDstDeserializer());
+ helper.register(OxmMatchConstants.ETH_SRC, new OxmEthSrcDeserializer());
+ helper.register(OxmMatchConstants.ETH_TYPE, new OxmEthTypeDeserializer());
+ helper.register(OxmMatchConstants.VLAN_VID, new OxmVlanVidDeserializer());
+ helper.register(OxmMatchConstants.VLAN_PCP, new OxmVlanPcpDeserializer());
+ helper.register(OxmMatchConstants.IP_DSCP, new OxmIpDscpDeserializer());
+ helper.register(OxmMatchConstants.IP_ECN, new OxmIpEcnDeserializer());
+ helper.register(OxmMatchConstants.IP_PROTO, new OxmIpProtoDeserializer());
+ helper.register(OxmMatchConstants.IPV4_SRC, new OxmIpv4SrcDeserializer());
+ helper.register(OxmMatchConstants.IPV4_DST, new OxmIpv4DstDeserializer());
+ helper.register(OxmMatchConstants.TCP_SRC, new OxmTcpSrcDeserializer());
+ helper.register(OxmMatchConstants.TCP_DST, new OxmTcpDstDeserializer());
+ helper.register(OxmMatchConstants.UDP_SRC, new OxmUdpSrcDeserializer());
+ helper.register(OxmMatchConstants.UDP_DST, new OxmUdpDstDeserializer());
+ helper.register(OxmMatchConstants.SCTP_SRC, new OxmSctpSrcDeserializer());
+ helper.register(OxmMatchConstants.SCTP_DST, new OxmSctpDstDeserializer());
+ helper.register(OxmMatchConstants.ICMPV4_TYPE, new OxmIcmpv4TypeDeserializer());
+ helper.register(OxmMatchConstants.ICMPV4_CODE, new OxmIcmpv4CodeDeserializer());
+ helper.register(OxmMatchConstants.ARP_OP, new OxmArpOpDeserializer());
+ helper.register(OxmMatchConstants.ARP_SPA, new OxmArpSpaDeserializer());
+ helper.register(OxmMatchConstants.ARP_TPA, new OxmArpTpaDeserializer());
+ helper.register(OxmMatchConstants.ARP_SHA, new OxmArpShaDeserializer());
+ helper.register(OxmMatchConstants.ARP_THA, new OxmArpThaDeserializer());
+ helper.register(OxmMatchConstants.IPV6_SRC, new OxmIpv6SrcDeserializer());
+ helper.register(OxmMatchConstants.IPV6_DST, new OxmIpv6DstDeserializer());
+ helper.register(OxmMatchConstants.IPV6_FLABEL, new OxmIpv6FlabelDeserializer());
+ helper.register(OxmMatchConstants.ICMPV6_TYPE, new OxmIcmpv6TypeDeserializer());
+ helper.register(OxmMatchConstants.ICMPV6_CODE, new OxmIcmpv6CodeDeserializer());
+ helper.register(OxmMatchConstants.IPV6_ND_TARGET, new OxmIpv6NdTargetDeserializer());
+ helper.register(OxmMatchConstants.IPV6_ND_SLL, new OxmIpv6NdSllDeserializer());
+ helper.register(OxmMatchConstants.IPV6_ND_TLL, new OxmIpv6NdTllDeserializer());
+ helper.register(OxmMatchConstants.MPLS_LABEL, new OxmMplsLabelDeserializer());
+ helper.register(OxmMatchConstants.MPLS_TC, new OxmMplsTcDeserializer());
+ helper.register(OxmMatchConstants.MPLS_BOS, new OxmMplsBosDeserializer());
+ helper.register(OxmMatchConstants.PBB_ISID, new OxmPbbIsidDeserializer());
+ helper.register(OxmMatchConstants.TUNNEL_ID, new OxmTunnelIdDeserializer());
+ helper.register(OxmMatchConstants.IPV6_EXTHDR, new OxmIpv6ExtHdrDeserializer());
+
+ // Register NXM1Class match entry deserializers
+ MatchEntryDeserializerRegistryHelper nxm1helper =
+ new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,
+ OxmMatchConstants.NXM_1_CLASS, registry);
+ nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_SRC, new NxmTunnelIpv4SrcDeserializer());
+ nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_DST, new NxmTunnelIpv4DstDeserializer());
+ nxm1helper.register(OxmMatchConstants.NXM_NX_TCP_FLAG, new NxmTcpFlagDeserializer());
+
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FlowRemovedMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetAsyncReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10BarrierReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoRequestMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10ErrorMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FeaturesReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FlowRemovedMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10HelloMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PacketInMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PortStatusMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10QueueGetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PacketInMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PortStatusMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.RoleReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.SimpleDeserializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MessageDeserializerInitializer {\r
-\r
- private MessageDeserializerInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers message deserializers\r
- * @param registry registry to be filled with deserializers\r
- */\r
- public static void registerMessageDeserializers(DeserializerRegistry registry) {\r
- // register OF v1.0 message deserializers\r
- SimpleDeserializerRegistryHelper helper =\r
- new SimpleDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);\r
- helper.registerDeserializer(0, null, HelloMessage.class, new OF10HelloMessageFactory());\r
- helper.registerDeserializer(1, null, ErrorMessage.class, new OF10ErrorMessageFactory());\r
- helper.registerDeserializer(2, null, EchoRequestMessage.class, new OF10EchoRequestMessageFactory());\r
- helper.registerDeserializer(3, null, EchoOutput.class, new OF10EchoReplyMessageFactory());\r
- helper.registerDeserializer(6, null, GetFeaturesOutput.class, new OF10FeaturesReplyMessageFactory());\r
- helper.registerDeserializer(8, null, GetConfigOutput.class, new OF10GetConfigReplyMessageFactory());\r
- helper.registerDeserializer(10, null, PacketInMessage.class, new OF10PacketInMessageFactory());\r
- helper.registerDeserializer(11, null, FlowRemovedMessage.class, new OF10FlowRemovedMessageFactory());\r
- helper.registerDeserializer(12, null, PortStatusMessage.class, new OF10PortStatusMessageFactory());\r
- helper.registerDeserializer(17, null, MultipartReplyMessage.class, new OF10StatsReplyMessageFactory());\r
- helper.registerDeserializer(19, null, BarrierOutput.class, new OF10BarrierReplyMessageFactory());\r
- helper.registerDeserializer(21, null, GetQueueConfigOutput.class, new OF10QueueGetConfigReplyMessageFactory());\r
- // register Of v1.3 message deserializers\r
- helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);\r
- helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());\r
- helper.registerDeserializer(1, null, ErrorMessage.class, new ErrorMessageFactory());\r
- helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());\r
- helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());\r
- helper.registerDeserializer(6, null, GetFeaturesOutput.class, new FeaturesReplyMessageFactory());\r
- helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());\r
- helper.registerDeserializer(10, null, PacketInMessage.class, new PacketInMessageFactory());\r
- helper.registerDeserializer(11, null, FlowRemovedMessage.class, new FlowRemovedMessageFactory());\r
- helper.registerDeserializer(12, null, PortStatusMessage.class, new PortStatusMessageFactory());\r
- helper.registerDeserializer(19, null, MultipartReplyMessage.class, new MultipartReplyMessageFactory());\r
- helper.registerDeserializer(21, null, BarrierOutput.class, new BarrierReplyMessageFactory());\r
- helper.registerDeserializer(23, null, GetQueueConfigOutput.class, new QueueGetConfigReplyMessageFactory());\r
- helper.registerDeserializer(25, null, RoleRequestOutput.class, new RoleReplyMessageFactory());\r
- helper.registerDeserializer(27, null, GetAsyncOutput.class, new GetAsyncReplyMessageFactory());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FlowRemovedMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetAsyncReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10BarrierReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoRequestMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10ErrorMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FeaturesReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FlowRemovedMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10HelloMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PacketInMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PortStatusMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10QueueGetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PacketInMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PortStatusMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.RoleReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.SimpleDeserializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MessageDeserializerInitializer {
+
+ private MessageDeserializerInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers message deserializers
+ * @param registry registry to be filled with deserializers
+ */
+ public static void registerMessageDeserializers(DeserializerRegistry registry) {
+ // register OF v1.0 message deserializers
+ SimpleDeserializerRegistryHelper helper =
+ new SimpleDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);
+ helper.registerDeserializer(0, null, HelloMessage.class, new OF10HelloMessageFactory());
+ helper.registerDeserializer(1, null, ErrorMessage.class, new OF10ErrorMessageFactory());
+ helper.registerDeserializer(2, null, EchoRequestMessage.class, new OF10EchoRequestMessageFactory());
+ helper.registerDeserializer(3, null, EchoOutput.class, new OF10EchoReplyMessageFactory());
+ helper.registerDeserializer(6, null, GetFeaturesOutput.class, new OF10FeaturesReplyMessageFactory());
+ helper.registerDeserializer(8, null, GetConfigOutput.class, new OF10GetConfigReplyMessageFactory());
+ helper.registerDeserializer(10, null, PacketInMessage.class, new OF10PacketInMessageFactory());
+ helper.registerDeserializer(11, null, FlowRemovedMessage.class, new OF10FlowRemovedMessageFactory());
+ helper.registerDeserializer(12, null, PortStatusMessage.class, new OF10PortStatusMessageFactory());
+ helper.registerDeserializer(17, null, MultipartReplyMessage.class, new OF10StatsReplyMessageFactory());
+ helper.registerDeserializer(19, null, BarrierOutput.class, new OF10BarrierReplyMessageFactory());
+ helper.registerDeserializer(21, null, GetQueueConfigOutput.class, new OF10QueueGetConfigReplyMessageFactory());
+ // register Of v1.3 message deserializers
+ helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
+ helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());
+ helper.registerDeserializer(1, null, ErrorMessage.class, new ErrorMessageFactory());
+ helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());
+ helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());
+ helper.registerDeserializer(6, null, GetFeaturesOutput.class, new FeaturesReplyMessageFactory());
+ helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());
+ helper.registerDeserializer(10, null, PacketInMessage.class, new PacketInMessageFactory());
+ helper.registerDeserializer(11, null, FlowRemovedMessage.class, new FlowRemovedMessageFactory());
+ helper.registerDeserializer(12, null, PortStatusMessage.class, new PortStatusMessageFactory());
+ helper.registerDeserializer(19, null, MultipartReplyMessage.class, new MultipartReplyMessageFactory());
+ helper.registerDeserializer(21, null, BarrierOutput.class, new BarrierReplyMessageFactory());
+ helper.registerDeserializer(23, null, GetQueueConfigOutput.class, new QueueGetConfigReplyMessageFactory());
+ helper.registerDeserializer(25, null, RoleRequestOutput.class, new RoleReplyMessageFactory());
+ helper.registerDeserializer(27, null, GetAsyncOutput.class, new GetAsyncReplyMessageFactory());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import java.util.Map;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassInitHelper;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class TypeToClassMapInitializer {\r
-\r
- private TypeToClassMapInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Initializes type to class map\r
- * @param messageClassMap\r
- */\r
- public static void initializeTypeToClassMap(Map<TypeToClassKey, Class<?>> messageClassMap) {\r
- // init OF v1.0 mapping\r
- TypeToClassInitHelper helper = \r
- new TypeToClassInitHelper(EncodeConstants.OF10_VERSION_ID, messageClassMap);\r
- helper.registerTypeToClass((short) 0, HelloMessage.class);\r
- helper.registerTypeToClass((short) 1, ErrorMessage.class);\r
- helper.registerTypeToClass((short) 2, EchoRequestMessage.class);\r
- helper.registerTypeToClass((short) 3, EchoOutput.class);\r
- helper.registerTypeToClass((short) 4, ExperimenterMessage.class);\r
- helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);\r
- helper.registerTypeToClass((short) 8, GetConfigOutput.class);\r
- helper.registerTypeToClass((short) 10, PacketInMessage.class);\r
- helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);\r
- helper.registerTypeToClass((short) 12, PortStatusMessage.class);\r
- helper.registerTypeToClass((short) 17, MultipartReplyMessage.class);\r
- helper.registerTypeToClass((short) 19, BarrierOutput.class);\r
- helper.registerTypeToClass((short) 21, GetQueueConfigOutput.class);\r
- // init OF v1.0 mapping\r
- helper = new TypeToClassInitHelper(EncodeConstants.OF13_VERSION_ID, messageClassMap);\r
- helper.registerTypeToClass((short) 0, HelloMessage.class);\r
- helper.registerTypeToClass((short) 1, ErrorMessage.class);\r
- helper.registerTypeToClass((short) 2, EchoRequestMessage.class);\r
- helper.registerTypeToClass((short) 3, EchoOutput.class);\r
- helper.registerTypeToClass((short) 4, ExperimenterMessage.class);\r
- helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);\r
- helper.registerTypeToClass((short) 8, GetConfigOutput.class);\r
- helper.registerTypeToClass((short) 10, PacketInMessage.class);\r
- helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);\r
- helper.registerTypeToClass((short) 12, PortStatusMessage.class);\r
- helper.registerTypeToClass((short) 19, MultipartReplyMessage.class);\r
- helper.registerTypeToClass((short) 21, BarrierOutput.class);\r
- helper.registerTypeToClass((short) 23, GetQueueConfigOutput.class);\r
- helper.registerTypeToClass((short) 25, RoleRequestOutput.class);\r
- helper.registerTypeToClass((short) 27, GetAsyncOutput.class);\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization;
+
+import java.util.Map;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassInitHelper;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class TypeToClassMapInitializer {
+
+ private TypeToClassMapInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Initializes type to class map
+ * @param messageClassMap
+ */
+ public static void initializeTypeToClassMap(Map<TypeToClassKey, Class<?>> messageClassMap) {
+ // init OF v1.0 mapping
+ TypeToClassInitHelper helper =
+ new TypeToClassInitHelper(EncodeConstants.OF10_VERSION_ID, messageClassMap);
+ helper.registerTypeToClass((short) 0, HelloMessage.class);
+ helper.registerTypeToClass((short) 1, ErrorMessage.class);
+ helper.registerTypeToClass((short) 2, EchoRequestMessage.class);
+ helper.registerTypeToClass((short) 3, EchoOutput.class);
+ helper.registerTypeToClass((short) 4, ExperimenterMessage.class);
+ helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);
+ helper.registerTypeToClass((short) 8, GetConfigOutput.class);
+ helper.registerTypeToClass((short) 10, PacketInMessage.class);
+ helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);
+ helper.registerTypeToClass((short) 12, PortStatusMessage.class);
+ helper.registerTypeToClass((short) 17, MultipartReplyMessage.class);
+ helper.registerTypeToClass((short) 19, BarrierOutput.class);
+ helper.registerTypeToClass((short) 21, GetQueueConfigOutput.class);
+ // init OF v1.0 mapping
+ helper = new TypeToClassInitHelper(EncodeConstants.OF13_VERSION_ID, messageClassMap);
+ helper.registerTypeToClass((short) 0, HelloMessage.class);
+ helper.registerTypeToClass((short) 1, ErrorMessage.class);
+ helper.registerTypeToClass((short) 2, EchoRequestMessage.class);
+ helper.registerTypeToClass((short) 3, EchoOutput.class);
+ helper.registerTypeToClass((short) 4, ExperimenterMessage.class);
+ helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);
+ helper.registerTypeToClass((short) 8, GetConfigOutput.class);
+ helper.registerTypeToClass((short) 10, PacketInMessage.class);
+ helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);
+ helper.registerTypeToClass((short) 12, PortStatusMessage.class);
+ helper.registerTypeToClass((short) 19, MultipartReplyMessage.class);
+ helper.registerTypeToClass((short) 21, BarrierOutput.class);
+ helper.registerTypeToClass((short) 23, GetQueueConfigOutput.class);
+ helper.registerTypeToClass((short) 25, RoleRequestOutput.class);
+ helper.registerTypeToClass((short) 27, GetAsyncOutput.class);
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionDeserializer implements OFDeserializer<Action>,\r
- HeaderDeserializer<Action> {\r
-\r
- @Override\r
- public Action deserializeHeader(ByteBuf input) {\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- actionBuilder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- return actionBuilder.build();\r
- }\r
-\r
- protected abstract Class<? extends ActionBase> getType();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionDeserializer implements OFDeserializer<Action>,
+ HeaderDeserializer<Action> {
+
+ @Override
+ public Action deserializeHeader(ByteBuf input) {
+ ActionBuilder actionBuilder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ actionBuilder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ return actionBuilder.build();
+ }
+
+ protected abstract Class<? extends ActionBase> getType();
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractEthertypeActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- EthertypeActionBuilder etherType = new EthertypeActionBuilder();\r
- etherType.setEthertype(new EtherType(input.readUnsignedShort()));\r
- builder.addAugmentation(EthertypeAction.class, etherType.build());\r
- input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);\r
- return builder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractEthertypeActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ EthertypeActionBuilder etherType = new EthertypeActionBuilder();
+ etherType.setEthertype(new EtherType(input.readUnsignedShort()));
+ builder.addAugmentation(EthertypeAction.class, etherType.build());
+ input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
+ return builder.build();
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractHeaderActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);\r
- return builder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractHeaderActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
+ return builder.build();
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yangtools.yang.binding.Augmentation;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractIpAddressActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(final ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.addAugmentation(IpAddressAction.class,\r
- createNwAddressAugmentationAndPad(input));\r
- return builder.build();\r
- }\r
-\r
- private static Augmentation<Action> createNwAddressAugmentationAndPad(final ByteBuf input) {\r
- IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();\r
- ipBuilder.setIpAddress(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));\r
- return ipBuilder.build();\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractIpAddressActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(final ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.addAugmentation(IpAddressAction.class,
+ createNwAddressAugmentationAndPad(input));
+ return builder.build();
+ }
+
+ private static Augmentation<Action> createNwAddressAugmentationAndPad(final ByteBuf input) {
+ IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();
+ ipBuilder.setIpAddress(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));
+ return ipBuilder.build();
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractMacAddressActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.addAugmentation(DlAddressAction.class, createDlAugmentationAndPad(input));\r
- return builder.build();\r
- }\r
-\r
- private static DlAddressAction createDlAugmentationAndPad(ByteBuf input) {\r
- DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();\r
- byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
- input.readBytes(address);\r
- dlBuilder.setDlAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));\r
- input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);\r
- return dlBuilder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractMacAddressActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.addAugmentation(DlAddressAction.class, createDlAugmentationAndPad(input));
+ return builder.build();
+ }
+
+ private static DlAddressAction createDlAugmentationAndPad(ByteBuf input) {
+ DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();
+ byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+ input.readBytes(address);
+ dlBuilder.setDlAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
+ input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);
+ return dlBuilder.build();
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractPortActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- createPortAugmentation(input, builder);\r
- input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);\r
- return builder.build();\r
- }\r
-\r
- protected static void createPortAugmentation(ByteBuf input, ActionBuilder actionBuilder) {\r
- PortActionBuilder portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractPortActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ createPortAugmentation(input, builder);
+ input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
+ return builder.build();
+ }
+
+ protected static void createPortAugmentation(ByteBuf input, ActionBuilder actionBuilder) {
+ PortActionBuilder portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10EnqueueActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- createPortAugmentation(input, builder);\r
- input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);\r
- QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();\r
- queueBuilder.setQueueId(input.readUnsignedInt());\r
- builder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return Enqueue.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10EnqueueActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ createPortAugmentation(input, builder);
+ input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
+ QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();
+ queueBuilder.setQueueId(input.readUnsignedInt());
+ builder.addAugmentation(QueueIdAction.class, queueBuilder.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return Enqueue.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10OutputActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- createPortAugmentation(input, builder);\r
- MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
- maxLen.setMaxLength(input.readUnsignedShort());\r
- builder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return Output.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10OutputActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ createPortAugmentation(input, builder);
+ MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+ maxLen.setMaxLength(input.readUnsignedShort());
+ builder.addAugmentation(MaxLengthAction.class, maxLen.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return Output.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlDstActionDeserializer extends OF10AbstractMacAddressActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetDlDst.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlDstActionDeserializer extends OF10AbstractMacAddressActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetDlDst.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlSrcActionDeserializer extends OF10AbstractMacAddressActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetDlSrc.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlSrcActionDeserializer extends OF10AbstractMacAddressActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetDlSrc.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwDstActionDeserializer extends OF10AbstractIpAddressActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetNwDst.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwDstActionDeserializer extends OF10AbstractIpAddressActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetNwDst.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwSrcActionDeserializer extends OF10AbstractIpAddressActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetNwSrc.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwSrcActionDeserializer extends OF10AbstractIpAddressActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetNwSrc.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwTosActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- NwTosActionBuilder tosBuilder = new NwTosActionBuilder();\r
- tosBuilder.setNwTos(input.readUnsignedByte());\r
- builder.addAugmentation(NwTosAction.class, tosBuilder.build());\r
- input.skipBytes(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetNwTos.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwTosActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ NwTosActionBuilder tosBuilder = new NwTosActionBuilder();
+ tosBuilder.setNwTos(input.readUnsignedByte());
+ builder.addAugmentation(NwTosAction.class, tosBuilder.build());
+ input.skipBytes(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetNwTos.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpDstActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetTpDst.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpDstActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetTpDst.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpSrcActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetTpSrc.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpSrcActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetTpSrc.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- VlanPcpActionBuilder vlanBuilder = new VlanPcpActionBuilder();\r
- vlanBuilder.setVlanPcp(input.readUnsignedByte());\r
- input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);\r
- builder.addAugmentation(VlanPcpAction.class, vlanBuilder.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetVlanPcp.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ VlanPcpActionBuilder vlanBuilder = new VlanPcpActionBuilder();
+ vlanBuilder.setVlanPcp(input.readUnsignedByte());
+ input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);
+ builder.addAugmentation(VlanPcpAction.class, vlanBuilder.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetVlanPcp.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanVidActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();\r
- vlanBuilder.setVlanVid(input.readUnsignedShort());\r
- input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);\r
- builder.addAugmentation(VlanVidAction.class, vlanBuilder.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetVlanVid.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanVidActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();
+ vlanBuilder.setVlanVid(input.readUnsignedShort());
+ input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);
+ builder.addAugmentation(VlanVidAction.class, vlanBuilder.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetVlanVid.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StripVlanActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return StripVlan.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StripVlanActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return StripVlan.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlInActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return CopyTtlIn.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlInActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return CopyTtlIn.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlOutActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return CopyTtlOut.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlOutActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return CopyTtlOut.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecMplsTtlActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return DecMplsTtl.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecMplsTtlActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return DecMplsTtl.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecNwTtlActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return DecNwTtl.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecNwTtlActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return DecNwTtl.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13GroupActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- GroupIdActionBuilder group = new GroupIdActionBuilder();\r
- group.setGroupId(input.readUnsignedInt());\r
- builder.addAugmentation(GroupIdAction.class, group.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return Group.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13GroupActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ GroupIdActionBuilder group = new GroupIdActionBuilder();
+ group.setGroupId(input.readUnsignedInt());
+ builder.addAugmentation(GroupIdAction.class, group.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return Group.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13OutputActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- PortActionBuilder port = new PortActionBuilder();\r
- port.setPort(new PortNumber(input.readUnsignedInt()));\r
- builder.addAugmentation(PortAction.class, port.build());\r
- MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
- maxLen.setMaxLength(input.readUnsignedShort());\r
- builder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
- input.skipBytes(ActionConstants.OUTPUT_PADDING);\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return Output.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13OutputActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ PortActionBuilder port = new PortActionBuilder();
+ port.setPort(new PortNumber(input.readUnsignedInt()));
+ builder.addAugmentation(PortAction.class, port.build());
+ MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+ maxLen.setMaxLength(input.readUnsignedShort());
+ builder.addAugmentation(MaxLengthAction.class, maxLen.build());
+ input.skipBytes(ActionConstants.OUTPUT_PADDING);
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return Output.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopMplsActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return PopMpls.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopMplsActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return PopMpls.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopPbbActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return PopPbb.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopPbbActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return PopPbb.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopVlanActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return PopVlan.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopVlanActionDeserializer extends AbstractHeaderActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return PopVlan.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushMplsActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return PushMpls.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushMplsActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return PushMpls.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushPbbActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return PushPbb.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushPbbActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return PushPbb.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushVlanActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return PushVlan.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushVlanActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return PushVlan.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetFieldActionDeserializer extends AbstractActionDeserializer\r
- implements DeserializerRegistryInjector {\r
-\r
- private DeserializerRegistry registry;\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- int startIndex = input.readerIndex();\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
- int oxmClass = input.getUnsignedShort(input.readerIndex());\r
- // get oxm_field & hasMask byte and extract the field value\r
- int oxmField = input.getUnsignedByte(input.readerIndex()\r
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;\r
- MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- oxmClass, oxmField);\r
- if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {\r
- long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES\r
- + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
- key.setExperimenterId(expId);\r
- }\r
- OFDeserializer<MatchEntries> matchDeserializer = registry.getDeserializer(key);\r
- List<MatchEntries> entry = new ArrayList<>();\r
- entry.add(matchDeserializer.deserialize(input));\r
- matchEntries.setMatchEntries(entry);\r
- builder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
- int paddingRemainder = (input.readerIndex() - startIndex) % EncodeConstants.PADDING;\r
- if (paddingRemainder != 0) {\r
- input.skipBytes(EncodeConstants.PADDING - paddingRemainder);\r
- }\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetField.class;\r
- }\r
-\r
- @Override\r
- public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
- this.registry = deserializerRegistry;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetFieldActionDeserializer extends AbstractActionDeserializer
+ implements DeserializerRegistryInjector {
+
+ private DeserializerRegistry registry;
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ int startIndex = input.readerIndex();
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+ int oxmClass = input.getUnsignedShort(input.readerIndex());
+ // get oxm_field & hasMask byte and extract the field value
+ int oxmField = input.getUnsignedByte(input.readerIndex()
+ + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ oxmClass, oxmField);
+ if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
+ long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
+ + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ key.setExperimenterId(expId);
+ }
+ OFDeserializer<MatchEntries> matchDeserializer = registry.getDeserializer(key);
+ List<MatchEntries> entry = new ArrayList<>();
+ entry.add(matchDeserializer.deserialize(input));
+ matchEntries.setMatchEntries(entry);
+ builder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+ int paddingRemainder = (input.readerIndex() - startIndex) % EncodeConstants.PADDING;
+ if (paddingRemainder != 0) {
+ input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
+ }
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetField.class;
+ }
+
+ @Override
+ public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ this.registry = deserializerRegistry;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetMplsTtlActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();\r
- mplsTtl.setMplsTtl(input.readUnsignedByte());\r
- builder.addAugmentation(MplsTtlAction.class, mplsTtl.build());\r
- input.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetMplsTtl.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetMplsTtlActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();
+ mplsTtl.setMplsTtl(input.readUnsignedByte());
+ builder.addAugmentation(MplsTtlAction.class, mplsTtl.build());
+ input.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetMplsTtl.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetNwTtlActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
- nwTtl.setNwTtl(input.readUnsignedByte());\r
- builder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
- input.skipBytes(ActionConstants.SET_NW_TTL_PADDING);\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetNwTtl.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetNwTtlActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+ nwTtl.setNwTtl(input.readUnsignedByte());
+ builder.addAugmentation(NwTtlAction.class, nwTtl.build());
+ input.skipBytes(ActionConstants.SET_NW_TTL_PADDING);
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetNwTtl.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetQueueActionDeserializer extends AbstractActionDeserializer {\r
-\r
- @Override\r
- public Action deserialize(ByteBuf input) {\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(getType());\r
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- QueueIdActionBuilder queueId = new QueueIdActionBuilder();\r
- queueId.setQueueId(input.readUnsignedInt());\r
- builder.addAugmentation(QueueIdAction.class, queueId.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends ActionBase> getType() {\r
- return SetQueue.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetQueueActionDeserializer extends AbstractActionDeserializer {
+
+ @Override
+ public Action deserialize(ByteBuf input) {
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(getType());
+ input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ QueueIdActionBuilder queueId = new QueueIdActionBuilder();
+ queueId.setQueueId(input.readUnsignedInt());
+ builder.addAugmentation(QueueIdAction.class, queueId.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends ActionBase> getType() {
+ return SetQueue.class;
+ }
+
+}
-/*\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.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMessage>,\r
- DeserializerRegistryInjector {\r
-\r
- /** Experimenter ID index after version, message type and length were read */\r
- private static final byte EXPERIMENTER_ID_INDEX = 4;\r
- private DeserializerRegistry deserializerRegistry;\r
-\r
- @Override\r
- public ExperimenterMessage deserialize(ByteBuf message) {\r
- long expId = message.getUnsignedInt(message.readerIndex() + EXPERIMENTER_ID_INDEX);\r
- OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(\r
- ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
- EncodeConstants.OF13_VERSION_ID, expId));\r
- return deserializer.deserialize(message);\r
- }\r
-\r
- @Override\r
- public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
- this.deserializerRegistry = deserializerRegistry;\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.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMessage>,
+ DeserializerRegistryInjector {
+
+ /** Experimenter ID index after version, message type and length were read */
+ private static final byte EXPERIMENTER_ID_INDEX = 4;
+ private DeserializerRegistry deserializerRegistry;
+
+ @Override
+ public ExperimenterMessage deserialize(ByteBuf message) {
+ long expId = message.getUnsignedInt(message.readerIndex() + EXPERIMENTER_ID_INDEX);
+ OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(
+ ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, expId));
+ return deserializer.deserialize(message);
+ }
+
+ @Override
+ public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ this.deserializerRegistry = deserializerRegistry;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class VendorMessageFactory implements OFDeserializer<ExperimenterMessage>,\r
- DeserializerRegistryInjector {\r
-\r
- private static final byte VENDOR_ID_INDEX = 8;\r
- private DeserializerRegistry deserializerRegistry;\r
-\r
- @Override\r
- public ExperimenterMessage deserialize(ByteBuf message) {\r
- long expId = message.getUnsignedInt(message.readerIndex() + VENDOR_ID_INDEX);\r
- OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(\r
- ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, expId));\r
- return deserializer.deserialize(message);\r
- }\r
-\r
- @Override\r
- public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
- this.deserializerRegistry = deserializerRegistry;\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.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class VendorMessageFactory implements OFDeserializer<ExperimenterMessage>,
+ DeserializerRegistryInjector {
+
+ private static final byte VENDOR_ID_INDEX = 8;
+ private DeserializerRegistry deserializerRegistry;
+
+ @Override
+ public ExperimenterMessage deserialize(ByteBuf message) {
+ long expId = message.getUnsignedInt(message.readerIndex() + VENDOR_ID_INDEX);
+ OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(
+ ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, expId));
+ return deserializer.deserialize(message);
+ }
+
+ @Override
+ public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ this.deserializerRegistry = deserializerRegistry;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMakerFactory;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ListDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionInstructionDeserializer extends AbstractInstructionDeserializer\r
- implements DeserializerRegistryInjector {\r
-\r
- private DeserializerRegistry registry;\r
-\r
- @Override\r
- public Instruction deserialize(ByteBuf input) {\r
- InstructionBuilder builder = new InstructionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(getType());\r
- int instructionLength = input.readUnsignedShort();\r
- input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
- ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();\r
- int length = instructionLength - InstructionConstants.STANDARD_INSTRUCTION_LENGTH;\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- List<Action> actions = ListDeserializer.deserializeList(\r
- EncodeConstants.OF13_VERSION_ID, length, input, keyMaker, getRegistry());\r
- actionsBuilder.setAction(actions);\r
- builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
- return builder.build();\r
- }\r
-\r
- protected abstract Class<? extends InstructionBase> getType();\r
-\r
- protected DeserializerRegistry getRegistry() {\r
- return registry;\r
- }\r
-\r
- @Override\r
- public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
- this.registry = deserializerRegistry;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker;
+import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMakerFactory;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.ListDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionInstructionDeserializer extends AbstractInstructionDeserializer
+ implements DeserializerRegistryInjector {
+
+ private DeserializerRegistry registry;
+
+ @Override
+ public Instruction deserialize(ByteBuf input) {
+ InstructionBuilder builder = new InstructionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(getType());
+ int instructionLength = input.readUnsignedShort();
+ input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+ ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();
+ int length = instructionLength - InstructionConstants.STANDARD_INSTRUCTION_LENGTH;
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ List<Action> actions = ListDeserializer.deserializeList(
+ EncodeConstants.OF13_VERSION_ID, length, input, keyMaker, getRegistry());
+ actionsBuilder.setAction(actions);
+ builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+ return builder.build();
+ }
+
+ protected abstract Class<? extends InstructionBase> getType();
+
+ protected DeserializerRegistry getRegistry() {
+ return registry;
+ }
+
+ @Override
+ public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ this.registry = deserializerRegistry;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>,\r
- HeaderDeserializer<Instruction> {\r
-\r
- @Override\r
- public Instruction deserializeHeader(ByteBuf rawMessage) {\r
- InstructionBuilder builder = processHeader(rawMessage);\r
- rawMessage.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- return builder.build();\r
- }\r
-\r
- protected InstructionBuilder processHeader(ByteBuf input) {\r
- InstructionBuilder builder = new InstructionBuilder();\r
- int type = input.readUnsignedShort();\r
- switch (type) {\r
- case 1:\r
- builder.setType(GotoTable.class);\r
- break;\r
- case 2:\r
- builder.setType(WriteMetadata.class);\r
- break;\r
- case 3:\r
- builder.setType(WriteActions.class);\r
- break;\r
- case 4:\r
- builder.setType(ApplyActions.class);\r
- break;\r
- case 5:\r
- builder.setType(ClearActions.class);\r
- break;\r
- case 6:\r
- builder.setType(Meter.class);\r
- break;\r
- default:\r
- throw new IllegalStateException("Unknown instruction type received, type: " + type);\r
- }\r
- return builder;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>,
+ HeaderDeserializer<Instruction> {
+
+ @Override
+ public Instruction deserializeHeader(ByteBuf rawMessage) {
+ InstructionBuilder builder = processHeader(rawMessage);
+ rawMessage.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ return builder.build();
+ }
+
+ protected InstructionBuilder processHeader(ByteBuf input) {
+ InstructionBuilder builder = new InstructionBuilder();
+ int type = input.readUnsignedShort();
+ switch (type) {
+ case 1:
+ builder.setType(GotoTable.class);
+ break;
+ case 2:
+ builder.setType(WriteMetadata.class);
+ break;
+ case 3:
+ builder.setType(WriteActions.class);
+ break;
+ case 4:
+ builder.setType(ApplyActions.class);
+ break;
+ case 5:
+ builder.setType(ClearActions.class);
+ break;
+ case 6:
+ builder.setType(Meter.class);
+ break;
+ default:
+ throw new IllegalStateException("Unknown instruction type received, type: " + type);
+ }
+ return builder;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ApplyActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends InstructionBase> getType() {\r
- return ApplyActions.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ApplyActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {
+
+ @Override
+ protected Class<? extends InstructionBase> getType() {
+ return ApplyActions.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
- @Override\r
- public Instruction deserialize(ByteBuf input) {\r
- InstructionBuilder builder = super.processHeader(input);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
- ActionsInstructionBuilder actionsBuilder = \r
- new ActionsInstructionBuilder();\r
- List<Action> actions = new ArrayList<>();\r
- actionsBuilder.setAction(actions);\r
- builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
- return builder.build();\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {
+
+ @Override
+ public Instruction deserialize(ByteBuf input) {
+ InstructionBuilder builder = super.processHeader(input);
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+ ActionsInstructionBuilder actionsBuilder =
+ new ActionsInstructionBuilder();
+ List<Action> actions = new ArrayList<>();
+ actionsBuilder.setAction(actions);
+ builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+ return builder.build();
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class GoToTableInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
- @Override\r
- public Instruction deserialize(ByteBuf input) {\r
- InstructionBuilder builder = new InstructionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(GotoTable.class);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- TableIdInstructionBuilder tableBuilder = new TableIdInstructionBuilder();\r
- tableBuilder.setTableId(input.readUnsignedByte());\r
- builder.addAugmentation(TableIdInstruction.class, tableBuilder.build());\r
- input.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);\r
- return builder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class GoToTableInstructionDeserializer extends AbstractInstructionDeserializer {
+
+ @Override
+ public Instruction deserialize(ByteBuf input) {
+ InstructionBuilder builder = new InstructionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(GotoTable.class);
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ TableIdInstructionBuilder tableBuilder = new TableIdInstructionBuilder();
+ tableBuilder.setTableId(input.readUnsignedByte());
+ builder.addAugmentation(TableIdInstruction.class, tableBuilder.build());
+ input.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);
+ return builder.build();
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MeterInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
- @Override\r
- public Instruction deserialize(ByteBuf input) {\r
- InstructionBuilder builder = new InstructionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(Meter.class);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();\r
- meterBuilder.setMeterId(input.readUnsignedInt());\r
- builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());\r
- return builder.build();\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MeterInstructionDeserializer extends AbstractInstructionDeserializer {
+
+ @Override
+ public Instruction deserialize(ByteBuf input) {
+ InstructionBuilder builder = new InstructionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(Meter.class);
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();
+ meterBuilder.setMeterId(input.readUnsignedInt());
+ builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());
+ return builder.build();
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {\r
-\r
- @Override\r
- protected Class<? extends InstructionBase> getType() {\r
- return WriteActions.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {
+
+ @Override
+ protected Class<? extends InstructionBase> getType() {
+ return WriteActions.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
- @Override\r
- public Instruction deserialize(ByteBuf input) {\r
- InstructionBuilder builder = new InstructionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setType(WriteMetadata.class);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);\r
- MetadataInstructionBuilder metadataBuilder = new MetadataInstructionBuilder();\r
- byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- input.readBytes(metadata);\r
- metadataBuilder.setMetadata(metadata);\r
- byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- input.readBytes(metadataMask);\r
- metadataBuilder.setMetadataMask(metadataMask);\r
- builder.addAugmentation(MetadataInstruction.class, metadataBuilder.build());\r
- return builder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {
+
+ @Override
+ public Instruction deserialize(ByteBuf input) {
+ InstructionBuilder builder = new InstructionBuilder();
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setType(WriteMetadata.class);
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
+ MetadataInstructionBuilder metadataBuilder = new MetadataInstructionBuilder();
+ byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ input.readBytes(metadata);
+ metadataBuilder.setMetadata(metadata);
+ byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ input.readBytes(metadataMask);
+ metadataBuilder.setMetadataMask(metadataMask);
+ builder.addAugmentation(MetadataInstruction.class, metadataBuilder.build());
+ return builder.build();
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmIpv4AddressDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(final ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpv4AddressAugmentation(builder, input);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addIpv4AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {\r
- Ipv4AddressMatchEntryBuilder ipv4AddressBuilder = new Ipv4AddressMatchEntryBuilder();\r
- ipv4AddressBuilder.setIpv4Address(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));\r
- builder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4AddressBuilder.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmIpv4AddressDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(final ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpv4AddressAugmentation(builder, input);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addIpv4AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {
+ Ipv4AddressMatchEntryBuilder ipv4AddressBuilder = new Ipv4AddressMatchEntryBuilder();
+ ipv4AddressBuilder.setIpv4Address(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));
+ builder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4AddressBuilder.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmIpv6AddressDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(final ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpv6AddressAugmentation(builder, input);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input,\r
- EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addIpv6AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {\r
- Ipv6AddressMatchEntryBuilder ipv6AddressBuilder = new Ipv6AddressMatchEntryBuilder();\r
- ipv6AddressBuilder.setIpv6Address(new Ipv6Address(ByteBufUtils.readIpv6Address(input)));\r
- builder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6AddressBuilder.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmIpv6AddressDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(final ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpv6AddressAugmentation(builder, input);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input,
+ EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addIpv6AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {
+ Ipv6AddressMatchEntryBuilder ipv6AddressBuilder = new Ipv6AddressMatchEntryBuilder();
+ ipv6AddressBuilder.setIpv6Address(new Ipv6Address(ByteBufUtils.readIpv6Address(input)));
+ builder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6AddressBuilder.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmMacAddressDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addMacAddressAugmentation(builder, input);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.MAC_ADDRESS_LENGTH);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addMacAddressAugmentation(MatchEntriesBuilder builder, ByteBuf input) {\r
- MacAddressMatchEntryBuilder macAddress = new MacAddressMatchEntryBuilder();\r
- byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
- input.readBytes(address);\r
- macAddress.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macAddress.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmMacAddressDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addMacAddressAugmentation(builder, input);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.MAC_ADDRESS_LENGTH);
+ }
+ return builder.build();
+ }
+
+ private static void addMacAddressAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
+ MacAddressMatchEntryBuilder macAddress = new MacAddressMatchEntryBuilder();
+ byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+ input.readBytes(address);
+ macAddress.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
+ builder.addAugmentation(MacAddressMatchEntry.class, macAddress.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserializeHeader(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- return builder.build();\r
- }\r
-\r
- /**\r
- * @return oxm_field class\r
- */\r
- protected abstract Class<? extends MatchField> getOxmField();\r
-\r
- /**\r
- * @return oxm_class class\r
- */\r
- protected abstract Class<? extends OxmClassBase> getOxmClass();\r
-\r
- /**\r
- * Prepares match entry header - sets oxm_class, oxm_field, hasMask\r
- * + sets the buffer.readerIndex() to the end of match entry \r
- * - where augmentation starts\r
- * @param oxmClass oxm class type\r
- * @param oxmField oxm field type\r
- * @param input input bytebuf\r
- * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation\r
- */\r
- protected MatchEntriesBuilder processHeader(Class<? extends OxmClassBase> oxmClass,\r
- Class<? extends MatchField> oxmField, ByteBuf input) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(oxmClass);\r
- // skip oxm_class (provided)\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- builder.setOxmMatchField(oxmField);\r
- boolean hasMask = (input.readUnsignedByte() & 1) != 0;\r
- builder.setHasMask(hasMask);\r
- // skip match entry length - not needed\r
- input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
- return builder;\r
- }\r
- \r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserializeHeader(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ return builder.build();
+ }
+
+ /**
+ * @return oxm_field class
+ */
+ protected abstract Class<? extends MatchField> getOxmField();
+
+ /**
+ * @return oxm_class class
+ */
+ protected abstract Class<? extends OxmClassBase> getOxmClass();
+
+ /**
+ * Prepares match entry header - sets oxm_class, oxm_field, hasMask
+ * + sets the buffer.readerIndex() to the end of match entry
+ * - where augmentation starts
+ * @param oxmClass oxm class type
+ * @param oxmField oxm field type
+ * @param input input bytebuf
+ * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation
+ */
+ protected MatchEntriesBuilder processHeader(Class<? extends OxmClassBase> oxmClass,
+ Class<? extends MatchField> oxmField, ByteBuf input) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(oxmClass);
+ // skip oxm_class (provided)
+ input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ builder.setOxmMatchField(oxmField);
+ boolean hasMask = (input.readUnsignedByte() & 1) != 0;
+ builder.setHasMask(hasMask);
+ // skip match entry length - not needed
+ input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ return builder;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmMetadataDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addMetadataAugmentation(builder, input);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_LONG_IN_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addMetadataAugmentation(MatchEntriesBuilder builder, ByteBuf input) {\r
- MetadataMatchEntryBuilder metadata = new MetadataMatchEntryBuilder();\r
- byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- input.readBytes(metadataBytes);\r
- metadata.setMetadata(metadataBytes);\r
- builder.addAugmentation(MetadataMatchEntry.class, metadata.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmMetadataDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addMetadataAugmentation(builder, input);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addMetadataAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
+ MetadataMatchEntryBuilder metadata = new MetadataMatchEntryBuilder();
+ byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ input.readBytes(metadataBytes);
+ metadata.setMetadata(metadataBytes);
+ builder.addAugmentation(MetadataMatchEntry.class, metadata.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmPortDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addPortAugmentation(builder, input);\r
- return builder.build();\r
- }\r
-\r
- private static void addPortAugmentation(MatchEntriesBuilder builder, ByteBuf input) {\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(input.readUnsignedShort()));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmPortDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addPortAugmentation(builder, input);
+ return builder.build();
+ }
+
+ private static void addPortAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(input.readUnsignedShort()));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\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.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmPortNumberDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- PortNumberMatchEntryBuilder port = new PortNumberMatchEntryBuilder();\r
- port.setPortNumber(new PortNumber(input.readUnsignedInt()));\r
- builder.addAugmentation(PortNumberMatchEntry.class, port.build());\r
- return builder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmPortNumberDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ PortNumberMatchEntryBuilder port = new PortNumberMatchEntryBuilder();
+ port.setPortNumber(new PortNumber(input.readUnsignedInt()));
+ builder.addAugmentation(PortNumberMatchEntry.class, port.build());
+ return builder.build();
+ }
+}
-/*\r
- * Copyright (C) 2014 Red Hat, Inc.\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author brent.salisbury\r
- *\r
- */\r
-public class NxmTcpFlagDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
- private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagDeserializer.class);\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addTcpFlagAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addTcpFlagAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- TcpFlagMatchEntryBuilder tcpFlagMatchEntryBuilder = new TcpFlagMatchEntryBuilder();\r
- tcpFlagMatchEntryBuilder.setTcpFlag(input.readUnsignedShort());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return TcpFlag.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return Nxm1Class.class;\r
- }\r
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTcpFlagDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+ private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagDeserializer.class);
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addTcpFlagAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addTcpFlagAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ TcpFlagMatchEntryBuilder tcpFlagMatchEntryBuilder = new TcpFlagMatchEntryBuilder();
+ tcpFlagMatchEntryBuilder.setTcpFlag(input.readUnsignedShort());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return TcpFlag.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return Nxm1Class.class;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpOpDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addArpOpAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addArpOpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- OpCodeMatchEntryBuilder opcodeBuilder = new OpCodeMatchEntryBuilder();\r
- opcodeBuilder.setOpCode(input.readUnsignedShort());\r
- builder.addAugmentation(OpCodeMatchEntry.class, opcodeBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return ArpOp.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpOpDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addArpOpAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addArpOpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ OpCodeMatchEntryBuilder opcodeBuilder = new OpCodeMatchEntryBuilder();
+ opcodeBuilder.setOpCode(input.readUnsignedShort());
+ builder.addAugmentation(OpCodeMatchEntry.class, opcodeBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return ArpOp.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpShaDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return ArpSha.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpShaDeserializer extends AbstractOxmMacAddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return ArpSha.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpSpaDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return ArpSpa.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpSpaDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return ArpSpa.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpThaDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return ArpTha.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpThaDeserializer extends AbstractOxmMacAddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return ArpTha.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpTpaDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return ArpTpa.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpTpaDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return ArpTpa.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthDstDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return EthDst.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthDstDeserializer extends AbstractOxmMacAddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return EthDst.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthSrcDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return EthSrc.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthSrcDeserializer extends AbstractOxmMacAddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return EthSrc.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthTypeDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addEthTypeAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addEthTypeAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- EthTypeMatchEntryBuilder ethertypeBuilder = new EthTypeMatchEntryBuilder();\r
- ethertypeBuilder.setEthType(new EtherType(input.readUnsignedShort()));\r
- builder.addAugmentation(EthTypeMatchEntry.class, ethertypeBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return EthType.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthTypeDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addEthTypeAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addEthTypeAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ EthTypeMatchEntryBuilder ethertypeBuilder = new EthTypeMatchEntryBuilder();
+ ethertypeBuilder.setEthType(new EtherType(input.readUnsignedShort()));
+ builder.addAugmentation(EthTypeMatchEntry.class, ethertypeBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return EthType.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIcmpv4CodeAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addIcmpv4CodeAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();\r
- icmpv4CodeBuilder.setIcmpv4Code(input.readUnsignedByte());\r
- builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Icmpv4Code.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIcmpv4CodeAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addIcmpv4CodeAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();
+ icmpv4CodeBuilder.setIcmpv4Code(input.readUnsignedByte());
+ builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Icmpv4Code.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4TypeDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIcmpv4TypeAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addIcmpv4TypeAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- Icmpv4TypeMatchEntryBuilder icmpv4TypeBuilder = new Icmpv4TypeMatchEntryBuilder();\r
- icmpv4TypeBuilder.setIcmpv4Type(input.readUnsignedByte());\r
- builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4TypeBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Icmpv4Type.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4TypeDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIcmpv4TypeAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addIcmpv4TypeAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ Icmpv4TypeMatchEntryBuilder icmpv4TypeBuilder = new Icmpv4TypeMatchEntryBuilder();
+ icmpv4TypeBuilder.setIcmpv4Type(input.readUnsignedByte());
+ builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4TypeBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Icmpv4Type.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6CodeDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIcmpv6CodeAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addIcmpv6CodeAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();\r
- icmpv6CodeBuilder.setIcmpv6Code(input.readUnsignedByte());\r
- builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Icmpv6Code.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6CodeDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIcmpv6CodeAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addIcmpv6CodeAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();
+ icmpv6CodeBuilder.setIcmpv6Code(input.readUnsignedByte());
+ builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Icmpv6Code.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6TypeDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();\r
- icmpv6TypeBuilder.setIcmpv6Type(input.readUnsignedByte());\r
- builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());\r
- return builder.build();\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Icmpv6Type.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6TypeDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();
+ icmpv6TypeBuilder.setIcmpv6Type(input.readUnsignedByte());
+ builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());
+ return builder.build();
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Icmpv6Type.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPhyPortDeserializer extends AbstractOxmPortNumberDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return InPhyPort.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPhyPortDeserializer extends AbstractOxmPortNumberDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return InPhyPort.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPortDeserializer extends AbstractOxmPortNumberDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return InPort.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPortDeserializer extends AbstractOxmPortNumberDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return InPort.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpDscpDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpDscpAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addIpDscpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
- dscpBuilder.setDscp(new Dscp(input.readUnsignedByte()));\r
- builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return IpDscp.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpDscpDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpDscpAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addIpDscpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();
+ dscpBuilder.setDscp(new Dscp(input.readUnsignedByte()));
+ builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return IpDscp.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpEcnDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpEcnAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addIpEcnAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();\r
- ecnBuilder.setEcn(input.readUnsignedByte());\r
- builder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return IpEcn.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpEcnDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpEcnAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addIpEcnAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();
+ ecnBuilder.setEcn(input.readUnsignedByte());
+ builder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return IpEcn.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpProtoDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpProtoAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addIpProtoAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- ProtocolNumberMatchEntryBuilder protoNumberBuilder = new ProtocolNumberMatchEntryBuilder();\r
- protoNumberBuilder.setProtocolNumber(input.readUnsignedByte());\r
- builder.addAugmentation(ProtocolNumberMatchEntry.class, protoNumberBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return IpProto.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpProtoDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpProtoAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addIpProtoAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ ProtocolNumberMatchEntryBuilder protoNumberBuilder = new ProtocolNumberMatchEntryBuilder();
+ protoNumberBuilder.setProtocolNumber(input.readUnsignedByte());
+ builder.addAugmentation(ProtocolNumberMatchEntry.class, protoNumberBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return IpProto.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4DstDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv4Dst.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4DstDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv4Dst.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4SrcDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv4Src.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4SrcDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv4Src.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6DstDeserializer extends AbstractOxmIpv6AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6Dst.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6DstDeserializer extends AbstractOxmIpv6AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6Dst.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpv6ExtHdrAugmentation(input, builder);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addIpv6ExtHdrAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
- int bitmap = input.readUnsignedShort();\r
- final Boolean nonext = ((bitmap) & (1<<0)) != 0;\r
- final Boolean esp = ((bitmap) & (1<<1)) != 0;\r
- final Boolean auth = ((bitmap) & (1<<2)) != 0;\r
- final Boolean dest = ((bitmap) & (1<<3)) != 0;\r
- final Boolean frag = ((bitmap) & (1<<4)) != 0;\r
- final Boolean router = ((bitmap) & (1<<5)) != 0;\r
- final Boolean hop = ((bitmap) & (1<<6)) != 0;\r
- final Boolean unrep = ((bitmap) & (1<<7)) != 0;\r
- final Boolean unseq = ((bitmap) & (1<<8)) != 0;\r
- pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(auth, dest, esp, frag, hop, nonext, router, unrep, unseq));\r
- builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6Exthdr.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpv6ExtHdrAugmentation(input, builder);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addIpv6ExtHdrAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();
+ int bitmap = input.readUnsignedShort();
+ final Boolean nonext = ((bitmap) & (1<<0)) != 0;
+ final Boolean esp = ((bitmap) & (1<<1)) != 0;
+ final Boolean auth = ((bitmap) & (1<<2)) != 0;
+ final Boolean dest = ((bitmap) & (1<<3)) != 0;
+ final Boolean frag = ((bitmap) & (1<<4)) != 0;
+ final Boolean router = ((bitmap) & (1<<5)) != 0;
+ final Boolean hop = ((bitmap) & (1<<6)) != 0;
+ final Boolean unrep = ((bitmap) & (1<<7)) != 0;
+ final Boolean unseq = ((bitmap) & (1<<8)) != 0;
+ pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(auth, dest, esp, frag, hop, nonext, router, unrep, unseq));
+ builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6Exthdr.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addIpv6FlabelAugmentation(input, builder);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addIpv6FlabelAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- Ipv6FlabelMatchEntryBuilder ipv6FlabelBuilder = new Ipv6FlabelMatchEntryBuilder();\r
- ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(input.readUnsignedInt()));\r
- builder.addAugmentation(Ipv6FlabelMatchEntry.class, ipv6FlabelBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6Flabel.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addIpv6FlabelAugmentation(input, builder);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addIpv6FlabelAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ Ipv6FlabelMatchEntryBuilder ipv6FlabelBuilder = new Ipv6FlabelMatchEntryBuilder();
+ ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(input.readUnsignedInt()));
+ builder.addAugmentation(Ipv6FlabelMatchEntry.class, ipv6FlabelBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6Flabel.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdSllDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6NdSll.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdSllDeserializer extends AbstractOxmMacAddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6NdSll.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTargetDeserializer extends AbstractOxmIpv6AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6NdTarget.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTargetDeserializer extends AbstractOxmIpv6AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6NdTarget.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTllDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6NdTll.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTllDeserializer extends AbstractOxmMacAddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6NdTll.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6SrcDeserializer extends AbstractOxmIpv6AddressDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Ipv6Src.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6SrcDeserializer extends AbstractOxmIpv6AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Ipv6Src.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class OxmMaskDeserializer {\r
-\r
- private OxmMaskDeserializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Appends mask to match entry (match entry builder)\r
- * @param builder builder which the mask will append to\r
- * @param input input ByteBuf\r
- * @param matchEntryLength mask length\r
- */\r
- public static void addMaskAugmentation(MatchEntriesBuilder builder, ByteBuf input,\r
- int matchEntryLength) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- byte[] mask = new byte[matchEntryLength];\r
- input.readBytes(mask);\r
- maskBuilder.setMask(mask);\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class OxmMaskDeserializer {
+
+ private OxmMaskDeserializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Appends mask to match entry (match entry builder)
+ * @param builder builder which the mask will append to
+ * @param input input ByteBuf
+ * @param matchEntryLength mask length
+ */
+ public static void addMaskAugmentation(MatchEntriesBuilder builder, ByteBuf input,
+ int matchEntryLength) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ byte[] mask = new byte[matchEntryLength];
+ input.readBytes(mask);
+ maskBuilder.setMask(mask);
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataDeserializer extends AbstractOxmMetadataDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return Metadata.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataDeserializer extends AbstractOxmMetadataDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return Metadata.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addMplsBosDeserializer(input, builder);\r
- return builder.build();\r
- }\r
-\r
-\r
- private static void addMplsBosDeserializer(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
- if (input.readUnsignedByte() != 0) {\r
- bosBuilder.setBos(true);\r
- } else {\r
- bosBuilder.setBos(false);\r
- }\r
- builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return MplsBos.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addMplsBosDeserializer(input, builder);
+ return builder.build();
+ }
+
+
+ private static void addMplsBosDeserializer(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();
+ if (input.readUnsignedByte() != 0) {
+ bosBuilder.setBos(true);
+ } else {
+ bosBuilder.setBos(false);
+ }
+ builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return MplsBos.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsLabelDeserializer extends AbstractOxmMatchEntryDeserializer\r
-implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addMplsLabelAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addMplsLabelAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- MplsLabelMatchEntryBuilder mplsLabelBuilder = new MplsLabelMatchEntryBuilder();\r
- mplsLabelBuilder.setMplsLabel(input.readUnsignedInt());\r
- builder.addAugmentation(MplsLabelMatchEntry.class, mplsLabelBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return MplsLabel.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsLabelDeserializer extends AbstractOxmMatchEntryDeserializer
+implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addMplsLabelAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addMplsLabelAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ MplsLabelMatchEntryBuilder mplsLabelBuilder = new MplsLabelMatchEntryBuilder();
+ mplsLabelBuilder.setMplsLabel(input.readUnsignedInt());
+ builder.addAugmentation(MplsLabelMatchEntry.class, mplsLabelBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return MplsLabel.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addMplsTcAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addMplsTcAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
- tcBuilder.setTc(input.readUnsignedByte());\r
- builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return MplsTc.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addMplsTcAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addMplsTcAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();
+ tcBuilder.setTc(input.readUnsignedByte());
+ builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return MplsTc.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addPbbIsidAugmentation(input, builder);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_3_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addPbbIsidAugmentation(ByteBuf input,\r
- MatchEntriesBuilder builder) {\r
- IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
- Integer isid = input.readUnsignedMedium();\r
- isidBuilder.setIsid(isid.longValue());\r
- builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return PbbIsid.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addPbbIsidAugmentation(input, builder);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_3_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addPbbIsidAugmentation(ByteBuf input,
+ MatchEntriesBuilder builder) {
+ IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();
+ Integer isid = input.readUnsignedMedium();
+ isidBuilder.setIsid(isid.longValue());
+ builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return PbbIsid.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpDstDeserializer extends AbstractOxmPortDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return SctpDst.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpDstDeserializer extends AbstractOxmPortDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return SctpDst.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpSrcDeserializer extends AbstractOxmPortDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return SctpSrc.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpSrcDeserializer extends AbstractOxmPortDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return SctpSrc.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpDstDeserializer extends AbstractOxmPortDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return TcpDst.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpDstDeserializer extends AbstractOxmPortDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return TcpDst.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpSrcDeserializer extends AbstractOxmPortDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return TcpSrc.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpSrcDeserializer extends AbstractOxmPortDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return TcpSrc.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTunnelIdDeserializer extends AbstractOxmMetadataDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return TunnelId.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTunnelIdDeserializer extends AbstractOxmMetadataDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return TunnelId.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpDstDeserializer extends AbstractOxmPortDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return UdpDst.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpDstDeserializer extends AbstractOxmPortDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return UdpDst.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpSrcDeserializer extends AbstractOxmPortDeserializer {\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return UdpSrc.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpSrcDeserializer extends AbstractOxmPortDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return UdpSrc.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanPcpDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addVlanPcpAugmentation(input, builder);\r
- return builder.build();\r
- }\r
-\r
- private static void addVlanPcpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- VlanPcpMatchEntryBuilder vlanPcpBuilder = new VlanPcpMatchEntryBuilder();\r
- vlanPcpBuilder.setVlanPcp(input.readUnsignedByte());\r
- builder.addAugmentation(VlanPcpMatchEntry.class, vlanPcpBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return VlanPcp.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanPcpDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addVlanPcpAugmentation(input, builder);
+ return builder.build();
+ }
+
+ private static void addVlanPcpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ VlanPcpMatchEntryBuilder vlanPcpBuilder = new VlanPcpMatchEntryBuilder();
+ vlanPcpBuilder.setVlanPcp(input.readUnsignedByte());
+ builder.addAugmentation(VlanPcpMatchEntry.class, vlanPcpBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return VlanPcp.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidDeserializer extends AbstractOxmMatchEntryDeserializer\r
- implements OFDeserializer<MatchEntries> {\r
-\r
- @Override\r
- public MatchEntries deserialize(ByteBuf input) {\r
- MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
- addVlanVidAugmentation(input, builder);\r
- if (builder.isHasMask()) {\r
- OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- }\r
- return builder.build();\r
- }\r
-\r
- private static void addVlanVidAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
- VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();\r
- int vidEntryValue = input.readUnsignedShort();\r
- vlanVidBuilder.setCfiBit((vidEntryValue & (1 << 12)) != 0); // cfi is 13-th bit\r
- vlanVidBuilder.setVlanVid(vidEntryValue & ((1 << 12) - 1)); // value without 13-th bit\r
- builder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());\r
- }\r
-\r
- @Override\r
- protected Class<? extends MatchField> getOxmField() {\r
- return VlanVid.class;\r
- }\r
-\r
- @Override\r
- protected Class<? extends OxmClassBase> getOxmClass() {\r
- return OpenflowBasicClass.class;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidDeserializer extends AbstractOxmMatchEntryDeserializer
+ implements OFDeserializer<MatchEntries> {
+
+ @Override
+ public MatchEntries deserialize(ByteBuf input) {
+ MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+ addVlanVidAugmentation(input, builder);
+ if (builder.isHasMask()) {
+ OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ }
+ return builder.build();
+ }
+
+ private static void addVlanVidAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+ VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
+ int vidEntryValue = input.readUnsignedShort();
+ vlanVidBuilder.setCfiBit((vidEntryValue & (1 << 12)) != 0); // cfi is 13-th bit
+ vlanVidBuilder.setVlanVid(vidEntryValue & ((1 << 12) - 1)); // value without 13-th bit
+ builder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
+ }
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return VlanVid.class;
+ }
+
+ @Override
+ protected Class<? extends OxmClassBase> getOxmClass() {
+ return OpenflowBasicClass.class;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10EnqueueActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10OutputActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlDstActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlSrcActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwDstActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwSrcActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwTosActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpDstActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpSrcActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanPcpActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanVidActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10StripVlanActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlInActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlOutActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecMplsTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecNwTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13GroupActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13OutputActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopMplsActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopPbbActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopVlanActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushMplsActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushPbbActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushVlanActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetFieldActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetMplsTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetNwTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetQueueActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionSerializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
-\r
-/**\r
- * Initializes serializer registry with action serializers\r
- * @author michal.polkorab\r
- */\r
-public final class ActionsInitializer {\r
-\r
- private ActionsInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers action serializers into provided registry\r
- * @param serializerRegistry registry to be initialized with action serializers\r
- */\r
- public static void registerActionSerializers(SerializerRegistry serializerRegistry) {\r
- // register OF v1.0 action serializers\r
- ActionSerializerRegistryHelper helper = new ActionSerializerRegistryHelper(\r
- EncodeConstants.OF10_VERSION_ID, serializerRegistry);\r
- helper.registerSerializer(Output.class, new OF10OutputActionSerializer());\r
- helper.registerSerializer(SetVlanVid.class, new OF10SetVlanVidActionSerializer());\r
- helper.registerSerializer(SetVlanPcp.class, new OF10SetVlanPcpActionSerializer());\r
- helper.registerSerializer(StripVlan.class, new OF10StripVlanActionSerializer());\r
- helper.registerSerializer(SetDlSrc.class, new OF10SetDlSrcActionSerializer());\r
- helper.registerSerializer(SetDlDst.class, new OF10SetDlDstActionSerializer());\r
- helper.registerSerializer(SetNwSrc.class, new OF10SetNwSrcActionSerializer());\r
- helper.registerSerializer(SetNwDst.class, new OF10SetNwDstActionSerializer());\r
- helper.registerSerializer(SetNwTos.class, new OF10SetNwTosActionSerializer());\r
- helper.registerSerializer(SetTpSrc.class, new OF10SetTpSrcActionSerializer());\r
- helper.registerSerializer(SetTpDst.class, new OF10SetTpDstActionSerializer());\r
- helper.registerSerializer(Enqueue.class, new OF10EnqueueActionSerializer());\r
- // register OF v1.0 action serializers\r
- helper = new ActionSerializerRegistryHelper(\r
- EncodeConstants.OF13_VERSION_ID, serializerRegistry);\r
- helper.registerSerializer(Output.class, new OF13OutputActionSerializer());\r
- helper.registerSerializer(CopyTtlOut.class, new OF13CopyTtlOutActionSerializer());\r
- helper.registerSerializer(CopyTtlIn.class, new OF13CopyTtlInActionSerializer());\r
- helper.registerSerializer(SetMplsTtl.class, new OF13SetMplsTtlActionSerializer());\r
- helper.registerSerializer(DecMplsTtl.class, new OF13DecMplsTtlActionSerializer());\r
- helper.registerSerializer(PushVlan.class, new OF13PushVlanActionSerializer());\r
- helper.registerSerializer(PopVlan.class, new OF13PopVlanActionSerializer());\r
- helper.registerSerializer(PushMpls.class, new OF13PushMplsActionSerializer());\r
- helper.registerSerializer(PopMpls.class, new OF13PopMplsActionSerializer());\r
- helper.registerSerializer(SetQueue.class, new OF13SetQueueActionSerializer());\r
- helper.registerSerializer(Group.class, new OF13GroupActionSerializer());\r
- helper.registerSerializer(SetNwTtl.class, new OF13SetNwTtlActionSerializer());\r
- helper.registerSerializer(DecNwTtl.class, new OF13DecNwTtlActionSerializer());\r
- helper.registerSerializer(SetField.class, new OF13SetFieldActionSerializer());\r
- helper.registerSerializer(PushPbb.class, new OF13PushPbbActionSerializer());\r
- helper.registerSerializer(PopPbb.class, new OF13PopPbbActionSerializer());\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10EnqueueActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10OutputActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlDstActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlSrcActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwDstActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwSrcActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwTosActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpDstActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpSrcActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanPcpActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanVidActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10StripVlanActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlInActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlOutActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecMplsTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecNwTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13GroupActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13OutputActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopMplsActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopPbbActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopVlanActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushMplsActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushPbbActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushVlanActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetFieldActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetMplsTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetNwTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetQueueActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionSerializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;
+
+/**
+ * Initializes serializer registry with action serializers
+ * @author michal.polkorab
+ */
+public final class ActionsInitializer {
+
+ private ActionsInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers action serializers into provided registry
+ * @param serializerRegistry registry to be initialized with action serializers
+ */
+ public static void registerActionSerializers(SerializerRegistry serializerRegistry) {
+ // register OF v1.0 action serializers
+ ActionSerializerRegistryHelper helper = new ActionSerializerRegistryHelper(
+ EncodeConstants.OF10_VERSION_ID, serializerRegistry);
+ helper.registerSerializer(Output.class, new OF10OutputActionSerializer());
+ helper.registerSerializer(SetVlanVid.class, new OF10SetVlanVidActionSerializer());
+ helper.registerSerializer(SetVlanPcp.class, new OF10SetVlanPcpActionSerializer());
+ helper.registerSerializer(StripVlan.class, new OF10StripVlanActionSerializer());
+ helper.registerSerializer(SetDlSrc.class, new OF10SetDlSrcActionSerializer());
+ helper.registerSerializer(SetDlDst.class, new OF10SetDlDstActionSerializer());
+ helper.registerSerializer(SetNwSrc.class, new OF10SetNwSrcActionSerializer());
+ helper.registerSerializer(SetNwDst.class, new OF10SetNwDstActionSerializer());
+ helper.registerSerializer(SetNwTos.class, new OF10SetNwTosActionSerializer());
+ helper.registerSerializer(SetTpSrc.class, new OF10SetTpSrcActionSerializer());
+ helper.registerSerializer(SetTpDst.class, new OF10SetTpDstActionSerializer());
+ helper.registerSerializer(Enqueue.class, new OF10EnqueueActionSerializer());
+ // register OF v1.0 action serializers
+ helper = new ActionSerializerRegistryHelper(
+ EncodeConstants.OF13_VERSION_ID, serializerRegistry);
+ helper.registerSerializer(Output.class, new OF13OutputActionSerializer());
+ helper.registerSerializer(CopyTtlOut.class, new OF13CopyTtlOutActionSerializer());
+ helper.registerSerializer(CopyTtlIn.class, new OF13CopyTtlInActionSerializer());
+ helper.registerSerializer(SetMplsTtl.class, new OF13SetMplsTtlActionSerializer());
+ helper.registerSerializer(DecMplsTtl.class, new OF13DecMplsTtlActionSerializer());
+ helper.registerSerializer(PushVlan.class, new OF13PushVlanActionSerializer());
+ helper.registerSerializer(PopVlan.class, new OF13PopVlanActionSerializer());
+ helper.registerSerializer(PushMpls.class, new OF13PushMplsActionSerializer());
+ helper.registerSerializer(PopMpls.class, new OF13PopMplsActionSerializer());
+ helper.registerSerializer(SetQueue.class, new OF13SetQueueActionSerializer());
+ helper.registerSerializer(Group.class, new OF13GroupActionSerializer());
+ helper.registerSerializer(SetNwTtl.class, new OF13SetNwTtlActionSerializer());
+ helper.registerSerializer(DecNwTtl.class, new OF13DecNwTtlActionSerializer());
+ helper.registerSerializer(SetField.class, new OF13SetFieldActionSerializer());
+ helper.registerSerializer(PushPbb.class, new OF13PushPbbActionSerializer());
+ helper.registerSerializer(PopPbb.class, new OF13PopPbbActionSerializer());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ApplyActionsInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ClearActionsInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.GoToTableInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.MeterInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteActionsInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteMetadataInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionSerializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class InstructionsInitializer {\r
-\r
- private InstructionsInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers instruction serializers into provided registry\r
- * @param serializerRegistry registry to be initialized with instruction serializers\r
- */\r
- public static void registerInstructionSerializers(SerializerRegistry serializerRegistry) {\r
- // register OF v1.3 instruction serializers\r
- InstructionSerializerRegistryHelper helper= new InstructionSerializerRegistryHelper(\r
- EncodeConstants.OF13_VERSION_ID, serializerRegistry);\r
- helper.registerSerializer(GotoTable.class, new GoToTableInstructionSerializer());\r
- helper.registerSerializer(WriteMetadata.class, new WriteMetadataInstructionSerializer());\r
- helper.registerSerializer(WriteActions.class, new WriteActionsInstructionSerializer());\r
- helper.registerSerializer(ApplyActions.class, new ApplyActionsInstructionSerializer());\r
- helper.registerSerializer(ClearActions.class, new ClearActionsInstructionSerializer());\r
- helper.registerSerializer(Meter.class, new MeterInstructionSerializer());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ApplyActionsInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ClearActionsInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.GoToTableInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.MeterInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteActionsInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteMetadataInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionSerializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class InstructionsInitializer {
+
+ private InstructionsInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers instruction serializers into provided registry
+ * @param serializerRegistry registry to be initialized with instruction serializers
+ */
+ public static void registerInstructionSerializers(SerializerRegistry serializerRegistry) {
+ // register OF v1.3 instruction serializers
+ InstructionSerializerRegistryHelper helper= new InstructionSerializerRegistryHelper(
+ EncodeConstants.OF13_VERSION_ID, serializerRegistry);
+ helper.registerSerializer(GotoTable.class, new GoToTableInstructionSerializer());
+ helper.registerSerializer(WriteMetadata.class, new WriteMetadataInstructionSerializer());
+ helper.registerSerializer(WriteActions.class, new WriteActionsInstructionSerializer());
+ helper.registerSerializer(ApplyActions.class, new ApplyActionsInstructionSerializer());
+ helper.registerSerializer(ClearActions.class, new ClearActionsInstructionSerializer());
+ helper.registerSerializer(Meter.class, new MeterInstructionSerializer());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTcpFlagSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4DstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4SrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-\r
-/**\r
- * Initializes serializer registry with match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public final class MatchEntriesInitializer {\r
-\r
- private MatchEntriesInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers match entry serializers into provided registry\r
- * @param serializerRegistry registry to be initialized with match entry serializers\r
- */\r
- public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {\r
- // register OF v1.3 OpenflowBasicClass match entry serializers\r
- Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;\r
- MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper =\r
- new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,\r
- oxmClass, serializerRegistry);\r
- helper.registerSerializer(InPort.class, new OxmInPortSerializer());\r
- helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());\r
- helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());\r
- helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());\r
- helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());\r
- helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());\r
- helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());\r
- helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());\r
- helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());\r
- helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());\r
- helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());\r
- helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());\r
- helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());\r
- helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());\r
- helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());\r
- helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());\r
- helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());\r
- helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());\r
- helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());\r
- helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());\r
- helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());\r
- helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());\r
- helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());\r
- helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());\r
- helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());\r
- helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());\r
- helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());\r
- helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());\r
- helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());\r
- helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());\r
- helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());\r
- helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());\r
- helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());\r
- helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());\r
- helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());\r
- helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());\r
- helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());\r
- helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());\r
- helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());\r
- helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());\r
-\r
- // Register OpenFlow NXM1Class match entry serializer\r
- Class<Nxm1Class> nxm1Class = Nxm1Class.class;\r
- MatchEntrySerializerRegistryHelper<Nxm1Class> nxm1RegistryHelper =\r
- new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,\r
- nxm1Class, serializerRegistry);\r
- nxm1RegistryHelper.registerSerializer(TunnelIpv4Dst.class, new NxmTunnelIpv4DstSerializer());\r
- nxm1RegistryHelper.registerSerializer(TunnelIpv4Src.class, new NxmTunnelIpv4SrcSerializer());\r
- nxm1RegistryHelper.registerSerializer(TcpFlag.class, new NxmTcpFlagSerializer());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTcpFlagSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4DstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4SrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+
+/**
+ * Initializes serializer registry with match entry serializers
+ * @author michal.polkorab
+ */
+public final class MatchEntriesInitializer {
+
+ private MatchEntriesInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers match entry serializers into provided registry
+ * @param serializerRegistry registry to be initialized with match entry serializers
+ */
+ public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {
+ // register OF v1.3 OpenflowBasicClass match entry serializers
+ Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;
+ MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper =
+ new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,
+ oxmClass, serializerRegistry);
+ helper.registerSerializer(InPort.class, new OxmInPortSerializer());
+ helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());
+ helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());
+ helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());
+ helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());
+ helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());
+ helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());
+ helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());
+ helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());
+ helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());
+ helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());
+ helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());
+ helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());
+ helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());
+ helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());
+ helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());
+ helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());
+ helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());
+ helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());
+ helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());
+ helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());
+ helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());
+ helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());
+ helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());
+ helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());
+ helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());
+ helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());
+ helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());
+ helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());
+ helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());
+ helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());
+ helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());
+ helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());
+ helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());
+ helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());
+ helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());
+ helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());
+ helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());
+ helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());
+ helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());
+
+ // Register OpenFlow NXM1Class match entry serializer
+ Class<Nxm1Class> nxm1Class = Nxm1Class.class;
+ MatchEntrySerializerRegistryHelper<Nxm1Class> nxm1RegistryHelper =
+ new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,
+ nxm1Class, serializerRegistry);
+ nxm1RegistryHelper.registerSerializer(TunnelIpv4Dst.class, new NxmTunnelIpv4DstSerializer());
+ nxm1RegistryHelper.registerSerializer(TunnelIpv4Src.class, new NxmTunnelIpv4SrcSerializer());
+ nxm1RegistryHelper.registerSerializer(TcpFlag.class, new NxmTcpFlagSerializer());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.BarrierInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoReplyInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.ExperimenterInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.FlowModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetAsyncRequestMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetConfigInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetFeaturesInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetQueueConfigInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GroupModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.HelloInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MeterModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10BarrierInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10FlowModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10HelloInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PacketOutInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PortModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10QueueGetConfigInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PacketOutInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PortModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.RoleRequestInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetAsyncInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetConfigMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.TableModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CommonMessageRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MessageFactoryInitializer {\r
-\r
- private MessageFactoryInitializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Registers message serializers into provided registry\r
- * @param serializerRegistry registry to be initialized with message serializers\r
- */\r
- public static void registerMessageSerializers(SerializerRegistry serializerRegistry) {\r
- // register OF v1.0 message serializers\r
- short version = EncodeConstants.OF10_VERSION_ID;\r
- CommonMessageRegistryHelper registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
- registryHelper.registerSerializer(BarrierInput.class, new OF10BarrierInputMessageFactory());\r
- registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());\r
- registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());\r
- registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());\r
- registryHelper.registerSerializer(FlowModInput.class, new OF10FlowModInputMessageFactory());\r
- registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());\r
- registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());\r
- registryHelper.registerSerializer(GetQueueConfigInput.class, new OF10QueueGetConfigInputMessageFactory());\r
- registryHelper.registerSerializer(HelloInput.class, new OF10HelloInputMessageFactory());\r
- registryHelper.registerSerializer(MultipartRequestInput.class, new OF10StatsRequestInputFactory());\r
- registryHelper.registerSerializer(PacketOutInput.class, new OF10PacketOutInputMessageFactory());\r
- registryHelper.registerSerializer(PortModInput.class, new OF10PortModInputMessageFactory());\r
- registryHelper.registerSerializer(SetConfigInput.class, new SetConfigMessageFactory());\r
- // register OF v1.3 message serializers\r
- version = EncodeConstants.OF13_VERSION_ID;\r
- registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
- registryHelper.registerSerializer(BarrierInput.class, new BarrierInputMessageFactory());\r
- registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());\r
- registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());\r
- registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());\r
- registryHelper.registerSerializer(FlowModInput.class, new FlowModInputMessageFactory());\r
- registryHelper.registerSerializer(GetAsyncInput.class, new GetAsyncRequestMessageFactory());\r
- registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());\r
- registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());\r
- registryHelper.registerSerializer(GetQueueConfigInput.class, new GetQueueConfigInputMessageFactory());\r
- registryHelper.registerSerializer(GroupModInput.class, new GroupModInputMessageFactory());\r
- registryHelper.registerSerializer(HelloInput.class, new HelloInputMessageFactory());\r
- registryHelper.registerSerializer(MeterModInput.class, new MeterModInputMessageFactory());\r
- registryHelper.registerSerializer(MultipartRequestInput.class, new MultipartRequestInputFactory());\r
- registryHelper.registerSerializer(PacketOutInput.class, new PacketOutInputMessageFactory());\r
- registryHelper.registerSerializer(PortModInput.class, new PortModInputMessageFactory());\r
- registryHelper.registerSerializer(RoleRequestInput.class, new RoleRequestInputMessageFactory());\r
- registryHelper.registerSerializer(SetAsyncInput.class, new SetAsyncInputMessageFactory());\r
- registryHelper.registerSerializer( SetConfigInput.class, new SetConfigMessageFactory());\r
- registryHelper.registerSerializer(TableModInput.class, new TableModInputMessageFactory());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.BarrierInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoReplyInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.ExperimenterInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.FlowModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetAsyncRequestMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetConfigInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetFeaturesInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetQueueConfigInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GroupModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.HelloInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MeterModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10BarrierInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10FlowModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10HelloInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PacketOutInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PortModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10QueueGetConfigInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PacketOutInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PortModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.RoleRequestInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetAsyncInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetConfigMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.TableModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.CommonMessageRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MessageFactoryInitializer {
+
+ private MessageFactoryInitializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Registers message serializers into provided registry
+ * @param serializerRegistry registry to be initialized with message serializers
+ */
+ public static void registerMessageSerializers(SerializerRegistry serializerRegistry) {
+ // register OF v1.0 message serializers
+ short version = EncodeConstants.OF10_VERSION_ID;
+ CommonMessageRegistryHelper registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);
+ registryHelper.registerSerializer(BarrierInput.class, new OF10BarrierInputMessageFactory());
+ registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());
+ registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());
+ registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());
+ registryHelper.registerSerializer(FlowModInput.class, new OF10FlowModInputMessageFactory());
+ registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());
+ registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());
+ registryHelper.registerSerializer(GetQueueConfigInput.class, new OF10QueueGetConfigInputMessageFactory());
+ registryHelper.registerSerializer(HelloInput.class, new OF10HelloInputMessageFactory());
+ registryHelper.registerSerializer(MultipartRequestInput.class, new OF10StatsRequestInputFactory());
+ registryHelper.registerSerializer(PacketOutInput.class, new OF10PacketOutInputMessageFactory());
+ registryHelper.registerSerializer(PortModInput.class, new OF10PortModInputMessageFactory());
+ registryHelper.registerSerializer(SetConfigInput.class, new SetConfigMessageFactory());
+ // register OF v1.3 message serializers
+ version = EncodeConstants.OF13_VERSION_ID;
+ registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);
+ registryHelper.registerSerializer(BarrierInput.class, new BarrierInputMessageFactory());
+ registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());
+ registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());
+ registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());
+ registryHelper.registerSerializer(FlowModInput.class, new FlowModInputMessageFactory());
+ registryHelper.registerSerializer(GetAsyncInput.class, new GetAsyncRequestMessageFactory());
+ registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());
+ registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());
+ registryHelper.registerSerializer(GetQueueConfigInput.class, new GetQueueConfigInputMessageFactory());
+ registryHelper.registerSerializer(GroupModInput.class, new GroupModInputMessageFactory());
+ registryHelper.registerSerializer(HelloInput.class, new HelloInputMessageFactory());
+ registryHelper.registerSerializer(MeterModInput.class, new MeterModInputMessageFactory());
+ registryHelper.registerSerializer(MultipartRequestInput.class, new MultipartRequestInputFactory());
+ registryHelper.registerSerializer(PacketOutInput.class, new PacketOutInputMessageFactory());
+ registryHelper.registerSerializer(PortModInput.class, new PortModInputMessageFactory());
+ registryHelper.registerSerializer(RoleRequestInput.class, new RoleRequestInputMessageFactory());
+ registryHelper.registerSerializer(SetAsyncInput.class, new SetAsyncInputMessageFactory());
+ registryHelper.registerSerializer( SetConfigInput.class, new SetConfigMessageFactory());
+ registryHelper.registerSerializer(TableModInput.class, new TableModInputMessageFactory());
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionSerializer implements OFSerializer<Action>,\r
- HeaderSerializer<Action>{\r
-\r
- @Override\r
- public void serialize(Action input, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getType());\r
- outBuffer.writeShort(getLength());\r
- }\r
-\r
- @Override\r
- public void serializeHeader(Action input, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getType());\r
- outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);\r
- }\r
-\r
- /**\r
- * @return numeric representation of action type\r
- */\r
- protected abstract int getType();\r
-\r
- /**\r
- * @return action length\r
- */\r
- protected abstract int getLength();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionSerializer implements OFSerializer<Action>,
+ HeaderSerializer<Action>{
+
+ @Override
+ public void serialize(Action input, ByteBuf outBuffer) {
+ outBuffer.writeShort(getType());
+ outBuffer.writeShort(getLength());
+ }
+
+ @Override
+ public void serializeHeader(Action input, ByteBuf outBuffer) {
+ outBuffer.writeShort(getType());
+ outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);
+ }
+
+ /**
+ * @return numeric representation of action type
+ */
+ protected abstract int getType();
+
+ /**
+ * @return action length
+ */
+ protected abstract int getLength();
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractEthertypeActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- EthertypeAction ethertype = action.getAugmentation(EthertypeAction.class);\r
- outBuffer.writeShort(ethertype.getEthertype().getValue());\r
- outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractEthertypeActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ EthertypeAction ethertype = action.getAugmentation(EthertypeAction.class);
+ outBuffer.writeShort(ethertype.getEthertype().getValue());
+ outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractHeaderActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractHeaderActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ outBuffer.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractIpAddressActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(final Action action, final ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER\r
- .split(action.getAugmentation(IpAddressAction.class).getIpAddress().getValue());\r
- for (String group : addressGroups) {\r
- outBuffer.writeByte(Short.parseShort(group));\r
- }\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractIpAddressActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(final Action action, final ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER
+ .split(action.getAugmentation(IpAddressAction.class).getIpAddress().getValue());
+ for (String group : addressGroups) {
+ outBuffer.writeByte(Short.parseShort(group));
+ }
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractMacAddressActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(action\r
- .getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractMacAddressActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(action
+ .getAugmentation(DlAddressAction.class).getDlAddress().getValue()));
+ outBuffer.writeZero(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractPortActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- PortAction port = action.getAugmentation(PortAction.class);\r
- outBuffer.writeShort(port.getPort().getValue().intValue());\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_TP_PORT_ACTION);\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractPortActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ PortAction port = action.getAugmentation(PortAction.class);
+ outBuffer.writeShort(port.getPort().getValue().intValue());
+ outBuffer.writeZero(ActionConstants.PADDING_IN_TP_PORT_ACTION);
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10EnqueueActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- PortAction port = action.getAugmentation(PortAction.class);\r
- outBuffer.writeShort(port.getPort().getValue().intValue());\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_ENQUEUE_ACTION);\r
- QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);\r
- outBuffer.writeInt(queueId.getQueueId().intValue());\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.ENQUEUE_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.LARGER_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10EnqueueActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ PortAction port = action.getAugmentation(PortAction.class);
+ outBuffer.writeShort(port.getPort().getValue().intValue());
+ outBuffer.writeZero(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
+ QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);
+ outBuffer.writeInt(queueId.getQueueId().intValue());
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.ENQUEUE_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.LARGER_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10OutputActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- PortAction port = action.getAugmentation(PortAction.class);\r
- outBuffer.writeShort(port.getPort().getValue().intValue());\r
- MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);\r
- outBuffer.writeShort(maxlength.getMaxLength());\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.OUTPUT_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10OutputActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ PortAction port = action.getAugmentation(PortAction.class);
+ outBuffer.writeShort(port.getPort().getValue().intValue());
+ MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);
+ outBuffer.writeShort(maxlength.getMaxLength());
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.OUTPUT_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlDstActionSerializer extends OF10AbstractMacAddressActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_DL_DST_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.LARGER_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlDstActionSerializer extends OF10AbstractMacAddressActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_DL_DST_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.LARGER_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlSrcActionSerializer extends OF10AbstractMacAddressActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_DL_SRC_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.LARGER_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlSrcActionSerializer extends OF10AbstractMacAddressActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_DL_SRC_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.LARGER_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwDstActionSerializer extends OF10AbstractIpAddressActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_NW_DST_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwDstActionSerializer extends OF10AbstractIpAddressActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_NW_DST_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwSrcActionSerializer extends OF10AbstractIpAddressActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_NW_SRC_CODE;\r
- }\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwSrcActionSerializer extends OF10AbstractIpAddressActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_NW_SRC_CODE;
+ }
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwTosActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- outBuffer.writeByte(action.getAugmentation(NwTosAction.class).getNwTos());\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_NW_TOS_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwTosActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ outBuffer.writeByte(action.getAugmentation(NwTosAction.class).getNwTos());
+ outBuffer.writeZero(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_NW_TOS_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpDstActionSerializer extends OF10AbstractPortActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_TP_DST_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpDstActionSerializer extends OF10AbstractPortActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_TP_DST_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpSrcActionSerializer extends OF10AbstractPortActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_TP_SRC_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpSrcActionSerializer extends OF10AbstractPortActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_TP_SRC_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanPcpActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- outBuffer.writeByte(action.getAugmentation(VlanPcpAction.class).getVlanPcp());\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_VLAN_PCP_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanPcpActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ outBuffer.writeByte(action.getAugmentation(VlanPcpAction.class).getVlanPcp());
+ outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_VLAN_PCP_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanVidActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- outBuffer.writeShort(action.getAugmentation(VlanVidAction.class).getVlanVid());\r
- outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_VLAN_VID_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanVidActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ outBuffer.writeShort(action.getAugmentation(VlanVidAction.class).getVlanVid());
+ outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_VLAN_VID_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StripVlanActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.STRIP_VLAN_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StripVlanActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.STRIP_VLAN_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlInActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.COPY_TTL_IN_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlInActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.COPY_TTL_IN_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlOutActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.COPY_TTL_OUT_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlOutActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.COPY_TTL_OUT_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecMplsTtlActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.DEC_MPLS_TTL_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecMplsTtlActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.DEC_MPLS_TTL_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecNwTtlActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.DEC_NW_TTL_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecNwTtlActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.DEC_NW_TTL_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13GroupActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- GroupIdAction groupId = action.getAugmentation(GroupIdAction.class);\r
- outBuffer.writeInt(groupId.getGroupId().intValue());\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.GROUP_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13GroupActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ GroupIdAction groupId = action.getAugmentation(GroupIdAction.class);
+ outBuffer.writeInt(groupId.getGroupId().intValue());
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.GROUP_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13OutputActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- PortAction port = action.getAugmentation(PortAction.class);\r
- outBuffer.writeInt(port.getPort().getValue().intValue());\r
- MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);\r
- outBuffer.writeShort(maxlength.getMaxLength());\r
- outBuffer.writeZero(ActionConstants.OUTPUT_PADDING);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.OUTPUT_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.LARGER_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13OutputActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ PortAction port = action.getAugmentation(PortAction.class);
+ outBuffer.writeInt(port.getPort().getValue().intValue());
+ MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);
+ outBuffer.writeShort(maxlength.getMaxLength());
+ outBuffer.writeZero(ActionConstants.OUTPUT_PADDING);
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.OUTPUT_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.LARGER_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopMplsActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.POP_MPLS_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopMplsActionSerializer extends AbstractEthertypeActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.POP_MPLS_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopPbbActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.POP_PBB_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopPbbActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.POP_PBB_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopVlanActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.POP_VLAN_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopVlanActionSerializer extends AbstractHeaderActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.POP_VLAN_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushMplsActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.PUSH_MPLS_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushMplsActionSerializer extends AbstractEthertypeActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.PUSH_MPLS_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushPbbActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.PUSH_PBB_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushPbbActionSerializer extends AbstractEthertypeActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.PUSH_PBB_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushVlanActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.PUSH_VLAN_CODE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushVlanActionSerializer extends AbstractEthertypeActionSerializer {
+
+ @Override
+ protected int getType() {
+ return ActionConstants.PUSH_VLAN_CODE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetFieldActionSerializer implements OFSerializer<Action>,\r
- HeaderSerializer<Action>, SerializerRegistryInjector {\r
-\r
- private SerializerRegistry registry;\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- int startIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);\r
- int lengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
- OxmFieldsAction oxmField = action.getAugmentation(OxmFieldsAction.class);\r
- MatchEntries entry = oxmField.getMatchEntries().get(0);\r
- MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(\r
- EncodeConstants.OF13_VERSION_ID, entry.getOxmClass(), entry.getOxmMatchField());\r
- if (entry.getOxmClass().equals(ExperimenterClass.class)) {\r
- key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)\r
- .getExperimenter().getValue());\r
- } else {\r
- key.setExperimenterId(null);\r
- }\r
- OFSerializer<MatchEntries> serializer = registry.getSerializer(key);\r
- serializer.serialize(entry, outBuffer);\r
- int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;\r
- if (paddingRemainder != 0) {\r
- outBuffer.writeZero(EncodeConstants.PADDING - paddingRemainder);\r
- }\r
- outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);\r
- }\r
-\r
- @Override\r
- public void serializeHeader(Action input, ByteBuf outBuffer) {\r
- outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);\r
- outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);\r
- }\r
-\r
- @Override\r
- public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {\r
- registry = serializerRegistry;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetFieldActionSerializer implements OFSerializer<Action>,
+ HeaderSerializer<Action>, SerializerRegistryInjector {
+
+ private SerializerRegistry registry;
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ int startIndex = outBuffer.writerIndex();
+ outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);
+ int lengthIndex = outBuffer.writerIndex();
+ outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
+ OxmFieldsAction oxmField = action.getAugmentation(OxmFieldsAction.class);
+ MatchEntries entry = oxmField.getMatchEntries().get(0);
+ MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, entry.getOxmClass(), entry.getOxmMatchField());
+ if (entry.getOxmClass().equals(ExperimenterClass.class)) {
+ key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)
+ .getExperimenter().getValue());
+ } else {
+ key.setExperimenterId(null);
+ }
+ OFSerializer<MatchEntries> serializer = registry.getSerializer(key);
+ serializer.serialize(entry, outBuffer);
+ int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;
+ if (paddingRemainder != 0) {
+ outBuffer.writeZero(EncodeConstants.PADDING - paddingRemainder);
+ }
+ outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
+ }
+
+ @Override
+ public void serializeHeader(Action input, ByteBuf outBuffer) {
+ outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);
+ outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);
+ }
+
+ @Override
+ public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetMplsTtlActionSerializer extends AbstractActionSerializer {\r
-\r
-\r
- \r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- MplsTtlAction mplsTtl = action.getAugmentation(MplsTtlAction.class);\r
- outBuffer.writeByte(mplsTtl.getMplsTtl());\r
- outBuffer.writeZero(ActionConstants.SET_MPLS_TTL_PADDING);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_MPLS_TTL_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetMplsTtlActionSerializer extends AbstractActionSerializer {
+
+
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ MplsTtlAction mplsTtl = action.getAugmentation(MplsTtlAction.class);
+ outBuffer.writeByte(mplsTtl.getMplsTtl());
+ outBuffer.writeZero(ActionConstants.SET_MPLS_TTL_PADDING);
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_MPLS_TTL_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetNwTtlActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- NwTtlAction nwTtl = action.getAugmentation(NwTtlAction.class);\r
- outBuffer.writeByte(nwTtl.getNwTtl());\r
- outBuffer.writeZero(ActionConstants.SET_NW_TTL_PADDING);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_NW_TTL_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetNwTtlActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ NwTtlAction nwTtl = action.getAugmentation(NwTtlAction.class);
+ outBuffer.writeByte(nwTtl.getNwTtl());
+ outBuffer.writeZero(ActionConstants.SET_NW_TTL_PADDING);
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_NW_TTL_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetQueueActionSerializer extends AbstractActionSerializer {\r
-\r
- @Override\r
- public void serialize(Action action, ByteBuf outBuffer) {\r
- super.serialize(action, outBuffer);\r
- QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);\r
- outBuffer.writeInt(queueId.getQueueId().intValue());\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return ActionConstants.SET_QUEUE_CODE;\r
- }\r
-\r
- @Override\r
- protected int getLength() {\r
- return ActionConstants.GENERAL_ACTION_LENGTH;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetQueueActionSerializer extends AbstractActionSerializer {
+
+ @Override
+ public void serialize(Action action, ByteBuf outBuffer) {
+ super.serialize(action, outBuffer);
+ QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);
+ outBuffer.writeInt(queueId.getQueueId().intValue());
+ }
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_QUEUE_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMaker;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ListSerializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer\r
- implements SerializerRegistryInjector {\r
-\r
- private static final TypeKeyMaker<Action> ACTION_KEY_MAKER =\r
- TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-\r
- private SerializerRegistry registry;\r
-\r
- @Override\r
- public void serialize(final Instruction instruction, final ByteBuf outBuffer) {\r
- int startIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(getType());\r
- if (instruction.getAugmentation(ActionsInstruction.class) != null) {\r
- List<Action> actions = instruction.getAugmentation(ActionsInstruction.class).getAction();\r
- int lengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
- outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
- ListSerializer.serializeList(actions, ACTION_KEY_MAKER, getRegistry(), outBuffer);\r
- int instructionLength = outBuffer.writerIndex() - startIndex;\r
- outBuffer.setShort(lengthIndex, instructionLength);\r
- } else {\r
- outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);\r
- outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
- }\r
- }\r
-\r
- protected SerializerRegistry getRegistry() {\r
- return registry;\r
- }\r
-\r
- @Override\r
- public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {\r
- registry = serializerRegistry;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMaker;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.ListSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer
+ implements SerializerRegistryInjector {
+
+ private static final TypeKeyMaker<Action> ACTION_KEY_MAKER =
+ TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+
+ private SerializerRegistry registry;
+
+ @Override
+ public void serialize(final Instruction instruction, final ByteBuf outBuffer) {
+ int startIndex = outBuffer.writerIndex();
+ outBuffer.writeShort(getType());
+ if (instruction.getAugmentation(ActionsInstruction.class) != null) {
+ List<Action> actions = instruction.getAugmentation(ActionsInstruction.class).getAction();
+ int lengthIndex = outBuffer.writerIndex();
+ outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
+ outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+ ListSerializer.serializeList(actions, ACTION_KEY_MAKER, getRegistry(), outBuffer);
+ int instructionLength = outBuffer.writerIndex() - startIndex;
+ outBuffer.setShort(lengthIndex, instructionLength);
+ } else {
+ outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
+ outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+ }
+ }
+
+ protected SerializerRegistry getRegistry() {
+ return registry;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractInstructionSerializer implements OFSerializer<Instruction>,\r
- HeaderSerializer<Instruction> {\r
-\r
- @Override\r
- public void serializeHeader(Instruction input, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getType());\r
- outBuffer.writeShort(InstructionConstants.INSTRUCTION_IDS_LENGTH);\r
- }\r
-\r
- /**\r
- * @return numeric representation of action type\r
- */\r
- protected abstract int getType();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractInstructionSerializer implements OFSerializer<Instruction>,
+ HeaderSerializer<Instruction> {
+
+ @Override
+ public void serializeHeader(Instruction input, ByteBuf outBuffer) {
+ outBuffer.writeShort(getType());
+ outBuffer.writeShort(InstructionConstants.INSTRUCTION_IDS_LENGTH);
+ }
+
+ /**
+ * @return numeric representation of action type
+ */
+ protected abstract int getType();
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ApplyActionsInstructionSerializer extends AbstractActionInstructionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return InstructionConstants.APPLY_ACTIONS_TYPE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ApplyActionsInstructionSerializer extends AbstractActionInstructionSerializer {
+
+ @Override
+ protected int getType() {
+ return InstructionConstants.APPLY_ACTIONS_TYPE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ClearActionsInstructionSerializer extends AbstractActionInstructionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return InstructionConstants.CLEAR_ACTIONS_TYPE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ClearActionsInstructionSerializer extends AbstractActionInstructionSerializer {
+
+ @Override
+ protected int getType() {
+ return InstructionConstants.CLEAR_ACTIONS_TYPE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class GoToTableInstructionSerializer extends AbstractInstructionSerializer {\r
-\r
- @Override\r
- public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getType());\r
- outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);\r
- outBuffer.writeByte(instruction.getAugmentation(TableIdInstruction.class).getTableId());\r
- outBuffer.writeZero(InstructionConstants.PADDING_IN_GOTO_TABLE);\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return InstructionConstants.GOTO_TABLE_TYPE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class GoToTableInstructionSerializer extends AbstractInstructionSerializer {
+
+ @Override
+ public void serialize(Instruction instruction, ByteBuf outBuffer) {
+ outBuffer.writeShort(getType());
+ outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
+ outBuffer.writeByte(instruction.getAugmentation(TableIdInstruction.class).getTableId());
+ outBuffer.writeZero(InstructionConstants.PADDING_IN_GOTO_TABLE);
+ }
+
+ @Override
+ protected int getType() {
+ return InstructionConstants.GOTO_TABLE_TYPE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MeterInstructionSerializer extends AbstractInstructionSerializer {\r
-\r
- @Override\r
- public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getType());\r
- outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);\r
- outBuffer.writeInt(instruction.\r
- getAugmentation(MeterIdInstruction.class).getMeterId().intValue());\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return InstructionConstants.METER_TYPE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MeterInstructionSerializer extends AbstractInstructionSerializer {
+
+ @Override
+ public void serialize(Instruction instruction, ByteBuf outBuffer) {
+ outBuffer.writeShort(getType());
+ outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
+ outBuffer.writeInt(instruction.
+ getAugmentation(MeterIdInstruction.class).getMeterId().intValue());
+ }
+
+ @Override
+ protected int getType() {
+ return InstructionConstants.METER_TYPE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteActionsInstructionSerializer extends AbstractActionInstructionSerializer {\r
-\r
- @Override\r
- protected int getType() {\r
- return InstructionConstants.WRITE_ACTIONS_TYPE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteActionsInstructionSerializer extends AbstractActionInstructionSerializer {
+
+ @Override
+ protected int getType() {
+ return InstructionConstants.WRITE_ACTIONS_TYPE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteMetadataInstructionSerializer extends AbstractInstructionSerializer {\r
-\r
- @Override\r
- public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getType());\r
- outBuffer.writeShort(InstructionConstants.WRITE_METADATA_LENGTH);\r
- outBuffer.writeZero(InstructionConstants.PADDING_IN_WRITE_METADATA);\r
- MetadataInstruction metadata = instruction.getAugmentation(MetadataInstruction.class);\r
- outBuffer.writeBytes(metadata.getMetadata());\r
- outBuffer.writeBytes(metadata.getMetadataMask());\r
- }\r
-\r
- @Override\r
- protected int getType() {\r
- return InstructionConstants.WRITE_METADATA_TYPE;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteMetadataInstructionSerializer extends AbstractInstructionSerializer {
+
+ @Override
+ public void serialize(Instruction instruction, ByteBuf outBuffer) {
+ outBuffer.writeShort(getType());
+ outBuffer.writeShort(InstructionConstants.WRITE_METADATA_LENGTH);
+ outBuffer.writeZero(InstructionConstants.PADDING_IN_WRITE_METADATA);
+ MetadataInstruction metadata = instruction.getAugmentation(MetadataInstruction.class);
+ outBuffer.writeBytes(metadata.getMetadata());
+ outBuffer.writeBytes(metadata.getMetadataMask());
+ }
+
+ @Override
+ protected int getType() {
+ return InstructionConstants.WRITE_METADATA_TYPE;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for Ipv4 address based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmIpv4AddressSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- writeIpv4Address(entry, outBuffer);\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-\r
- private static void writeIpv4Address(final MatchEntries entry, final ByteBuf out) {\r
- Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER\r
- .split(entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address().getValue());\r
- for (String group : addressGroups) {\r
- out.writeByte(Short.parseShort(group));\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for Ipv4 address based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmIpv4AddressSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ writeIpv4Address(entry, outBuffer);
+ writeMask(entry, outBuffer, getValueLength());
+ }
+
+ private static void writeIpv4Address(final MatchEntries entry, final ByteBuf out) {
+ Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER
+ .split(entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address().getValue());
+ for (String group : addressGroups) {
+ out.writeByte(Short.parseShort(group));
+ }
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-import com.google.common.collect.Lists;\r
-\r
-/**\r
- * Parent for Ipv6 address based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmIpv6AddressSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- String textAddress = entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address().getValue();\r
- List<String> address;\r
- if (textAddress.equals("::")) {\r
- String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];\r
- Arrays.fill(tmp, "0");\r
- address = Arrays.asList(tmp);\r
- } else {\r
- address = parseIpv6Address(Lists.newArrayList(ByteBufUtils.COLON_SPLITTER.split(textAddress)));\r
- }\r
- for (String group : address) {\r
- outBuffer.writeShort(Integer.parseInt(group, 16));\r
- }\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-\r
- private static List<String> parseIpv6Address(final List<String> addressGroups) {\r
- int countEmpty = 0;\r
- for (String group : addressGroups) {\r
- if (group.equals("")) {\r
- countEmpty++;\r
- }\r
- }\r
- List<String> ready = new ArrayList<>(EncodeConstants.GROUPS_IN_IPV6_ADDRESS);\r
- switch (countEmpty) {\r
- case 0:\r
- ready = addressGroups;\r
- break;\r
- case 1:\r
- int zerosToBePushed = EncodeConstants.GROUPS_IN_IPV6_ADDRESS - addressGroups.size() + 1;\r
- for (String group : addressGroups) {\r
- if (group.equals("")) {\r
- for (int j = 0; j < zerosToBePushed; j++) {\r
- ready.add("0");\r
- }\r
- } else {\r
- ready.add(group);\r
- }\r
- }\r
- break;\r
- case 2:\r
- String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];\r
- Arrays.fill(tmp, "0");\r
- tmp[EncodeConstants.GROUPS_IN_IPV6_ADDRESS - 1] =\r
- addressGroups.get(addressGroups.size() - 1);\r
- ready = Arrays.asList(tmp);\r
- break;\r
- default:\r
- throw new IllegalStateException("Incorrect ipv6 address");\r
- }\r
- return ready;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Parent for Ipv6 address based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmIpv6AddressSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ String textAddress = entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address().getValue();
+ List<String> address;
+ if (textAddress.equals("::")) {
+ String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];
+ Arrays.fill(tmp, "0");
+ address = Arrays.asList(tmp);
+ } else {
+ address = parseIpv6Address(Lists.newArrayList(ByteBufUtils.COLON_SPLITTER.split(textAddress)));
+ }
+ for (String group : address) {
+ outBuffer.writeShort(Integer.parseInt(group, 16));
+ }
+ writeMask(entry, outBuffer, getValueLength());
+ }
+
+ private static List<String> parseIpv6Address(final List<String> addressGroups) {
+ int countEmpty = 0;
+ for (String group : addressGroups) {
+ if (group.equals("")) {
+ countEmpty++;
+ }
+ }
+ List<String> ready = new ArrayList<>(EncodeConstants.GROUPS_IN_IPV6_ADDRESS);
+ switch (countEmpty) {
+ case 0:
+ ready = addressGroups;
+ break;
+ case 1:
+ int zerosToBePushed = EncodeConstants.GROUPS_IN_IPV6_ADDRESS - addressGroups.size() + 1;
+ for (String group : addressGroups) {
+ if (group.equals("")) {
+ for (int j = 0; j < zerosToBePushed; j++) {
+ ready.add("0");
+ }
+ } else {
+ ready.add(group);
+ }
+ }
+ break;
+ case 2:
+ String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];
+ Arrays.fill(tmp, "0");
+ tmp[EncodeConstants.GROUPS_IN_IPV6_ADDRESS - 1] =
+ addressGroups.get(addressGroups.size() - 1);
+ ready = Arrays.asList(tmp);
+ break;
+ default:
+ throw new IllegalStateException("Incorrect ipv6 address");
+ }
+ return ready;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for MAC address based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- String macAddress = entry.getAugmentation(MacAddressMatchEntry.class).getMacAddress().getValue();\r
- outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(macAddress)); // 48 b + mask [OF 1.3.2 spec]\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for MAC address based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ String macAddress = entry.getAugmentation(MacAddressMatchEntry.class).getMacAddress().getValue();
+ outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(macAddress)); // 48 b + mask [OF 1.3.2 spec]
+ writeMask(entry, outBuffer, getValueLength());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for all match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmMatchEntrySerializer\r
- implements OFSerializer<MatchEntries>, HeaderSerializer<MatchEntries>{\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- serializeHeader(entry, outBuffer);\r
- }\r
-\r
- @Override\r
- public void serializeHeader(MatchEntries entry, ByteBuf outBuffer) {\r
- outBuffer.writeShort(getOxmClassCode());\r
- writeOxmFieldAndLength(outBuffer, getOxmFieldCode(), entry.isHasMask(),\r
- getValueLength());\r
- }\r
-\r
- protected static void writeMask(MatchEntries entry, ByteBuf out, int length) {\r
- if (entry.isHasMask()) {\r
- byte[] mask = entry.getAugmentation(MaskMatchEntry.class).getMask();\r
- if (mask != null && mask.length != length) {\r
- throw new IllegalArgumentException("incorrect length of mask: "+\r
- mask.length + ", expected: " + length);\r
- }\r
- out.writeBytes(mask);\r
- }\r
- }\r
-\r
- protected static void writeOxmFieldAndLength(ByteBuf out, int fieldValue, boolean hasMask, int lengthArg) {\r
- int fieldAndMask = fieldValue << 1;\r
- int length = lengthArg;\r
- if (hasMask) {\r
- fieldAndMask |= 1;\r
- length *= 2;\r
- }\r
- out.writeByte(fieldAndMask);\r
- out.writeByte(length);\r
- }\r
-\r
- /**\r
- * @return numeric representation of oxm_field\r
- */\r
- protected abstract int getOxmFieldCode();\r
-\r
- /**\r
- * @return numeric representation of oxm_class\r
- */\r
- protected abstract int getOxmClassCode();\r
-\r
- /**\r
- * @return match entry value length (without mask length)\r
- */\r
- protected abstract int getValueLength();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for all match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmMatchEntrySerializer
+ implements OFSerializer<MatchEntries>, HeaderSerializer<MatchEntries>{
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ serializeHeader(entry, outBuffer);
+ }
+
+ @Override
+ public void serializeHeader(MatchEntries entry, ByteBuf outBuffer) {
+ outBuffer.writeShort(getOxmClassCode());
+ writeOxmFieldAndLength(outBuffer, getOxmFieldCode(), entry.isHasMask(),
+ getValueLength());
+ }
+
+ protected static void writeMask(MatchEntries entry, ByteBuf out, int length) {
+ if (entry.isHasMask()) {
+ byte[] mask = entry.getAugmentation(MaskMatchEntry.class).getMask();
+ if (mask != null && mask.length != length) {
+ throw new IllegalArgumentException("incorrect length of mask: "+
+ mask.length + ", expected: " + length);
+ }
+ out.writeBytes(mask);
+ }
+ }
+
+ protected static void writeOxmFieldAndLength(ByteBuf out, int fieldValue, boolean hasMask, int lengthArg) {
+ int fieldAndMask = fieldValue << 1;
+ int length = lengthArg;
+ if (hasMask) {
+ fieldAndMask |= 1;
+ length *= 2;
+ }
+ out.writeByte(fieldAndMask);
+ out.writeByte(length);
+ }
+
+ /**
+ * @return numeric representation of oxm_field
+ */
+ protected abstract int getOxmFieldCode();
+
+ /**
+ * @return numeric representation of oxm_class
+ */
+ protected abstract int getOxmClassCode();
+
+ /**
+ * @return match entry value length (without mask length)
+ */
+ protected abstract int getValueLength();
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for metadata based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmMetadataSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeBytes(entry.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for metadata based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmMetadataSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeBytes(entry.getAugmentation(MetadataMatchEntry.class).getMetadata());
+ writeMask(entry, outBuffer, getValueLength());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for port(32-bit) based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmPortNumberSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeInt(entry.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for port(32-bit) based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmPortNumberSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeInt(entry.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for port(16-bit) based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmPortSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeShort(entry.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for port(16-bit) based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmPortSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeShort(entry.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ }
+}
-/*\r
- * Copyright (C) 2014 Red Hat, Inc.\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author brent.salisbury\r
- *\r
- */\r
-public class NxmTcpFlagSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagSerializer.class);\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeShort(entry.getAugmentation(TcpFlagMatchEntry.class).getTcpFlag());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.NXM_1_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.NXM_NX_TCP_FLAG;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTcpFlagSerializer extends AbstractOxmMatchEntrySerializer {
+
+ private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagSerializer.class);
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeShort(entry.getAugmentation(TcpFlagMatchEntry.class).getTcpFlag());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.NXM_1_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.NXM_NX_TCP_FLAG;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpOpSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeShort(entry.getAugmentation(OpCodeMatchEntry.class).getOpCode());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ARP_OP;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpOpSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeShort(entry.getAugmentation(OpCodeMatchEntry.class).getOpCode());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_OP;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpShaSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ARP_SHA;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.MAC_ADDRESS_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpShaSerializer extends AbstractOxmMacAddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_SHA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpSpaSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ARP_SPA;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpSpaSerializer extends AbstractOxmIpv4AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_SPA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpThaSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ARP_THA;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.MAC_ADDRESS_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpThaSerializer extends AbstractOxmMacAddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_THA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpTpaSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ARP_TPA;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpTpaSerializer extends AbstractOxmIpv4AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_TPA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthDstSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ETH_DST;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.MAC_ADDRESS_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthDstSerializer extends AbstractOxmMacAddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ETH_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthSrcSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.MAC_ADDRESS_LENGTH;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ETH_SRC;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthSrcSerializer extends AbstractOxmMacAddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ETH_SRC;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthTypeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeShort(entry.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().shortValue());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ETH_TYPE;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthTypeSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeShort(entry.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().shortValue());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ETH_TYPE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4CodeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ICMPV4_CODE;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4CodeSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV4_CODE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4TypeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ICMPV4_TYPE;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4TypeSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV4_TYPE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6CodeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ICMPV6_CODE;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6CodeSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV6_CODE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6TypeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.ICMPV6_TYPE;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6TypeSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV6_TYPE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPhyPortSerializer extends AbstractOxmPortNumberSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IN_PHY_PORT;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPhyPortSerializer extends AbstractOxmPortNumberSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IN_PHY_PORT;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPortSerializer extends AbstractOxmPortNumberSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IN_PORT;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPortSerializer extends AbstractOxmPortNumberSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IN_PORT;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpDscpSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(DscpMatchEntry.class).getDscp().getValue());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IP_DSCP;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpDscpSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(DscpMatchEntry.class).getDscp().getValue());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IP_DSCP;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpEcnSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(EcnMatchEntry.class).getEcn());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IP_ECN;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpEcnSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(EcnMatchEntry.class).getEcn());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IP_ECN;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpProtoSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IP_PROTO;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpProtoSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IP_PROTO;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4DstSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV4_DST;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4DstSerializer extends AbstractOxmIpv4AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV4_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4SrcSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV4_SRC;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4SrcSerializer extends AbstractOxmIpv4AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV4_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6DstSerializer extends AbstractOxmIpv6AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_DST;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6DstSerializer extends AbstractOxmIpv6AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- Ipv6ExthdrFlags pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();\r
- int bitmap = ByteBufUtils.fillBitMask(0,\r
- pseudoField.isNonext(),\r
- pseudoField.isEsp(),\r
- pseudoField.isAuth(),\r
- pseudoField.isDest(),\r
- pseudoField.isFrag(),\r
- pseudoField.isRouter(),\r
- pseudoField.isHop(),\r
- pseudoField.isUnrep(),\r
- pseudoField.isUnseq());\r
- outBuffer.writeShort(bitmap);\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_EXTHDR;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ Ipv6ExthdrFlags pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();
+ int bitmap = ByteBufUtils.fillBitMask(0,
+ pseudoField.isNonext(),
+ pseudoField.isEsp(),
+ pseudoField.isAuth(),
+ pseudoField.isDest(),
+ pseudoField.isFrag(),
+ pseudoField.isRouter(),
+ pseudoField.isHop(),
+ pseudoField.isUnrep(),
+ pseudoField.isUnseq());
+ outBuffer.writeShort(bitmap);
+ writeMask(entry, outBuffer, getValueLength());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_EXTHDR;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6FlabelSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeInt(entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_FLABEL;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6FlabelSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeInt(entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
+ writeMask(entry, outBuffer, getValueLength());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_FLABEL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdSllSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.MAC_ADDRESS_LENGTH;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_ND_SLL;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdSllSerializer extends AbstractOxmMacAddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_ND_SLL;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTargetSerializer extends AbstractOxmIpv6AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_ND_TARGET;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTargetSerializer extends AbstractOxmIpv6AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_ND_TARGET;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTllSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_ND_TLL;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.MAC_ADDRESS_LENGTH;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTllSerializer extends AbstractOxmMacAddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_ND_TLL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6SrcSerializer extends AbstractOxmIpv6AddressSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.IPV6_SRC;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6SrcSerializer extends AbstractOxmIpv6AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataSerializer extends AbstractOxmMetadataSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.METADATA;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataSerializer extends AbstractOxmMetadataSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.METADATA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeBoolean(entry.getAugmentation(BosMatchEntry.class).isBos().booleanValue());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.MPLS_BOS;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeBoolean(entry.getAugmentation(BosMatchEntry.class).isBos().booleanValue());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.MPLS_BOS;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsLabelSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeInt(entry.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.MPLS_LABEL;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsLabelSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeInt(entry.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.MPLS_LABEL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsTcSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(TcMatchEntry.class).getTc());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.MPLS_TC;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsTcSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(TcMatchEntry.class).getTc());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.MPLS_TC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeMedium(entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.PBB_ISID;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_3_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeMedium(entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());
+ writeMask(entry, outBuffer, getValueLength());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.PBB_ISID;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_3_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpDstSerializer extends AbstractOxmPortSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.SCTP_DST;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpDstSerializer extends AbstractOxmPortSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.SCTP_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpSrcSerializer extends AbstractOxmPortSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.SCTP_SRC;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpSrcSerializer extends AbstractOxmPortSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.SCTP_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpDstSerializer extends AbstractOxmPortSerializer{\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.TCP_DST;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpDstSerializer extends AbstractOxmPortSerializer{
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.TCP_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpSrcSerializer extends AbstractOxmPortSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.TCP_SRC;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpSrcSerializer extends AbstractOxmPortSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.TCP_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTunnelIdSerializer extends AbstractOxmMetadataSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.TUNNEL_ID;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTunnelIdSerializer extends AbstractOxmMetadataSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.TUNNEL_ID;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpDstSerializer extends AbstractOxmPortSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.UDP_DST;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpDstSerializer extends AbstractOxmPortSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.UDP_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpSrcSerializer extends AbstractOxmPortSerializer {\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.UDP_SRC;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpSrcSerializer extends AbstractOxmPortSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.UDP_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanPcpSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- outBuffer.writeByte(entry.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().byteValue());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.VLAN_PCP;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanPcpSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ outBuffer.writeByte(entry.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().byteValue());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.VLAN_PCP;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
- @Override\r
- public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
- super.serialize(entry, outBuffer);\r
- VlanVidMatchEntry vlanVid = entry.getAugmentation(VlanVidMatchEntry.class);\r
- int vlanVidValue = vlanVid.getVlanVid();\r
- if (vlanVid.isCfiBit()) {\r
- short cfi = 1 << 12; // 13-th bit\r
- vlanVidValue = vlanVidValue | cfi;\r
- }\r
-\r
- outBuffer.writeShort(vlanVidValue);\r
- writeMask(entry, outBuffer, getValueLength());\r
- }\r
-\r
- @Override\r
- protected int getOxmClassCode() {\r
- return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
- }\r
-\r
- @Override\r
- protected int getOxmFieldCode() {\r
- return OxmMatchConstants.VLAN_VID;\r
- }\r
-\r
- @Override\r
- protected int getValueLength() {\r
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidSerializer extends AbstractOxmMatchEntrySerializer {
+
+ @Override
+ public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+ super.serialize(entry, outBuffer);
+ VlanVidMatchEntry vlanVid = entry.getAugmentation(VlanVidMatchEntry.class);
+ int vlanVidValue = vlanVid.getVlanVid();
+ if (vlanVid.isCfiBit()) {
+ short cfi = 1 << 12; // 13-th bit
+ vlanVidValue = vlanVidValue | cfi;
+ }
+
+ outBuffer.writeShort(vlanVidValue);
+ writeMask(entry, outBuffer, getValueLength());
+ }
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.VLAN_VID;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <T> type the key maker is based on \r
- */\r
-public abstract class AbstractCodeKeyMaker implements CodeKeyMaker {\r
-\r
- private short version;\r
-\r
- /**\r
- * @param version openflow wire version\r
- */\r
- public AbstractCodeKeyMaker(short version) {\r
- this.version = version;\r
- \r
- }\r
-\r
- /**\r
- * @return the version\r
- */\r
- public short getVersion() {\r
- return version;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+
+/**
+ * @author michal.polkorab
+ * @param <T> type the key maker is based on
+ */
+public abstract class AbstractCodeKeyMaker implements CodeKeyMaker {
+
+ private short version;
+
+ /**
+ * @param version openflow wire version
+ */
+ public AbstractCodeKeyMaker(short version) {
+ this.version = version;
+
+ }
+
+ /**
+ * @return the version
+ */
+ public short getVersion() {
+ return version;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <T> type the key maker is based on \r
- */\r
-public abstract class AbstractTypeKeyMaker<T> implements TypeKeyMaker<T> {\r
-\r
- private short version;\r
-\r
- /**\r
- * @param version openflow wire version\r
- */\r
- public AbstractTypeKeyMaker(short version) {\r
- this.version = version;\r
- \r
- }\r
-\r
- /**\r
- * @return the version\r
- */\r
- public short getVersion() {\r
- return version;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+
+/**
+ * @author michal.polkorab
+ * @param <T> type the key maker is based on
+ */
+public abstract class AbstractTypeKeyMaker<T> implements TypeKeyMaker<T> {
+
+ private short version;
+
+ /**
+ * @param version openflow wire version
+ */
+ public AbstractTypeKeyMaker(short version) {
+ this.version = version;
+
+ }
+
+ /**
+ * @return the version
+ */
+ public short getVersion() {
+ return version;
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ActionConstants {\r
-\r
- /** Openflow v1.0 & v1.3 OFPAT_OUTPUT code */\r
- public static final byte OUTPUT_CODE = 0;\r
- /** Openflow v1.0 OFPAT_SET_VLAN_VID code */\r
- public static final byte SET_VLAN_VID_CODE = 1;\r
- /** Openflow v1.0 OFPAT_SET_VLAN_PCP code */\r
- public static final byte SET_VLAN_PCP_CODE = 2;\r
- /** Openflow v1.0 OFPAT_STRIP_VLAN code */\r
- public static final byte STRIP_VLAN_CODE = 3;\r
- /** Openflow v1.0 OFPAT_SET_DL_SRC code */\r
- public static final byte SET_DL_SRC_CODE = 4;\r
- /** Openflow v1.0 OFPAT_SET_DL_DST code */\r
- public static final byte SET_DL_DST_CODE = 5;\r
- /** Openflow v1.0 OFPAT_SET_NW_SRC code */\r
- public static final byte SET_NW_SRC_CODE = 6;\r
- /** Openflow v1.0 OFPAT_SET_NW_DST code */\r
- public static final byte SET_NW_DST_CODE = 7;\r
- /** Openflow v1.0 OFPAT_SET_NW_TOS code */\r
- public static final byte SET_NW_TOS_CODE = 8;\r
- /** Openflow v1.0 OFPAT_SET_TP_SRC code */\r
- public static final byte SET_TP_SRC_CODE = 9;\r
- /** Openflow v1.0 OFPAT_SET_TP_DST code */\r
- public static final byte SET_TP_DST_CODE = 10;\r
- /** Openflow v1.0 OFPAT_ENQUEUE code */\r
- public static final byte ENQUEUE_CODE = 11;\r
- /** Openflow v1.3 OFPAT_COPY_TTL_OUT code */\r
- public static final byte COPY_TTL_OUT_CODE = 11;\r
- /** Openflow v1.3 OFPAT_COPY_TTL_IN code */\r
- public static final byte COPY_TTL_IN_CODE = 12;\r
- /** Openflow v1.3 OFPAT_SET_MPLS_TTL code */\r
- public static final byte SET_MPLS_TTL_CODE = 15;\r
- /** Openflow v1.3 OFPAT_DEC_MPLS_TTL code */\r
- public static final byte DEC_MPLS_TTL_CODE = 16;\r
- /** Openflow v1.3 OFPAT_PUSH_VLAN code */\r
- public static final byte PUSH_VLAN_CODE = 17;\r
- /** Openflow v1.3 OFPAT_POP_VLAN code */\r
- public static final byte POP_VLAN_CODE = 18;\r
- /** Openflow v1.3 OFPAT_PUSH_MPLS code */\r
- public static final byte PUSH_MPLS_CODE = 19;\r
- /** Openflow v1.3 OFPAT_POP_MPLS code */\r
- public static final byte POP_MPLS_CODE = 20;\r
- /** Openflow v1.3 OFPAT_SET_QUEUE code */\r
- public static final byte SET_QUEUE_CODE = 21;\r
- /** Openflow v1.3 OFPAT_GROUP code */\r
- public static final byte GROUP_CODE = 22;\r
- /** Openflow v1.3 OFPAT_SET_NW_TTL code */\r
- public static final byte SET_NW_TTL_CODE = 23;\r
- /** Openflow v1.3 OFPAT_DEC_NW_TTL code */\r
- public static final byte DEC_NW_TTL_CODE = 24;\r
- /** Openflow v1.3 OFPAT_SET_FIELD code */\r
- public static final int SET_FIELD_CODE = 25;\r
- /** Openflow v1.3 OFPAT_PUSH_PBB code */\r
- public static final byte PUSH_PBB_CODE = 26;\r
- /** Openflow v1.3 OFPAT_POP_PBB code */\r
- public static final byte POP_PBB_CODE = 27;\r
-\r
- /** Padding in OFPAT_OUTPUT (OF v1.3) */\r
- public static final byte OUTPUT_PADDING = 6;\r
- /** Padding in OFPAT_SET_VLAN_VID (OF v1.3) */\r
- public static final byte PADDING_IN_SET_VLAN_VID_ACTION = 2;\r
- /** Padding in OFPAT_SET_VLAN_PCP (OF v1.3) */\r
- public static final byte PADDING_IN_SET_VLAN_PCP_ACTION = 3;\r
- /** Padding in OFPAT_SET_NW_TOS (OF v1.3) */\r
- public static final byte PADDING_IN_SET_NW_TOS_ACTION = 3;\r
- /** Padding in OFPAT_ENQUEUE (OF v1.3) */\r
- public static final int PADDING_IN_ENQUEUE_ACTION = 6;\r
- /** Padding in OFPAT_SET_MPLS_TTL (OF v1.3) */\r
- public static final byte SET_MPLS_TTL_PADDING = 3;\r
- /** Padding in OFPAT_SET_NW_TTL (OF v1.3) */\r
- public static final byte SET_NW_TTL_PADDING = 3;\r
- /** Padding in OFPAT_SET_DL_SRC and OFPAT_SET_DL_DST (OF v1.3) */\r
- public static final byte PADDING_IN_DL_ADDRESS_ACTION = 6;\r
- /** Padding in OFPAT_SET_TP_SRC and OFPAT_SET_TP_DST (OF v1.3) */\r
- public static final byte PADDING_IN_TP_PORT_ACTION = 2;\r
- /** Padding in action header (OF v1.3) */\r
- public static final byte PADDING_IN_ACTION_HEADER = 4;\r
- /** Padding in OFPAT_PUSH_VLAN, OFPAT_PUSH_MPLS, OFPAT_POP_MPLS\r
- * and OFPAT_PUSH_PBB (OF v1.3) */\r
- public static final byte ETHERTYPE_ACTION_PADDING = 2;\r
-\r
- /** Most common action length */\r
- public static final byte GENERAL_ACTION_LENGTH = 8;\r
- /** Action larger than GENERAL_ACTION_LENGTH - currently\r
- * only 16 bytes long actions for both OF v1.0 & v1.3*/\r
- public static final byte LARGER_ACTION_LENGTH = 16;\r
- /** Action header size */\r
- public static final byte ACTION_IDS_LENGTH = 4;\r
-\r
- private ActionConstants() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ActionConstants {
+
+ /** Openflow v1.0 & v1.3 OFPAT_OUTPUT code */
+ public static final byte OUTPUT_CODE = 0;
+ /** Openflow v1.0 OFPAT_SET_VLAN_VID code */
+ public static final byte SET_VLAN_VID_CODE = 1;
+ /** Openflow v1.0 OFPAT_SET_VLAN_PCP code */
+ public static final byte SET_VLAN_PCP_CODE = 2;
+ /** Openflow v1.0 OFPAT_STRIP_VLAN code */
+ public static final byte STRIP_VLAN_CODE = 3;
+ /** Openflow v1.0 OFPAT_SET_DL_SRC code */
+ public static final byte SET_DL_SRC_CODE = 4;
+ /** Openflow v1.0 OFPAT_SET_DL_DST code */
+ public static final byte SET_DL_DST_CODE = 5;
+ /** Openflow v1.0 OFPAT_SET_NW_SRC code */
+ public static final byte SET_NW_SRC_CODE = 6;
+ /** Openflow v1.0 OFPAT_SET_NW_DST code */
+ public static final byte SET_NW_DST_CODE = 7;
+ /** Openflow v1.0 OFPAT_SET_NW_TOS code */
+ public static final byte SET_NW_TOS_CODE = 8;
+ /** Openflow v1.0 OFPAT_SET_TP_SRC code */
+ public static final byte SET_TP_SRC_CODE = 9;
+ /** Openflow v1.0 OFPAT_SET_TP_DST code */
+ public static final byte SET_TP_DST_CODE = 10;
+ /** Openflow v1.0 OFPAT_ENQUEUE code */
+ public static final byte ENQUEUE_CODE = 11;
+ /** Openflow v1.3 OFPAT_COPY_TTL_OUT code */
+ public static final byte COPY_TTL_OUT_CODE = 11;
+ /** Openflow v1.3 OFPAT_COPY_TTL_IN code */
+ public static final byte COPY_TTL_IN_CODE = 12;
+ /** Openflow v1.3 OFPAT_SET_MPLS_TTL code */
+ public static final byte SET_MPLS_TTL_CODE = 15;
+ /** Openflow v1.3 OFPAT_DEC_MPLS_TTL code */
+ public static final byte DEC_MPLS_TTL_CODE = 16;
+ /** Openflow v1.3 OFPAT_PUSH_VLAN code */
+ public static final byte PUSH_VLAN_CODE = 17;
+ /** Openflow v1.3 OFPAT_POP_VLAN code */
+ public static final byte POP_VLAN_CODE = 18;
+ /** Openflow v1.3 OFPAT_PUSH_MPLS code */
+ public static final byte PUSH_MPLS_CODE = 19;
+ /** Openflow v1.3 OFPAT_POP_MPLS code */
+ public static final byte POP_MPLS_CODE = 20;
+ /** Openflow v1.3 OFPAT_SET_QUEUE code */
+ public static final byte SET_QUEUE_CODE = 21;
+ /** Openflow v1.3 OFPAT_GROUP code */
+ public static final byte GROUP_CODE = 22;
+ /** Openflow v1.3 OFPAT_SET_NW_TTL code */
+ public static final byte SET_NW_TTL_CODE = 23;
+ /** Openflow v1.3 OFPAT_DEC_NW_TTL code */
+ public static final byte DEC_NW_TTL_CODE = 24;
+ /** Openflow v1.3 OFPAT_SET_FIELD code */
+ public static final int SET_FIELD_CODE = 25;
+ /** Openflow v1.3 OFPAT_PUSH_PBB code */
+ public static final byte PUSH_PBB_CODE = 26;
+ /** Openflow v1.3 OFPAT_POP_PBB code */
+ public static final byte POP_PBB_CODE = 27;
+
+ /** Padding in OFPAT_OUTPUT (OF v1.3) */
+ public static final byte OUTPUT_PADDING = 6;
+ /** Padding in OFPAT_SET_VLAN_VID (OF v1.3) */
+ public static final byte PADDING_IN_SET_VLAN_VID_ACTION = 2;
+ /** Padding in OFPAT_SET_VLAN_PCP (OF v1.3) */
+ public static final byte PADDING_IN_SET_VLAN_PCP_ACTION = 3;
+ /** Padding in OFPAT_SET_NW_TOS (OF v1.3) */
+ public static final byte PADDING_IN_SET_NW_TOS_ACTION = 3;
+ /** Padding in OFPAT_ENQUEUE (OF v1.3) */
+ public static final int PADDING_IN_ENQUEUE_ACTION = 6;
+ /** Padding in OFPAT_SET_MPLS_TTL (OF v1.3) */
+ public static final byte SET_MPLS_TTL_PADDING = 3;
+ /** Padding in OFPAT_SET_NW_TTL (OF v1.3) */
+ public static final byte SET_NW_TTL_PADDING = 3;
+ /** Padding in OFPAT_SET_DL_SRC and OFPAT_SET_DL_DST (OF v1.3) */
+ public static final byte PADDING_IN_DL_ADDRESS_ACTION = 6;
+ /** Padding in OFPAT_SET_TP_SRC and OFPAT_SET_TP_DST (OF v1.3) */
+ public static final byte PADDING_IN_TP_PORT_ACTION = 2;
+ /** Padding in action header (OF v1.3) */
+ public static final byte PADDING_IN_ACTION_HEADER = 4;
+ /** Padding in OFPAT_PUSH_VLAN, OFPAT_PUSH_MPLS, OFPAT_POP_MPLS
+ * and OFPAT_PUSH_PBB (OF v1.3) */
+ public static final byte ETHERTYPE_ACTION_PADDING = 2;
+
+ /** Most common action length */
+ public static final byte GENERAL_ACTION_LENGTH = 8;
+ /** Action larger than GENERAL_ACTION_LENGTH - currently
+ * only 16 bytes long actions for both OF v1.0 & v1.3*/
+ public static final byte LARGER_ACTION_LENGTH = 16;
+ /** Action header size */
+ public static final byte ACTION_IDS_LENGTH = 4;
+
+ private ActionConstants() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+}
-/*\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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionDeserializerRegistryHelper {\r
-\r
- private short version;\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * @param version wire protocol version\r
- * @param deserializerRegistry registry to be filled with message deserializers\r
- */\r
- public ActionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {\r
- this.version = version;\r
- this.registry = deserializerRegistry;\r
- }\r
-\r
- /**\r
- * @param code code / value to distinguish between deserializers\r
- * @param deserializer deserializer instance\r
- * @param deserializedObjectClass class of object that will be deserialized\r
- * by given deserializer\r
- */\r
- public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {\r
- registry.registerDeserializer(new ActionDeserializerKey(version, code,\r
- null), deserializer);\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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionDeserializerRegistryHelper {
+
+ private short version;
+ private DeserializerRegistry registry;
+
+ /**
+ * @param version wire protocol version
+ * @param deserializerRegistry registry to be filled with message deserializers
+ */
+ public ActionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {
+ this.version = version;
+ this.registry = deserializerRegistry;
+ }
+
+ /**
+ * @param code code / value to distinguish between deserializers
+ * @param deserializer deserializer instance
+ * @param deserializedObjectClass class of object that will be deserialized
+ * by given deserializer
+ */
+ public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {
+ registry.registerDeserializer(new ActionDeserializerKey(version, code,
+ null), deserializer);
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class ActionSerializerRegistryHelper {\r
-\r
- private short version;\r
- private SerializerRegistry serializerRegistry;\r
-\r
- /**\r
- * @param version Openflow wire version\r
- * @param objectType\r
- * @param serializerRegistry\r
- */\r
- public ActionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {\r
- this.version = version;\r
- this.serializerRegistry = serializerRegistry;\r
- }\r
-\r
- /**\r
- * Registers given serializer\r
- * @param actionType\r
- * @param serializer\r
- */\r
- public <TYPE extends ActionBase> void registerSerializer(Class<TYPE> actionType,\r
- OFGeneralSerializer serializer) {\r
- serializerRegistry.registerSerializer(new ActionSerializerKey<>(version,\r
- actionType, null), serializer);\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ */
+public class ActionSerializerRegistryHelper {
+
+ private short version;
+ private SerializerRegistry serializerRegistry;
+
+ /**
+ * @param version Openflow wire version
+ * @param objectType
+ * @param serializerRegistry
+ */
+ public ActionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
+ this.version = version;
+ this.serializerRegistry = serializerRegistry;
+ }
+
+ /**
+ * Registers given serializer
+ * @param actionType
+ * @param serializer
+ */
+ public <TYPE extends ActionBase> void registerSerializer(Class<TYPE> actionType,
+ OFGeneralSerializer serializer) {
+ serializerRegistry.registerSerializer(new ActionSerializerKey<>(version,
+ actionType, null), serializer);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public interface CodeKeyMaker {\r
-\r
- /**\r
- * @param input buffer that will be the needed data gathered from\r
- * @return key for deserializer lookup\r
- */\r
- abstract MessageCodeKey make(ByteBuf input);\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+
+import io.netty.buffer.ByteBuf;
+
+/**
+ * @author michal.polkorab
+ */
+public interface CodeKeyMaker {
+
+ /**
+ * @param input buffer that will be the needed data gathered from
+ * @return key for deserializer lookup
+ */
+ abstract MessageCodeKey make(ByteBuf input);
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class CodeKeyMakerFactory {\r
-\r
- /**\r
- * @param version\r
- * @return\r
- */\r
- public static CodeKeyMaker createMatchEntriesKeyMaker(short version) {\r
- return new AbstractCodeKeyMaker(version) {\r
- @Override\r
- public MessageCodeKey make(ByteBuf input) {\r
- int oxmClass = input.getUnsignedShort(input.readerIndex());\r
- int oxmField = input.getUnsignedByte(input.readerIndex()\r
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;\r
- MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(),\r
- oxmClass, oxmField);\r
- if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {\r
- long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES\r
- + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
- key.setExperimenterId(expId);\r
- return key;\r
- }\r
- key.setExperimenterId(null);\r
- return key;\r
- }\r
- };\r
- }\r
-\r
- /**\r
- * @param version\r
- * @return\r
- */\r
- public static CodeKeyMaker createActionsKeyMaker(short version) {\r
- return new AbstractCodeKeyMaker(version) {\r
- @Override\r
- public MessageCodeKey make(ByteBuf input) {\r
- int type = input.getUnsignedShort(input.readerIndex());\r
- if (type == EncodeConstants.EXPERIMENTER_VALUE) {\r
- Long expId = input.getUnsignedInt(input.readerIndex()\r
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- return new ExperimenterActionDeserializerKey(getVersion(), expId);\r
- }\r
- ActionDeserializerKey actionDeserializerKey = new ActionDeserializerKey(getVersion(), type, null);\r
- return actionDeserializerKey;\r
- }\r
- };\r
- }\r
-\r
- /**\r
- * @param version\r
- * @return\r
- */\r
- public static CodeKeyMaker createInstructionsKeyMaker(short version) {\r
- return new AbstractCodeKeyMaker(version) {\r
- @Override\r
- public MessageCodeKey make(ByteBuf input) {\r
- int type = input.getUnsignedShort(input.readerIndex());\r
- if (type == EncodeConstants.EXPERIMENTER_VALUE) {\r
- Long expId = input.getUnsignedInt(input.readerIndex()\r
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
- return new ExperimenterInstructionDeserializerKey(getVersion(), expId);\r
- }\r
- return new InstructionDeserializerKey(getVersion(), type, null);\r
- }\r
- };\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class CodeKeyMakerFactory {
+
+ /**
+ * @param version
+ * @return
+ */
+ public static CodeKeyMaker createMatchEntriesKeyMaker(short version) {
+ return new AbstractCodeKeyMaker(version) {
+ @Override
+ public MessageCodeKey make(ByteBuf input) {
+ int oxmClass = input.getUnsignedShort(input.readerIndex());
+ int oxmField = input.getUnsignedByte(input.readerIndex()
+ + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(),
+ oxmClass, oxmField);
+ if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
+ long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
+ + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ key.setExperimenterId(expId);
+ return key;
+ }
+ key.setExperimenterId(null);
+ return key;
+ }
+ };
+ }
+
+ /**
+ * @param version
+ * @return
+ */
+ public static CodeKeyMaker createActionsKeyMaker(short version) {
+ return new AbstractCodeKeyMaker(version) {
+ @Override
+ public MessageCodeKey make(ByteBuf input) {
+ int type = input.getUnsignedShort(input.readerIndex());
+ if (type == EncodeConstants.EXPERIMENTER_VALUE) {
+ Long expId = input.getUnsignedInt(input.readerIndex()
+ + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ return new ExperimenterActionDeserializerKey(getVersion(), expId);
+ }
+ ActionDeserializerKey actionDeserializerKey = new ActionDeserializerKey(getVersion(), type, null);
+ return actionDeserializerKey;
+ }
+ };
+ }
+
+ /**
+ * @param version
+ * @return
+ */
+ public static CodeKeyMaker createInstructionsKeyMaker(short version) {
+ return new AbstractCodeKeyMaker(version) {
+ @Override
+ public MessageCodeKey make(ByteBuf input) {
+ int type = input.getUnsignedShort(input.readerIndex());
+ if (type == EncodeConstants.EXPERIMENTER_VALUE) {
+ Long expId = input.getUnsignedInt(input.readerIndex()
+ + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ return new ExperimenterInstructionDeserializerKey(getVersion(), expId);
+ }
+ return new InstructionDeserializerKey(getVersion(), type, null);
+ }
+ };
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class CommonMessageRegistryHelper {\r
-\r
- private short version;\r
- private SerializerRegistry serializerRegistry;\r
-\r
- /**\r
- * @param version\r
- * @param serializerRegistry\r
- */\r
- public CommonMessageRegistryHelper(short version, SerializerRegistry serializerRegistry) {\r
- this.version = version;\r
- this.serializerRegistry = serializerRegistry;\r
- }\r
-\r
- /**\r
- * @param msgType\r
- * @param serializer\r
- */\r
- public void registerSerializer(Class<?> msgType, OFGeneralSerializer serializer) {\r
- serializerRegistry.registerSerializer(new MessageTypeKey<>(version, msgType), serializer);\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class CommonMessageRegistryHelper {
+
+ private short version;
+ private SerializerRegistry serializerRegistry;
+
+ /**
+ * @param version
+ * @param serializerRegistry
+ */
+ public CommonMessageRegistryHelper(short version, SerializerRegistry serializerRegistry) {
+ this.version = version;
+ this.serializerRegistry = serializerRegistry;
+ }
+
+ /**
+ * @param msgType
+ * @param serializer
+ */
+ public void registerSerializer(Class<?> msgType, OFGeneralSerializer serializer) {
+ serializerRegistry.registerSerializer(new MessageTypeKey<>(version, msgType), serializer);
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class InstructionConstants {\r
-\r
- /** Openflow v1.3 OFPIT_GOTO_TABLE code */\r
- public static final byte GOTO_TABLE_TYPE = 1;\r
- /** Openflow v1.3 OFPIT_WRITE_METADATA code */\r
- public static final byte WRITE_METADATA_TYPE = 2;\r
- /** Openflow v1.3 OFPIT_WRITE_ACTIONS code */\r
- public static final byte WRITE_ACTIONS_TYPE = 3;\r
- /** Openflow v1.3 OFPIT_APPLY_ACTIONS code */\r
- public static final byte APPLY_ACTIONS_TYPE = 4;\r
- /** Openflow v1.3 OFPIT_CLEAR_ACTIONS code */\r
- public static final byte CLEAR_ACTIONS_TYPE = 5;\r
- /** Openflow v1.3 OFPIT_METER code */\r
- public static final byte METER_TYPE = 6;\r
-\r
- /** PADDING in OFPIT_GOTO_TABLE */\r
- public static final byte PADDING_IN_GOTO_TABLE = 3;\r
- /** PADDING in OFPIT_WRITE_METADATA */\r
- public static final byte PADDING_IN_WRITE_METADATA = 4;\r
- /** PADDING in OFPIT_WRITE_ACTIONS, OFPIT_APPLY_ACTIONS\r
- * and OFPIT_CLEAR_ACTIONS */\r
- public static final byte PADDING_IN_ACTIONS_INSTRUCTION = 4;\r
-\r
- /** Openflow v1.3 header length (padded) */\r
- public static final byte STANDARD_INSTRUCTION_LENGTH = 8;\r
- /** Openflow v1.3 OFPIT_WRITE_METADATA length */\r
- public static final byte WRITE_METADATA_LENGTH = 24;\r
- /** Openflow v1.3 header length (only type and length fields) */\r
- public static final byte INSTRUCTION_IDS_LENGTH = 4;\r
-\r
- private InstructionConstants() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class InstructionConstants {
+
+ /** Openflow v1.3 OFPIT_GOTO_TABLE code */
+ public static final byte GOTO_TABLE_TYPE = 1;
+ /** Openflow v1.3 OFPIT_WRITE_METADATA code */
+ public static final byte WRITE_METADATA_TYPE = 2;
+ /** Openflow v1.3 OFPIT_WRITE_ACTIONS code */
+ public static final byte WRITE_ACTIONS_TYPE = 3;
+ /** Openflow v1.3 OFPIT_APPLY_ACTIONS code */
+ public static final byte APPLY_ACTIONS_TYPE = 4;
+ /** Openflow v1.3 OFPIT_CLEAR_ACTIONS code */
+ public static final byte CLEAR_ACTIONS_TYPE = 5;
+ /** Openflow v1.3 OFPIT_METER code */
+ public static final byte METER_TYPE = 6;
+
+ /** PADDING in OFPIT_GOTO_TABLE */
+ public static final byte PADDING_IN_GOTO_TABLE = 3;
+ /** PADDING in OFPIT_WRITE_METADATA */
+ public static final byte PADDING_IN_WRITE_METADATA = 4;
+ /** PADDING in OFPIT_WRITE_ACTIONS, OFPIT_APPLY_ACTIONS
+ * and OFPIT_CLEAR_ACTIONS */
+ public static final byte PADDING_IN_ACTIONS_INSTRUCTION = 4;
+
+ /** Openflow v1.3 header length (padded) */
+ public static final byte STANDARD_INSTRUCTION_LENGTH = 8;
+ /** Openflow v1.3 OFPIT_WRITE_METADATA length */
+ public static final byte WRITE_METADATA_LENGTH = 24;
+ /** Openflow v1.3 header length (only type and length fields) */
+ public static final byte INSTRUCTION_IDS_LENGTH = 4;
+
+ private InstructionConstants() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+}
-/*\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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionDeserializerRegistryHelper {\r
-\r
- private short version;\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * @param version wire protocol version\r
- * @param deserializerRegistry registry to be filled with message deserializers\r
- */\r
- public InstructionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {\r
- this.version = version;\r
- this.registry = deserializerRegistry;\r
- }\r
-\r
- /**\r
- * @param code code / value to distinguish between deserializers\r
- * @param deserializer deserializer instance\r
- * @param deserializedObjectClass class of object that will be deserialized\r
- * by given deserializer\r
- */\r
- public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {\r
- registry.registerDeserializer(new InstructionDeserializerKey(version, code,\r
- null), deserializer);\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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionDeserializerRegistryHelper {
+
+ private short version;
+ private DeserializerRegistry registry;
+
+ /**
+ * @param version wire protocol version
+ * @param deserializerRegistry registry to be filled with message deserializers
+ */
+ public InstructionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {
+ this.version = version;
+ this.registry = deserializerRegistry;
+ }
+
+ /**
+ * @param code code / value to distinguish between deserializers
+ * @param deserializer deserializer instance
+ * @param deserializedObjectClass class of object that will be deserialized
+ * by given deserializer
+ */
+ public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {
+ registry.registerDeserializer(new InstructionDeserializerKey(version, code,
+ null), deserializer);
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class InstructionSerializerRegistryHelper {\r
-\r
- private short version;\r
- private SerializerRegistry serializerRegistry;\r
-\r
- /**\r
- * @param version Openflow wire version\r
- * @param serializerRegistry\r
- */\r
- public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {\r
- this.version = version;\r
- this.serializerRegistry = serializerRegistry;\r
- }\r
-\r
- /**\r
- * Registers given serializer\r
- * @param instructionType \r
- * @param serializer\r
- */\r
- public <TYPE extends InstructionBase> void registerSerializer(Class<TYPE> instructionType,\r
- OFGeneralSerializer serializer) {\r
- serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,\r
- instructionType, null), serializer);\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ */
+public class InstructionSerializerRegistryHelper {
+
+ private short version;
+ private SerializerRegistry serializerRegistry;
+
+ /**
+ * @param version Openflow wire version
+ * @param serializerRegistry
+ */
+ public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
+ this.version = version;
+ this.serializerRegistry = serializerRegistry;
+ }
+
+ /**
+ * Registers given serializer
+ * @param instructionType
+ * @param serializer
+ */
+ public <TYPE extends InstructionBase> void registerSerializer(Class<TYPE> instructionType,
+ OFGeneralSerializer serializer) {
+ serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,
+ instructionType, null), serializer);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ListDeserializer {\r
-\r
- private ListDeserializer() {\r
- throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
- }\r
-\r
- /**\r
- * Deserializes items into list\r
- * @param version openflow wire version\r
- * @param length length of list in ByteBuf (bytes)\r
- * @param input input buffer\r
- * @param keyMaker creates keys for deserializer lookup\r
- * @param registry stores deserializers\r
- * @return list of items\r
- */\r
- public static <E extends DataObject> List<E> deserializeList(short version, int length,\r
- ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {\r
- List<E> items = null;\r
- if (input.readableBytes() > 0) {\r
- items = new ArrayList<>();\r
- int startIndex = input.readerIndex();\r
- while ((input.readerIndex() - startIndex) < length){\r
- OFDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));\r
- E item = deserializer.deserialize(input);\r
- items.add(item);\r
- }\r
- }\r
- return items;\r
- }\r
-\r
- /**\r
- * Deserializes headers of items into list\r
- * @param version openflow wire version\r
- * @param length length of list in ByteBuf (bytes)\r
- * @param input input buffer\r
- * @param keyMaker creates keys for deserializer lookup\r
- * @param registry stores deserializers\r
- * @return list of items\r
- */\r
- public static <E extends DataObject> List<E> deserializeHeaders(short version, int length,\r
- ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {\r
- List<E> items = null;\r
- if (input.readableBytes() > 0) {\r
- items = new ArrayList<>();\r
- int startIndex = input.readerIndex();\r
- while ((input.readerIndex() - startIndex) < length){\r
- HeaderDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));\r
- E item = deserializer.deserializeHeader(input);\r
- items.add(item);\r
- }\r
- }\r
- return items;\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ListDeserializer {
+
+ private ListDeserializer() {
+ throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+ }
+
+ /**
+ * Deserializes items into list
+ * @param version openflow wire version
+ * @param length length of list in ByteBuf (bytes)
+ * @param input input buffer
+ * @param keyMaker creates keys for deserializer lookup
+ * @param registry stores deserializers
+ * @return list of items
+ */
+ public static <E extends DataObject> List<E> deserializeList(short version, int length,
+ ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {
+ List<E> items = null;
+ if (input.readableBytes() > 0) {
+ items = new ArrayList<>();
+ int startIndex = input.readerIndex();
+ while ((input.readerIndex() - startIndex) < length){
+ OFDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));
+ E item = deserializer.deserialize(input);
+ items.add(item);
+ }
+ }
+ return items;
+ }
+
+ /**
+ * Deserializes headers of items into list
+ * @param version openflow wire version
+ * @param length length of list in ByteBuf (bytes)
+ * @param input input buffer
+ * @param keyMaker creates keys for deserializer lookup
+ * @param registry stores deserializers
+ * @return list of items
+ */
+ public static <E extends DataObject> List<E> deserializeHeaders(short version, int length,
+ ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {
+ List<E> items = null;
+ if (input.readableBytes() > 0) {
+ items = new ArrayList<>();
+ int startIndex = input.readerIndex();
+ while ((input.readerIndex() - startIndex) < length){
+ HeaderDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));
+ E item = deserializer.deserializeHeader(input);
+ items.add(item);
+ }
+ }
+ return items;
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * Serializes list items and their headers\r
- * @author michal.polkorab\r
- * @param <E> \r
- */\r
-public abstract class ListSerializer {\r
-\r
- /**\r
- * Serializes item list\r
- * @param list list of items to be serialized\r
- * @param keyMaker creates key for registry lookup\r
- * @param registry stores serializers\r
- * @param outBuffer output buffer\r
- */\r
- public static <E extends DataObject> void serializeList(List<E> list,\r
- TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {\r
- if (list != null) {\r
- for (E item : list) {\r
- OFSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));\r
- serializer.serialize(item, outBuffer);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Serializes headers of items in list\r
- * @param list list of items to be serialized\r
- * @param keyMaker creates key for registry lookup\r
- * @param registry stores serializers\r
- * @param outBuffer output buffer\r
- */\r
- public static <E extends DataObject> void serializeHeaderList(List<E> list,\r
- TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {\r
- if (list != null) {\r
- for (E item : list) {\r
- HeaderSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));\r
- serializer.serializeHeader(item, outBuffer);\r
- }\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * Serializes list items and their headers
+ * @author michal.polkorab
+ * @param <E>
+ */
+public abstract class ListSerializer {
+
+ /**
+ * Serializes item list
+ * @param list list of items to be serialized
+ * @param keyMaker creates key for registry lookup
+ * @param registry stores serializers
+ * @param outBuffer output buffer
+ */
+ public static <E extends DataObject> void serializeList(List<E> list,
+ TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {
+ if (list != null) {
+ for (E item : list) {
+ OFSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));
+ serializer.serialize(item, outBuffer);
+ }
+ }
+ }
+
+ /**
+ * Serializes headers of items in list
+ * @param list list of items to be serialized
+ * @param keyMaker creates key for registry lookup
+ * @param registry stores serializers
+ * @param outBuffer output buffer
+ */
+ public static <E extends DataObject> void serializeHeaderList(List<E> list,
+ TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {
+ if (list != null) {
+ for (E item : list) {
+ HeaderSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));
+ serializer.serializeHeader(item, outBuffer);
+ }
+ }
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchEntryDeserializerRegistryHelper {\r
-\r
- private short version;\r
- private DeserializerRegistry registry;\r
- private int oxmClass;\r
-\r
- /**\r
- * @param version wire protocol version\r
- * @param oxmClass oxm_class that will be used for match entry deserializer\r
- * registration\r
- * @param deserializerRegistry registry to be filled with message deserializers\r
- */\r
- public MatchEntryDeserializerRegistryHelper(short version, int oxmClass,\r
- DeserializerRegistry deserializerRegistry) {\r
- this.version = version;\r
- this.oxmClass = oxmClass;\r
- this.registry = deserializerRegistry;\r
- }\r
-\r
- /**\r
- * Registers match entry deserializer under provided oxmfield ()\r
- * @param oxmField oxm_field value/code\r
- * @param deserializer deserializer instance\r
- */\r
- public void register(int oxmField, OFGeneralDeserializer deserializer) {\r
- MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, oxmClass, oxmField);\r
- key.setExperimenterId(null);\r
- registry.registerDeserializer(key, deserializer);\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchEntryDeserializerRegistryHelper {
+
+ private short version;
+ private DeserializerRegistry registry;
+ private int oxmClass;
+
+ /**
+ * @param version wire protocol version
+ * @param oxmClass oxm_class that will be used for match entry deserializer
+ * registration
+ * @param deserializerRegistry registry to be filled with message deserializers
+ */
+ public MatchEntryDeserializerRegistryHelper(short version, int oxmClass,
+ DeserializerRegistry deserializerRegistry) {
+ this.version = version;
+ this.oxmClass = oxmClass;
+ this.registry = deserializerRegistry;
+ }
+
+ /**
+ * Registers match entry deserializer under provided oxmfield ()
+ * @param oxmField oxm_field value/code
+ * @param deserializer deserializer instance
+ */
+ public void register(int oxmField, OFGeneralDeserializer deserializer) {
+ MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, oxmClass, oxmField);
+ key.setExperimenterId(null);
+ registry.registerDeserializer(key, deserializer);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <OXM_CLASS> OXM class\r
- */\r
-public class MatchEntrySerializerRegistryHelper<OXM_CLASS extends OxmClassBase> {\r
-\r
- private short version;\r
- private Class<OXM_CLASS> generalClass;\r
- private SerializerRegistry serializerRegistry;\r
-\r
- /**\r
- * @param version Openflow wire version\r
- * @param generalClass\r
- * @param serializerRegistry\r
- */\r
- public MatchEntrySerializerRegistryHelper(short version, Class<OXM_CLASS> generalClass,\r
- SerializerRegistry serializerRegistry) {\r
- this.version = version;\r
- this.generalClass = generalClass;\r
- this.serializerRegistry = serializerRegistry;\r
- }\r
-\r
- /**\r
- * Registers given serializer\r
- * @param specificClass \r
- * @param serializer \r
- */\r
- public <OXM_FIELD extends MatchField> void registerSerializer(\r
- Class<OXM_FIELD> specificClass, OFGeneralSerializer serializer) {\r
- MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(version, generalClass, specificClass);\r
- key.setExperimenterId(null);\r
- serializerRegistry.registerSerializer(key, serializer);\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ * @param <OXM_CLASS> OXM class
+ */
+public class MatchEntrySerializerRegistryHelper<OXM_CLASS extends OxmClassBase> {
+
+ private short version;
+ private Class<OXM_CLASS> generalClass;
+ private SerializerRegistry serializerRegistry;
+
+ /**
+ * @param version Openflow wire version
+ * @param generalClass
+ * @param serializerRegistry
+ */
+ public MatchEntrySerializerRegistryHelper(short version, Class<OXM_CLASS> generalClass,
+ SerializerRegistry serializerRegistry) {
+ this.version = version;
+ this.generalClass = generalClass;
+ this.serializerRegistry = serializerRegistry;
+ }
+
+ /**
+ * Registers given serializer
+ * @param specificClass
+ * @param serializer
+ */
+ public <OXM_FIELD extends MatchField> void registerSerializer(
+ Class<OXM_FIELD> specificClass, OFGeneralSerializer serializer) {
+ MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(version, generalClass, specificClass);
+ key.setExperimenterId(null);
+ serializerRegistry.registerSerializer(key, serializer);
+ }
+}
-/*\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.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;\r
-\r
-/**\r
- * Used for common structures translation / conversion\r
- * \r
- * @author michal.polkorab\r
- */\r
-public abstract class OpenflowUtils {\r
-\r
- /**\r
- * Creates PortState (OF v1.0) from input\r
- * @param input value read from buffer\r
- * @return port state\r
- */\r
- public static PortStateV10 createPortState(long input){\r
- final Boolean psLinkDown = ((input) & (1<<0)) != 0;\r
- final Boolean psBlocked = ((input) & (1<<1)) != 0;\r
- final Boolean psLive = ((input) & (1<<2)) != 0;\r
- final Boolean psStpListen = ((input) & (1<<8)) == 0;\r
- final Boolean psStpLearn = ((input) & (1<<8)) != 0;\r
- final Boolean psStpForward = ((input) & (1<<9)) != 0; // equals 2 << 8\r
- final Boolean psStpBlock = (((input) & (1<<9)) != 0) && (((input) & (1<<8)) != 0); // equals 3 << 8\r
- final Boolean psStpMask = ((input) & (1<<10)) != 0; // equals 4 << 8\r
- return new PortStateV10(psBlocked, psLinkDown, psLive, psStpBlock, psStpForward, psStpLearn, psStpListen, psStpMask);\r
- }\r
-\r
- /**\r
- * Creates PortConfig (OF v1.0) from input\r
- * @param input value read from buffer\r
- * @return port state\r
- */\r
- public static PortConfigV10 createPortConfig(long input){\r
- final Boolean pcPortDown = ((input) & (1<<0)) != 0;\r
- final Boolean pcNoStp = ((input) & (1<<1)) != 0;\r
- final Boolean pcNoRecv = ((input) & (1<<2)) != 0;\r
- final Boolean pcNoRecvStp = ((input) & (1<<3)) != 0;\r
- final Boolean pcNoFlood = ((input) & (1<<4)) != 0;\r
- final Boolean pcNoFwd = ((input) & (1<<5)) != 0;\r
- final Boolean pcNoPacketIn = ((input) & (1<<6)) != 0;\r
- return new PortConfigV10(pcNoFlood, pcNoFwd, pcNoPacketIn, pcNoRecv, pcNoRecvStp, pcNoStp, pcPortDown);\r
- }\r
-\r
- /**\r
- * Creates PortFeatures (OF v1.0) from input\r
- * @param input value read from buffer\r
- * @return port state\r
- */\r
- public static PortFeaturesV10 createPortFeatures(long input){\r
- final Boolean pf10mbHd = ((input) & (1<<0)) != 0;\r
- final Boolean pf10mbFd = ((input) & (1<<1)) != 0;\r
- final Boolean pf100mbHd = ((input) & (1<<2)) != 0;\r
- final Boolean pf100mbFd = ((input) & (1<<3)) != 0;\r
- final Boolean pf1gbHd = ((input) & (1<<4)) != 0;\r
- final Boolean pf1gbFd = ((input) & (1<<5)) != 0;\r
- final Boolean pf10gbFd = ((input) & (1<<6)) != 0;\r
- final Boolean pfCopper = ((input) & (1<<7)) != 0;\r
- final Boolean pfFiber = ((input) & (1<<8)) != 0;\r
- final Boolean pfAutoneg = ((input) & (1<<9)) != 0;\r
- final Boolean pfPause = ((input) & (1<<10)) != 0;\r
- final Boolean pfPauseAsym = ((input) & (1<<11)) != 0;\r
- return new PortFeaturesV10(pf100mbFd, pf100mbHd, pf10gbFd, pf10mbFd, pf10mbHd,\r
- pf1gbFd, pf1gbHd, pfAutoneg, pfCopper, pfFiber, pfPause, pfPauseAsym);\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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
+
+/**
+ * Used for common structures translation / conversion
+ *
+ * @author michal.polkorab
+ */
+public abstract class OpenflowUtils {
+
+ /**
+ * Creates PortState (OF v1.0) from input
+ * @param input value read from buffer
+ * @return port state
+ */
+ public static PortStateV10 createPortState(long input){
+ final Boolean psLinkDown = ((input) & (1<<0)) != 0;
+ final Boolean psBlocked = ((input) & (1<<1)) != 0;
+ final Boolean psLive = ((input) & (1<<2)) != 0;
+ final Boolean psStpListen = ((input) & (1<<8)) == 0;
+ final Boolean psStpLearn = ((input) & (1<<8)) != 0;
+ final Boolean psStpForward = ((input) & (1<<9)) != 0; // equals 2 << 8
+ final Boolean psStpBlock = (((input) & (1<<9)) != 0) && (((input) & (1<<8)) != 0); // equals 3 << 8
+ final Boolean psStpMask = ((input) & (1<<10)) != 0; // equals 4 << 8
+ return new PortStateV10(psBlocked, psLinkDown, psLive, psStpBlock, psStpForward, psStpLearn, psStpListen, psStpMask);
+ }
+
+ /**
+ * Creates PortConfig (OF v1.0) from input
+ * @param input value read from buffer
+ * @return port state
+ */
+ public static PortConfigV10 createPortConfig(long input){
+ final Boolean pcPortDown = ((input) & (1<<0)) != 0;
+ final Boolean pcNoStp = ((input) & (1<<1)) != 0;
+ final Boolean pcNoRecv = ((input) & (1<<2)) != 0;
+ final Boolean pcNoRecvStp = ((input) & (1<<3)) != 0;
+ final Boolean pcNoFlood = ((input) & (1<<4)) != 0;
+ final Boolean pcNoFwd = ((input) & (1<<5)) != 0;
+ final Boolean pcNoPacketIn = ((input) & (1<<6)) != 0;
+ return new PortConfigV10(pcNoFlood, pcNoFwd, pcNoPacketIn, pcNoRecv, pcNoRecvStp, pcNoStp, pcPortDown);
+ }
+
+ /**
+ * Creates PortFeatures (OF v1.0) from input
+ * @param input value read from buffer
+ * @return port state
+ */
+ public static PortFeaturesV10 createPortFeatures(long input){
+ final Boolean pf10mbHd = ((input) & (1<<0)) != 0;
+ final Boolean pf10mbFd = ((input) & (1<<1)) != 0;
+ final Boolean pf100mbHd = ((input) & (1<<2)) != 0;
+ final Boolean pf100mbFd = ((input) & (1<<3)) != 0;
+ final Boolean pf1gbHd = ((input) & (1<<4)) != 0;
+ final Boolean pf1gbFd = ((input) & (1<<5)) != 0;
+ final Boolean pf10gbFd = ((input) & (1<<6)) != 0;
+ final Boolean pfCopper = ((input) & (1<<7)) != 0;
+ final Boolean pfFiber = ((input) & (1<<8)) != 0;
+ final Boolean pfAutoneg = ((input) & (1<<9)) != 0;
+ final Boolean pfPause = ((input) & (1<<10)) != 0;
+ final Boolean pfPauseAsym = ((input) & (1<<11)) != 0;
+ return new PortFeaturesV10(pf100mbFd, pf100mbHd, pf10gbFd, pf10mbFd, pf10mbHd,
+ pf1gbFd, pf1gbHd, pfAutoneg, pfCopper, pfFiber, pfPause, pfPauseAsym);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SimpleDeserializerRegistryHelper {\r
-\r
- private short version;\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * @param version wire protocol version\r
- * @param deserializerRegistry registry to be filled with message deserializers\r
- */\r
- public SimpleDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {\r
- this.version = version;\r
- this.registry = deserializerRegistry;\r
- }\r
-\r
- /**\r
- * @param code code / value to distinguish between deserializers\r
- * @param experimenterID TODO\r
- * @param deserializedObjectClass class of object that will be deserialized\r
- * by given deserializer\r
- * @param deserializer deserializer instance\r
- */\r
- public void registerDeserializer(int code,\r
- Long experimenterID, Class<?> deserializedObjectClass, OFGeneralDeserializer deserializer) {\r
- registry.registerDeserializer(new MessageCodeKey(version, code,\r
- deserializedObjectClass), deserializer);\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SimpleDeserializerRegistryHelper {
+
+ private short version;
+ private DeserializerRegistry registry;
+
+ /**
+ * @param version wire protocol version
+ * @param deserializerRegistry registry to be filled with message deserializers
+ */
+ public SimpleDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {
+ this.version = version;
+ this.registry = deserializerRegistry;
+ }
+
+ /**
+ * @param code code / value to distinguish between deserializers
+ * @param experimenterID TODO
+ * @param deserializedObjectClass class of object that will be deserialized
+ * by given deserializer
+ * @param deserializer deserializer instance
+ */
+ public void registerDeserializer(int code,
+ Long experimenterID, Class<?> deserializedObjectClass, OFGeneralDeserializer deserializer) {
+ registry.registerDeserializer(new MessageCodeKey(version, code,
+ deserializedObjectClass), deserializer);
+ }
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <T> \r
- */\r
-public interface TypeKeyMaker<T> {\r
-\r
- /**\r
- * @param entry\r
- * @return key that will be used for serializer lookup in \r
- * the serializer registry\r
- */\r
- abstract MessageTypeKey<?> make(T entry);\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+
+/**
+ * @author michal.polkorab
+ * @param <T>
+ */
+public interface TypeKeyMaker<T> {
+
+ /**
+ * @param entry
+ * @return key that will be used for serializer lookup in
+ * the serializer registry
+ */
+ abstract MessageTypeKey<?> make(T entry);
+
+}
-/*\r
- * Copyright (c) 2013 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.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Creates KeyMakers\r
- * @author michal.polkorab\r
- */\r
-public abstract class TypeKeyMakerFactory {\r
-\r
- /**\r
- * @param version openflow wire version that shall be used\r
- * in lookup key\r
- * @return lookup key\r
- */\r
- public static TypeKeyMaker<MatchEntries> createMatchEntriesKeyMaker(short version) {\r
- return new AbstractTypeKeyMaker<MatchEntries>(version) {\r
- @Override\r
- public MatchEntrySerializerKey<?, ?> make(MatchEntries entry) {\r
- MatchEntrySerializerKey<?, ?> key;\r
- key = new MatchEntrySerializerKey<>(getVersion(), entry.getOxmClass(),\r
- entry.getOxmMatchField());\r
- if (entry.getOxmClass().equals(ExperimenterClass.class)) {\r
- key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)\r
- .getExperimenter().getValue());\r
- return key;\r
- }\r
- key.setExperimenterId(null);\r
- return key;\r
- }\r
- };\r
- }\r
-\r
- /**\r
- * @param version openflow wire version that shall be used\r
- * in lookup key\r
- * @return lookup key\r
- */\r
- public static TypeKeyMaker<Action> createActionKeyMaker(short version) {\r
- return new AbstractTypeKeyMaker<Action>(version) {\r
- @Override\r
- public MessageTypeKey<?> make(Action entry) {\r
- if (entry.getType().equals(Experimenter.class)) {\r
- return new ExperimenterActionSerializerKey(getVersion(),\r
- entry.getAugmentation(ExperimenterIdAction.class).getExperimenter().getValue(), entry.getAugmentation(ExperimenterIdAction.class).getSubType());\r
- }\r
- return new ActionSerializerKey<>(getVersion(), entry.getType(), null);\r
- }\r
- };\r
- }\r
-\r
- /**\r
- * @param version openflow wire version that shall be used\r
- * in lookup key\r
- * @return lookup key\r
- */\r
- public static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version) {\r
- return new AbstractTypeKeyMaker<Instruction>(version) {\r
- @Override\r
- public MessageTypeKey<?> make(Instruction entry) {\r
- if (entry.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common\r
- .instruction.rev130731.Experimenter.class)) {\r
- return new ExperimenterInstructionSerializerKey(getVersion(),\r
- entry.getAugmentation(ExperimenterIdInstruction.class)\r
- .getExperimenter().getValue());\r
- }\r
- return new InstructionSerializerKey<>(getVersion(), entry.getType(), null);\r
- }\r
- };\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Creates KeyMakers
+ * @author michal.polkorab
+ */
+public abstract class TypeKeyMakerFactory {
+
+ /**
+ * @param version openflow wire version that shall be used
+ * in lookup key
+ * @return lookup key
+ */
+ public static TypeKeyMaker<MatchEntries> createMatchEntriesKeyMaker(short version) {
+ return new AbstractTypeKeyMaker<MatchEntries>(version) {
+ @Override
+ public MatchEntrySerializerKey<?, ?> make(MatchEntries entry) {
+ MatchEntrySerializerKey<?, ?> key;
+ key = new MatchEntrySerializerKey<>(getVersion(), entry.getOxmClass(),
+ entry.getOxmMatchField());
+ if (entry.getOxmClass().equals(ExperimenterClass.class)) {
+ key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)
+ .getExperimenter().getValue());
+ return key;
+ }
+ key.setExperimenterId(null);
+ return key;
+ }
+ };
+ }
+
+ /**
+ * @param version openflow wire version that shall be used
+ * in lookup key
+ * @return lookup key
+ */
+ public static TypeKeyMaker<Action> createActionKeyMaker(short version) {
+ return new AbstractTypeKeyMaker<Action>(version) {
+ @Override
+ public MessageTypeKey<?> make(Action entry) {
+ if (entry.getType().equals(Experimenter.class)) {
+ return new ExperimenterActionSerializerKey(getVersion(),
+ entry.getAugmentation(ExperimenterIdAction.class).getExperimenter().getValue(), entry.getAugmentation(ExperimenterIdAction.class).getSubType());
+ }
+ return new ActionSerializerKey<>(getVersion(), entry.getType(), null);
+ }
+ };
+ }
+
+ /**
+ * @param version openflow wire version that shall be used
+ * in lookup key
+ * @return lookup key
+ */
+ public static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version) {
+ return new AbstractTypeKeyMaker<Instruction>(version) {
+ @Override
+ public MessageTypeKey<?> make(Instruction entry) {
+ if (entry.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
+ .instruction.rev130731.Experimenter.class)) {
+ return new ExperimenterInstructionSerializerKey(getVersion(),
+ entry.getAugmentation(ExperimenterIdInstruction.class)
+ .getExperimenter().getValue());
+ }
+ return new InstructionSerializerKey<>(getVersion(), entry.getType(), null);
+ }
+ };
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import java.util.Map;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeToClassInitHelper {\r
-\r
- private short version;\r
- private Map<TypeToClassKey, Class<?>> messageClassMap;\r
-\r
- /**\r
- * Constructor\r
- * @param version protocol wire version\r
- * @param messageClassMap map which stores type to class mapping\r
- */\r
- public TypeToClassInitHelper(short version, Map<TypeToClassKey, \r
- Class<?>> messageClassMap) {\r
- this.version = version;\r
- this.messageClassMap = messageClassMap;\r
- }\r
-\r
- /**\r
- * Registers Class int the type to class mapping\r
- * @param type code value for message type / class\r
- * @param clazz corresponding code -> class\r
- */\r
- public void registerTypeToClass(short type, Class<?> clazz) {\r
- messageClassMap.put(new TypeToClassKey(version, type), clazz);\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import java.util.Map;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeToClassInitHelper {
+
+ private short version;
+ private Map<TypeToClassKey, Class<?>> messageClassMap;
+
+ /**
+ * Constructor
+ * @param version protocol wire version
+ * @param messageClassMap map which stores type to class mapping
+ */
+ public TypeToClassInitHelper(short version, Map<TypeToClassKey,
+ Class<?>> messageClassMap) {
+ this.version = version;
+ this.messageClassMap = messageClassMap;
+ }
+
+ /**
+ * Registers Class int the type to class mapping
+ * @param type code value for message type / class
+ * @param clazz corresponding code -> class
+ */
+ public void registerTypeToClass(short type, Class<?> clazz) {
+ messageClassMap.put(new TypeToClassKey(version, type), clazz);
+ }
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeToClassKey {\r
-\r
- private short version;\r
- private int type;\r
-\r
- /**\r
- * Constructor\r
- * @param version wire protocol version\r
- * @param type message type / code\r
- */\r
- public TypeToClassKey(short version, int type) {\r
- this.version = version;\r
- this.type = type;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- result = prime * result + type;\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
- if (obj == null) {\r
- return false;\r
- }\r
- if (getClass() != obj.getClass()) {\r
- return false;\r
- }\r
- TypeToClassKey other = (TypeToClassKey) obj;\r
- if (type != other.type) {\r
- return false;\r
- }\r
- if (version != other.version) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeToClassKey {
+
+ private short version;
+ private int type;
+
+ /**
+ * Constructor
+ * @param version wire protocol version
+ * @param type message type / code
+ */
+ public TypeToClassKey(short version, int type) {
+ this.version = version;
+ this.type = type;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + type;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ TypeToClassKey other = (TypeToClassKey) obj;
+ if (type != other.type) {
+ return false;
+ }
+ if (version != other.version) {
+ return false;
+ }
+ return true;
+ }
}
\ No newline at end of file
-/*\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.openflowjava.statistics;\r
-\r
-import java.util.concurrent.atomic.AtomicLong;\r
-/**\r
- * Counts statistics\r
- * \r
- * @author madamjak\r
- */\r
-public class Counter {\r
-\r
- private AtomicLong counterValue;\r
- private AtomicLong counterLastReadValue;\r
-\r
- /**\r
- * Default constructor\r
- */\r
- public Counter() {\r
- counterValue = new AtomicLong(0L);\r
- counterLastReadValue = new AtomicLong(0L);\r
- }\r
-\r
- /**\r
- * Increment current counter value\r
- */\r
- public void incrementCounter(){\r
- counterValue.incrementAndGet();\r
- }\r
-\r
- /**\r
- * return the last read value of counter. This value can be set during the reading of current counter value, \r
- * for detail see method getCounterValue(boolean modifyLastReadValue).\r
- * @return the counterLastReadValue\r
- */\r
- public long getCounterLastReadValue() {\r
- return counterLastReadValue.get();\r
- }\r
-\r
- /**\r
- * get current value of counter and rewrite CounterLastReadValue by current value\r
- * @return the current value of counter\r
- */\r
- public long getCounterValue() {\r
- return getCounterValue(true);\r
- }\r
-\r
- /**\r
- * get current counter value\r
- * @param modifyLastReadValue\r
- * true - CounterLastReadValue will be rewritten by current CounterValue\r
- * false - no change CounterLastReadValue\r
- * @return the current value of counter\r
- */\r
- public long getCounterValue(boolean modifyLastReadValue) {\r
- if(modifyLastReadValue){\r
- counterLastReadValue.set(counterValue.get());\r
- }\r
- return counterValue.get();\r
- }\r
-\r
- /**\r
- * set current counter value and CounterLastReadValue to 0 (zero)\r
- */\r
- public void reset(){\r
- counterValue.set(0l);\r
- counterLastReadValue.set(0l);\r
- }\r
-\r
- /**\r
- * @return last and current count for specified statistic\r
- */\r
- public String getStat() {\r
- long cntPrevVal = getCounterLastReadValue();\r
- long cntCurValue = getCounterValue();\r
- return String.format("+%d | %d",cntCurValue-cntPrevVal,cntCurValue);\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.openflowjava.statistics;
+
+import java.util.concurrent.atomic.AtomicLong;
+/**
+ * Counts statistics
+ *
+ * @author madamjak
+ */
+public class Counter {
+
+ private AtomicLong counterValue;
+ private AtomicLong counterLastReadValue;
+
+ /**
+ * Default constructor
+ */
+ public Counter() {
+ counterValue = new AtomicLong(0L);
+ counterLastReadValue = new AtomicLong(0L);
+ }
+
+ /**
+ * Increment current counter value
+ */
+ public void incrementCounter(){
+ counterValue.incrementAndGet();
+ }
+
+ /**
+ * return the last read value of counter. This value can be set during the reading of current counter value,
+ * for detail see method getCounterValue(boolean modifyLastReadValue).
+ * @return the counterLastReadValue
+ */
+ public long getCounterLastReadValue() {
+ return counterLastReadValue.get();
+ }
+
+ /**
+ * get current value of counter and rewrite CounterLastReadValue by current value
+ * @return the current value of counter
+ */
+ public long getCounterValue() {
+ return getCounterValue(true);
+ }
+
+ /**
+ * get current counter value
+ * @param modifyLastReadValue
+ * true - CounterLastReadValue will be rewritten by current CounterValue
+ * false - no change CounterLastReadValue
+ * @return the current value of counter
+ */
+ public long getCounterValue(boolean modifyLastReadValue) {
+ if(modifyLastReadValue){
+ counterLastReadValue.set(counterValue.get());
+ }
+ return counterValue.get();
+ }
+
+ /**
+ * set current counter value and CounterLastReadValue to 0 (zero)
+ */
+ public void reset(){
+ counterValue.set(0l);
+ counterLastReadValue.set(0l);
+ }
+
+ /**
+ * @return last and current count for specified statistic
+ */
+ public String getStat() {
+ long cntPrevVal = getCounterLastReadValue();
+ long cntCurValue = getCounterValue();
+ return String.format("+%d | %d",cntCurValue-cntPrevVal,cntCurValue);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.statistics;\r
-\r
-/**\r
- * Enumeration of events to be counted with StatisticsCounters\r
- * @author madamjak\r
- *\r
- */\r
-public enum CounterEventTypes {\r
- /**\r
- * enter message to OFJ and pass to downstream\r
- */\r
- DS_ENTERED_OFJAVA,\r
- /**\r
- * flow-mod is entered\r
- */\r
- DS_FLOW_MODS_ENTERED,\r
- /**\r
- * encode message successfully\r
- */\r
- DS_ENCODE_SUCCESS,\r
- /**\r
- * fail encode message\r
- */\r
- DS_ENCODE_FAIL,\r
- /**\r
- * flow-mod encoded and sent to downstream\r
- */\r
- DS_FLOW_MODS_SENT,\r
- /**\r
- * receive message and pass to upstream\r
- */\r
- US_RECEIVED_IN_OFJAVA,\r
- /**\r
- * decode message successfully\r
- */\r
- US_DECODE_SUCCESS,\r
- /**\r
- * fail decode message\r
- */\r
- US_DECODE_FAIL,\r
- /**\r
- * pass message to consumer (end of upstream)\r
- */\r
- US_MESSAGE_PASS;\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.openflowjava.statistics;
+
+/**
+ * Enumeration of events to be counted with StatisticsCounters
+ * @author madamjak
+ *
+ */
+public enum CounterEventTypes {
+ /**
+ * enter message to OFJ and pass to downstream
+ */
+ DS_ENTERED_OFJAVA,
+ /**
+ * flow-mod is entered
+ */
+ DS_FLOW_MODS_ENTERED,
+ /**
+ * encode message successfully
+ */
+ DS_ENCODE_SUCCESS,
+ /**
+ * fail encode message
+ */
+ DS_ENCODE_FAIL,
+ /**
+ * flow-mod encoded and sent to downstream
+ */
+ DS_FLOW_MODS_SENT,
+ /**
+ * receive message and pass to upstream
+ */
+ US_RECEIVED_IN_OFJAVA,
+ /**
+ * decode message successfully
+ */
+ US_DECODE_SUCCESS,
+ /**
+ * fail decode message
+ */
+ US_DECODE_FAIL,
+ /**
+ * pass message to consumer (end of upstream)
+ */
+ US_MESSAGE_PASS;
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
-\r
- <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
- <layout class="org.apache.log4j.PatternLayout">\r
- <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
- </layout>\r
- </appender>\r
-\r
- <logger name="org.opendaylight.openflowjava.statistics" additivity="false">\r
- <level value="DEBUG" />\r
- <appender-ref ref="console" />\r
- </logger>\r
- <logger name="org.opendaylight.openflowjava.protocol.impl" additivity="false">\r
- <level value="DEBUG" />\r
- <appender-ref ref="console" />\r
- </logger>\r
- <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">\r
- <level value="DEBUG" />\r
- <appender-ref ref="console" />\r
- </logger>\r
-\r
- <root>\r
- <priority value="INFO" />\r
- <appender-ref ref="console" />\r
- </root>\r
-</log4j:configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />
+ </layout>
+ </appender>
+
+ <logger name="org.opendaylight.openflowjava.statistics" additivity="false">
+ <level value="DEBUG" />
+ <appender-ref ref="console" />
+ </logger>
+ <logger name="org.opendaylight.openflowjava.protocol.impl" additivity="false">
+ <level value="DEBUG" />
+ <appender-ref ref="console" />
+ </logger>
+ <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">
+ <level value="DEBUG" />
+ <appender-ref ref="console" />
+ </logger>
+
+ <root>
+ <priority value="INFO" />
+ <appender-ref ref="console" />
+ </root>
+</log4j:configuration>
-/*\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.openflowjava.protocol.impl.core;\r
-\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.util.concurrent.Future;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import java.net.InetSocketAddress;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketEncoderTest {\r
-\r
- @Mock ChannelHandlerContext ctx;\r
- @Mock GenericFutureListener<Future<Void>> listener;\r
- @Mock SerializationFactory factory;\r
-\r
- private UdpMessageListenerWrapper wrapper;\r
- private InetSocketAddress address = new InetSocketAddress("10.0.0.1", 6653);\r
- private List<Object> out;\r
-\r
- /**\r
- * Initializes mocks and other objects\r
- * @param version openflow protocol wire version\r
- */\r
- public void startUp(Short version) {\r
- MockitoAnnotations.initMocks(this);\r
- out = new ArrayList<>();\r
- HelloInputBuilder builder = new HelloInputBuilder();\r
- builder.setVersion(version);\r
- HelloInput hello = builder.build();\r
- wrapper = new UdpMessageListenerWrapper(hello, listener, address);\r
- }\r
-\r
- /**\r
- * Tests encoding\r
- */\r
- @Test\r
- public void testCorrectEncode() {\r
- startUp((short) EncodeConstants.OF13_VERSION_ID);\r
- OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();\r
- encoder.setSerializationFactory(factory);\r
- try {\r
- encoder.encode(ctx, wrapper, out);\r
- } catch (Exception e) {\r
- Assert.fail();\r
- }\r
- }\r
-\r
- /**\r
- * Tests encoding\r
- */\r
- @Test\r
- public void testIncorrectEncode() {\r
- startUp(null);\r
- OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();\r
- encoder.setSerializationFactory(factory);\r
- try {\r
- encoder.encode(ctx, wrapper, out);\r
- } catch (Exception e) {\r
- verify(wrapper, times(1)).getListener();\r
- Assert.assertEquals("List should be empty", 0, out.size());\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.openflowjava.protocol.impl.core;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketEncoderTest {
+
+ @Mock ChannelHandlerContext ctx;
+ @Mock GenericFutureListener<Future<Void>> listener;
+ @Mock SerializationFactory factory;
+
+ private UdpMessageListenerWrapper wrapper;
+ private InetSocketAddress address = new InetSocketAddress("10.0.0.1", 6653);
+ private List<Object> out;
+
+ /**
+ * Initializes mocks and other objects
+ * @param version openflow protocol wire version
+ */
+ public void startUp(Short version) {
+ MockitoAnnotations.initMocks(this);
+ out = new ArrayList<>();
+ HelloInputBuilder builder = new HelloInputBuilder();
+ builder.setVersion(version);
+ HelloInput hello = builder.build();
+ wrapper = new UdpMessageListenerWrapper(hello, listener, address);
+ }
+
+ /**
+ * Tests encoding
+ */
+ @Test
+ public void testCorrectEncode() {
+ startUp((short) EncodeConstants.OF13_VERSION_ID);
+ OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();
+ encoder.setSerializationFactory(factory);
+ try {
+ encoder.encode(ctx, wrapper, out);
+ } catch (Exception e) {
+ Assert.fail();
+ }
+ }
+
+ /**
+ * Tests encoding
+ */
+ @Test
+ public void testIncorrectEncode() {
+ startUp(null);
+ OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();
+ encoder.setSerializationFactory(factory);
+ try {
+ encoder.encode(ctx, wrapper, out);
+ } catch (Exception e) {
+ verify(wrapper, times(1)).getListener();
+ Assert.assertEquals("List should be empty", 0, out.size());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import io.netty.channel.Channel;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ChannelOutboundQueueTest {\r
-\r
- @Mock Channel channel;\r
-\r
- /**\r
- * Initialize mocks\r
- */\r
- public ChannelOutboundQueueTest() {\r
- MockitoAnnotations.initMocks(this);\r
- }\r
-\r
- /**\r
- * Test incorrect queue creation handling\r
- */\r
- @Test(expected=IllegalArgumentException.class)\r
- public void testIncorrectQueueCreation() {\r
- new ChannelOutboundQueue(channel, 0, null);\r
- }\r
-\r
- /**\r
- * Test correct enqueue handling\r
- */\r
- @Test\r
- public void testEnqueue() {\r
- ChannelOutboundQueue queue = new ChannelOutboundQueue(channel, 1, null);\r
- boolean enqueued;\r
- enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));\r
- Assert.assertTrue("Enqueue problem", enqueued);\r
- enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));\r
- Assert.assertFalse("Enqueue problem", enqueued);\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.openflowjava.protocol.impl.core.connection;
+
+import io.netty.channel.Channel;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ChannelOutboundQueueTest {
+
+ @Mock Channel channel;
+
+ /**
+ * Initialize mocks
+ */
+ public ChannelOutboundQueueTest() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ /**
+ * Test incorrect queue creation handling
+ */
+ @Test(expected=IllegalArgumentException.class)
+ public void testIncorrectQueueCreation() {
+ new ChannelOutboundQueue(channel, 0, null);
+ }
+
+ /**
+ * Test correct enqueue handling
+ */
+ @Test
+ public void testEnqueue() {
+ ChannelOutboundQueue queue = new ChannelOutboundQueue(channel, 1, null);
+ boolean enqueued;
+ enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+ Assert.assertTrue("Enqueue problem", enqueued);
+ enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+ Assert.assertFalse("Enqueue problem", enqueued);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.channel.ChannelFuture;\r
-import io.netty.channel.ChannelPipeline;\r
-import io.netty.channel.socket.SocketChannel;\r
-\r
-import java.net.InetSocketAddress;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEventBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-import com.google.common.cache.Cache;\r
-import com.google.common.cache.CacheBuilder;\r
-import com.google.common.cache.RemovalListener;\r
-import com.google.common.cache.RemovalNotification;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @author madamjak\r
- *\r
- */\r
-public class ConnectionAdapterImplTest {\r
-\r
- private static final int RPC_RESPONSE_EXPIRATION = 1;\r
- private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =\r
- new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {\r
- @Override\r
- public void onRemoval(\r
- final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {\r
- notification.getValue().discard();\r
- }\r
- };\r
-\r
- @Mock SocketChannel channel;\r
- @Mock ChannelPipeline pipeline;\r
- @Mock OpenflowProtocolListener messageListener;\r
- @Mock SystemNotificationsListener systemListener;\r
- @Mock ConnectionReadyListener readyListener;\r
- @Mock Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> mockCache;\r
- @Mock ChannelFuture channelFuture;\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
+ */
- private ConnectionAdapterImpl adapter;\r
- private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> cache;\r
-\r
- /**\r
- * Initializes ConnectionAdapter\r
- */\r
- @Before\r
- public void setUp() {\r
- MockitoAnnotations.initMocks(this);\r
- when(channel.pipeline()).thenReturn(pipeline);\r
- adapter = new ConnectionAdapterImpl(channel, InetSocketAddress.createUnresolved("10.0.0.1", 6653));\r
- adapter.setMessageListener(messageListener);\r
- adapter.setSystemListener(systemListener);\r
- adapter.setConnectionReadyListener(readyListener);\r
- cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)\r
- .removalListener(REMOVAL_LISTENER).build();\r
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.socket.SocketChannel;
+
+import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEventBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+
+/**
+ * @author michal.polkorab
+ * @author madamjak
+ *
+ */
+public class ConnectionAdapterImplTest {
+
+ private static final int RPC_RESPONSE_EXPIRATION = 1;
+ private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =
+ new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {
+ @Override
+ public void onRemoval(
+ final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {
+ notification.getValue().discard();
+ }
+ };
+
+ @Mock SocketChannel channel;
+ @Mock ChannelPipeline pipeline;
+ @Mock OpenflowProtocolListener messageListener;
+ @Mock SystemNotificationsListener systemListener;
+ @Mock ConnectionReadyListener readyListener;
+ @Mock Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> mockCache;
+ @Mock ChannelFuture channelFuture;
+
+ private ConnectionAdapterImpl adapter;
+ private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> cache;
+
+ /**
+ * Initializes ConnectionAdapter
+ */
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ when(channel.pipeline()).thenReturn(pipeline);
+ adapter = new ConnectionAdapterImpl(channel, InetSocketAddress.createUnresolved("10.0.0.1", 6653));
+ adapter.setMessageListener(messageListener);
+ adapter.setSystemListener(systemListener);
+ adapter.setConnectionReadyListener(readyListener);
+ cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
+ .removalListener(REMOVAL_LISTENER).build();
adapter.setResponseCache(cache);
when(channel.disconnect()).thenReturn(channelFuture);
- }\r
-\r
- /**\r
- * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with notifications\r
- */\r
- @Test\r
- public void testConsume() {\r
- DataObject message = new EchoRequestMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);\r
- message = new ErrorMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onErrorMessage((ErrorMessage) message);\r
- message = new ExperimenterMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onExperimenterMessage((ExperimenterMessage) message);\r
- message = new FlowRemovedMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onFlowRemovedMessage((FlowRemovedMessage) message);\r
- message = new HelloMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onHelloMessage((HelloMessage) message);\r
- message = new MultipartReplyMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onMultipartReplyMessage((MultipartReplyMessage) message);\r
- message = new PacketInMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onPacketInMessage((PacketInMessage) message);\r
- message = new PortStatusMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onPortStatusMessage((PortStatusMessage) message);\r
- message = new SwitchIdleEventBuilder().build();\r
- adapter.consume(message);\r
- verify(systemListener, times(1)).onSwitchIdleEvent((SwitchIdleEvent) message);\r
- message = new DisconnectEventBuilder().build();\r
- adapter.consume(message);\r
- verify(systemListener, times(1)).onDisconnectEvent((DisconnectEvent) message);\r
- message = new EchoRequestMessageBuilder().build();\r
- adapter.consume(message);\r
- verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);\r
- }\r
-\r
- /**\r
- * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with unexpected rpc\r
- */\r
- @Test\r
- public void testConsume2() {\r
- adapter.setResponseCache(mockCache);\r
- BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();\r
- barrierBuilder.setXid(42L);\r
- BarrierOutput barrier = barrierBuilder.build();\r
- adapter.consume(barrier);\r
- verify(mockCache, times(1)).getIfPresent(any(RpcResponseKey.class));\r
- }\r
-\r
- /**\r
- * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with expected rpc\r
- */\r
- @Test\r
- public void testConsume3() {\r
- BarrierInputBuilder inputBuilder = new BarrierInputBuilder();\r
- inputBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);\r
- inputBuilder.setXid(42L);\r
- BarrierInput barrierInput = inputBuilder.build();\r
- RpcResponseKey key = new RpcResponseKey(42L, "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput");\r
- ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>(barrierInput,\r
- "failure", mockCache, key);\r
- cache.put(key, listener);\r
- BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();\r
- barrierBuilder.setXid(42L);\r
- BarrierOutput barrierOutput = barrierBuilder.build();\r
- adapter.consume(barrierOutput);\r
- ResponseExpectedRpcListener<?> ifPresent = cache.getIfPresent(key);\r
- Assert.assertNull("Listener was not discarded", ifPresent);\r
+ }
+
+ /**
+ * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with notifications
+ */
+ @Test
+ public void testConsume() {
+ DataObject message = new EchoRequestMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
+ message = new ErrorMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onErrorMessage((ErrorMessage) message);
+ message = new ExperimenterMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onExperimenterMessage((ExperimenterMessage) message);
+ message = new FlowRemovedMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onFlowRemovedMessage((FlowRemovedMessage) message);
+ message = new HelloMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onHelloMessage((HelloMessage) message);
+ message = new MultipartReplyMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onMultipartReplyMessage((MultipartReplyMessage) message);
+ message = new PacketInMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onPacketInMessage((PacketInMessage) message);
+ message = new PortStatusMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onPortStatusMessage((PortStatusMessage) message);
+ message = new SwitchIdleEventBuilder().build();
+ adapter.consume(message);
+ verify(systemListener, times(1)).onSwitchIdleEvent((SwitchIdleEvent) message);
+ message = new DisconnectEventBuilder().build();
+ adapter.consume(message);
+ verify(systemListener, times(1)).onDisconnectEvent((DisconnectEvent) message);
+ message = new EchoRequestMessageBuilder().build();
+ adapter.consume(message);
+ verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
+ }
+
+ /**
+ * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with unexpected rpc
+ */
+ @Test
+ public void testConsume2() {
+ adapter.setResponseCache(mockCache);
+ BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();
+ barrierBuilder.setXid(42L);
+ BarrierOutput barrier = barrierBuilder.build();
+ adapter.consume(barrier);
+ verify(mockCache, times(1)).getIfPresent(any(RpcResponseKey.class));
+ }
+
+ /**
+ * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with expected rpc
+ */
+ @Test
+ public void testConsume3() {
+ BarrierInputBuilder inputBuilder = new BarrierInputBuilder();
+ inputBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
+ inputBuilder.setXid(42L);
+ BarrierInput barrierInput = inputBuilder.build();
+ RpcResponseKey key = new RpcResponseKey(42L, "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput");
+ ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>(barrierInput,
+ "failure", mockCache, key);
+ cache.put(key, listener);
+ BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();
+ barrierBuilder.setXid(42L);
+ BarrierOutput barrierOutput = barrierBuilder.build();
+ adapter.consume(barrierOutput);
+ ResponseExpectedRpcListener<?> ifPresent = cache.getIfPresent(key);
+ Assert.assertNull("Listener was not discarded", ifPresent);
}
/**
* Test IsAlive method
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageListenerWrapper;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MessageListenerWrapperTest {\r
-\r
- /**\r
- * Test MessageListenerWrapper creation\r
- */\r
- @Test\r
- public void test() {\r
- HelloInputBuilder builder = new HelloInputBuilder();\r
- HelloInput hello = builder.build();\r
- SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");\r
- MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);\r
- Assert.assertEquals("Wrong message", hello, wrapper.getMsg());\r
- Assert.assertEquals("Wrong listener", listener, wrapper.getListener());\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.openflowjava.protocol.impl.core.connection;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageListenerWrapper;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MessageListenerWrapperTest {
+
+ /**
+ * Test MessageListenerWrapper creation
+ */
+ @Test
+ public void test() {
+ HelloInputBuilder builder = new HelloInputBuilder();
+ HelloInput hello = builder.build();
+ SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");
+ MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);
+ Assert.assertEquals("Wrong message", hello, wrapper.getMsg());
+ Assert.assertEquals("Wrong listener", listener, wrapper.getListener());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import static org.junit.Assert.fail;\r
-\r
-import java.util.Collections;\r
-import java.util.concurrent.ExecutionException;\r
-import java.util.concurrent.TimeUnit;\r
-import java.util.concurrent.TimeoutException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.sal.common.util.Rpcs;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.AbstractRpcListener;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-import org.opendaylight.yangtools.yang.common.RpcError;\r
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
-\r
-import com.google.common.cache.Cache;\r
-import com.google.common.cache.CacheBuilder;\r
-import com.google.common.cache.RemovalListener;\r
-import com.google.common.cache.RemovalNotification;\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ResponseExpectedRpcListenerTest {\r
-\r
- private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =\r
- new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {\r
- @Override\r
- public void onRemoval(\r
- final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {\r
- notification.getValue().discard();\r
- }\r
- };\r
- private static final int RPC_RESPONSE_EXPIRATION = 1;\r
- private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> responseCache = CacheBuilder.newBuilder()\r
- .concurrencyLevel(1)\r
- .expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)\r
- .removalListener(REMOVAL_LISTENER).build();\r
-\r
- /**\r
- * Test object creation\r
- */\r
- @Test(expected=NullPointerException.class)\r
- public void testCreation() {\r
- RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
- new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", null, key);\r
- }\r
-\r
- /**\r
- * Test object creation\r
- */\r
- @Test(expected=NullPointerException.class)\r
- public void testCreation2() {\r
- new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, null);\r
- }\r
-\r
- /**\r
- * Test object creation\r
- */\r
- @Test\r
- public void testDiscard() {\r
- RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
- ResponseExpectedRpcListener<OfHeader> listener =\r
- new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);\r
- listener.discard();\r
- RpcError rpcError = AbstractRpcListener.buildRpcError("Failed to send message",\r
- ErrorSeverity.ERROR, "check switch connection", new TimeoutException("Request timed out"));\r
- SettableFuture<RpcResult<?>> result = SettableFuture.create();\r
- result.set(Rpcs.getRpcResult(false, null, Collections.singletonList(rpcError)));\r
- try {\r
- Assert.assertEquals("Wrong result", result.get().getErrors().iterator().next().getMessage(),\r
- listener.getResult().get().getErrors().iterator().next().getMessage());\r
- Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());\r
- Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());\r
- } catch (InterruptedException | ExecutionException e) {\r
- fail("Problem accessing result");\r
- }\r
- }\r
-\r
- /**\r
- * Test object creation\r
- */\r
- @Test\r
- public void testCompleted() {\r
- RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
- ResponseExpectedRpcListener<OfHeader> listener =\r
- new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);\r
- BarrierInputBuilder barrierBuilder = new BarrierInputBuilder();\r
- BarrierInput barrierInput = barrierBuilder.build();\r
- listener.completed(barrierInput);\r
- SettableFuture<RpcResult<?>> result = SettableFuture.create();\r
- result.set(Rpcs.getRpcResult(true, barrierInput, Collections.<RpcError>emptyList()));\r
- try {\r
- Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());\r
- Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());\r
- Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());\r
- } catch (InterruptedException | ExecutionException e) {\r
- fail("Problem accessing result");\r
- }\r
- }\r
-\r
- /**\r
- * Test object creation\r
- */\r
- @Test\r
- public void testOperationSuccessful() {\r
- RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
- ResponseExpectedRpcListener<OfHeader> listener =\r
- new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);\r
- listener.operationSuccessful();\r
- ResponseExpectedRpcListener<?> present = responseCache.getIfPresent(key);\r
- Assert.assertEquals(present, listener);\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.openflowjava.protocol.impl.core.connection;
+
+import static org.junit.Assert.fail;
+
+import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.AbstractRpcListener;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ResponseExpectedRpcListenerTest {
+
+ private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =
+ new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {
+ @Override
+ public void onRemoval(
+ final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {
+ notification.getValue().discard();
+ }
+ };
+ private static final int RPC_RESPONSE_EXPIRATION = 1;
+ private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> responseCache = CacheBuilder.newBuilder()
+ .concurrencyLevel(1)
+ .expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
+ .removalListener(REMOVAL_LISTENER).build();
+
+ /**
+ * Test object creation
+ */
+ @Test(expected=NullPointerException.class)
+ public void testCreation() {
+ RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+ new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", null, key);
+ }
+
+ /**
+ * Test object creation
+ */
+ @Test(expected=NullPointerException.class)
+ public void testCreation2() {
+ new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, null);
+ }
+
+ /**
+ * Test object creation
+ */
+ @Test
+ public void testDiscard() {
+ RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+ ResponseExpectedRpcListener<OfHeader> listener =
+ new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
+ listener.discard();
+ RpcError rpcError = AbstractRpcListener.buildRpcError("Failed to send message",
+ ErrorSeverity.ERROR, "check switch connection", new TimeoutException("Request timed out"));
+ SettableFuture<RpcResult<?>> result = SettableFuture.create();
+ result.set(Rpcs.getRpcResult(false, null, Collections.singletonList(rpcError)));
+ try {
+ Assert.assertEquals("Wrong result", result.get().getErrors().iterator().next().getMessage(),
+ listener.getResult().get().getErrors().iterator().next().getMessage());
+ Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
+ Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
+ } catch (InterruptedException | ExecutionException e) {
+ fail("Problem accessing result");
+ }
+ }
+
+ /**
+ * Test object creation
+ */
+ @Test
+ public void testCompleted() {
+ RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+ ResponseExpectedRpcListener<OfHeader> listener =
+ new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
+ BarrierInputBuilder barrierBuilder = new BarrierInputBuilder();
+ BarrierInput barrierInput = barrierBuilder.build();
+ listener.completed(barrierInput);
+ SettableFuture<RpcResult<?>> result = SettableFuture.create();
+ result.set(Rpcs.getRpcResult(true, barrierInput, Collections.<RpcError>emptyList()));
+ try {
+ Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());
+ Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
+ Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
+ } catch (InterruptedException | ExecutionException e) {
+ fail("Problem accessing result");
+ }
+ }
+
+ /**
+ * Test object creation
+ */
+ @Test
+ public void testOperationSuccessful() {
+ RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+ ResponseExpectedRpcListener<OfHeader> listener =
+ new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
+ listener.operationSuccessful();
+ ResponseExpectedRpcListener<?> present = responseCache.getIfPresent(key);
+ Assert.assertEquals(present, listener);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import static org.junit.Assert.fail;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.util.concurrent.Future;\r
-\r
-import java.util.Collections;\r
-import java.util.concurrent.ExecutionException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.controller.sal.common.util.Rpcs;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;\r
-import org.opendaylight.yangtools.yang.common.RpcError;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
-\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SimpleRpcListenerTest {\r
-\r
- @Mock Future<Void> future;\r
-\r
- /**\r
- * Initializes mocks\r
- */\r
- @Before\r
- public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
- }\r
-\r
- /**\r
- * Test SimpleRpcListener creation\r
- */\r
- @Test\r
- public void test() {\r
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
- Assert.assertEquals("Wrong message", "MESSAGE", listener.takeMessage());\r
- Assert.assertEquals("Wrong message", listener, listener.takeListener());\r
- }\r
-\r
- /**\r
- * Test rpc success\r
- */\r
- @Test\r
- public void testSuccessfulRpc() {\r
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
- listener.operationSuccessful();\r
- SettableFuture<RpcResult<?>> result = SettableFuture.create();\r
- result.set(Rpcs.getRpcResult(true, null, Collections.<RpcError>emptyList()));\r
- try {\r
- Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());\r
- Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());\r
- Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());\r
- } catch (InterruptedException | ExecutionException e) {\r
- fail("Problem accessing result");\r
- }\r
- }\r
-\r
- /**\r
- * Test rpc success\r
- */\r
- @Test\r
- public void testOperationComplete() {\r
- when(future.isSuccess()).thenReturn(false);\r
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
- listener.operationComplete(future);\r
- verify(future, times(1)).cause();\r
- try {\r
- Assert.assertEquals("Wrong result", 1, listener.getResult().get().getErrors().size());\r
- } catch (InterruptedException | ExecutionException e) {\r
- Assert.fail();\r
- }\r
- }\r
-\r
- /**\r
- * Test rpc success\r
- */\r
- @Test\r
- public void testOperationComplete2() {\r
- when(future.isSuccess()).thenReturn(true);\r
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
- listener.operationComplete(future);\r
- verify(future, times(0)).cause();\r
- try {\r
- Assert.assertEquals("Wrong result", 0, listener.getResult().get().getErrors().size());\r
- Assert.assertEquals("Wrong result", true, listener.getResult().get().isSuccessful());\r
- } catch (InterruptedException | ExecutionException e) {\r
- Assert.fail();\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.openflowjava.protocol.impl.core.connection;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import io.netty.util.concurrent.Future;
+
+import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SimpleRpcListenerTest {
+
+ @Mock Future<Void> future;
+
+ /**
+ * Initializes mocks
+ */
+ @Before
+ public void startUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ /**
+ * Test SimpleRpcListener creation
+ */
+ @Test
+ public void test() {
+ SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ Assert.assertEquals("Wrong message", "MESSAGE", listener.takeMessage());
+ Assert.assertEquals("Wrong message", listener, listener.takeListener());
+ }
+
+ /**
+ * Test rpc success
+ */
+ @Test
+ public void testSuccessfulRpc() {
+ SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ listener.operationSuccessful();
+ SettableFuture<RpcResult<?>> result = SettableFuture.create();
+ result.set(Rpcs.getRpcResult(true, null, Collections.<RpcError>emptyList()));
+ try {
+ Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());
+ Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
+ Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
+ } catch (InterruptedException | ExecutionException e) {
+ fail("Problem accessing result");
+ }
+ }
+
+ /**
+ * Test rpc success
+ */
+ @Test
+ public void testOperationComplete() {
+ when(future.isSuccess()).thenReturn(false);
+ SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ listener.operationComplete(future);
+ verify(future, times(1)).cause();
+ try {
+ Assert.assertEquals("Wrong result", 1, listener.getResult().get().getErrors().size());
+ } catch (InterruptedException | ExecutionException e) {
+ Assert.fail();
+ }
+ }
+
+ /**
+ * Test rpc success
+ */
+ @Test
+ public void testOperationComplete2() {
+ when(future.isSuccess()).thenReturn(true);
+ SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ listener.operationComplete(future);
+ verify(future, times(0)).cause();
+ try {
+ Assert.assertEquals("Wrong result", 0, listener.getResult().get().getErrors().size());
+ Assert.assertEquals("Wrong result", true, listener.getResult().get().isSuccessful());
+ } catch (InterruptedException | ExecutionException e) {
+ Assert.fail();
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.core.connection;\r
-\r
-import java.net.InetAddress;\r
-import java.net.UnknownHostException;\r
-import java.util.concurrent.ExecutionException;\r
-import java.util.concurrent.TimeUnit;\r
-import java.util.concurrent.TimeoutException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl;\r
-import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol;\r
-\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SwitchConnectionProviderImplTest {\r
-\r
- @Mock SwitchConnectionHandler handler;\r
-\r
- private static final int SWITCH_IDLE_TIMEOUT = 2000;\r
- private static final int WAIT_TIMEOUT = 2000;\r
- private InetAddress startupAddress;\r
- private TlsConfiguration tlsConfiguration;\r
- private SwitchConnectionProviderImpl provider;\r
- private ConnectionConfigurationImpl config;\r
-\r
- /**\r
- * Creates new {@link SwitchConnectionProvider} instance for each test\r
- * @param protocol communication protocol\r
- */\r
- public void startUp(TransportProtocol protocol) {\r
- MockitoAnnotations.initMocks(this);\r
- config = null;\r
- if (protocol != null) {\r
- createConfig(protocol);\r
- }\r
- provider = new SwitchConnectionProviderImpl();\r
- }\r
-\r
- private void createConfig(TransportProtocol protocol) {\r
- try {\r
- startupAddress = InetAddress.getLocalHost();\r
- } catch (UnknownHostException e) {\r
- e.printStackTrace();\r
- }\r
- tlsConfiguration = null;\r
- if (protocol.equals(TransportProtocol.TLS)) {\r
- tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,\r
- "/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,\r
- "/selfSignedController", PathType.CLASSPATH) ;\r
- }\r
- config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT);\r
- config.setTransferProtocol(protocol);\r
- }\r
-\r
- /**\r
- * Tests provider startup - without configuration and {@link SwitchConnectionHandler}\r
- */\r
- @Test\r
- public void testStartup1() {\r
- provider = new SwitchConnectionProviderImpl();\r
- ListenableFuture<Boolean> future = provider.startup();\r
- try {\r
- future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- * Tests provider startup - without configuration\r
- */\r
- @Test\r
- public void testStartup2() {\r
- startUp(null);\r
- provider.setSwitchConnectionHandler(handler);\r
- ListenableFuture<Boolean> future = provider.startup();\r
- try {\r
- future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- * Tests provider startup - without {@link SwitchConnectionHandler}\r
- */\r
- @Test\r
- public void testStartup3() {\r
- startUp(TransportProtocol.TCP);\r
- provider.setConfiguration(config);\r
- ListenableFuture<Boolean> future = provider.startup();\r
- try {\r
- future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- Assert.assertEquals("Wrong state", "java.lang.IllegalStateException:"\r
- + " SwitchConnectionHandler is not set", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- * Tests correct provider startup - over TCP\r
- */\r
- @Test\r
- public void testStartup4() {\r
- startUp(TransportProtocol.TCP);\r
- provider.setConfiguration(config);\r
- provider.setSwitchConnectionHandler(handler);\r
- try {\r
- Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- Assert.fail();\r
- }\r
- }\r
-\r
- /**\r
- * Tests correct provider startup - over TLS\r
- */\r
- @Test\r
- public void testStartup5() {\r
- startUp(TransportProtocol.TLS);\r
- provider.setConfiguration(config);\r
- provider.setSwitchConnectionHandler(handler);\r
- try {\r
- Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- Assert.fail();\r
- }\r
- }\r
-\r
- /**\r
- * Tests correct provider startup - over UDP\r
- */\r
- @Test\r
- public void testStartup6() {\r
- startUp(TransportProtocol.UDP);\r
- provider.setConfiguration(config);\r
- provider.setSwitchConnectionHandler(handler);\r
- try {\r
- Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- Assert.fail();\r
- }\r
- }\r
-\r
- /**\r
- * Tests correct provider shutdown\r
- */\r
- @Test\r
- public void testShutdown() {\r
- startUp(TransportProtocol.TCP);\r
- provider.setConfiguration(config);\r
- provider.setSwitchConnectionHandler(handler);\r
- try {\r
- Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
- Assert.assertTrue("Failed to stop", provider.shutdown().get(5 * WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
- } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
- e.printStackTrace();\r
- }\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.openflowjava.protocol.impl.core.connection;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
+import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SwitchConnectionProviderImplTest {
+
+ @Mock SwitchConnectionHandler handler;
+
+ private static final int SWITCH_IDLE_TIMEOUT = 2000;
+ private static final int WAIT_TIMEOUT = 2000;
+ private InetAddress startupAddress;
+ private TlsConfiguration tlsConfiguration;
+ private SwitchConnectionProviderImpl provider;
+ private ConnectionConfigurationImpl config;
+
+ /**
+ * Creates new {@link SwitchConnectionProvider} instance for each test
+ * @param protocol communication protocol
+ */
+ public void startUp(TransportProtocol protocol) {
+ MockitoAnnotations.initMocks(this);
+ config = null;
+ if (protocol != null) {
+ createConfig(protocol);
+ }
+ provider = new SwitchConnectionProviderImpl();
+ }
+
+ private void createConfig(TransportProtocol protocol) {
+ try {
+ startupAddress = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ tlsConfiguration = null;
+ if (protocol.equals(TransportProtocol.TLS)) {
+ tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,
+ "/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,
+ "/selfSignedController", PathType.CLASSPATH) ;
+ }
+ config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT);
+ config.setTransferProtocol(protocol);
+ }
+
+ /**
+ * Tests provider startup - without configuration and {@link SwitchConnectionHandler}
+ */
+ @Test
+ public void testStartup1() {
+ provider = new SwitchConnectionProviderImpl();
+ ListenableFuture<Boolean> future = provider.startup();
+ try {
+ future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());
+ }
+ }
+
+ /**
+ * Tests provider startup - without configuration
+ */
+ @Test
+ public void testStartup2() {
+ startUp(null);
+ provider.setSwitchConnectionHandler(handler);
+ ListenableFuture<Boolean> future = provider.startup();
+ try {
+ future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());
+ }
+ }
+
+ /**
+ * Tests provider startup - without {@link SwitchConnectionHandler}
+ */
+ @Test
+ public void testStartup3() {
+ startUp(TransportProtocol.TCP);
+ provider.setConfiguration(config);
+ ListenableFuture<Boolean> future = provider.startup();
+ try {
+ future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ Assert.assertEquals("Wrong state", "java.lang.IllegalStateException:"
+ + " SwitchConnectionHandler is not set", e.getMessage());
+ }
+ }
+
+ /**
+ * Tests correct provider startup - over TCP
+ */
+ @Test
+ public void testStartup4() {
+ startUp(TransportProtocol.TCP);
+ provider.setConfiguration(config);
+ provider.setSwitchConnectionHandler(handler);
+ try {
+ Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ Assert.fail();
+ }
+ }
+
+ /**
+ * Tests correct provider startup - over TLS
+ */
+ @Test
+ public void testStartup5() {
+ startUp(TransportProtocol.TLS);
+ provider.setConfiguration(config);
+ provider.setSwitchConnectionHandler(handler);
+ try {
+ Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ Assert.fail();
+ }
+ }
+
+ /**
+ * Tests correct provider startup - over UDP
+ */
+ @Test
+ public void testStartup6() {
+ startUp(TransportProtocol.UDP);
+ provider.setConfiguration(config);
+ provider.setSwitchConnectionHandler(handler);
+ try {
+ Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ Assert.fail();
+ }
+ }
+
+ /**
+ * Tests correct provider shutdown
+ */
+ @Test
+ public void testShutdown() {
+ startUp(TransportProtocol.TCP);
+ provider.setConfiguration(config);
+ provider.setSwitchConnectionHandler(handler);
+ try {
+ Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+ Assert.assertTrue("Failed to stop", provider.shutdown().get(5 * WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ e.printStackTrace();
+ }
+ }
+
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class DeserializationFactoryTest {\r
-\r
- /**\r
- * Test deserializer lookup & deserialization\r
- */\r
- @Test\r
- public void test() {\r
- DeserializerRegistryImpl registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- DeserializationFactory factory = new DeserializationFactory();\r
- factory.setRegistry(registry);\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- buffer.writeByte(0);\r
- buffer.writeShort(EncodeConstants.OFHEADER_SIZE);\r
- buffer.writeInt(1234);\r
- factory.deserialize(buffer, EncodeConstants.OF13_VERSION_ID);\r
- assertEquals("Deserialization failed", 0, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Test deserializer lookup & deserialization\r
- */\r
- @Test(expected=NullPointerException.class)\r
- public void testNotExistingDeserializer() {\r
- DeserializerRegistryImpl registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- DeserializationFactory factory = new DeserializationFactory();\r
- factory.setRegistry(registry);\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- buffer.writeByte(0);\r
- buffer.writeShort(EncodeConstants.OFHEADER_SIZE);\r
- buffer.writeInt(1234);\r
- factory.deserialize(buffer, (short) 0);\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.openflowjava.protocol.impl.deserialization;
+
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class DeserializationFactoryTest {
+
+ /**
+ * Test deserializer lookup & deserialization
+ */
+ @Test
+ public void test() {
+ DeserializerRegistryImpl registry = new DeserializerRegistryImpl();
+ registry.init();
+ DeserializationFactory factory = new DeserializationFactory();
+ factory.setRegistry(registry);
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ buffer.writeByte(0);
+ buffer.writeShort(EncodeConstants.OFHEADER_SIZE);
+ buffer.writeInt(1234);
+ factory.deserialize(buffer, EncodeConstants.OF13_VERSION_ID);
+ assertEquals("Deserialization failed", 0, buffer.readableBytes());
+ }
+
+ /**
+ * Test deserializer lookup & deserialization
+ */
+ @Test(expected=NullPointerException.class)
+ public void testNotExistingDeserializer() {
+ DeserializerRegistryImpl registry = new DeserializerRegistryImpl();
+ registry.init();
+ DeserializationFactory factory = new DeserializationFactory();
+ factory.setRegistry(registry);
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ buffer.writeByte(0);
+ buffer.writeShort(EncodeConstants.OFHEADER_SIZE);
+ buffer.writeInt(1234);
+ factory.deserialize(buffer, (short) 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeToClassMapInitializerTest {\r
-\r
- private Map<TypeToClassKey, Class<?>> messageClassMap;\r
-\r
- /**\r
- * Tests correct map initialization\r
- */\r
- @Test\r
- public void test() {\r
- messageClassMap = new HashMap<>();\r
- TypeToClassMapInitializer.initializeTypeToClassMap(messageClassMap);\r
- short version = EncodeConstants.OF10_VERSION_ID;\r
- assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));\r
- assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));\r
- assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));\r
- assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));\r
- assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));\r
- assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));\r
- assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));\r
- assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));\r
- assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));\r
- assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));\r
- assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 17)));\r
- assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 19)));\r
- assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));\r
- version = EncodeConstants.OF13_VERSION_ID;\r
- assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));\r
- assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));\r
- assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));\r
- assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));\r
- assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));\r
- assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));\r
- assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));\r
- assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));\r
- assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));\r
- assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));\r
- assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 19)));\r
- assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));\r
- assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 23)));\r
- assertEquals("Wrong class", RoleRequestOutput.class, messageClassMap.get(new TypeToClassKey(version, 25)));\r
- assertEquals("Wrong class", GetAsyncOutput.class, messageClassMap.get(new TypeToClassKey(version, 27)));\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.openflowjava.protocol.impl.deserialization;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeToClassMapInitializerTest {
+
+ private Map<TypeToClassKey, Class<?>> messageClassMap;
+
+ /**
+ * Tests correct map initialization
+ */
+ @Test
+ public void test() {
+ messageClassMap = new HashMap<>();
+ TypeToClassMapInitializer.initializeTypeToClassMap(messageClassMap);
+ short version = EncodeConstants.OF10_VERSION_ID;
+ assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));
+ assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));
+ assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));
+ assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));
+ assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));
+ assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));
+ assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));
+ assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));
+ assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));
+ assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));
+ assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 17)));
+ assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 19)));
+ assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));
+ version = EncodeConstants.OF13_VERSION_ID;
+ assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));
+ assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));
+ assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));
+ assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));
+ assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));
+ assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));
+ assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));
+ assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));
+ assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));
+ assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));
+ assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 19)));
+ assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));
+ assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 23)));
+ assertEquals("Wrong class", RoleRequestOutput.class, messageClassMap.get(new TypeToClassKey(version, 25)));
+ assertEquals("Wrong class", GetAsyncOutput.class, messageClassMap.get(new TypeToClassKey(version, 27)));
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterMessageFactoryTest {\r
-\r
- @Mock DeserializerRegistry registry;\r
- @Mock OFDeserializer<ExperimenterMessage> deserializer;\r
- @Mock ExperimenterMessage message;\r
-\r
- /**\r
- * Initializes mocks\r
- */\r
- @Before\r
- public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
- }\r
-\r
- /**\r
- * Test deserializer lookup correctness\r
- */\r
- @Test\r
- public void test() {\r
- when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);\r
- when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);\r
- \r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");\r
- ExperimenterMessageFactory factory = new ExperimenterMessageFactory();\r
- factory.injectDeserializerRegistry(registry);\r
- ExperimenterMessage deserializedMessage = factory.deserialize(buffer);\r
- Assert.assertEquals("Wrong return value", message, deserializedMessage);\r
- Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());\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.openflowjava.protocol.impl.deserialization.factories;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterMessageFactoryTest {
+
+ @Mock DeserializerRegistry registry;
+ @Mock OFDeserializer<ExperimenterMessage> deserializer;
+ @Mock ExperimenterMessage message;
+
+ /**
+ * Initializes mocks
+ */
+ @Before
+ public void startUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ /**
+ * Test deserializer lookup correctness
+ */
+ @Test
+ public void test() {
+ when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);
+ when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);
+
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");
+ ExperimenterMessageFactory factory = new ExperimenterMessageFactory();
+ factory.injectDeserializerRegistry(registry);
+ ExperimenterMessage deserializedMessage = factory.deserialize(buffer);
+ Assert.assertEquals("Wrong return value", message, deserializedMessage);
+ Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.math.BigInteger;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDesc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StatsReplyMessageFactoryTest {\r
-\r
- private OFDeserializer<MultipartReplyMessage> statsFactory;\r
-\r
- /**\r
- * Initializes deserializer registry and lookups correct deserializer\r
- */\r
- @Before\r
- public void startUp() {\r
- DeserializerRegistry registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- statsFactory = registry.getDeserializer(\r
- new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 17, MultipartReplyMessage.class));\r
- }\r
-\r
- /**\r
- * Testing OF10StatsReplyMessageFactory (Desc) for correct deserialization\r
- */\r
- @Test\r
- public void testDesc() {\r
- final int DESC_STR_LEN = 256;\r
- final int SERIAL_NUM_LEN = 32;\r
- ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");\r
- \r
- String mfrDesc = "Manufacturer description";\r
- byte[] mfrDescBytes = new byte[256];\r
- mfrDescBytes = mfrDesc.getBytes();\r
- bb.writeBytes(mfrDescBytes);\r
- bb.writeZero(DESC_STR_LEN - mfrDescBytes.length);\r
- \r
- String hwDesc = "Hardware description";\r
- byte[] hwDescBytes = new byte[256];\r
- hwDescBytes = hwDesc.getBytes();\r
- bb.writeBytes(hwDescBytes);\r
- bb.writeZero(DESC_STR_LEN - hwDescBytes.length);\r
- \r
- String swDesc = "Software description";\r
- byte[] swDescBytes = new byte[256];\r
- swDescBytes = swDesc.getBytes();\r
- bb.writeBytes(swDescBytes);\r
- bb.writeZero(DESC_STR_LEN - swDescBytes.length);\r
- \r
- String serialNum = "SN0123456789";\r
- byte[] serialNumBytes = new byte[32];\r
- serialNumBytes = serialNum.getBytes();\r
- bb.writeBytes(serialNumBytes);\r
- bb.writeZero(SERIAL_NUM_LEN - serialNumBytes.length);\r
- \r
- String dpDesc = "switch3 in room 3120";\r
- byte[] dpDescBytes = new byte[256];\r
- dpDescBytes = dpDesc.getBytes();\r
- bb.writeBytes(dpDescBytes);\r
- bb.writeZero(DESC_STR_LEN - dpDescBytes.length);\r
- \r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
- \r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());\r
- MultipartReplyDescCase messageCase = (MultipartReplyDescCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyDesc message = messageCase.getMultipartReplyDesc();\r
- Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());\r
- Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());\r
- Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());\r
- Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());\r
- Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());\r
- Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization\r
- */\r
- @Test\r
- public void testFlow() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 68 01 00 "\r
- + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
- + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
- + "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 "\r
- + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 "\r
- + "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");\r
- \r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());\r
- MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyFlow message = messageCase.getMultipartReplyFlow();\r
- Assert.assertEquals("Wrong tableId", 1, message.getFlowStats().get(0).getTableId().intValue());\r
- Assert.assertEquals("Wrong durationSec", 2, message.getFlowStats().get(0).getDurationSec().intValue());\r
- Assert.assertEquals("Wrong durationNsec", 3, message.getFlowStats().get(0).getDurationNsec().intValue());\r
- Assert.assertEquals("Wrong priority", 4, message.getFlowStats().get(0).getPriority().intValue());\r
- Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());\r
- Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());\r
- Assert.assertEquals("Wrong cookie",\r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
- message.getFlowStats().get(0).getCookie());\r
- Assert.assertEquals("Wrong packetCount",\r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
- message.getFlowStats().get(0).getPacketCount());\r
- Assert.assertEquals("Wrong byteCount",\r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
- message.getFlowStats().get(0).getByteCount());\r
- Action action1 = message.getFlowStats().get(0).getAction().get(0);\r
- Assert.assertEquals("Wrong action type", Output.class, action1.getType());\r
- Assert.assertEquals("Wrong action port", 1, action1.getAugmentation(PortAction.class)\r
- .getPort().getValue().intValue());\r
- Assert.assertEquals("Wrong action port", 2, action1.getAugmentation(MaxLengthAction.class)\r
- .getMaxLength().intValue());\r
- Action action2 = message.getFlowStats().get(0).getAction().get(1);\r
- Assert.assertEquals("Wrong action type", SetVlanVid.class, action2.getType());\r
- Assert.assertEquals("Wrong action port", 3, action2.getAugmentation(VlanVidAction.class)\r
- .getVlanVid().intValue());\r
- Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsReplyMessageFactory (Aggregate) for correct deserialization\r
- */\r
- @Test\r
- public void testAggregate() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 "\r
- + "FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");\r
- \r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());\r
- MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();\r
- Assert.assertEquals("Wrong packet-count",\r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
- message.getPacketCount());\r
- Assert.assertEquals("Wrong byte-count",\r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
- message.getByteCount());\r
- Assert.assertEquals("Wrong flow-count", 48, message.getFlowCount().intValue());\r
- Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsReplyMessageFactory (Table) for correct deserialization\r
- */\r
- @Test\r
- public void testTable() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 "\r
- + "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 "\r
- + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
- + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");\r
-\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-\r
- MultipartReplyTableCase messageCase = (MultipartReplyTableCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyTable message = messageCase.getMultipartReplyTable();\r
- Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());\r
- Assert.assertEquals("Wrong name", "JAMES BOND", message.getTableStats().get(0).getName());\r
- Assert.assertEquals("Wrong wildcards", new FlowWildcardsV10(false, false, false, false, false, false, false,\r
- false, false, false), message.getTableStats().get(0).getWildcards());\r
- Assert.assertEquals("Wrong src-mask", 32, message.getTableStats().get(0).getNwSrcMask().intValue());\r
- Assert.assertEquals("Wrong dst-mask", 32, message.getTableStats().get(0).getNwDstMask().intValue());\r
- Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());\r
- Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());\r
- Assert.assertEquals("Wrong lookupCount", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
- message.getTableStats().get(0).getLookupCount());\r
- Assert.assertEquals("Wrong matchedCount", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), \r
- message.getTableStats().get(0).getMatchedCount());\r
- Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsReplyMessageFactory (Port) for correct deserialization\r
- */\r
- @Test\r
- public void testPort() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 "\r
- + "00 FF 00 00 00 00 00 00 "\r
- + "FF 01 01 01 01 01 01 01 FF 02 02 02 02 02 02 02 "\r
- + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
- + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
- + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
- + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
- + "FF 02 03 02 03 02 03 02");\r
-\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyPortStatsCase messageCase = (MultipartReplyPortStatsCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();\r
- Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());\r
- Assert.assertEquals("Wrong rxPackets", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
- message.getPortStats().get(0).getRxPackets());\r
- Assert.assertEquals("Wrong txPackets", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
- message.getPortStats().get(0).getTxPackets());\r
- Assert.assertEquals("Wrong rxBytes", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getRxBytes());\r
- Assert.assertEquals("Wrong txBytes", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getTxBytes());\r
- Assert.assertEquals("Wrong rxDropped", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getRxDropped());\r
- Assert.assertEquals("Wrong txDropped", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getTxDropped());\r
- Assert.assertEquals("Wrong rxErrors", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getRxErrors());\r
- Assert.assertEquals("Wrong txErrors", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getTxErrors());\r
- Assert.assertEquals("Wrong rxFrameErr", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getRxFrameErr());\r
- Assert.assertEquals("Wrong rxOverErr", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getRxOverErr());\r
- Assert.assertEquals("Wrong rxCrcErr", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getRxCrcErr());\r
- Assert.assertEquals("Wrong collisions", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getPortStats().get(0).getCollisions());\r
- Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsReplyMessageFactory (Queue) for correct deserialization\r
- */\r
- @Test\r
- public void testQueue() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 05 00 00 "\r
- + "00 FF 00 00 00 00 00 10 "\r
- + "FF 02 03 02 03 02 03 02 "\r
- + "FF 02 02 02 02 02 02 02 "\r
- + "FF 02 03 02 03 02 03 02");\r
-\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyQueueCase messageCase = (MultipartReplyQueueCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyQueue message = messageCase.getMultipartReplyQueue();\r
- Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());\r
- Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());\r
- Assert.assertEquals("Wrong txBytes", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getQueueStats().get(0).getTxBytes());\r
- Assert.assertEquals("Wrong txPackets", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
- message.getQueueStats().get(0).getTxPackets());\r
- Assert.assertEquals("Wrong txErrors", \r
- new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
- message.getQueueStats().get(0).getTxErrors());\r
- Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import java.math.BigInteger;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StatsReplyMessageFactoryTest {
+
+ private OFDeserializer<MultipartReplyMessage> statsFactory;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ DeserializerRegistry registry = new DeserializerRegistryImpl();
+ registry.init();
+ statsFactory = registry.getDeserializer(
+ new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 17, MultipartReplyMessage.class));
+ }
+
+ /**
+ * Testing OF10StatsReplyMessageFactory (Desc) for correct deserialization
+ */
+ @Test
+ public void testDesc() {
+ final int DESC_STR_LEN = 256;
+ final int SERIAL_NUM_LEN = 32;
+ ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");
+
+ String mfrDesc = "Manufacturer description";
+ byte[] mfrDescBytes = new byte[256];
+ mfrDescBytes = mfrDesc.getBytes();
+ bb.writeBytes(mfrDescBytes);
+ bb.writeZero(DESC_STR_LEN - mfrDescBytes.length);
+
+ String hwDesc = "Hardware description";
+ byte[] hwDescBytes = new byte[256];
+ hwDescBytes = hwDesc.getBytes();
+ bb.writeBytes(hwDescBytes);
+ bb.writeZero(DESC_STR_LEN - hwDescBytes.length);
+
+ String swDesc = "Software description";
+ byte[] swDescBytes = new byte[256];
+ swDescBytes = swDesc.getBytes();
+ bb.writeBytes(swDescBytes);
+ bb.writeZero(DESC_STR_LEN - swDescBytes.length);
+
+ String serialNum = "SN0123456789";
+ byte[] serialNumBytes = new byte[32];
+ serialNumBytes = serialNum.getBytes();
+ bb.writeBytes(serialNumBytes);
+ bb.writeZero(SERIAL_NUM_LEN - serialNumBytes.length);
+
+ String dpDesc = "switch3 in room 3120";
+ byte[] dpDescBytes = new byte[256];
+ dpDescBytes = dpDesc.getBytes();
+ bb.writeBytes(dpDescBytes);
+ bb.writeZero(DESC_STR_LEN - dpDescBytes.length);
+
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 0, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
+ MultipartReplyDescCase messageCase = (MultipartReplyDescCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyDesc message = messageCase.getMultipartReplyDesc();
+ Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());
+ Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());
+ Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());
+ Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());
+ Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());
+ Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization
+ */
+ @Test
+ public void testFlow() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 68 01 00 "
+ + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+ + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+ + "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 "
+ + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 "
+ + "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");
+
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
+ MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
+ Assert.assertEquals("Wrong tableId", 1, message.getFlowStats().get(0).getTableId().intValue());
+ Assert.assertEquals("Wrong durationSec", 2, message.getFlowStats().get(0).getDurationSec().intValue());
+ Assert.assertEquals("Wrong durationNsec", 3, message.getFlowStats().get(0).getDurationNsec().intValue());
+ Assert.assertEquals("Wrong priority", 4, message.getFlowStats().get(0).getPriority().intValue());
+ Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());
+ Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());
+ Assert.assertEquals("Wrong cookie",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}),
+ message.getFlowStats().get(0).getCookie());
+ Assert.assertEquals("Wrong packetCount",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}),
+ message.getFlowStats().get(0).getPacketCount());
+ Assert.assertEquals("Wrong byteCount",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}),
+ message.getFlowStats().get(0).getByteCount());
+ Action action1 = message.getFlowStats().get(0).getAction().get(0);
+ Assert.assertEquals("Wrong action type", Output.class, action1.getType());
+ Assert.assertEquals("Wrong action port", 1, action1.getAugmentation(PortAction.class)
+ .getPort().getValue().intValue());
+ Assert.assertEquals("Wrong action port", 2, action1.getAugmentation(MaxLengthAction.class)
+ .getMaxLength().intValue());
+ Action action2 = message.getFlowStats().get(0).getAction().get(1);
+ Assert.assertEquals("Wrong action type", SetVlanVid.class, action2.getType());
+ Assert.assertEquals("Wrong action port", 3, action2.getAugmentation(VlanVidAction.class)
+ .getVlanVid().intValue());
+ Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsReplyMessageFactory (Aggregate) for correct deserialization
+ */
+ @Test
+ public void testAggregate() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 "
+ + "FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");
+
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
+ MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();
+ Assert.assertEquals("Wrong packet-count",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}),
+ message.getPacketCount());
+ Assert.assertEquals("Wrong byte-count",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}),
+ message.getByteCount());
+ Assert.assertEquals("Wrong flow-count", 48, message.getFlowCount().intValue());
+ Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsReplyMessageFactory (Table) for correct deserialization
+ */
+ @Test
+ public void testTable() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 "
+ + "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 "
+ + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+ + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");
+
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+
+ MultipartReplyTableCase messageCase = (MultipartReplyTableCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyTable message = messageCase.getMultipartReplyTable();
+ Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
+ Assert.assertEquals("Wrong name", "JAMES BOND", message.getTableStats().get(0).getName());
+ Assert.assertEquals("Wrong wildcards", new FlowWildcardsV10(false, false, false, false, false, false, false,
+ false, false, false), message.getTableStats().get(0).getWildcards());
+ Assert.assertEquals("Wrong src-mask", 32, message.getTableStats().get(0).getNwSrcMask().intValue());
+ Assert.assertEquals("Wrong dst-mask", 32, message.getTableStats().get(0).getNwDstMask().intValue());
+ Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());
+ Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
+ Assert.assertEquals("Wrong lookupCount",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ message.getTableStats().get(0).getLookupCount());
+ Assert.assertEquals("Wrong matchedCount",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}),
+ message.getTableStats().get(0).getMatchedCount());
+ Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsReplyMessageFactory (Port) for correct deserialization
+ */
+ @Test
+ public void testPort() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 "
+ + "00 FF 00 00 00 00 00 00 "
+ + "FF 01 01 01 01 01 01 01 FF 02 02 02 02 02 02 02 "
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+ + "FF 02 03 02 03 02 03 02");
+
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyPortStatsCase messageCase = (MultipartReplyPortStatsCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();
+ Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
+ Assert.assertEquals("Wrong rxPackets",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ message.getPortStats().get(0).getRxPackets());
+ Assert.assertEquals("Wrong txPackets",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ message.getPortStats().get(0).getTxPackets());
+ Assert.assertEquals("Wrong rxBytes",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getRxBytes());
+ Assert.assertEquals("Wrong txBytes",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getTxBytes());
+ Assert.assertEquals("Wrong rxDropped",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getRxDropped());
+ Assert.assertEquals("Wrong txDropped",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getTxDropped());
+ Assert.assertEquals("Wrong rxErrors",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getRxErrors());
+ Assert.assertEquals("Wrong txErrors",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getTxErrors());
+ Assert.assertEquals("Wrong rxFrameErr",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getRxFrameErr());
+ Assert.assertEquals("Wrong rxOverErr",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getRxOverErr());
+ Assert.assertEquals("Wrong rxCrcErr",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getRxCrcErr());
+ Assert.assertEquals("Wrong collisions",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getPortStats().get(0).getCollisions());
+ Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsReplyMessageFactory (Queue) for correct deserialization
+ */
+ @Test
+ public void testQueue() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 05 00 00 "
+ + "00 FF 00 00 00 00 00 10 "
+ + "FF 02 03 02 03 02 03 02 "
+ + "FF 02 02 02 02 02 02 02 "
+ + "FF 02 03 02 03 02 03 02");
+
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyQueueCase messageCase = (MultipartReplyQueueCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyQueue message = messageCase.getMultipartReplyQueue();
+ Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
+ Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
+ Assert.assertEquals("Wrong txBytes",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getQueueStats().get(0).getTxBytes());
+ Assert.assertEquals("Wrong txPackets",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ message.getQueueStats().get(0).getTxPackets());
+ Assert.assertEquals("Wrong txErrors",
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ message.getQueueStats().get(0).getTxErrors());
+ Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+ }
+
+}
-/*\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.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class VendorMessageFactoryTest {\r
-\r
- @Mock DeserializerRegistry registry;\r
- @Mock ExperimenterMessageFactory deserializer;\r
-\r
- /**\r
- * Tests {@link VendorMessageFactory#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer);\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00");\r
- VendorMessageFactory factory = new VendorMessageFactory();\r
- factory.injectDeserializerRegistry(registry);\r
- factory.deserialize(buffer);\r
-\r
- Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer);\r
- Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());\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.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VendorMessageFactoryTest {
+
+ @Mock DeserializerRegistry registry;
+ @Mock ExperimenterMessageFactory deserializer;
+
+ /**
+ * Tests {@link VendorMessageFactory#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer);
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00");
+ VendorMessageFactory factory = new VendorMessageFactory();
+ factory.injectDeserializerRegistry(registry);
+ factory.deserialize(buffer);
+
+ Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer);
+ Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class MultipartReplyExperimenterTest {\r
-\r
- @Mock DeserializerRegistry registry;\r
-\r
- private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyExperimenter() {\r
- factory.injectDeserializerRegistry(registry);\r
- ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "\r
- + "00 00 00 01 00 00 00 02"); // expID, expType\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-\r
- Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipartReplyExperimenterTest {
+
+ @Mock DeserializerRegistry registry;
+
+ private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyExperimenter() {
+ factory.injectDeserializerRegistry(registry);
+ ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "
+ + "00 00 00 01 00 00 00 02"); // expID, expType
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+
+ Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.math.BigInteger;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyFlowTest {\r
-\r
- private OFDeserializer<MultipartReplyMessage> factory;\r
-\r
- /**\r
- * Initializes deserializer registry and lookups correct deserializer\r
- */\r
- @Before\r
- public void startUp() {\r
- DeserializerRegistry registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- factory = registry.getDeserializer(\r
- new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 19, MultipartReplyMessage.class));\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testEmptyMultipartReplyFlowBody(){\r
- ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00");\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyFlow message = messageCase.getMultipartReplyFlow();\r
- Assert.assertEquals("Wrong flow stats size", 0, message.getFlowStats().size());\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyFlowBody(){\r
- ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+\r
- // first flow stat\r
- "00 48 08 00 "+ // length, tableId, padding\r
- "00 00 00 09 "+//durationSec\r
- "00 00 00 07 "+//durationNsec\r
- "00 0C 00 0E 00 0F 00 1F "+//priority, idleTimeout, hardTimeout, flags\r
- "00 00 00 00 "+//pad_02\r
- "FF 01 01 01 01 01 01 01 "+//cookie\r
- "EF 01 01 01 01 01 01 01 "+//packetCount\r
- "7F 01 01 01 01 01 01 01 "+//byteCount\r
- "00 01 00 04 00 00 00 00 "+//empty match\r
- "00 01 00 08 06 00 00 00 "+\r
- "00 01 00 08 06 00 00 00 "+\r
- // second flow stat\r
- "00 48 08 00 "+ // length, tableId, padding\r
- "00 00 00 09 "+//durationSec\r
- "00 00 00 07 "+//durationNsec\r
- "00 0C 00 0E 00 0F 00 00 "+//priority, idleTimeout, hardTimeout, flags\r
- "00 00 00 00 "+//pad_02\r
- "FF 01 01 01 01 01 01 01 "+//cookie\r
- "EF 01 01 01 01 01 01 01 "+//packetCount\r
- "7F 01 01 01 01 01 01 01 "+//byteCount\r
- "00 01 00 04 00 00 00 00 "+//empty match\r
- "00 01 00 08 06 00 00 00 "+\r
- "00 01 00 08 06 00 00 00");\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyFlow message = messageCase.getMultipartReplyFlow();\r
- Assert.assertEquals("Wrong flow stats size", 2, message.getFlowStats().size());\r
- FlowStats flowStats1 = message.getFlowStats().get(0);\r
- Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());\r
- Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());\r
- Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());\r
- Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());\r
- Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());\r
- Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());\r
- Assert.assertEquals("Wrong flags", new FlowModFlags(true, true, true, true, true), flowStats1.getFlags());\r
- Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,\r
- 0x01, 0x01, 0x01}), flowStats1.getCookie());\r
- Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,\r
- 0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());\r
- Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,\r
- 0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());\r
- Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());\r
- flowStats1 = message.getFlowStats().get(1);\r
- Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());\r
- Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());\r
- Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());\r
- Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());\r
- Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());\r
- Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());\r
- Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowStats1.getFlags());\r
- Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,\r
- 0x01, 0x01, 0x01}), flowStats1.getCookie());\r
- Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,\r
- 0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());\r
- Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,\r
- 0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());\r
- Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import java.math.BigInteger;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyFlowTest {
+
+ private OFDeserializer<MultipartReplyMessage> factory;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ DeserializerRegistry registry = new DeserializerRegistryImpl();
+ registry.init();
+ factory = registry.getDeserializer(
+ new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 19, MultipartReplyMessage.class));
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testEmptyMultipartReplyFlowBody(){
+ ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00");
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
+ Assert.assertEquals("Wrong flow stats size", 0, message.getFlowStats().size());
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyFlowBody(){
+ ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
+ // first flow stat
+ "00 48 08 00 "+ // length, tableId, padding
+ "00 00 00 09 "+//durationSec
+ "00 00 00 07 "+//durationNsec
+ "00 0C 00 0E 00 0F 00 1F "+//priority, idleTimeout, hardTimeout, flags
+ "00 00 00 00 "+//pad_02
+ "FF 01 01 01 01 01 01 01 "+//cookie
+ "EF 01 01 01 01 01 01 01 "+//packetCount
+ "7F 01 01 01 01 01 01 01 "+//byteCount
+ "00 01 00 04 00 00 00 00 "+//empty match
+ "00 01 00 08 06 00 00 00 "+
+ "00 01 00 08 06 00 00 00 "+
+ // second flow stat
+ "00 48 08 00 "+ // length, tableId, padding
+ "00 00 00 09 "+//durationSec
+ "00 00 00 07 "+//durationNsec
+ "00 0C 00 0E 00 0F 00 00 "+//priority, idleTimeout, hardTimeout, flags
+ "00 00 00 00 "+//pad_02
+ "FF 01 01 01 01 01 01 01 "+//cookie
+ "EF 01 01 01 01 01 01 01 "+//packetCount
+ "7F 01 01 01 01 01 01 01 "+//byteCount
+ "00 01 00 04 00 00 00 00 "+//empty match
+ "00 01 00 08 06 00 00 00 "+
+ "00 01 00 08 06 00 00 00");
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
+ Assert.assertEquals("Wrong flow stats size", 2, message.getFlowStats().size());
+ FlowStats flowStats1 = message.getFlowStats().get(0);
+ Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
+ Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
+ Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
+ Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
+ Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
+ Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
+ Assert.assertEquals("Wrong flags", new FlowModFlags(true, true, true, true, true), flowStats1.getFlags());
+ Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01}), flowStats1.getCookie());
+ Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());
+ Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());
+ Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
+ flowStats1 = message.getFlowStats().get(1);
+ Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
+ Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
+ Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
+ Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
+ Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
+ Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
+ Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowStats1.getFlags());
+ Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01}), flowStats1.getCookie());
+ Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());
+ Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());
+ Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyGroupFeaturesTest {\r
-\r
- private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyGroupFeatures() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+\r
- "00 00 00 0F "+// types\r
- "00 00 00 0F "+// capabilities\r
- "00 00 00 01 "+// max groups\r
- "00 00 00 02 "+// max groups\r
- "00 00 00 03 "+// max groups\r
- "00 00 00 04 "+// max groups\r
- "0F FF 98 01 "+// actions bitmap (all actions included)\r
- "00 00 00 00 "+// actions bitmap (no actions included)\r
- "00 00 00 00 "+// actions bitmap (no actions included)\r
- "00 00 00 00"// actions bitmap (no actions included)\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyGroupFeaturesCase messageCase =\r
- (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();\r
- Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());\r
- Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true),\r
- message.getCapabilities());\r
- Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());\r
- Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());\r
- Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());\r
- Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());\r
- Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true,\r
- true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));\r
- Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));\r
- Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));\r
- Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- * (with different group types and capabilities)\r
- */\r
- @Test\r
- public void testMultipartReplyGroupFeatures2() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+\r
- "00 00 00 00 "+// types\r
- "00 00 00 00 "+// capabilities\r
- "00 00 00 01 "+// max groups\r
- "00 00 00 02 "+// max groups\r
- "00 00 00 03 "+// max groups\r
- "00 00 00 04 "+// max groups\r
- "00 00 00 00 "+// actions bitmap (all actions included)\r
- "00 00 00 00 "+// actions bitmap (no actions included)\r
- "00 00 00 00 "+// actions bitmap (no actions included)\r
- "00 00 00 00"// actions bitmap (no actions included)\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyGroupFeaturesCase messageCase =\r
- (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();\r
- Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());\r
- Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false),\r
- message.getCapabilities());\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyGroupFeaturesTest {
+
+ private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyGroupFeatures() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+
+ "00 00 00 0F "+// types
+ "00 00 00 0F "+// capabilities
+ "00 00 00 01 "+// max groups
+ "00 00 00 02 "+// max groups
+ "00 00 00 03 "+// max groups
+ "00 00 00 04 "+// max groups
+ "0F FF 98 01 "+// actions bitmap (all actions included)
+ "00 00 00 00 "+// actions bitmap (no actions included)
+ "00 00 00 00 "+// actions bitmap (no actions included)
+ "00 00 00 00"// actions bitmap (no actions included)
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyGroupFeaturesCase messageCase =
+ (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
+ Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());
+ Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true),
+ message.getCapabilities());
+ Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());
+ Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());
+ Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());
+ Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());
+ Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true,
+ true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));
+ Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));
+ Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));
+ Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * (with different group types and capabilities)
+ */
+ @Test
+ public void testMultipartReplyGroupFeatures2() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+
+ "00 00 00 00 "+// types
+ "00 00 00 00 "+// capabilities
+ "00 00 00 01 "+// max groups
+ "00 00 00 02 "+// max groups
+ "00 00 00 03 "+// max groups
+ "00 00 00 04 "+// max groups
+ "00 00 00 00 "+// actions bitmap (all actions included)
+ "00 00 00 00 "+// actions bitmap (no actions included)
+ "00 00 00 00 "+// actions bitmap (no actions included)
+ "00 00 00 00"// actions bitmap (no actions included)
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyGroupFeaturesCase messageCase =
+ (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
+ Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());
+ Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false),
+ message.getCapabilities());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandTypeBitmap;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyMeterFeaturesTest {\r
-\r
- private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyMeterFeatures(){\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+\r
- "00 00 00 0A " + // maxMeter\r
- "00 00 00 06 " + // bandTypes\r
- "00 00 00 0F " + // capabilities\r
- "07 08 00 00" // maxBands, maxColor, padding\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();\r
- Assert.assertEquals("Wrong maxMeter", 10, message.getMaxMeter().intValue());\r
- Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(true, true), message.getBandTypes());\r
- Assert.assertEquals("Wrong capabilities", new MeterFlags(true, true, true, true), message.getCapabilities());\r
- Assert.assertEquals("Wrong maxBands", 7, message.getMaxBands().intValue());\r
- Assert.assertEquals("Wrong maxColor", 8, message.getMaxColor().intValue());\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyMeterFeatures2(){\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+\r
- "00 00 00 09 " + // maxMeter\r
- "00 00 00 00 " + // bandTypes\r
- "00 00 00 00 " + // capabilities\r
- "03 04 00 00" // maxBands, maxColor, padding\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();\r
- Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());\r
- Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(false, false), message.getBandTypes());\r
- Assert.assertEquals("Wrong capabilities", new MeterFlags(false, false, false, false), message.getCapabilities());\r
- Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());\r
- Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandTypeBitmap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyMeterFeaturesTest {
+
+ private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyMeterFeatures(){
+ ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
+ "00 00 00 0A " + // maxMeter
+ "00 00 00 06 " + // bandTypes
+ "00 00 00 0F " + // capabilities
+ "07 08 00 00" // maxBands, maxColor, padding
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();
+ Assert.assertEquals("Wrong maxMeter", 10, message.getMaxMeter().intValue());
+ Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(true, true), message.getBandTypes());
+ Assert.assertEquals("Wrong capabilities", new MeterFlags(true, true, true, true), message.getCapabilities());
+ Assert.assertEquals("Wrong maxBands", 7, message.getMaxBands().intValue());
+ Assert.assertEquals("Wrong maxColor", 8, message.getMaxColor().intValue());
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyMeterFeatures2(){
+ ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
+ "00 00 00 09 " + // maxMeter
+ "00 00 00 00 " + // bandTypes
+ "00 00 00 00 " + // capabilities
+ "03 04 00 00" // maxBands, maxColor, padding
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();
+ Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
+ Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(false, false), message.getBandTypes());
+ Assert.assertEquals("Wrong capabilities", new MeterFlags(false, false, false, false), message.getCapabilities());
+ Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
+ Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDescCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.MultipartReplyPortDesc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyPortDescTest {\r
-\r
- private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testEmptyMultipartReplyPortDesc() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00");\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();\r
- Assert.assertEquals("Wrong table features size", 0, message.getPorts().size());\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyPortDesc() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00 " +\r
- // first port desc\r
- "00 01 02 03 00 00 00 00 " + // portNo, padding\r
- "08 00 27 00 B0 EB 00 00 " + // mac address, padding\r
- "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name\r
- "00 00 00 65 " + //port config\r
- "00 00 00 07 " + //port state\r
- "00 00 00 81 " + //current features\r
- "00 00 FF FF " + //advertised features\r
- "00 00 C1 89 " + //supported features\r
- "00 00 C5 8D " + //peer features\r
- "00 00 00 81 " + //curr speed\r
- "00 00 00 80 " + //max speed\r
- // second port desc\r
- "00 00 00 01 00 00 00 00 " + // portNo, padding\r
- "08 00 27 00 B0 EB 00 00 " + // mac address, padding\r
- "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name\r
- "00 00 00 00 " + //port config\r
- "00 00 00 00 " + //port state\r
- "00 00 00 00 " + //current features\r
- "00 00 00 00 " + //advertised features\r
- "00 00 00 00 " + //supported features\r
- "00 00 00 00 " + //peer features\r
- "00 00 00 05 " + //curr speed\r
- "00 00 00 06" //max speed\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();\r
- Assert.assertEquals("Wrong port desc size", 2, message.getPorts().size());\r
- Ports port = message.getPorts().get(0);\r
- Assert.assertEquals("Wrong portNo", 66051L, port.getPortNo().longValue());\r
- Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());\r
- Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());\r
- Assert.assertEquals("Wrong portConfig", new PortConfig(true, true, true, true), port.getConfig());\r
- Assert.assertEquals("Wrong portState", new PortState(true, true, true), port.getState());\r
- Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, true,\r
- false, false, false, true, false, false, false, false, false, false), port.getCurrentFeatures());\r
- Assert.assertEquals("Wrong advertisedFeatures", new PortFeatures(true, true, true, true, true, true,\r
- true, true, true, true, true, true, true, true, true, true), port.getAdvertisedFeatures());\r
- Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, true, false, false, false, true,\r
- false, false, false, true, false, false, false, false, true, true), port.getSupportedFeatures());\r
- Assert.assertEquals("Wrong peerFeatures", new PortFeatures(true, true, true, false, false, true, false,\r
- false, false, true, false, false, false, true, true, true), port.getPeerFeatures());\r
- Assert.assertEquals("Wrong currSpeed", 129L, port.getCurrSpeed().longValue());\r
- Assert.assertEquals("Wrong maxSpeed", 128L, port.getMaxSpeed().longValue());\r
- port = message.getPorts().get(1);\r
- Assert.assertEquals("Wrong portNo", 1L, port.getPortNo().longValue());\r
- Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());\r
- Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());\r
- Assert.assertEquals("Wrong portConfig", new PortConfig(false, false, false, false), port.getConfig());\r
- Assert.assertEquals("Wrong portState", new PortState(false, false, false), port.getState());\r
- Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), port.getCurrentFeatures());\r
- Assert.assertEquals("Wrong advertisedFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), port.getAdvertisedFeatures());\r
- Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), port.getSupportedFeatures());\r
- Assert.assertEquals("Wrong peerFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
- false, false, false, false, false, false, false, false, false), port.getPeerFeatures());\r
- Assert.assertEquals("Wrong currSpeed", 5L, port.getCurrSpeed().longValue());\r
- Assert.assertEquals("Wrong maxSpeed", 6L, port.getMaxSpeed().longValue());\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDescCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.MultipartReplyPortDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyPortDescTest {
+
+ private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testEmptyMultipartReplyPortDesc() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00");
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();
+ Assert.assertEquals("Wrong table features size", 0, message.getPorts().size());
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyPortDesc() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00 " +
+ // first port desc
+ "00 01 02 03 00 00 00 00 " + // portNo, padding
+ "08 00 27 00 B0 EB 00 00 " + // mac address, padding
+ "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name
+ "00 00 00 65 " + //port config
+ "00 00 00 07 " + //port state
+ "00 00 00 81 " + //current features
+ "00 00 FF FF " + //advertised features
+ "00 00 C1 89 " + //supported features
+ "00 00 C5 8D " + //peer features
+ "00 00 00 81 " + //curr speed
+ "00 00 00 80 " + //max speed
+ // second port desc
+ "00 00 00 01 00 00 00 00 " + // portNo, padding
+ "08 00 27 00 B0 EB 00 00 " + // mac address, padding
+ "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name
+ "00 00 00 00 " + //port config
+ "00 00 00 00 " + //port state
+ "00 00 00 00 " + //current features
+ "00 00 00 00 " + //advertised features
+ "00 00 00 00 " + //supported features
+ "00 00 00 00 " + //peer features
+ "00 00 00 05 " + //curr speed
+ "00 00 00 06" //max speed
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();
+ Assert.assertEquals("Wrong port desc size", 2, message.getPorts().size());
+ Ports port = message.getPorts().get(0);
+ Assert.assertEquals("Wrong portNo", 66051L, port.getPortNo().longValue());
+ Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());
+ Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());
+ Assert.assertEquals("Wrong portConfig", new PortConfig(true, true, true, true), port.getConfig());
+ Assert.assertEquals("Wrong portState", new PortState(true, true, true), port.getState());
+ Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, true,
+ false, false, false, true, false, false, false, false, false, false), port.getCurrentFeatures());
+ Assert.assertEquals("Wrong advertisedFeatures", new PortFeatures(true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true), port.getAdvertisedFeatures());
+ Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, true, false, false, false, true,
+ false, false, false, true, false, false, false, false, true, true), port.getSupportedFeatures());
+ Assert.assertEquals("Wrong peerFeatures", new PortFeatures(true, true, true, false, false, true, false,
+ false, false, true, false, false, false, true, true, true), port.getPeerFeatures());
+ Assert.assertEquals("Wrong currSpeed", 129L, port.getCurrSpeed().longValue());
+ Assert.assertEquals("Wrong maxSpeed", 128L, port.getMaxSpeed().longValue());
+ port = message.getPorts().get(1);
+ Assert.assertEquals("Wrong portNo", 1L, port.getPortNo().longValue());
+ Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());
+ Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());
+ Assert.assertEquals("Wrong portConfig", new PortConfig(false, false, false, false), port.getConfig());
+ Assert.assertEquals("Wrong portState", new PortState(false, false, false), port.getState());
+ Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), port.getCurrentFeatures());
+ Assert.assertEquals("Wrong advertisedFeatures", new PortFeatures(false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), port.getAdvertisedFeatures());
+ Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), port.getSupportedFeatures());
+ Assert.assertEquals("Wrong peerFeatures", new PortFeatures(false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false), port.getPeerFeatures());
+ Assert.assertEquals("Wrong currSpeed", 5L, port.getCurrSpeed().longValue());
+ Assert.assertEquals("Wrong maxSpeed", 6L, port.getMaxSpeed().longValue());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyTableFeaturesTest {\r
-\r
- private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testEmptyMultipartReplyTableFeatures() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00");\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();\r
- Assert.assertEquals("Wrong table features size", 0, message.getTableFeatures().size());\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyTableFeatures() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+\r
- // first table feature\r
- "00 40 01 00 00 00 00 00 "+// length, tableId, padding\r
- "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+\r
- "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name\r
- "00 00 00 00 00 00 00 01 "+// metadata match\r
- "00 00 00 00 00 00 00 02 "+// metadata write\r
- "00 00 00 00 "+// config\r
- "00 00 00 2A "+// max entries\r
- // second table feature\r
- "00 40 02 00 00 00 00 00 "+// length, tableId, padding\r
- "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00"\r
- + " 00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name\r
- "00 00 00 00 00 00 00 03 "+// metadata match\r
- "00 00 00 00 00 00 00 04 "+// metadata write\r
- "00 00 00 03 "+// config\r
- "00 00 00 2B" // max entries\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();\r
- Assert.assertEquals("Wrong table features size", 2, message.getTableFeatures().size());\r
- TableFeatures feature = message.getTableFeatures().get(0);\r
- Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());\r
- Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());\r
- Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());\r
- Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());\r
- Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());\r
- Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());\r
- feature = message.getTableFeatures().get(1);\r
- Assert.assertEquals("Wrong table id", 2, feature.getTableId().intValue());\r
- Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());\r
- Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 3}, feature.getMetadataMatch());\r
- Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 4}, feature.getMetadataWrite());\r
- Assert.assertEquals("Wrong config", true, feature.getConfig().isOFPTCDEPRECATEDMASK());\r
- Assert.assertEquals("Wrong max entries", 43, feature.getMaxEntries().intValue());\r
- }\r
-\r
- /**\r
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
- */\r
- @Test\r
- public void testMultipartReplyTableFeatures2() {\r
- ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+\r
- "00 B0 01 00 00 00 00 00 "+// length, tableId, padding\r
- "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+\r
- "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name\r
- "00 00 00 00 00 00 00 01 "+// metadata match\r
- "00 00 00 00 00 00 00 02 "+// metadata write\r
- "00 00 00 00 "+// config\r
- "00 00 00 2A "+// max entries\r
- "00 00 00 04 00 00 00 00 "+\r
- "00 01 00 04 00 00 00 00 "+\r
- "00 02 00 08 01 02 03 04 "+\r
- "00 03 00 07 05 06 07 00 "+\r
- "00 04 00 04 00 00 00 00 "+\r
- "00 05 00 04 00 00 00 00 "+\r
- "00 06 00 04 00 00 00 00 "+\r
- "00 07 00 04 00 00 00 00 "+\r
- "00 08 00 04 00 00 00 00 "+\r
- "00 0A 00 04 00 00 00 00 "+\r
- "00 0C 00 04 00 00 00 00 "+\r
- "00 0D 00 04 00 00 00 00 "+\r
- "00 0E 00 04 00 00 00 00 "+\r
- "00 0F 00 04 00 00 00 00"\r
- );\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV13(builtByFactory);\r
- Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();\r
- MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();\r
- Assert.assertEquals("Wrong table features size", 1, message.getTableFeatures().size());\r
- TableFeatures feature = message.getTableFeatures().get(0);\r
- Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());\r
- Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());\r
- Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());\r
- Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());\r
- Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());\r
- Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());\r
- Assert.assertEquals("Wrong properties size", 14, feature.getTableFeatureProperties().size());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONS,\r
- feature.getTableFeatureProperties().get(0).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,\r
- feature.getTableFeatureProperties().get(1).getType());\r
- TableFeatureProperties property = feature.getTableFeatureProperties().get(2);\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLES,\r
- property.getType());\r
- List<NextTableIds> tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)\r
- .getNextTableIds();\r
- Assert.assertEquals("Wrong next table id size", 4, tableIds.size());\r
- Assert.assertEquals("Wrong next table id", 1, tableIds.get(0).getTableId().intValue());\r
- Assert.assertEquals("Wrong next table id", 2, tableIds.get(1).getTableId().intValue());\r
- Assert.assertEquals("Wrong next table id", 3, tableIds.get(2).getTableId().intValue());\r
- Assert.assertEquals("Wrong next table id", 4, tableIds.get(3).getTableId().intValue());\r
- property = feature.getTableFeatureProperties().get(3);\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,\r
- property.getType());\r
- tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)\r
- .getNextTableIds();\r
- Assert.assertEquals("Wrong next table id size", 3, tableIds.size());\r
- Assert.assertEquals("Wrong next table id", 5, tableIds.get(0).getTableId().intValue());\r
- Assert.assertEquals("Wrong next table id", 6, tableIds.get(1).getTableId().intValue());\r
- Assert.assertEquals("Wrong next table id", 7, tableIds.get(2).getTableId().intValue());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONS,\r
- feature.getTableFeatureProperties().get(4).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,\r
- feature.getTableFeatureProperties().get(5).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONS,\r
- feature.getTableFeatureProperties().get(6).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,\r
- feature.getTableFeatureProperties().get(7).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTMATCH,\r
- feature.getTableFeatureProperties().get(8).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWILDCARDS,\r
- feature.getTableFeatureProperties().get(9).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELD,\r
- feature.getTableFeatureProperties().get(10).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,\r
- feature.getTableFeatureProperties().get(11).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,\r
- feature.getTableFeatureProperties().get(12).getType());\r
- Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,\r
- feature.getTableFeatureProperties().get(13).getType());\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyTableFeaturesTest {
+
+ private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testEmptyMultipartReplyTableFeatures() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00");
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
+ Assert.assertEquals("Wrong table features size", 0, message.getTableFeatures().size());
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyTableFeatures() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+
+ // first table feature
+ "00 40 01 00 00 00 00 00 "+// length, tableId, padding
+ "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name
+ "00 00 00 00 00 00 00 01 "+// metadata match
+ "00 00 00 00 00 00 00 02 "+// metadata write
+ "00 00 00 00 "+// config
+ "00 00 00 2A "+// max entries
+ // second table feature
+ "00 40 02 00 00 00 00 00 "+// length, tableId, padding
+ "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00"
+ + " 00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name
+ "00 00 00 00 00 00 00 03 "+// metadata match
+ "00 00 00 00 00 00 00 04 "+// metadata write
+ "00 00 00 03 "+// config
+ "00 00 00 2B" // max entries
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
+ Assert.assertEquals("Wrong table features size", 2, message.getTableFeatures().size());
+ TableFeatures feature = message.getTableFeatures().get(0);
+ Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
+ Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
+ Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());
+ Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());
+ Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
+ Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
+ feature = message.getTableFeatures().get(1);
+ Assert.assertEquals("Wrong table id", 2, feature.getTableId().intValue());
+ Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
+ Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 3}, feature.getMetadataMatch());
+ Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 4}, feature.getMetadataWrite());
+ Assert.assertEquals("Wrong config", true, feature.getConfig().isOFPTCDEPRECATEDMASK());
+ Assert.assertEquals("Wrong max entries", 43, feature.getMaxEntries().intValue());
+ }
+
+ /**
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ */
+ @Test
+ public void testMultipartReplyTableFeatures2() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+
+ "00 B0 01 00 00 00 00 00 "+// length, tableId, padding
+ "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name
+ "00 00 00 00 00 00 00 01 "+// metadata match
+ "00 00 00 00 00 00 00 02 "+// metadata write
+ "00 00 00 00 "+// config
+ "00 00 00 2A "+// max entries
+ "00 00 00 04 00 00 00 00 "+
+ "00 01 00 04 00 00 00 00 "+
+ "00 02 00 08 01 02 03 04 "+
+ "00 03 00 07 05 06 07 00 "+
+ "00 04 00 04 00 00 00 00 "+
+ "00 05 00 04 00 00 00 00 "+
+ "00 06 00 04 00 00 00 00 "+
+ "00 07 00 04 00 00 00 00 "+
+ "00 08 00 04 00 00 00 00 "+
+ "00 0A 00 04 00 00 00 00 "+
+ "00 0C 00 04 00 00 00 00 "+
+ "00 0D 00 04 00 00 00 00 "+
+ "00 0E 00 04 00 00 00 00 "+
+ "00 0F 00 04 00 00 00 00"
+ );
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+ MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
+ Assert.assertEquals("Wrong table features size", 1, message.getTableFeatures().size());
+ TableFeatures feature = message.getTableFeatures().get(0);
+ Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
+ Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
+ Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());
+ Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());
+ Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
+ Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
+ Assert.assertEquals("Wrong properties size", 14, feature.getTableFeatureProperties().size());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
+ feature.getTableFeatureProperties().get(0).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
+ feature.getTableFeatureProperties().get(1).getType());
+ TableFeatureProperties property = feature.getTableFeatureProperties().get(2);
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLES,
+ property.getType());
+ List<NextTableIds> tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)
+ .getNextTableIds();
+ Assert.assertEquals("Wrong next table id size", 4, tableIds.size());
+ Assert.assertEquals("Wrong next table id", 1, tableIds.get(0).getTableId().intValue());
+ Assert.assertEquals("Wrong next table id", 2, tableIds.get(1).getTableId().intValue());
+ Assert.assertEquals("Wrong next table id", 3, tableIds.get(2).getTableId().intValue());
+ Assert.assertEquals("Wrong next table id", 4, tableIds.get(3).getTableId().intValue());
+ property = feature.getTableFeatureProperties().get(3);
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,
+ property.getType());
+ tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)
+ .getNextTableIds();
+ Assert.assertEquals("Wrong next table id size", 3, tableIds.size());
+ Assert.assertEquals("Wrong next table id", 5, tableIds.get(0).getTableId().intValue());
+ Assert.assertEquals("Wrong next table id", 6, tableIds.get(1).getTableId().intValue());
+ Assert.assertEquals("Wrong next table id", 7, tableIds.get(2).getTableId().intValue());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONS,
+ feature.getTableFeatureProperties().get(4).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
+ feature.getTableFeatureProperties().get(5).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
+ feature.getTableFeatureProperties().get(6).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
+ feature.getTableFeatureProperties().get(7).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTMATCH,
+ feature.getTableFeatureProperties().get(8).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWILDCARDS,
+ feature.getTableFeatureProperties().get(9).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELD,
+ feature.getTableFeatureProperties().get(10).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,
+ feature.getTableFeatureProperties().get(11).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,
+ feature.getTableFeatureProperties().get(12).getType());
+ Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,
+ feature.getTableFeatureProperties().get(13).getType());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class OF10StatsReplyExperimenterTest {\r
-\r
- @Mock DeserializerRegistry registry;\r
-\r
- /**\r
- * Tests {@link OF10StatsReplyMessageFactory} for experimenter body translation\r
- */\r
- @Test\r
- public void test() {\r
- OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory();\r
- factory.injectDeserializerRegistry(registry);\r
-\r
- ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "\r
- + "00 00 00 01"); // expID\r
- MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
- BufferHelper.checkHeaderV10(builtByFactory);\r
- Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());\r
- Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
- Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));\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.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OF10StatsReplyExperimenterTest {
+
+ @Mock DeserializerRegistry registry;
+
+ /**
+ * Tests {@link OF10StatsReplyMessageFactory} for experimenter body translation
+ */
+ @Test
+ public void test() {
+ OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory();
+ factory.injectDeserializerRegistry(registry);
+
+ ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "
+ + "00 00 00 01"); // expID
+ MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+ BufferHelper.checkHeaderV10(builtByFactory);
+ Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
+ Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+ Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class AbstractInstructionDeserializerTest {\r
-\r
- /**\r
- * Tests {@link AbstractInstructionDeserializer#deserializeHeader(ByteBuf)} with different\r
- * instruction types\r
- */\r
- @Test(expected=IllegalStateException.class)\r
- public void test() {\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 00 04");\r
- GoToTableInstructionDeserializer deserializer = new GoToTableInstructionDeserializer();\r
- Instruction instruction = deserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong type", GotoTable.class, instruction.getType());\r
-\r
- buffer = ByteBufUtils.hexStringToByteBuf("00 02 00 04");\r
- instruction = deserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong type", WriteMetadata.class, instruction.getType());\r
-\r
- buffer = ByteBufUtils.hexStringToByteBuf("00 03 00 04");\r
- instruction = deserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong type", WriteActions.class, instruction.getType());\r
-\r
- buffer = ByteBufUtils.hexStringToByteBuf("00 04 00 04");\r
- instruction = deserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong type", ApplyActions.class, instruction.getType());\r
-\r
- buffer = ByteBufUtils.hexStringToByteBuf("00 05 00 04");\r
- instruction = deserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong type", ClearActions.class, instruction.getType());\r
-\r
- buffer = ByteBufUtils.hexStringToByteBuf("00 06 00 04");\r
- instruction = deserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong type", Meter.class, instruction.getType());\r
-\r
- buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 04");\r
- instruction = deserializer.deserializeHeader(buffer);\r
- // exception expected\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.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class AbstractInstructionDeserializerTest {
+
+ /**
+ * Tests {@link AbstractInstructionDeserializer#deserializeHeader(ByteBuf)} with different
+ * instruction types
+ */
+ @Test(expected=IllegalStateException.class)
+ public void test() {
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 00 04");
+ GoToTableInstructionDeserializer deserializer = new GoToTableInstructionDeserializer();
+ Instruction instruction = deserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong type", GotoTable.class, instruction.getType());
+
+ buffer = ByteBufUtils.hexStringToByteBuf("00 02 00 04");
+ instruction = deserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong type", WriteMetadata.class, instruction.getType());
+
+ buffer = ByteBufUtils.hexStringToByteBuf("00 03 00 04");
+ instruction = deserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong type", WriteActions.class, instruction.getType());
+
+ buffer = ByteBufUtils.hexStringToByteBuf("00 04 00 04");
+ instruction = deserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong type", ApplyActions.class, instruction.getType());
+
+ buffer = ByteBufUtils.hexStringToByteBuf("00 05 00 04");
+ instruction = deserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong type", ClearActions.class, instruction.getType());
+
+ buffer = ByteBufUtils.hexStringToByteBuf("00 06 00 04");
+ instruction = deserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong type", Meter.class, instruction.getType());
+
+ buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 04");
+ instruction = deserializer.deserializeHeader(buffer);
+ // exception expected
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrDeserializerTest {\r
-\r
- /**\r
- * Tests {@link OxmIpv6ExtHdrDeserializer#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 4E 02 01 FF");\r
-\r
- buffer.skipBytes(4); // skip XID\r
- OxmIpv6ExtHdrDeserializer deserializer = new OxmIpv6ExtHdrDeserializer();\r
- MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertEquals("Wrong entry value",\r
- new Ipv6ExthdrFlags(true, true, true, true, true, true, true, true, true),\r
- entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());\r
- Assert.assertEquals("Wrong entry mask", null, entry.getAugmentation(MaskMatchEntry.class));\r
- Assert.assertTrue("Unread data", buffer.readableBytes() == 0);\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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrDeserializerTest {
+
+ /**
+ * Tests {@link OxmIpv6ExtHdrDeserializer#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 4E 02 01 FF");
+
+ buffer.skipBytes(4); // skip XID
+ OxmIpv6ExtHdrDeserializer deserializer = new OxmIpv6ExtHdrDeserializer();
+ MatchEntries entry = deserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertEquals("Wrong entry value",
+ new Ipv6ExthdrFlags(true, true, true, true, true, true, true, true, true),
+ entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());
+ Assert.assertEquals("Wrong entry mask", null, entry.getAugmentation(MaskMatchEntry.class));
+ Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6FlabelDeserializerTest {\r
-\r
- /**\r
- * Tests {@link OxmIpv6FlabelDeserializer#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 38 04 00 00 00 02");\r
-\r
- buffer.skipBytes(4); // skip XID\r
- OxmIpv6FlabelDeserializer deserializer = new OxmIpv6FlabelDeserializer();\r
- MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 2, \r
- entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6FlabelDeserializerTest {
+
+ /**
+ * Tests {@link OxmIpv6FlabelDeserializer#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 38 04 00 00 00 02");
+
+ buffer.skipBytes(4); // skip XID
+ OxmIpv6FlabelDeserializer deserializer = new OxmIpv6FlabelDeserializer();
+ MatchEntries entry = deserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertEquals("Wrong entry value", 2,
+ entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataDeserializerTest {\r
-\r
- /**\r
- * Tests {@link OxmMetadataDeserializer#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 04 08 00 00 00 00 00 00 00 03");\r
-\r
- buffer.skipBytes(4); // skip XID\r
- OxmMetadataDeserializer deserializer = new OxmMetadataDeserializer();\r
- MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Metadata.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), \r
- entry.getAugmentation(MetadataMatchEntry.class).getMetadata());\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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataDeserializerTest {
+
+ /**
+ * Tests {@link OxmMetadataDeserializer#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 04 08 00 00 00 00 00 00 00 03");
+
+ buffer.skipBytes(4); // skip XID
+ OxmMetadataDeserializer deserializer = new OxmMetadataDeserializer();
+ MatchEntries entry = deserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Metadata.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"),
+ entry.getAugmentation(MetadataMatchEntry.class).getMetadata());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosDeserializerTest {\r
-\r
- /**\r
- * Tests {@link OxmMplsBosDeserializer#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 48 01 00");\r
-\r
- buffer.skipBytes(4); // skip XID\r
- OxmMplsBosDeserializer deserializer = new OxmMplsBosDeserializer();\r
- MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", MplsBos.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertEquals("Wrong entry value", false, entry.getAugmentation(BosMatchEntry.class).isBos());\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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosDeserializerTest {
+
+ /**
+ * Tests {@link OxmMplsBosDeserializer#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 48 01 00");
+
+ buffer.skipBytes(4); // skip XID
+ OxmMplsBosDeserializer deserializer = new OxmMplsBosDeserializer();
+ MatchEntries entry = deserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", MplsBos.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertEquals("Wrong entry value", false, entry.getAugmentation(BosMatchEntry.class).isBos());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidDeserializerTest {\r
-\r
- /**\r
- * Tests {@link OxmPbbIsidDeserializer#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 4A 03 00 00 02");\r
-\r
- buffer.skipBytes(4); // skip XID\r
- OxmPbbIsidDeserializer deserializer = new OxmPbbIsidDeserializer();\r
- MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", PbbIsid.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 2, entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidDeserializerTest {
+
+ /**
+ * Tests {@link OxmPbbIsidDeserializer#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 4A 03 00 00 02");
+
+ buffer.skipBytes(4); // skip XID
+ OxmPbbIsidDeserializer deserializer = new OxmPbbIsidDeserializer();
+ MatchEntries entry = deserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", PbbIsid.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertEquals("Wrong entry value", 2, entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidDeserializerTest {\r
-\r
- /**\r
- * Tests {@link OxmVlanVidDeserializer#deserialize(ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 0C 02 20 0A");\r
-\r
- buffer.skipBytes(4); // skip XID\r
- OxmVlanVidDeserializer deserializer = new OxmVlanVidDeserializer();\r
- MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", VlanVid.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 10,\r
- entry.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());\r
- Assert.assertEquals("Wrong entry value", false, \r
- entry.getAugmentation(VlanVidMatchEntry.class).isCfiBit());\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.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidDeserializerTest {
+
+ /**
+ * Tests {@link OxmVlanVidDeserializer#deserialize(ByteBuf)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 0C 02 20 0A");
+
+ buffer.skipBytes(4); // skip XID
+ OxmVlanVidDeserializer deserializer = new OxmVlanVidDeserializer();
+ MatchEntries entry = deserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", VlanVid.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertEquals("Wrong entry value", 10,
+ entry.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());
+ Assert.assertEquals("Wrong entry value", false,
+ entry.getAugmentation(VlanVidMatchEntry.class).isCfiBit());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SerializationFactoryTest {\r
-\r
- /**\r
- * Test serializer lookup & serialization\r
- */\r
- @Test\r
- public void test() {\r
- SerializerRegistry registry = new SerializerRegistryImpl();\r
- registry.init();\r
- SerializationFactory factory = new SerializationFactory();\r
- factory.setSerializerTable(registry);\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- HelloInputBuilder helloBuilder = new HelloInputBuilder();\r
- helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);\r
- helloBuilder.setXid(123456L);\r
- helloBuilder.setElements(null);\r
- factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, buffer, helloBuilder.build());\r
- assertEquals("Serialization failed", EncodeConstants.OFHEADER_SIZE, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Test serializer not found scenario\r
- */\r
- @Test(expected=IllegalStateException.class)\r
- public void testNotExistingSerializer() {\r
- SerializerRegistry registry = new SerializerRegistryImpl();\r
- registry.init();\r
- SerializationFactory factory = new SerializationFactory();\r
- factory.setSerializerTable(registry);\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- HelloInputBuilder helloBuilder = new HelloInputBuilder();\r
- helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);\r
- helloBuilder.setXid(123456L);\r
- helloBuilder.setElements(null);\r
- factory.messageToBuffer((short) 0, buffer, helloBuilder.build());\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.openflowjava.protocol.impl.serialization;
+
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SerializationFactoryTest {
+
+ /**
+ * Test serializer lookup & serialization
+ */
+ @Test
+ public void test() {
+ SerializerRegistry registry = new SerializerRegistryImpl();
+ registry.init();
+ SerializationFactory factory = new SerializationFactory();
+ factory.setSerializerTable(registry);
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ HelloInputBuilder helloBuilder = new HelloInputBuilder();
+ helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
+ helloBuilder.setXid(123456L);
+ helloBuilder.setElements(null);
+ factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, buffer, helloBuilder.build());
+ assertEquals("Serialization failed", EncodeConstants.OFHEADER_SIZE, buffer.readableBytes());
+ }
+
+ /**
+ * Test serializer not found scenario
+ */
+ @Test(expected=IllegalStateException.class)
+ public void testNotExistingSerializer() {
+ SerializerRegistry registry = new SerializerRegistryImpl();
+ registry.init();
+ SerializationFactory factory = new SerializationFactory();
+ factory.setSerializerTable(registry);
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ HelloInputBuilder helloBuilder = new HelloInputBuilder();
+ helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
+ helloBuilder.setXid(123456L);
+ helloBuilder.setElements(null);
+ factory.messageToBuffer((short) 0, buffer, helloBuilder.build());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterInputMessageFactoryTest {\r
-\r
- @Mock SerializerRegistry registry;\r
- @Mock OFSerializer<ExperimenterInput> serializer;\r
- private OFSerializer<ExperimenterInput> expFactory;\r
-\r
- /**\r
- * Sets up ExperimenterInputMessageFactory\r
- * @param real true if setup should use real registry, false when mock is desired\r
- */\r
- public void startUp(boolean real) {\r
- MockitoAnnotations.initMocks(this);\r
- expFactory = new ExperimenterInputMessageFactory();\r
- if (real) {\r
- SerializerRegistry realRegistry = new SerializerRegistryImpl();\r
- realRegistry.init();\r
- ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(realRegistry);\r
- } else {\r
- ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(registry);\r
- }\r
- }\r
-\r
- /**\r
- * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
- * lookup and serialization\r
- * @throws Exception \r
- */\r
- @Test(expected=IllegalStateException.class)\r
- public void testV10Real() throws Exception {\r
- startUp(true);\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setExperimenter(new ExperimenterId(42L));\r
- ExperimenterInput input = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- expFactory.serialize(input, out);\r
- }\r
-\r
- /**\r
- * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
- * lookup and serialization\r
- * @throws Exception \r
- */\r
- @Test(expected=IllegalStateException.class)\r
- public void testV13Real() throws Exception {\r
- startUp(true);\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setExperimenter(new ExperimenterId(42L));\r
- ExperimenterInput input = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- expFactory.serialize(input, out);\r
- }\r
-\r
- /**\r
- * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
- * lookup and serialization\r
- * @throws Exception \r
- */\r
- @Test\r
- public void testV10() throws Exception {\r
- startUp(false);\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setExperimenter(new ExperimenterId(42L));\r
- ExperimenterInput input = builder.build();\r
-\r
- Mockito.when(registry.getSerializer(\r
- (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- expFactory.serialize(input, out);\r
- }\r
-\r
- /**\r
- * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
- * lookup and serialization\r
- * @throws Exception \r
- */\r
- @Test\r
- public void testV13() throws Exception {\r
- startUp(false);\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setExperimenter(new ExperimenterId(42L));\r
- ExperimenterInput input = builder.build();\r
-\r
- Mockito.when(registry.getSerializer(\r
- (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- expFactory.serialize(input, out);\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.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterInputMessageFactoryTest {
+
+ @Mock SerializerRegistry registry;
+ @Mock OFSerializer<ExperimenterInput> serializer;
+ private OFSerializer<ExperimenterInput> expFactory;
+
+ /**
+ * Sets up ExperimenterInputMessageFactory
+ * @param real true if setup should use real registry, false when mock is desired
+ */
+ public void startUp(boolean real) {
+ MockitoAnnotations.initMocks(this);
+ expFactory = new ExperimenterInputMessageFactory();
+ if (real) {
+ SerializerRegistry realRegistry = new SerializerRegistryImpl();
+ realRegistry.init();
+ ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(realRegistry);
+ } else {
+ ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(registry);
+ }
+ }
+
+ /**
+ * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+ * lookup and serialization
+ * @throws Exception
+ */
+ @Test(expected=IllegalStateException.class)
+ public void testV10Real() throws Exception {
+ startUp(true);
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setExperimenter(new ExperimenterId(42L));
+ ExperimenterInput input = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ expFactory.serialize(input, out);
+ }
+
+ /**
+ * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+ * lookup and serialization
+ * @throws Exception
+ */
+ @Test(expected=IllegalStateException.class)
+ public void testV13Real() throws Exception {
+ startUp(true);
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setExperimenter(new ExperimenterId(42L));
+ ExperimenterInput input = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ expFactory.serialize(input, out);
+ }
+
+ /**
+ * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+ * lookup and serialization
+ * @throws Exception
+ */
+ @Test
+ public void testV10() throws Exception {
+ startUp(false);
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setExperimenter(new ExperimenterId(42L));
+ ExperimenterInput input = builder.build();
+
+ Mockito.when(registry.getSerializer(
+ (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ expFactory.serialize(input, out);
+ }
+
+ /**
+ * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+ * lookup and serialization
+ * @throws Exception
+ */
+ @Test
+ public void testV13() throws Exception {
+ startUp(false);
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setExperimenter(new ExperimenterId(42L));
+ ExperimenterInput input = builder.build();
+
+ Mockito.when(registry.getSerializer(
+ (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ expFactory.serialize(input, out);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StatsRequestInputFactoryTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Testing OF10StatsRequestInputFactory (Desc) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testDesc() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPDESC);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestDescCaseBuilder caseBuilder = new MultipartRequestDescCaseBuilder();\r
- MultipartRequestDescBuilder descBuilder = new MultipartRequestDescBuilder();\r
- caseBuilder.setMultipartRequestDesc(descBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 12);\r
- Assert.assertEquals("Wrong type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsRequestInputFactory (Flow) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testFlow() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPFLOW);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();\r
- MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();\r
- MatchV10Builder matchBuilder = new MatchV10Builder();\r
- matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,\r
- true, true, true, true));\r
- matchBuilder.setNwSrcMask((short) 8);\r
- matchBuilder.setNwDstMask((short) 16);\r
- matchBuilder.setInPort(51);\r
- matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));\r
- matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));\r
- matchBuilder.setDlVlan(52);\r
- matchBuilder.setDlVlanPcp((short) 53);\r
- matchBuilder.setDlType(54);\r
- matchBuilder.setNwTos((short) 55);\r
- matchBuilder.setNwProto((short) 56);\r
- matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));\r
- matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));\r
- matchBuilder.setTpSrc(57);\r
- matchBuilder.setTpDst(58);\r
- flowBuilder.setMatchV10(matchBuilder.build());\r
- flowBuilder.setTableId((short) 1);\r
- flowBuilder.setOutPort(42L);\r
- caseBuilder.setMultipartRequestFlow(flowBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 56);\r
- Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong wildcards", 3414271, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());\r
- byte[] dlSrc = new byte[6];\r
- out.readBytes(dlSrc);\r
- Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));\r
- byte[] dlDst = new byte[6];\r
- out.readBytes(dlDst);\r
- Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));\r
- Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());\r
- out.skipBytes(1);\r
- Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong table-id", 1, out.readUnsignedByte());\r
- out.skipBytes(1);\r
- Assert.assertEquals("Wrong out-port", 42, out.readUnsignedShort());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsRequestInputFactory (Aggregate) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testAggregate() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPAGGREGATE);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();\r
- MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();\r
- MatchV10Builder matchBuilder = new MatchV10Builder();\r
- matchBuilder.setWildcards(new FlowWildcardsV10(false, false, false, false,\r
- false, false, false, false, false, false));\r
- matchBuilder.setNwSrcMask((short) 32);\r
- matchBuilder.setNwDstMask((short) 32);\r
- matchBuilder.setInPort(51);\r
- matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));\r
- matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));\r
- matchBuilder.setDlVlan(52);\r
- matchBuilder.setDlVlanPcp((short) 53);\r
- matchBuilder.setDlType(54);\r
- matchBuilder.setNwTos((short) 55);\r
- matchBuilder.setNwProto((short) 56);\r
- matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));\r
- matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));\r
- matchBuilder.setTpSrc(57);\r
- matchBuilder.setTpDst(58);\r
- flowBuilder.setMatchV10(matchBuilder.build());\r
- flowBuilder.setTableId((short) 42);\r
- flowBuilder.setOutPort(6653L);\r
- caseBuilder.setMultipartRequestFlow(flowBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 56);\r
- Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong wildcards", 0, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());\r
- byte[] dlSrc = new byte[6];\r
- out.readBytes(dlSrc);\r
- Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));\r
- byte[] dlDst = new byte[6];\r
- out.readBytes(dlDst);\r
- Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));\r
- Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());\r
- out.skipBytes(1);\r
- Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong table-id", 42, out.readUnsignedByte());\r
- out.skipBytes(1);\r
- Assert.assertEquals("Wrong out-port", 6653, out.readUnsignedShort());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsRequestInputFactory (Table) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testTable() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPTABLE);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();\r
- MultipartRequestTableBuilder tableBuilder = new MultipartRequestTableBuilder();\r
- caseBuilder.setMultipartRequestTable(tableBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 12);\r
- Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
- \r
- /**\r
- * Testing OF10StatsRequestInputFactory (Port) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testPort() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPPORTSTATS);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();\r
- MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();\r
- portBuilder.setPortNo(15L);\r
- caseBuilder.setMultipartRequestPortStats(portBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 20);\r
- Assert.assertEquals("Wrong type", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());\r
- out.skipBytes(6);\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Testing OF10StatsRequestInputFactory (Queue) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testQueue() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPQUEUE);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();\r
- MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();\r
- queueBuilder.setPortNo(15L);\r
- queueBuilder.setQueueId(16L);\r
- caseBuilder.setMultipartRequestQueue(queueBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 20);\r
- Assert.assertEquals("Wrong type", 5, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong queue-id", 16, out.readUnsignedInt());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StatsRequestInputFactoryTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Desc) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testDesc() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPDESC);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestDescCaseBuilder caseBuilder = new MultipartRequestDescCaseBuilder();
+ MultipartRequestDescBuilder descBuilder = new MultipartRequestDescBuilder();
+ caseBuilder.setMultipartRequestDesc(descBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 12);
+ Assert.assertEquals("Wrong type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Flow) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testFlow() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPFLOW);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
+ MatchV10Builder matchBuilder = new MatchV10Builder();
+ matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,
+ true, true, true, true));
+ matchBuilder.setNwSrcMask((short) 8);
+ matchBuilder.setNwDstMask((short) 16);
+ matchBuilder.setInPort(51);
+ matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
+ matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
+ matchBuilder.setDlVlan(52);
+ matchBuilder.setDlVlanPcp((short) 53);
+ matchBuilder.setDlType(54);
+ matchBuilder.setNwTos((short) 55);
+ matchBuilder.setNwProto((short) 56);
+ matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
+ matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
+ matchBuilder.setTpSrc(57);
+ matchBuilder.setTpDst(58);
+ flowBuilder.setMatchV10(matchBuilder.build());
+ flowBuilder.setTableId((short) 1);
+ flowBuilder.setOutPort(42L);
+ caseBuilder.setMultipartRequestFlow(flowBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 56);
+ Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong wildcards", 3414271, out.readUnsignedInt());
+ Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());
+ byte[] dlSrc = new byte[6];
+ out.readBytes(dlSrc);
+ Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));
+ byte[] dlDst = new byte[6];
+ out.readBytes(dlDst);
+ Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));
+ Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());
+ Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());
+ out.skipBytes(1);
+ Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());
+ Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());
+ Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());
+ Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());
+ Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());
+ Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());
+ Assert.assertEquals("Wrong table-id", 1, out.readUnsignedByte());
+ out.skipBytes(1);
+ Assert.assertEquals("Wrong out-port", 42, out.readUnsignedShort());
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Aggregate) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testAggregate() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPAGGREGATE);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
+ MatchV10Builder matchBuilder = new MatchV10Builder();
+ matchBuilder.setWildcards(new FlowWildcardsV10(false, false, false, false,
+ false, false, false, false, false, false));
+ matchBuilder.setNwSrcMask((short) 32);
+ matchBuilder.setNwDstMask((short) 32);
+ matchBuilder.setInPort(51);
+ matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
+ matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
+ matchBuilder.setDlVlan(52);
+ matchBuilder.setDlVlanPcp((short) 53);
+ matchBuilder.setDlType(54);
+ matchBuilder.setNwTos((short) 55);
+ matchBuilder.setNwProto((short) 56);
+ matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
+ matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
+ matchBuilder.setTpSrc(57);
+ matchBuilder.setTpDst(58);
+ flowBuilder.setMatchV10(matchBuilder.build());
+ flowBuilder.setTableId((short) 42);
+ flowBuilder.setOutPort(6653L);
+ caseBuilder.setMultipartRequestFlow(flowBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 56);
+ Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong wildcards", 0, out.readUnsignedInt());
+ Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());
+ byte[] dlSrc = new byte[6];
+ out.readBytes(dlSrc);
+ Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));
+ byte[] dlDst = new byte[6];
+ out.readBytes(dlDst);
+ Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));
+ Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());
+ Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());
+ out.skipBytes(1);
+ Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());
+ Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());
+ Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());
+ Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());
+ Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());
+ Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());
+ Assert.assertEquals("Wrong table-id", 42, out.readUnsignedByte());
+ out.skipBytes(1);
+ Assert.assertEquals("Wrong out-port", 6653, out.readUnsignedShort());
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Table) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testTable() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPTABLE);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();
+ MultipartRequestTableBuilder tableBuilder = new MultipartRequestTableBuilder();
+ caseBuilder.setMultipartRequestTable(tableBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 12);
+ Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Port) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testPort() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPPORTSTATS);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
+ MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
+ portBuilder.setPortNo(15L);
+ caseBuilder.setMultipartRequestPortStats(portBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 20);
+ Assert.assertEquals("Wrong type", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());
+ out.skipBytes(6);
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Queue) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testQueue() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPQUEUE);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+ MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
+ queueBuilder.setPortNo(15L);
+ queueBuilder.setQueueId(16L);
+ caseBuilder.setMultipartRequestQueue(queueBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 20);
+ Assert.assertEquals("Wrong type", 5, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong queue-id", 16, out.readUnsignedInt());
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class VendorInputMessageFactoryTest {\r
-\r
- @Mock SerializerRegistry registry;\r
- @Mock ExperimenterInputMessageFactory serializer;\r
-\r
- /**\r
- * Tests {@link VendorInputMessageFactory#serialize(ExperimenterInput, ByteBuf)}\r
- */\r
- @Test\r
- public void test() {\r
- Mockito.when(registry.getSerializer((MessageTypeKey<?>) Matchers.any(MessageTypeKey.class)))\r
- .thenReturn(serializer);\r
- VendorInputMessageFactory factory = new VendorInputMessageFactory();\r
- factory.injectSerializerRegistry(registry);\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);\r
- builder.setXid(12345L);\r
- builder.setExperimenter(new ExperimenterId(42L));\r
- builder.setExpType(84L);\r
- ExperimenterInput experimenterInput = builder.build();\r
-\r
- factory.serialize(experimenterInput, buffer);\r
- Mockito.verify(serializer, Mockito.times(1)).serialize(experimenterInput, buffer);\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.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VendorInputMessageFactoryTest {
+
+ @Mock SerializerRegistry registry;
+ @Mock ExperimenterInputMessageFactory serializer;
+
+ /**
+ * Tests {@link VendorInputMessageFactory#serialize(ExperimenterInput, ByteBuf)}
+ */
+ @Test
+ public void test() {
+ Mockito.when(registry.getSerializer((MessageTypeKey<?>) Matchers.any(MessageTypeKey.class)))
+ .thenReturn(serializer);
+ VendorInputMessageFactory factory = new VendorInputMessageFactory();
+ factory.injectSerializerRegistry(registry);
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+ builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
+ builder.setXid(12345L);
+ builder.setExperimenter(new ExperimenterId(42L));
+ builder.setExpType(84L);
+ ExperimenterInput experimenterInput = builder.build();
+
+ factory.serialize(experimenterInput, buffer);
+ Mockito.verify(serializer, Mockito.times(1)).serialize(experimenterInput, buffer);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class MultipartRequestExperimenterTest {\r
-\r
- @Mock SerializerRegistry mockRegistry;\r
- @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;\r
-\r
- /**\r
- * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testExperimenter() throws Exception {\r
- Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))\r
- .thenReturn(serializer);\r
- MultipartRequestInputFactory multipartFactory = new MultipartRequestInputFactory();\r
- multipartFactory.injectSerializerRegistry(mockRegistry);\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
- MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
- ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();\r
- expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
- expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());\r
- caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
- Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipartRequestExperimenterTest {
+
+ @Mock SerializerRegistry mockRegistry;
+ @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testExperimenter() throws Exception {
+ Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))
+ .thenReturn(serializer);
+ MultipartRequestInputFactory multipartFactory = new MultipartRequestInputFactory();
+ multipartFactory.injectSerializerRegistry(mockRegistry);
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.OFPMPEXPERIMENTER);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
+ MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
+ ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();
+ expIdBuilder.setExperimenter(new ExperimenterId(42L));
+ expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());
+ caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+ Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.desc._case.MultipartRequestGroupDescBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestGroupDescTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Tests {@link MultipartRequestInputFactory} - GroupDesc case\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPGROUPDESC);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestGroupDescCaseBuilder caseBuilder = new MultipartRequestGroupDescCaseBuilder();\r
- MultipartRequestGroupDescBuilder descBuilder = new MultipartRequestGroupDescBuilder();\r
- descBuilder.setEmpty(true);\r
- caseBuilder.setMultipartRequestGroupDesc(descBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
- Assert.assertEquals("Wrong type", 7, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- out.skipBytes(4); // skip padding\r
- Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.desc._case.MultipartRequestGroupDescBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestGroupDescTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Tests {@link MultipartRequestInputFactory} - GroupDesc case
+ * @throws Exception
+ */
+ @Test
+ public void test() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.OFPMPGROUPDESC);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestGroupDescCaseBuilder caseBuilder = new MultipartRequestGroupDescCaseBuilder();
+ MultipartRequestGroupDescBuilder descBuilder = new MultipartRequestGroupDescBuilder();
+ descBuilder.setEmpty(true);
+ caseBuilder.setMultipartRequestGroupDesc(descBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+ Assert.assertEquals("Wrong type", 7, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ out.skipBytes(4); // skip padding
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.features._case.MultipartRequestGroupFeaturesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestGroupFeaturesTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Tests {@link MultipartRequestInputFactory} - GroupFeatures case\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPGROUPFEATURES);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestGroupFeaturesCaseBuilder caseBuilder = new MultipartRequestGroupFeaturesCaseBuilder();\r
- MultipartRequestGroupFeaturesBuilder featuresBuilder = new MultipartRequestGroupFeaturesBuilder();\r
- featuresBuilder.setEmpty(true);\r
- caseBuilder.setMultipartRequestGroupFeatures(featuresBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
- Assert.assertEquals("Wrong type", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- out.skipBytes(4); // skip padding\r
- Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.features._case.MultipartRequestGroupFeaturesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestGroupFeaturesTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Tests {@link MultipartRequestInputFactory} - GroupFeatures case
+ * @throws Exception
+ */
+ @Test
+ public void test() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.OFPMPGROUPFEATURES);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestGroupFeaturesCaseBuilder caseBuilder = new MultipartRequestGroupFeaturesCaseBuilder();
+ MultipartRequestGroupFeaturesBuilder featuresBuilder = new MultipartRequestGroupFeaturesBuilder();
+ featuresBuilder.setEmpty(true);
+ caseBuilder.setMultipartRequestGroupFeatures(featuresBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+ Assert.assertEquals("Wrong type", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ out.skipBytes(4); // skip padding
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.features._case.MultipartRequestMeterFeaturesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestMeterFeaturesTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Tests {@link MultipartRequestInputFactory} - MeterFeatures case\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPMETERFEATURES);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestMeterFeaturesCaseBuilder caseBuilder = new MultipartRequestMeterFeaturesCaseBuilder();\r
- MultipartRequestMeterFeaturesBuilder featuresBuilder = new MultipartRequestMeterFeaturesBuilder();\r
- featuresBuilder.setEmpty(true);\r
- caseBuilder.setMultipartRequestMeterFeatures(featuresBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
- Assert.assertEquals("Wrong type", 11, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- out.skipBytes(4); // skip padding\r
- Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.features._case.MultipartRequestMeterFeaturesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestMeterFeaturesTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Tests {@link MultipartRequestInputFactory} - MeterFeatures case
+ * @throws Exception
+ */
+ @Test
+ public void test() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.OFPMPMETERFEATURES);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestMeterFeaturesCaseBuilder caseBuilder = new MultipartRequestMeterFeaturesCaseBuilder();
+ MultipartRequestMeterFeaturesBuilder featuresBuilder = new MultipartRequestMeterFeaturesBuilder();
+ featuresBuilder.setEmpty(true);
+ caseBuilder.setMultipartRequestMeterFeatures(featuresBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+ Assert.assertEquals("Wrong type", 11, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ out.skipBytes(4); // skip padding
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.desc._case.MultipartRequestPortDescBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestPortDescTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Tests {@link MultipartRequestInputFactory} - PortDesc case\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPPORTDESC);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestPortDescCaseBuilder caseBuilder = new MultipartRequestPortDescCaseBuilder();\r
- MultipartRequestPortDescBuilder descBuilder = new MultipartRequestPortDescBuilder();\r
- descBuilder.setEmpty(true);\r
- caseBuilder.setMultipartRequestPortDesc(descBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
- Assert.assertEquals("Wrong type", 13, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- out.skipBytes(4); // skip padding\r
- Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.desc._case.MultipartRequestPortDescBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestPortDescTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Tests {@link MultipartRequestInputFactory} - PortDesc case
+ * @throws Exception
+ */
+ @Test
+ public void test() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.OFPMPPORTDESC);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestPortDescCaseBuilder caseBuilder = new MultipartRequestPortDescCaseBuilder();
+ MultipartRequestPortDescBuilder descBuilder = new MultipartRequestPortDescBuilder();
+ descBuilder.setEmpty(true);
+ caseBuilder.setMultipartRequestPortDesc(descBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+ Assert.assertEquals("Wrong type", 13, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ out.skipBytes(4); // skip padding
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.math.BigInteger;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class MultipartRequestTableFeaturesTest {\r
-\r
- private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE =\r
- MultipartRequestInputFactoryTest.PADDING_IN_MULTIPART_REQUEST_MESSAGE;\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- @Mock SerializerRegistry mockRegistry;\r
- @Mock OFSerializer<TableFeatureProperties> serializer;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- Mockito.when(mockRegistry.getSerializer((MessageTypeKey<?>)Matchers.any()))\r
- .thenReturn(serializer);\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * @throws Exception\r
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO\r
- */\r
- @Test\r
- public void testMultipartRequestTableFeaturesMessageFactory() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.forValue(12));\r
- builder.setFlags(new MultipartRequestFlags(true));\r
- MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();\r
- MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();\r
- List<TableFeatures> tableFeaturesList = new ArrayList<>();\r
- TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();\r
- tableFeaturesBuilder.setTableId((short) 8);\r
- tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");\r
- tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));\r
- tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));\r
- tableFeaturesBuilder.setConfig(new TableConfig(true));\r
- tableFeaturesBuilder.setMaxEntries(65L);\r
- List<TableFeatureProperties> properties = new ArrayList<>();\r
- TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);\r
- NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder =\r
- new NextTableRelatedTableFeaturePropertyBuilder();\r
- List<NextTableIds> nextIds = new ArrayList<>();\r
- nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());\r
- nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());\r
- nextPropBuilder.setNextTableIds(nextIds);\r
- propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);\r
- nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();\r
- nextIds = new ArrayList<>();\r
- nextPropBuilder.setNextTableIds(nextIds);\r
- propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);\r
- InstructionRelatedTableFeaturePropertyBuilder insPropBuilder =\r
- new InstructionRelatedTableFeaturePropertyBuilder();\r
- List<Instruction> insIds = new ArrayList<>();\r
- InstructionBuilder insBuilder = new InstructionBuilder();\r
- insBuilder.setType(WriteActions.class);\r
- insIds.add(insBuilder.build());\r
- insBuilder = new InstructionBuilder();\r
- insBuilder.setType(GotoTable.class);\r
- insIds.add(insBuilder.build());\r
- insPropBuilder.setInstruction(insIds);\r
- propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);\r
- insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();\r
- insIds = new ArrayList<>();\r
- insBuilder = new InstructionBuilder();\r
- insBuilder.setType(WriteMetadata.class);\r
- insIds.add(insBuilder.build());\r
- insBuilder = new InstructionBuilder();\r
- insBuilder.setType(ApplyActions.class);\r
- insIds.add(insBuilder.build());\r
- insBuilder = new InstructionBuilder();\r
- insBuilder.setType(Meter.class);\r
- insIds.add(insBuilder.build());\r
- insBuilder = new InstructionBuilder();\r
- insBuilder.setType(ClearActions.class);\r
- insIds.add(insBuilder.build());\r
- insBuilder = new InstructionBuilder();\r
- insBuilder.setType(GotoTable.class);\r
- insIds.add(insBuilder.build());\r
- insPropBuilder.setInstruction(insIds);\r
- propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());\r
- properties.add(propBuilder.build());\r
- tableFeaturesBuilder.setTableFeatureProperties(properties);\r
- tableFeaturesList.add(tableFeaturesBuilder.build());\r
- tableFeaturesBuilder = new TableFeaturesBuilder();\r
- tableFeaturesBuilder.setTableId((short) 8);\r
- tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");\r
- tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));\r
- tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));\r
- tableFeaturesBuilder.setConfig(new TableConfig(true));\r
- tableFeaturesBuilder.setMaxEntries(67L);\r
- properties = new ArrayList<>();\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONS);\r
- ActionRelatedTableFeaturePropertyBuilder actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
- List<Action> actions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Output.class);\r
- actions.add(actionBuilder.build());\r
- actBuilder.setAction(actions);\r
- propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS);\r
- actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
- actions = new ArrayList<>();\r
- actBuilder.setAction(actions);\r
- propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONS);\r
- actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
- actions = new ArrayList<>();\r
- actBuilder.setAction(actions);\r
- propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS);\r
- actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
- actions = new ArrayList<>();\r
- actBuilder.setAction(actions);\r
- propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);\r
- OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
- List<MatchEntries> entries = new ArrayList<>();\r
- MatchEntriesBuilder entriesBuilder = new MatchEntriesBuilder();\r
- entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entriesBuilder.setOxmMatchField(InPhyPort.class);\r
- entriesBuilder.setHasMask(false);\r
- entries.add(entriesBuilder.build());\r
- entriesBuilder = new MatchEntriesBuilder();\r
- entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entriesBuilder.setOxmMatchField(InPort.class);\r
- entriesBuilder.setHasMask(false);\r
- entries.add(entriesBuilder.build());\r
- oxmBuilder.setMatchEntries(entries);\r
- propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTWILDCARDS);\r
- oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
- entries = new ArrayList<>();\r
- oxmBuilder.setMatchEntries(entries);\r
- propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELD);\r
- oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
- entries = new ArrayList<>();\r
- oxmBuilder.setMatchEntries(entries);\r
- propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS);\r
- oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
- entries = new ArrayList<>();\r
- oxmBuilder.setMatchEntries(entries);\r
- propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);\r
- oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
- entries = new ArrayList<>();\r
- entriesBuilder = new MatchEntriesBuilder();\r
- entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entriesBuilder.setOxmMatchField(IpProto.class);\r
- entriesBuilder.setHasMask(false);\r
- entries.add(entriesBuilder.build());\r
- entriesBuilder = new MatchEntriesBuilder();\r
- entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entriesBuilder.setOxmMatchField(IpEcn.class);\r
- entriesBuilder.setHasMask(false);\r
- entries.add(entriesBuilder.build());\r
- oxmBuilder.setMatchEntries(entries);\r
- propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS);\r
- oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
- entries = new ArrayList<>();\r
- oxmBuilder.setMatchEntries(entries);\r
- propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
- properties.add(propBuilder.build());\r
- tableFeaturesBuilder.setTableFeatureProperties(properties);\r
- tableFeaturesList.add(tableFeaturesBuilder.build());\r
- featuresBuilder.setTableFeatures(tableFeaturesList);\r
- caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 296);\r
- Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());\r
- out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);\r
- Assert.assertEquals("Wrong length", 120, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
- out.skipBytes(5);\r
- Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
- ByteBufUtils.decodeNullTerminatedString(out, 32));\r
- byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- out.readBytes(metadataMatch);\r
- Assert.assertArrayEquals("Wrong metadata-match",\r
- new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);\r
- byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- out.readBytes(metadataWrite);\r
- Assert.assertArrayEquals("Wrong metadata-write",\r
- new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);\r
- Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong property type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 6, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong next-registry-id", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong next-registry-id", 2, out.readUnsignedByte());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong property type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong length", 160, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
- out.skipBytes(5);\r
- Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
- ByteBufUtils.decodeNullTerminatedString(out, 32));\r
- metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- out.readBytes(metadataMatch);\r
- Assert.assertArrayEquals("Wrong metadata-match",\r
- new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);\r
- metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- out.readBytes(metadataWrite);\r
- Assert.assertArrayEquals("Wrong metadata-write",\r
- new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);\r
- Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong max-entries", 67, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong property type", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property type", 5, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 6, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 7, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match field&mask", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match field&mask", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 10, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 13, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 14, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match field&mask", 20, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 15, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * @throws Exception\r
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO\r
- */\r
- @Test\r
- public void testMultipartRequestTableFeaturesExperimenter() throws Exception {\r
- MultipartRequestInputFactory factory = new MultipartRequestInputFactory();\r
- factory.injectSerializerRegistry(mockRegistry);\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.forValue(12));\r
- builder.setFlags(new MultipartRequestFlags(true));\r
- MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();\r
- MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();\r
- List<TableFeatures> tableFeaturesList = new ArrayList<>();\r
- TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();\r
- tableFeaturesBuilder.setTableId((short) 8);\r
- tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");\r
- tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));\r
- tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));\r
- tableFeaturesBuilder.setConfig(new TableConfig(true));\r
- tableFeaturesBuilder.setMaxEntries(65L);\r
- List<TableFeatureProperties> properties = new ArrayList<>();\r
- TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
- ExperimenterIdTableFeaturePropertyBuilder expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();\r
- expBuilder.setExperimenter(new ExperimenterId(42L));\r
- propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
- expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();\r
- expBuilder.setExperimenter(new ExperimenterId(43L));\r
- propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());\r
- properties.add(propBuilder.build());\r
- tableFeaturesBuilder.setTableFeatureProperties(properties);\r
- tableFeaturesList.add(tableFeaturesBuilder.build());\r
- featuresBuilder.setTableFeatures(tableFeaturesList);\r
- caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- factory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 80);\r
- Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());\r
- out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);\r
- Assert.assertEquals("Wrong length", 64, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
- out.skipBytes(5);\r
- Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
- ByteBufUtils.decodeNullTerminatedString(out, 32));\r
- byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- out.readBytes(metadataMatch);\r
- Assert.assertArrayEquals("Wrong metadata-match",\r
- new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);\r
- byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
- out.readBytes(metadataWrite);\r
- Assert.assertArrayEquals("Wrong metadata-write",\r
- new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);\r
- Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());\r
- Mockito.verify(serializer, Mockito.times(2)).serialize(Matchers.any(TableFeatureProperties.class),\r
- Matchers.any(ByteBuf.class));\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipartRequestTableFeaturesTest {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE =
+ MultipartRequestInputFactoryTest.PADDING_IN_MULTIPART_REQUEST_MESSAGE;
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ @Mock SerializerRegistry mockRegistry;
+ @Mock OFSerializer<TableFeatureProperties> serializer;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ Mockito.when(mockRegistry.getSerializer((MessageTypeKey<?>)Matchers.any()))
+ .thenReturn(serializer);
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * @throws Exception
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ */
+ @Test
+ public void testMultipartRequestTableFeaturesMessageFactory() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.forValue(12));
+ builder.setFlags(new MultipartRequestFlags(true));
+ MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
+ MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
+ List<TableFeatures> tableFeaturesList = new ArrayList<>();
+ TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
+ tableFeaturesBuilder.setTableId((short) 8);
+ tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
+ tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
+ tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
+ tableFeaturesBuilder.setConfig(new TableConfig(true));
+ tableFeaturesBuilder.setMaxEntries(65L);
+ List<TableFeatureProperties> properties = new ArrayList<>();
+ TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
+ NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder =
+ new NextTableRelatedTableFeaturePropertyBuilder();
+ List<NextTableIds> nextIds = new ArrayList<>();
+ nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());
+ nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
+ nextPropBuilder.setNextTableIds(nextIds);
+ propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
+ nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
+ nextIds = new ArrayList<>();
+ nextPropBuilder.setNextTableIds(nextIds);
+ propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);
+ InstructionRelatedTableFeaturePropertyBuilder insPropBuilder =
+ new InstructionRelatedTableFeaturePropertyBuilder();
+ List<Instruction> insIds = new ArrayList<>();
+ InstructionBuilder insBuilder = new InstructionBuilder();
+ insBuilder.setType(WriteActions.class);
+ insIds.add(insBuilder.build());
+ insBuilder = new InstructionBuilder();
+ insBuilder.setType(GotoTable.class);
+ insIds.add(insBuilder.build());
+ insPropBuilder.setInstruction(insIds);
+ propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);
+ insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
+ insIds = new ArrayList<>();
+ insBuilder = new InstructionBuilder();
+ insBuilder.setType(WriteMetadata.class);
+ insIds.add(insBuilder.build());
+ insBuilder = new InstructionBuilder();
+ insBuilder.setType(ApplyActions.class);
+ insIds.add(insBuilder.build());
+ insBuilder = new InstructionBuilder();
+ insBuilder.setType(Meter.class);
+ insIds.add(insBuilder.build());
+ insBuilder = new InstructionBuilder();
+ insBuilder.setType(ClearActions.class);
+ insIds.add(insBuilder.build());
+ insBuilder = new InstructionBuilder();
+ insBuilder.setType(GotoTable.class);
+ insIds.add(insBuilder.build());
+ insPropBuilder.setInstruction(insIds);
+ propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
+ properties.add(propBuilder.build());
+ tableFeaturesBuilder.setTableFeatureProperties(properties);
+ tableFeaturesList.add(tableFeaturesBuilder.build());
+ tableFeaturesBuilder = new TableFeaturesBuilder();
+ tableFeaturesBuilder.setTableId((short) 8);
+ tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
+ tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
+ tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
+ tableFeaturesBuilder.setConfig(new TableConfig(true));
+ tableFeaturesBuilder.setMaxEntries(67L);
+ properties = new ArrayList<>();
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONS);
+ ActionRelatedTableFeaturePropertyBuilder actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Output.class);
+ actions.add(actionBuilder.build());
+ actBuilder.setAction(actions);
+ propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS);
+ actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+ actions = new ArrayList<>();
+ actBuilder.setAction(actions);
+ propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONS);
+ actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+ actions = new ArrayList<>();
+ actBuilder.setAction(actions);
+ propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS);
+ actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+ actions = new ArrayList<>();
+ actBuilder.setAction(actions);
+ propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);
+ OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+ List<MatchEntries> entries = new ArrayList<>();
+ MatchEntriesBuilder entriesBuilder = new MatchEntriesBuilder();
+ entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+ entriesBuilder.setOxmMatchField(InPhyPort.class);
+ entriesBuilder.setHasMask(false);
+ entries.add(entriesBuilder.build());
+ entriesBuilder = new MatchEntriesBuilder();
+ entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+ entriesBuilder.setOxmMatchField(InPort.class);
+ entriesBuilder.setHasMask(false);
+ entries.add(entriesBuilder.build());
+ oxmBuilder.setMatchEntries(entries);
+ propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTWILDCARDS);
+ oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+ entries = new ArrayList<>();
+ oxmBuilder.setMatchEntries(entries);
+ propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELD);
+ oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+ entries = new ArrayList<>();
+ oxmBuilder.setMatchEntries(entries);
+ propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS);
+ oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+ entries = new ArrayList<>();
+ oxmBuilder.setMatchEntries(entries);
+ propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);
+ oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+ entries = new ArrayList<>();
+ entriesBuilder = new MatchEntriesBuilder();
+ entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+ entriesBuilder.setOxmMatchField(IpProto.class);
+ entriesBuilder.setHasMask(false);
+ entries.add(entriesBuilder.build());
+ entriesBuilder = new MatchEntriesBuilder();
+ entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+ entriesBuilder.setOxmMatchField(IpEcn.class);
+ entriesBuilder.setHasMask(false);
+ entries.add(entriesBuilder.build());
+ oxmBuilder.setMatchEntries(entries);
+ propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS);
+ oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+ entries = new ArrayList<>();
+ oxmBuilder.setMatchEntries(entries);
+ propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+ properties.add(propBuilder.build());
+ tableFeaturesBuilder.setTableFeatureProperties(properties);
+ tableFeaturesList.add(tableFeaturesBuilder.build());
+ featuresBuilder.setTableFeatures(tableFeaturesList);
+ caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 296);
+ Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());
+ out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
+ Assert.assertEquals("Wrong length", 120, out.readUnsignedShort());
+ Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
+ out.skipBytes(5);
+ Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
+ ByteBufUtils.decodeNullTerminatedString(out, 32));
+ byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(metadataMatch);
+ Assert.assertArrayEquals("Wrong metadata-match",
+ new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
+ byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(metadataWrite);
+ Assert.assertArrayEquals("Wrong metadata-write",
+ new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
+ Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
+ Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());
+ Assert.assertEquals("Wrong property type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 6, out.readUnsignedShort());
+ Assert.assertEquals("Wrong next-registry-id", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong next-registry-id", 2, out.readUnsignedByte());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong property type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong length", 160, out.readUnsignedShort());
+ Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
+ out.skipBytes(5);
+ Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
+ ByteBufUtils.decodeNullTerminatedString(out, 32));
+ metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(metadataMatch);
+ Assert.assertArrayEquals("Wrong metadata-match",
+ new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
+ metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(metadataWrite);
+ Assert.assertArrayEquals("Wrong metadata-write",
+ new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
+ Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
+ Assert.assertEquals("Wrong max-entries", 67, out.readUnsignedInt());
+ Assert.assertEquals("Wrong property type", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property type", 5, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 6, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 7, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match field&mask", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match field&mask", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 10, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 13, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 14, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match field&mask", 20, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong property type", 15, out.readUnsignedShort());
+ Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * @throws Exception
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ */
+ @Test
+ public void testMultipartRequestTableFeaturesExperimenter() throws Exception {
+ MultipartRequestInputFactory factory = new MultipartRequestInputFactory();
+ factory.injectSerializerRegistry(mockRegistry);
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.forValue(12));
+ builder.setFlags(new MultipartRequestFlags(true));
+ MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
+ MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
+ List<TableFeatures> tableFeaturesList = new ArrayList<>();
+ TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
+ tableFeaturesBuilder.setTableId((short) 8);
+ tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
+ tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
+ tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
+ tableFeaturesBuilder.setConfig(new TableConfig(true));
+ tableFeaturesBuilder.setMaxEntries(65L);
+ List<TableFeatureProperties> properties = new ArrayList<>();
+ TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);
+ ExperimenterIdTableFeaturePropertyBuilder expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();
+ expBuilder.setExperimenter(new ExperimenterId(42L));
+ propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());
+ properties.add(propBuilder.build());
+ propBuilder = new TableFeaturePropertiesBuilder();
+ propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);
+ expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();
+ expBuilder.setExperimenter(new ExperimenterId(43L));
+ propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());
+ properties.add(propBuilder.build());
+ tableFeaturesBuilder.setTableFeatureProperties(properties);
+ tableFeaturesList.add(tableFeaturesBuilder.build());
+ featuresBuilder.setTableFeatures(tableFeaturesList);
+ caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ factory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 80);
+ Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());
+ out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
+ Assert.assertEquals("Wrong length", 64, out.readUnsignedShort());
+ Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
+ out.skipBytes(5);
+ Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
+ ByteBufUtils.decodeNullTerminatedString(out, 32));
+ byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(metadataMatch);
+ Assert.assertArrayEquals("Wrong metadata-match",
+ new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
+ byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(metadataWrite);
+ Assert.assertArrayEquals("Wrong metadata-write",
+ new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
+ Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
+ Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());
+ Mockito.verify(serializer, Mockito.times(2)).serialize(Matchers.any(TableFeatureProperties.class),
+ Matchers.any(ByteBuf.class));
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestTableTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- multipartFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Tests {@link MultipartRequestInputFactory} - Table case\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPTABLE);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();\r
- MultipartRequestTableBuilder tablesBuilder = new MultipartRequestTableBuilder();\r
- tablesBuilder.setEmpty(true);\r
- caseBuilder.setMultipartRequestTable(tablesBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
- Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- out.skipBytes(4); // skip padding\r
- Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestTableTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> multipartFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ multipartFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Tests {@link MultipartRequestInputFactory} - Table case
+ * @throws Exception
+ */
+ @Test
+ public void test() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+ builder.setType(MultipartType.OFPMPTABLE);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();
+ MultipartRequestTableBuilder tablesBuilder = new MultipartRequestTableBuilder();
+ tablesBuilder.setEmpty(true);
+ caseBuilder.setMultipartRequestTable(tablesBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+ Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ out.skipBytes(4); // skip padding
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StatsRequestAggregateTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<MultipartRequestInput> statsFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- statsFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));\r
- }\r
-\r
- /**\r
- * Tests {@link OF10StatsRequestInputFactory} for correct serialization\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPAGGREGATE);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();\r
- MultipartRequestAggregateBuilder aggBuilder = new MultipartRequestAggregateBuilder();\r
- MatchV10Builder matchBuilder = new MatchV10Builder();\r
- matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,\r
- true, true, true, true));\r
- matchBuilder.setNwSrcMask((short) 8);\r
- matchBuilder.setNwDstMask((short) 16);\r
- matchBuilder.setInPort(51);\r
- matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));\r
- matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));\r
- matchBuilder.setDlVlan(52);\r
- matchBuilder.setDlVlanPcp((short) 53);\r
- matchBuilder.setDlType(54);\r
- matchBuilder.setNwTos((short) 55);\r
- matchBuilder.setNwProto((short) 56);\r
- matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));\r
- matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));\r
- matchBuilder.setTpSrc(57);\r
- matchBuilder.setTpDst(58);\r
- aggBuilder.setMatchV10(matchBuilder.build());\r
- aggBuilder.setTableId((short) 5);\r
- aggBuilder.setOutPort(42L);\r
- caseBuilder.setMultipartRequestAggregate(aggBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- statsFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV10(out, (byte) 16, 56);\r
- Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- out.skipBytes(40); // skip match check\r
- Assert.assertEquals("Wrong table-id", 5, out.readUnsignedByte());\r
- out.skipBytes(1);\r
- Assert.assertEquals("Wrong out port", 42, out.readUnsignedShort());\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StatsRequestAggregateTest {
+
+ private SerializerRegistry registry;
+ private OFSerializer<MultipartRequestInput> statsFactory;
+
+ /**
+ * Initializes serializer registry and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ statsFactory = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));
+ }
+
+ /**
+ * Tests {@link OF10StatsRequestInputFactory} for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void test() throws Exception {
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPAGGREGATE);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
+ MultipartRequestAggregateBuilder aggBuilder = new MultipartRequestAggregateBuilder();
+ MatchV10Builder matchBuilder = new MatchV10Builder();
+ matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,
+ true, true, true, true));
+ matchBuilder.setNwSrcMask((short) 8);
+ matchBuilder.setNwDstMask((short) 16);
+ matchBuilder.setInPort(51);
+ matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
+ matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
+ matchBuilder.setDlVlan(52);
+ matchBuilder.setDlVlanPcp((short) 53);
+ matchBuilder.setDlType(54);
+ matchBuilder.setNwTos((short) 55);
+ matchBuilder.setNwProto((short) 56);
+ matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
+ matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
+ matchBuilder.setTpSrc(57);
+ matchBuilder.setTpDst(58);
+ aggBuilder.setMatchV10(matchBuilder.build());
+ aggBuilder.setTableId((short) 5);
+ aggBuilder.setOutPort(42L);
+ caseBuilder.setMultipartRequestAggregate(aggBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ statsFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 56);
+ Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ out.skipBytes(40); // skip match check
+ Assert.assertEquals("Wrong table-id", 5, out.readUnsignedByte());
+ out.skipBytes(1);
+ Assert.assertEquals("Wrong out port", 42, out.readUnsignedShort());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class OF10StatsRequestExperimenterTest {\r
-\r
- @Mock SerializerRegistry mockRegistry;\r
- @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;\r
-\r
- /**\r
- * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testExperimenter() throws Exception {\r
- Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))\r
- .thenReturn(serializer);\r
- OF10StatsRequestInputFactory multipartFactory = new OF10StatsRequestInputFactory();\r
- multipartFactory.injectSerializerRegistry(mockRegistry);\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
- MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
- ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();\r
- expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
- expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());\r
- caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
-\r
- BufferHelper.checkHeaderV10(out, (byte) 16, 12);\r
- Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));\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.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OF10StatsRequestExperimenterTest {
+
+ @Mock SerializerRegistry mockRegistry;
+ @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;
+
+ /**
+ * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization
+ * @throws Exception
+ */
+ @Test
+ public void testExperimenter() throws Exception {
+ Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))
+ .thenReturn(serializer);
+ OF10StatsRequestInputFactory multipartFactory = new OF10StatsRequestInputFactory();
+ multipartFactory.injectSerializerRegistry(mockRegistry);
+ MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setType(MultipartType.OFPMPEXPERIMENTER);
+ builder.setFlags(new MultipartRequestFlags(false));
+ MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
+ MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
+ ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();
+ expIdBuilder.setExperimenter(new ExperimenterId(42L));
+ expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());
+ caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
+ builder.setMultipartRequestBody(caseBuilder.build());
+ MultipartRequestInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ multipartFactory.serialize(message, out);
+
+ BufferHelper.checkHeaderV10(out, (byte) 16, 12);
+ Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());
+ Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+ Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpOpSerializerTest {\r
-\r
- OxmArpOpSerializer serializer = new OxmArpOpSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareArpOpMatchEntry(1402);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 1402, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareArpOpHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_OP, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareArpOpMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareArpOpHeader(false);\r
- OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();\r
- opBuilder.setOpCode(value);\r
- builder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareArpOpHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(ArpOp.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_OP, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpOpSerializerTest {
+
+ OxmArpOpSerializer serializer = new OxmArpOpSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareArpOpMatchEntry(1402);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 1402, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareArpOpHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_OP, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareArpOpMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareArpOpHeader(false);
+ OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();
+ opBuilder.setOpCode(value);
+ builder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareArpOpHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(ArpOp.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_OP, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpShaSerializerTest {\r
-\r
- OxmArpThaSerializer serializer = new OxmArpThaSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
- byte[] tmp = new byte[6];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_THA, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress(value));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(ArpTha.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_THA, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpShaSerializerTest {
+
+ OxmArpThaSerializer serializer = new OxmArpThaSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+ byte[] tmp = new byte[6];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_THA, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress(value));
+ builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(ArpTha.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_THA, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpSpaSerializerTest {\r
-\r
- OxmArpSpaSerializer serializer = new OxmArpSpaSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
- byte[] tmp = new byte[4];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SPA, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
- addressBuilder.setIpv4Address(new Ipv4Address(value));\r
- builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(ArpSpa.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SPA, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpSpaSerializerTest {
+
+ OxmArpSpaSerializer serializer = new OxmArpSpaSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+ byte[] tmp = new byte[4];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SPA, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+ addressBuilder.setIpv4Address(new Ipv4Address(value));
+ builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(ArpSpa.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SPA, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpThaSerializerTest {\r
-\r
- OxmArpShaSerializer serializer = new OxmArpShaSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
- byte[] tmp = new byte[6];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SHA, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress(value));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(ArpSha.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SHA, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpThaSerializerTest {
+
+ OxmArpShaSerializer serializer = new OxmArpShaSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+ byte[] tmp = new byte[6];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SHA, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress(value));
+ builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(ArpSha.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SHA, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpTpaSerializerTest {\r
-\r
- OxmArpTpaSerializer serializer = new OxmArpTpaSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
- byte[] tmp = new byte[4];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_TPA, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
- addressBuilder.setIpv4Address(new Ipv4Address(value));\r
- builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(ArpTpa.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_TPA, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpTpaSerializerTest {
+
+ OxmArpTpaSerializer serializer = new OxmArpTpaSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+ byte[] tmp = new byte[4];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_TPA, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+ addressBuilder.setIpv4Address(new Ipv4Address(value));
+ builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(ArpTpa.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_TPA, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthDstSerializerTest {\r
-\r
- OxmEthDstSerializer serializer = new OxmEthDstSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
- byte[] tmp = new byte[6];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_DST, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress(value));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(EthDst.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_DST, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthDstSerializerTest {
+
+ OxmEthDstSerializer serializer = new OxmEthDstSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+ byte[] tmp = new byte[6];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_DST, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress(value));
+ builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(EthDst.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_DST, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthSrcSerializerTest {\r
-\r
- OxmEthSrcSerializer serializer = new OxmEthSrcSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
- byte[] tmp = new byte[6];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_SRC, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress(value));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(EthSrc.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_SRC, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthSrcSerializerTest {
+
+ OxmEthSrcSerializer serializer = new OxmEthSrcSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+ byte[] tmp = new byte[6];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_SRC, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress(value));
+ builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(EthSrc.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_SRC, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthTypeSerializerTest {\r
-\r
- OxmEthTypeSerializer serializer = new OxmEthTypeSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareEthTypeMatchEntry(65535);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 65535, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareEthTypeHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_TYPE, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder prepareEthTypeMatchEntry(int type) {\r
- MatchEntriesBuilder builder = prepareEthTypeHeader(false);\r
- EthTypeMatchEntryBuilder typeBuilder = new EthTypeMatchEntryBuilder();\r
- typeBuilder.setEthType(new EtherType(type));\r
- builder.addAugmentation(EthTypeMatchEntry.class, typeBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareEthTypeHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(EthType.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_TYPE, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthTypeSerializerTest {
+
+ OxmEthTypeSerializer serializer = new OxmEthTypeSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareEthTypeMatchEntry(65535);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 65535, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareEthTypeHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_TYPE, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder prepareEthTypeMatchEntry(int type) {
+ MatchEntriesBuilder builder = prepareEthTypeHeader(false);
+ EthTypeMatchEntryBuilder typeBuilder = new EthTypeMatchEntryBuilder();
+ typeBuilder.setEthType(new EtherType(type));
+ builder.addAugmentation(EthTypeMatchEntry.class, typeBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareEthTypeHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(EthType.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_TYPE, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4CodeSerializerTest {\r
-\r
- OxmIcmpv4CodeSerializer serializer = new OxmIcmpv4CodeSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareIcmpv4CodeMatchEntry((short) 200);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 200, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_CODE, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder prepareIcmpv4CodeMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);\r
- Icmpv4CodeMatchEntryBuilder icmpv4Builder = new Icmpv4CodeMatchEntryBuilder();\r
- icmpv4Builder.setIcmpv4Code(value);\r
- builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4Builder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIcmpv4CodeHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Icmpv4Code.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_CODE, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4CodeSerializerTest {
+
+ OxmIcmpv4CodeSerializer serializer = new OxmIcmpv4CodeSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareIcmpv4CodeMatchEntry((short) 200);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 200, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_CODE, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder prepareIcmpv4CodeMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);
+ Icmpv4CodeMatchEntryBuilder icmpv4Builder = new Icmpv4CodeMatchEntryBuilder();
+ icmpv4Builder.setIcmpv4Code(value);
+ builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4Builder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareIcmpv4CodeHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Icmpv4Code.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_CODE, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4TypeSerializerTest {\r
-\r
- OxmIcmpv4TypeSerializer serializer = new OxmIcmpv4TypeSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareIcmpv4TypeMatchEntry((short) 128);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 128, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_TYPE, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder prepareIcmpv4TypeMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);\r
- Icmpv4TypeMatchEntryBuilder icmpv4Builder = new Icmpv4TypeMatchEntryBuilder();\r
- icmpv4Builder.setIcmpv4Type(value);\r
- builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4Builder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIcmpv4TypeHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Icmpv4Type.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_TYPE, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4TypeSerializerTest {
+
+ OxmIcmpv4TypeSerializer serializer = new OxmIcmpv4TypeSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareIcmpv4TypeMatchEntry((short) 128);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 128, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_TYPE, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder prepareIcmpv4TypeMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);
+ Icmpv4TypeMatchEntryBuilder icmpv4Builder = new Icmpv4TypeMatchEntryBuilder();
+ icmpv4Builder.setIcmpv4Type(value);
+ builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4Builder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareIcmpv4TypeHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Icmpv4Type.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_TYPE, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6CodeSerializerTest {\r
-\r
- OxmIcmpv6CodeSerializer serializer = new OxmIcmpv6CodeSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 101, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_CODE, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIcmpv6CodeMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);\r
- Icmpv6CodeMatchEntryBuilder icmpv6Builder = new Icmpv6CodeMatchEntryBuilder();\r
- icmpv6Builder.setIcmpv6Code(value);\r
- builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6Builder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIcmpv6CodeHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Icmpv6Code.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_CODE, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6CodeSerializerTest {
+
+ OxmIcmpv6CodeSerializer serializer = new OxmIcmpv6CodeSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 101, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_CODE, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareIcmpv6CodeMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
+ Icmpv6CodeMatchEntryBuilder icmpv6Builder = new Icmpv6CodeMatchEntryBuilder();
+ icmpv6Builder.setIcmpv6Code(value);
+ builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6Builder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareIcmpv6CodeHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Icmpv6Code.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_CODE, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6TypeSerializerTest {\r
-\r
- OxmIcmpv6TypeSerializer serializer = new OxmIcmpv6TypeSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareIcmpv6TypeMatchEntry((short) 123);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 123, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_TYPE, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder prepareIcmpv6TypeMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);\r
- Icmpv6TypeMatchEntryBuilder icmpv6Builder = new Icmpv6TypeMatchEntryBuilder();\r
- icmpv6Builder.setIcmpv6Type(value);\r
- builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6Builder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIcmpv6TypeHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Icmpv6Type.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_TYPE, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6TypeSerializerTest {
+
+ OxmIcmpv6TypeSerializer serializer = new OxmIcmpv6TypeSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareIcmpv6TypeMatchEntry((short) 123);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 123, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_TYPE, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder prepareIcmpv6TypeMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);
+ Icmpv6TypeMatchEntryBuilder icmpv6Builder = new Icmpv6TypeMatchEntryBuilder();
+ icmpv6Builder.setIcmpv6Type(value);
+ builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6Builder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareIcmpv6TypeHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Icmpv6Type.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_TYPE, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpDscpSerializerTest {\r
-\r
- OxmIpDscpSerializer serializer = new OxmIpDscpSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareIpDscpMatchEntry((short) 58);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 58, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareIpDscpHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IP_DSCP, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIpDscpMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareIpDscpHeader(false);\r
- DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
- dscpBuilder.setDscp(new Dscp(value));\r
- builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIpDscpHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(IpDscp.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IP_DSCP, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpDscpSerializerTest {
+
+ OxmIpDscpSerializer serializer = new OxmIpDscpSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareIpDscpMatchEntry((short) 58);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 58, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareIpDscpHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IP_DSCP, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareIpDscpMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareIpDscpHeader(false);
+ DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();
+ dscpBuilder.setDscp(new Dscp(value));
+ builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareIpDscpHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(IpDscp.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IP_DSCP, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpProtoSerializerTest {\r
-\r
- OxmIpProtoSerializer serializer = new OxmIpProtoSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry((short) 123);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 123, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IP_PROTO, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();\r
- protoBuilder.setProtocolNumber(value);\r
- builder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(IpProto.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IP_PROTO, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpProtoSerializerTest {
+
+ OxmIpProtoSerializer serializer = new OxmIpProtoSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry((short) 123);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 123, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IP_PROTO, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();
+ protoBuilder.setProtocolNumber(value);
+ builder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(IpProto.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IP_PROTO, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4DstSerializerTest {\r
-\r
- OxmIpv4DstSerializer serializer = new OxmIpv4DstSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
- byte[] tmp = new byte[4];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_DST, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
- addressBuilder.setIpv4Address(new Ipv4Address(value));\r
- builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Ipv4Dst.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_DST, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4DstSerializerTest {
+
+ OxmIpv4DstSerializer serializer = new OxmIpv4DstSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+ byte[] tmp = new byte[4];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_DST, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+ addressBuilder.setIpv4Address(new Ipv4Address(value));
+ builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Ipv4Dst.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_DST, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4SrcSerializerTest {\r
-\r
- OxmIpv4SrcSerializer serializer = new OxmIpv4SrcSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[4];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
- byte[] tmp = new byte[4];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_SRC, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
- addressBuilder.setIpv4Address(new Ipv4Address(value));\r
- builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Ipv4Src.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_SRC, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4SrcSerializerTest {
+
+ OxmIpv4SrcSerializer serializer = new OxmIpv4SrcSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[4];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+ byte[] tmp = new byte[4];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_SRC, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+ addressBuilder.setIpv4Address(new Ipv4Address(value));
+ builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Ipv4Src.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_SRC, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrSerializerTest {\r
-\r
- OxmIpv6ExtHdrSerializer serializer = new OxmIpv6ExtHdrSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(false,\r
- new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 358, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(true,\r
- new Ipv6ExthdrFlags(false, true, false, true, false, true, false, true, false));\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertEquals("Wrong value", 153, buffer.readUnsignedShort());\r
- byte[] tmp = new byte[2];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_EXTHDR, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder prepareIpv6ExtHdrMatchEntry(boolean hasMask, Ipv6ExthdrFlags flags) {\r
- MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0, 15});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
- pseudoBuilder.setPseudoField(flags);\r
- builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareIpv6ExtHdrHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Ipv6Exthdr.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_EXTHDR, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrSerializerTest {
+
+ OxmIpv6ExtHdrSerializer serializer = new OxmIpv6ExtHdrSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(false,
+ new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 358, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(true,
+ new Ipv6ExthdrFlags(false, true, false, true, false, true, false, true, false));
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertEquals("Wrong value", 153, buffer.readUnsignedShort());
+ byte[] tmp = new byte[2];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_EXTHDR, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder prepareIpv6ExtHdrMatchEntry(boolean hasMask, Ipv6ExthdrFlags flags) {
+ MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0, 15});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();
+ pseudoBuilder.setPseudoField(flags);
+ builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareIpv6ExtHdrHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Ipv6Exthdr.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_EXTHDR, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdSllSerializerTest {\r
-\r
- OxmIpv6NdSllSerializer serializer = new OxmIpv6NdSllSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_SLL, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress(value));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Ipv6NdSll.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_SLL, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdSllSerializerTest {
+
+ OxmIpv6NdSllSerializer serializer = new OxmIpv6NdSllSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_SLL, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress(value));
+ builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Ipv6NdSll.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_SLL, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTllSerializerTest {\r
-\r
- OxmIpv6NdTllSerializer serializer = new OxmIpv6NdTllSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[6];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_TLL, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress(value));\r
- builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Ipv6NdTll.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_TLL, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTllSerializerTest {
+
+ OxmIpv6NdTllSerializer serializer = new OxmIpv6NdTllSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[6];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_TLL, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress(value));
+ builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Ipv6NdTll.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_TLL, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataSerializerTest {\r
-\r
- OxmMetadataSerializer serializer = new OxmMetadataSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[8];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[8];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);\r
- byte[] tmp = new byte[8];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.METADATA, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
- metadataBuilder.setMetadata(value);\r
- builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(Metadata.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.METADATA, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataSerializerTest {
+
+ OxmMetadataSerializer serializer = new OxmMetadataSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[8];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[8];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);
+ byte[] tmp = new byte[8];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.METADATA, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();
+ metadataBuilder.setMetadata(value);
+ builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(Metadata.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.METADATA, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosSerializerTest {\r
-\r
- OxmMplsBosSerializer serializer = new OxmMplsBosSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMplsBosMatchEntry(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 1, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareMplsBosHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_BOS, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder prepareMplsBosMatchEntry(boolean bos) {\r
- MatchEntriesBuilder builder = prepareMplsBosHeader(false);\r
- BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
- bosBuilder.setBos(bos);\r
- builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMplsBosHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(MplsBos.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_BOS, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosSerializerTest {
+
+ OxmMplsBosSerializer serializer = new OxmMplsBosSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMplsBosMatchEntry(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 1, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareMplsBosHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_BOS, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder prepareMplsBosMatchEntry(boolean bos) {
+ MatchEntriesBuilder builder = prepareMplsBosHeader(false);
+ BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();
+ bosBuilder.setBos(bos);
+ builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareMplsBosHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(MplsBos.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_BOS, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsLabelSerializerTest {\r
-\r
- OxmMplsLabelSerializer serializer = new OxmMplsLabelSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMplsLabelMatchEntry(168535);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 168535, buffer.readUnsignedInt());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareMplsLabelHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_LABEL, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMplsLabelMatchEntry(long label) {\r
- MatchEntriesBuilder builder = prepareMplsLabelHeader(false);\r
- MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();\r
- labelBuilder.setMplsLabel(label);\r
- builder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMplsLabelHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(MplsLabel.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_LABEL, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsLabelSerializerTest {
+
+ OxmMplsLabelSerializer serializer = new OxmMplsLabelSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMplsLabelMatchEntry(168535);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 168535, buffer.readUnsignedInt());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareMplsLabelHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_LABEL, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMplsLabelMatchEntry(long label) {
+ MatchEntriesBuilder builder = prepareMplsLabelHeader(false);
+ MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();
+ labelBuilder.setMplsLabel(label);
+ builder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareMplsLabelHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(MplsLabel.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_LABEL, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsTcSerializerTest {\r
-\r
- OxmMplsTcSerializer serializer = new OxmMplsTcSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMplsTcMatchEntry((short) 16);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 16, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareMplsTcHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_TC, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMplsTcMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareMplsTcHeader(false);\r
- TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
- tcBuilder.setTc(value);\r
- builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMplsTcHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(MplsTc.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_TC, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsTcSerializerTest {
+
+ OxmMplsTcSerializer serializer = new OxmMplsTcSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMplsTcMatchEntry((short) 16);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 16, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareMplsTcHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_TC, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMplsTcMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareMplsTcHeader(false);
+ TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();
+ tcBuilder.setTc(value);
+ builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareMplsTcHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(MplsTc.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_TC, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidSerializerTest {\r
-\r
- OxmPbbIsidSerializer serializer = new OxmPbbIsidSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = preparePbbIsidMatchEntry(false, 12345);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 12345, buffer.readUnsignedMedium());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = preparePbbIsidMatchEntry(true, 6789);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertEquals("Wrong value", 6789, buffer.readUnsignedMedium());\r
- byte[] tmp = new byte[3];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15, 10}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = preparePbbIsidHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = preparePbbIsidHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.PBB_ISID, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_3_BYTES, serializer.getValueLength());\r
- }\r
-\r
- \r
- private static MatchEntriesBuilder preparePbbIsidMatchEntry(boolean hasMask, long value) {\r
- MatchEntriesBuilder builder = preparePbbIsidHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0, 15, 10});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
- isidBuilder.setIsid(value);\r
- builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder preparePbbIsidHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(PbbIsid.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.PBB_ISID, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidSerializerTest {
+
+ OxmPbbIsidSerializer serializer = new OxmPbbIsidSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = preparePbbIsidMatchEntry(false, 12345);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 12345, buffer.readUnsignedMedium());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = preparePbbIsidMatchEntry(true, 6789);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertEquals("Wrong value", 6789, buffer.readUnsignedMedium());
+ byte[] tmp = new byte[3];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15, 10}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = preparePbbIsidHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = preparePbbIsidHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.PBB_ISID, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_3_BYTES, serializer.getValueLength());
+ }
+
+
+ private static MatchEntriesBuilder preparePbbIsidMatchEntry(boolean hasMask, long value) {
+ MatchEntriesBuilder builder = preparePbbIsidHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0, 15, 10});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();
+ isidBuilder.setIsid(value);
+ builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder preparePbbIsidHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(PbbIsid.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.PBB_ISID, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpDstSerializerTest {\r
-\r
- OxmSctpDstSerializer serializer = new OxmSctpDstSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(4096);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 4096, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_DST, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(value));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(SctpDst.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_DST, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpDstSerializerTest {
+
+ OxmSctpDstSerializer serializer = new OxmSctpDstSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(4096);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_DST, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(value));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(SctpDst.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_DST, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpSrcSerializerTest {\r
-\r
- OxmSctpSrcSerializer serializer = new OxmSctpSrcSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(4096);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 4096, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_SRC, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(value));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(SctpSrc.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_SRC, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpSrcSerializerTest {
+
+ OxmSctpSrcSerializer serializer = new OxmSctpSrcSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(4096);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_SRC, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(value));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(SctpSrc.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_SRC, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpDstSerializerTest {\r
-\r
- OxmTcpDstSerializer serializer = new OxmTcpDstSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(4096);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 4096, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_DST, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(value));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(TcpDst.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_DST, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpDstSerializerTest {
+
+ OxmTcpDstSerializer serializer = new OxmTcpDstSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(4096);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_DST, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(value));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(TcpDst.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_DST, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpSrcSerializerTest {\r
-\r
- OxmTcpSrcSerializer serializer = new OxmTcpSrcSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(512);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 512, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_SRC, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(value));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(TcpSrc.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_SRC, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpSrcSerializerTest {
+
+ OxmTcpSrcSerializer serializer = new OxmTcpSrcSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(512);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 512, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_SRC, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(value));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(TcpSrc.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_SRC, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTunnelIdSerializerTest {\r
-\r
- OxmTunnelIdSerializer serializer = new OxmTunnelIdSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- byte[] address = new byte[8];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithMask() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- \r
- byte[] address = new byte[8];\r
- buffer.readBytes(address);\r
- Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);\r
- byte[] tmp = new byte[8];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.TUNNEL_ID, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {\r
- MatchEntriesBuilder builder = prepareHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
- metadataBuilder.setMetadata(value);\r
- builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(TunnelId.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.TUNNEL_ID, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTunnelIdSerializerTest {
+
+ OxmTunnelIdSerializer serializer = new OxmTunnelIdSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ byte[] address = new byte[8];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithMask() {
+ MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+
+ byte[] address = new byte[8];
+ buffer.readBytes(address);
+ Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);
+ byte[] tmp = new byte[8];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.TUNNEL_ID, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
+ MatchEntriesBuilder builder = prepareHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();
+ metadataBuilder.setMetadata(value);
+ builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(TunnelId.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.TUNNEL_ID, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpDstSerializerTest {\r
-\r
- OxmUdpDstSerializer serializer = new OxmUdpDstSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(2048);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 2048, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_DST, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(value));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(UdpDst.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_DST, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpDstSerializerTest {
+
+ OxmUdpDstSerializer serializer = new OxmUdpDstSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(2048);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 2048, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_DST, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(value));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(UdpDst.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_DST, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpSrcSerializerTest {\r
-\r
- OxmUdpSrcSerializer serializer = new OxmUdpSrcSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareMatchEntry(1024);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 1024, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_SRC, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
- MatchEntriesBuilder builder = prepareHeader(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new PortNumber(value));\r
- builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(UdpSrc.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_SRC, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpSrcSerializerTest {
+
+ OxmUdpSrcSerializer serializer = new OxmUdpSrcSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareMatchEntry(1024);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 1024, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_SRC, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareMatchEntry(int value) {
+ MatchEntriesBuilder builder = prepareHeader(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new PortNumber(value));
+ builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(UdpSrc.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_SRC, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanPcpSerializerTest {\r
-\r
- OxmVlanPcpSerializer serializer = new OxmVlanPcpSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerialize() {\r
- MatchEntriesBuilder builder = prepareVlanPcpMatchEntry((short) 42);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 42, buffer.readUnsignedByte());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeader() {\r
- MatchEntriesBuilder builder = prepareVlanPcpHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_PCP, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareVlanPcpMatchEntry(short value) {\r
- MatchEntriesBuilder builder = prepareVlanPcpHeader(false);\r
- VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();\r
- pcpBuilder.setVlanPcp(value);\r
- builder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareVlanPcpHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(VlanPcp.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_PCP, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanPcpSerializerTest {
+
+ OxmVlanPcpSerializer serializer = new OxmVlanPcpSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerialize() {
+ MatchEntriesBuilder builder = prepareVlanPcpMatchEntry((short) 42);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 42, buffer.readUnsignedByte());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeader() {
+ MatchEntriesBuilder builder = prepareVlanPcpHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_PCP, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareVlanPcpMatchEntry(short value) {
+ MatchEntriesBuilder builder = prepareVlanPcpHeader(false);
+ VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();
+ pcpBuilder.setVlanPcp(value);
+ builder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareVlanPcpHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(VlanPcp.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_PCP, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidSerializerTest {\r
-\r
- OxmVlanVidSerializer serializer = new OxmVlanVidSerializer();\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithCfiBitSet() {\r
- MatchEntriesBuilder builder = prepareVlanVidMatchEntry(false, true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertEquals("Wrong value", 4596, buffer.readUnsignedShort());\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct serialization\r
- */\r
- @Test\r
- public void testSerializeWithoutCfiBitSet() {\r
- MatchEntriesBuilder builder = prepareVlanVidMatchEntry(true, false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serialize(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertEquals("Wrong value", 500, buffer.readUnsignedShort());\r
- byte[] tmp = new byte[2];\r
- buffer.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15}, tmp);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithoutMask() {\r
- MatchEntriesBuilder builder = prepareVlanVidHeader(false);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, false);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct header serialization\r
- */\r
- @Test\r
- public void testSerializeHeaderWithMask() {\r
- MatchEntriesBuilder builder = prepareVlanVidHeader(true);\r
- \r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- serializer.serializeHeader(builder.build(), buffer);\r
-\r
- checkHeader(buffer, true);\r
- assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Test correct oxm-class return value\r
- */\r
- @Test\r
- public void testGetOxmClassCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
- }\r
-\r
- /**\r
- * Test correct oxm-field return value\r
- */\r
- @Test\r
- public void getOxmFieldCode() {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_VID, serializer.getOxmFieldCode());\r
- }\r
-\r
- /**\r
- * Test correct value length return value\r
- */\r
- @Test\r
- public void testGetValueLength() {\r
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
- }\r
-\r
- private static MatchEntriesBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) {\r
- MatchEntriesBuilder builder = prepareVlanVidHeader(hasMask);\r
- if (hasMask) {\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{15, 15});\r
- builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- }\r
- VlanVidMatchEntryBuilder vlanBuilder = new VlanVidMatchEntryBuilder();\r
- vlanBuilder.setVlanVid(500);\r
- vlanBuilder.setCfiBit(cfiBit);\r
- builder.addAugmentation(VlanVidMatchEntry.class, vlanBuilder.build());\r
- return builder;\r
- }\r
-\r
- private static MatchEntriesBuilder prepareVlanVidHeader(boolean hasMask) {\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(VlanVid.class);\r
- builder.setHasMask(hasMask);\r
- return builder;\r
- }\r
-\r
- private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
- assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
- short fieldAndMask = buffer.readUnsignedByte();\r
- assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_VID, fieldAndMask >>> 1);\r
- assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
- if (hasMask) {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
- } else {\r
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\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.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidSerializerTest {
+
+ OxmVlanVidSerializer serializer = new OxmVlanVidSerializer();
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithCfiBitSet() {
+ MatchEntriesBuilder builder = prepareVlanVidMatchEntry(false, true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertEquals("Wrong value", 4596, buffer.readUnsignedShort());
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct serialization
+ */
+ @Test
+ public void testSerializeWithoutCfiBitSet() {
+ MatchEntriesBuilder builder = prepareVlanVidMatchEntry(true, false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertEquals("Wrong value", 500, buffer.readUnsignedShort());
+ byte[] tmp = new byte[2];
+ buffer.readBytes(tmp);
+ Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15}, tmp);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithoutMask() {
+ MatchEntriesBuilder builder = prepareVlanVidHeader(false);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, false);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct header serialization
+ */
+ @Test
+ public void testSerializeHeaderWithMask() {
+ MatchEntriesBuilder builder = prepareVlanVidHeader(true);
+
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serializeHeader(builder.build(), buffer);
+
+ checkHeader(buffer, true);
+ assertTrue("Unexpected data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Test correct oxm-class return value
+ */
+ @Test
+ public void testGetOxmClassCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+ }
+
+ /**
+ * Test correct oxm-field return value
+ */
+ @Test
+ public void getOxmFieldCode() {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_VID, serializer.getOxmFieldCode());
+ }
+
+ /**
+ * Test correct value length return value
+ */
+ @Test
+ public void testGetValueLength() {
+ assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ }
+
+ private static MatchEntriesBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) {
+ MatchEntriesBuilder builder = prepareVlanVidHeader(hasMask);
+ if (hasMask) {
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{15, 15});
+ builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ }
+ VlanVidMatchEntryBuilder vlanBuilder = new VlanVidMatchEntryBuilder();
+ vlanBuilder.setVlanVid(500);
+ vlanBuilder.setCfiBit(cfiBit);
+ builder.addAugmentation(VlanVidMatchEntry.class, vlanBuilder.build());
+ return builder;
+ }
+
+ private static MatchEntriesBuilder prepareVlanVidHeader(boolean hasMask) {
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(VlanVid.class);
+ builder.setHasMask(hasMask);
+ return builder;
+ }
+
+ private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+ assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+ short fieldAndMask = buffer.readUnsignedByte();
+ assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_VID, fieldAndMask >>> 1);
+ assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+ if (hasMask) {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ } else {
+ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ }
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.AbstractActionDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionsDeserializerTest {\r
-\r
- private static final Logger LOGGER = LoggerFactory\r
- .getLogger(ActionsDeserializerTest.class);\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * Initializes deserializer registry and lookups correct deserializer\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- }\r
-\r
- /**\r
- * Testing actions deserialization\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf message = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00 "\r
- + "00 0B 00 08 00 00 00 00 "\r
- + "00 0C 00 08 00 00 00 00 "\r
- + "00 0F 00 08 03 00 00 00 "\r
- + "00 10 00 08 00 00 00 00 "\r
- + "00 11 00 08 00 04 00 00 "\r
- + "00 12 00 08 00 00 00 00 "\r
- + "00 13 00 08 00 05 00 00 "\r
- + "00 14 00 08 00 06 00 00 "\r
- + "00 15 00 08 00 00 00 07 "\r
- + "00 16 00 08 00 00 00 08 "\r
- + "00 17 00 08 09 00 00 00 "\r
- + "00 18 00 08 00 00 00 00 "\r
- + "00 19 00 10 80 00 02 04 00 00 00 0B 00 00 00 00 "\r
- + "00 1A 00 08 00 0A 00 00 "\r
- + "00 1B 00 08 00 00 00 00");\r
- \r
- message.skipBytes(4); // skip XID\r
- LOGGER.info("bytes: " + message.readableBytes());\r
- \r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
- message.readableBytes(), message, keyMaker, registry);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());\r
- Assert.assertEquals("Wrong action port", 1,\r
- actions.get(0).getAugmentation(PortAction.class).getPort().getValue().intValue());\r
- Assert.assertEquals("Wrong action max-length", 2,\r
- actions.get(0).getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.CopyTtlOut", actions.get(1).getType().getName());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.CopyTtlIn", actions.get(2).getType().getName());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.SetMplsTtl", actions.get(3).getType().getName());\r
- Assert.assertEquals("Wrong action value", 3,\r
- actions.get(3).getAugmentation(MplsTtlAction.class).getMplsTtl().shortValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.DecMplsTtl", actions.get(4).getType().getName());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.PushVlan", actions.get(5).getType().getName());\r
- Assert.assertEquals("Wrong action value", 4,\r
- actions.get(5).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.PopVlan", actions.get(6).getType().getName());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.PushMpls", actions.get(7).getType().getName());\r
- Assert.assertEquals("Wrong action value", 5,\r
- actions.get(7).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.PopMpls", actions.get(8).getType().getName());\r
- Assert.assertEquals("Wrong action value", 6,\r
- actions.get(8).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.SetQueue", actions.get(9).getType().getName());\r
- Assert.assertEquals("Wrong action value", 7,\r
- actions.get(9).getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.Group", actions.get(10).getType().getName());\r
- Assert.assertEquals("Wrong action value", 8,\r
- actions.get(10).getAugmentation(GroupIdAction.class).getGroupId().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.SetNwTtl", actions.get(11).getType().getName());\r
- Assert.assertEquals("Wrong action value", 9,\r
- actions.get(11).getAugmentation(NwTtlAction.class).getNwTtl().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.DecNwTtl", actions.get(12).getType().getName());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.SetField", actions.get(13).getType().getName());\r
- List<MatchEntries> entries = actions.get(13).getAugmentation(OxmFieldsAction.class).getMatchEntries();\r
- Assert.assertEquals("Wrong number of fields", 1, entries.size());\r
- Assert.assertEquals("Wrong match entry class", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."\r
- + "oxm.rev130731.OpenflowBasicClass", entries.get(0).getOxmClass().getName());\r
- Assert.assertEquals("Wrong match entry field", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."\r
- + "oxm.rev130731.InPhyPort", entries.get(0).getOxmMatchField().getName());\r
- Assert.assertEquals("Wrong match entry mask", false, entries.get(0).isHasMask());\r
- Assert.assertEquals("Wrong match entry value", 11, \r
- entries.get(0).getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.PushPbb", actions.get(14).getType().getName());\r
- Assert.assertEquals("Wrong action value", 10,\r
- actions.get(14).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.PopPbb", actions.get(15).getType().getName());\r
- Assert.assertTrue("Unread data in message", message.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Tests {@link AbstractActionDeserializer#deserializeHeader(ByteBuf)}\r
- */\r
- @Test\r
- public void testDeserializeHeader() {\r
- ByteBuf message = BufferHelper.buildBuffer("00 00 00 04 00 19 00 04");\r
-\r
- message.skipBytes(4); // skip XID\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- List<Action> actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,\r
- message.readableBytes(), message, keyMaker, registry);\r
-\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());\r
- Assert.assertEquals("Wrong action port", null, actions.get(0).getAugmentation(PortAction.class));\r
- Assert.assertEquals("Wrong action max-length", null, actions.get(0).getAugmentation(MaxLengthAction.class));\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "openflow.common.action.rev130731.SetField", actions.get(1).getType().getName());\r
- Assert.assertEquals("Wrong action oxm field", null, actions.get(1).getAugmentation(OxmFieldsAction.class));\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.AbstractActionDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionsDeserializerTest {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(ActionsDeserializerTest.class);
+ private DeserializerRegistry registry;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ registry = new DeserializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing actions deserialization
+ */
+ @Test
+ public void test() {
+ ByteBuf message = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00 "
+ + "00 0B 00 08 00 00 00 00 "
+ + "00 0C 00 08 00 00 00 00 "
+ + "00 0F 00 08 03 00 00 00 "
+ + "00 10 00 08 00 00 00 00 "
+ + "00 11 00 08 00 04 00 00 "
+ + "00 12 00 08 00 00 00 00 "
+ + "00 13 00 08 00 05 00 00 "
+ + "00 14 00 08 00 06 00 00 "
+ + "00 15 00 08 00 00 00 07 "
+ + "00 16 00 08 00 00 00 08 "
+ + "00 17 00 08 09 00 00 00 "
+ + "00 18 00 08 00 00 00 00 "
+ + "00 19 00 10 80 00 02 04 00 00 00 0B 00 00 00 00 "
+ + "00 1A 00 08 00 0A 00 00 "
+ + "00 1B 00 08 00 00 00 00");
+
+ message.skipBytes(4); // skip XID
+ LOGGER.info("bytes: " + message.readableBytes());
+
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
+ message.readableBytes(), message, keyMaker, registry);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());
+ Assert.assertEquals("Wrong action port", 1,
+ actions.get(0).getAugmentation(PortAction.class).getPort().getValue().intValue());
+ Assert.assertEquals("Wrong action max-length", 2,
+ actions.get(0).getAugmentation(MaxLengthAction.class).getMaxLength().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.CopyTtlOut", actions.get(1).getType().getName());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.CopyTtlIn", actions.get(2).getType().getName());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.SetMplsTtl", actions.get(3).getType().getName());
+ Assert.assertEquals("Wrong action value", 3,
+ actions.get(3).getAugmentation(MplsTtlAction.class).getMplsTtl().shortValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.DecMplsTtl", actions.get(4).getType().getName());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.PushVlan", actions.get(5).getType().getName());
+ Assert.assertEquals("Wrong action value", 4,
+ actions.get(5).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.PopVlan", actions.get(6).getType().getName());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.PushMpls", actions.get(7).getType().getName());
+ Assert.assertEquals("Wrong action value", 5,
+ actions.get(7).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.PopMpls", actions.get(8).getType().getName());
+ Assert.assertEquals("Wrong action value", 6,
+ actions.get(8).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.SetQueue", actions.get(9).getType().getName());
+ Assert.assertEquals("Wrong action value", 7,
+ actions.get(9).getAugmentation(QueueIdAction.class).getQueueId().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.Group", actions.get(10).getType().getName());
+ Assert.assertEquals("Wrong action value", 8,
+ actions.get(10).getAugmentation(GroupIdAction.class).getGroupId().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.SetNwTtl", actions.get(11).getType().getName());
+ Assert.assertEquals("Wrong action value", 9,
+ actions.get(11).getAugmentation(NwTtlAction.class).getNwTtl().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.DecNwTtl", actions.get(12).getType().getName());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.SetField", actions.get(13).getType().getName());
+ List<MatchEntries> entries = actions.get(13).getAugmentation(OxmFieldsAction.class).getMatchEntries();
+ Assert.assertEquals("Wrong number of fields", 1, entries.size());
+ Assert.assertEquals("Wrong match entry class", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."
+ + "oxm.rev130731.OpenflowBasicClass", entries.get(0).getOxmClass().getName());
+ Assert.assertEquals("Wrong match entry field", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."
+ + "oxm.rev130731.InPhyPort", entries.get(0).getOxmMatchField().getName());
+ Assert.assertEquals("Wrong match entry mask", false, entries.get(0).isHasMask());
+ Assert.assertEquals("Wrong match entry value", 11,
+ entries.get(0).getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.PushPbb", actions.get(14).getType().getName());
+ Assert.assertEquals("Wrong action value", 10,
+ actions.get(14).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.PopPbb", actions.get(15).getType().getName());
+ Assert.assertTrue("Unread data in message", message.readableBytes() == 0);
+ }
+
+ /**
+ * Tests {@link AbstractActionDeserializer#deserializeHeader(ByteBuf)}
+ */
+ @Test
+ public void testDeserializeHeader() {
+ ByteBuf message = BufferHelper.buildBuffer("00 00 00 04 00 19 00 04");
+
+ message.skipBytes(4); // skip XID
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ List<Action> actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,
+ message.readableBytes(), message, keyMaker, registry);
+
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());
+ Assert.assertEquals("Wrong action port", null, actions.get(0).getAugmentation(PortAction.class));
+ Assert.assertEquals("Wrong action max-length", null, actions.get(0).getAugmentation(MaxLengthAction.class));
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+ + "openflow.common.action.rev130731.SetField", actions.get(1).getType().getName());
+ Assert.assertEquals("Wrong action oxm field", null, actions.get(1).getAugmentation(OxmFieldsAction.class));
+ }
+}
-/*\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.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class CodeKeyMakerFactoryTest {\r
-\r
- /**\r
- * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
- */\r
- @Test\r
- public void testMatchEntriesKeyMaker() {\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
- ByteBuf buffer = BufferHelper.buildBuffer("80 00 00 04 00 00 00 01");\r
- buffer.skipBytes(4); // skip XID\r
- MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
- Assert.assertNotNull("Null key", codeKey);\r
- Assert.assertEquals("Wrong key", new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 32768, 0), codeKey);\r
- Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
- */\r
- @Test\r
- public void testExperimenterMatchEntriesKeyMaker() {\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
- ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 04 00 00 00 01");\r
- buffer.skipBytes(4); // skip XID\r
- MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
- Assert.assertNotNull("Null key", codeKey);\r
- MatchEntryDeserializerKey comparationKey = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0);\r
- comparationKey.setExperimenterId(1L);\r
- Assert.assertEquals("Wrong key", comparationKey, codeKey);\r
- Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}\r
- */\r
- @Test\r
- public void testActionKeyMaker() {\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
- ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00");\r
- buffer.skipBytes(4); // skip XID\r
- MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
- Assert.assertNotNull("Null key", codeKey);\r
- Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 0, null), codeKey);\r
- Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}\r
- */\r
- @Test\r
- public void testExperimenterActionKeyMaker() {\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
- ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");\r
- buffer.skipBytes(4); // skip XID\r
- MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
- Assert.assertNotNull("Null key", codeKey);\r
- Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 65535, 1L), codeKey);\r
- Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}\r
- */\r
- @Test\r
- public void testInstructionKeyMaker() {\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
- ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 08");\r
- buffer.skipBytes(4); // skip XID\r
- MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
- Assert.assertNotNull("Null key", codeKey);\r
- Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 0, null), codeKey);\r
- Assert.assertEquals("Buffer index modified", 4, buffer.readableBytes());\r
- }\r
-\r
- /**\r
- * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}\r
- */\r
- @Test\r
- public void testExperimenterInstructionKeyMaker() {\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
- ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");\r
- buffer.skipBytes(4); // skip XID\r
- MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
- Assert.assertNotNull("Null key", codeKey);\r
- Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 65535, 1L), codeKey);\r
- Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class CodeKeyMakerFactoryTest {
+
+ /**
+ * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ */
+ @Test
+ public void testMatchEntriesKeyMaker() {
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null key maker", keyMaker);
+
+ ByteBuf buffer = BufferHelper.buildBuffer("80 00 00 04 00 00 00 01");
+ buffer.skipBytes(4); // skip XID
+ MessageCodeKey codeKey = keyMaker.make(buffer);
+
+ Assert.assertNotNull("Null key", codeKey);
+ Assert.assertEquals("Wrong key", new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 32768, 0), codeKey);
+ Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+ }
+
+ /**
+ * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ */
+ @Test
+ public void testExperimenterMatchEntriesKeyMaker() {
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null key maker", keyMaker);
+
+ ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 04 00 00 00 01");
+ buffer.skipBytes(4); // skip XID
+ MessageCodeKey codeKey = keyMaker.make(buffer);
+
+ Assert.assertNotNull("Null key", codeKey);
+ MatchEntryDeserializerKey comparationKey = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0);
+ comparationKey.setExperimenterId(1L);
+ Assert.assertEquals("Wrong key", comparationKey, codeKey);
+ Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+ }
+
+ /**
+ * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}
+ */
+ @Test
+ public void testActionKeyMaker() {
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null key maker", keyMaker);
+
+ ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00");
+ buffer.skipBytes(4); // skip XID
+ MessageCodeKey codeKey = keyMaker.make(buffer);
+
+ Assert.assertNotNull("Null key", codeKey);
+ Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 0, null), codeKey);
+ Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());
+ }
+
+ /**
+ * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}
+ */
+ @Test
+ public void testExperimenterActionKeyMaker() {
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null key maker", keyMaker);
+
+ ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");
+ buffer.skipBytes(4); // skip XID
+ MessageCodeKey codeKey = keyMaker.make(buffer);
+
+ Assert.assertNotNull("Null key", codeKey);
+ Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 65535, 1L), codeKey);
+ Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+ }
+
+ /**
+ * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}
+ */
+ @Test
+ public void testInstructionKeyMaker() {
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null key maker", keyMaker);
+
+ ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 08");
+ buffer.skipBytes(4); // skip XID
+ MessageCodeKey codeKey = keyMaker.make(buffer);
+
+ Assert.assertNotNull("Null key", codeKey);
+ Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 0, null), codeKey);
+ Assert.assertEquals("Buffer index modified", 4, buffer.readableBytes());
+ }
+
+ /**
+ * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}
+ */
+ @Test
+ public void testExperimenterInstructionKeyMaker() {
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null key maker", keyMaker);
+
+ ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");
+ buffer.skipBytes(4); // skip XID
+ MessageCodeKey codeKey = keyMaker.make(buffer);
+
+ Assert.assertNotNull("Null key", codeKey);
+ Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 65535, 1L), codeKey);
+ Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionsDeserializerTest {\r
-\r
-\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * Initializes deserializer registry and lookups correct deserializer\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- }\r
-\r
- /**\r
- * Testing instructions translation\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf message = BufferHelper.buildBuffer("00 01 00 08 0A 00 00 00 00 02 00 18 00 00 00 00 "\r
- + "00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 30 00 05 00 08 00 00 00 00 00 06 00 08 "\r
- + "00 01 02 03 00 03 00 20 00 00 00 00 00 00 00 10 00 00 00 25 00 35 00 00 00 00 00 00 "\r
- + "00 16 00 08 00 00 00 50 00 04 00 18 00 00 00 00 00 15 00 08 00 00 00 25 00 0F 00 08 05 00 00 00");\r
- \r
- message.skipBytes(4); // skip XID\r
- \r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- List<Instruction> instructions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
- message.readableBytes(), message, keyMaker, registry);\r
- Instruction i1 = instructions.get(0);\r
- Assert.assertEquals("Wrong type - i1", "org.opendaylight.yang.gen.v1.urn."\r
- + "opendaylight.openflow.common.instruction.rev130731.GotoTable", i1.getType().getName());\r
- Assert.assertEquals("Wrong table-id - i1", 10, i1.getAugmentation(TableIdInstruction.class).getTableId().intValue());\r
- Instruction i2 = instructions.get(1);\r
- Assert.assertEquals("Wrong type - i2", "org.opendaylight.yang.gen.v1.urn."\r
- + "opendaylight.openflow.common.instruction.rev130731.WriteMetadata", i2.getType().getName());\r
- Assert.assertArrayEquals("Wrong metadata - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 20"),\r
- i2.getAugmentation(MetadataInstruction.class).getMetadata());\r
- Assert.assertArrayEquals("Wrong metadata-mask - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 30"),\r
- i2.getAugmentation(MetadataInstruction.class).getMetadataMask());\r
- Instruction i3 = instructions.get(2);\r
- Assert.assertEquals("Wrong type - i3", "org.opendaylight.yang.gen.v1.urn."\r
- + "opendaylight.openflow.common.instruction.rev130731.ClearActions", i3.getType().getName());\r
- Assert.assertEquals("Wrong instructions - i3", 0, i3.getAugmentation(ActionsInstruction.class).getAction().size());\r
- Instruction i4 = instructions.get(3);\r
- Assert.assertEquals("Wrong type - i4", "org.opendaylight.yang.gen.v1.urn."\r
- + "opendaylight.openflow.common.instruction.rev130731.Meter", i4.getType().getName());\r
- Assert.assertEquals("Wrong meterId - i4", 66051, i4.getAugmentation(MeterIdInstruction.class).getMeterId().intValue());\r
- Instruction i5 = instructions.get(4);\r
- Assert.assertEquals("Wrong type - i5", "org.opendaylight.yang.gen.v1.urn."\r
- + "opendaylight.openflow.common.instruction.rev130731.WriteActions", i5.getType().getName());\r
- Assert.assertEquals("Wrong instructions - i5", 2, i5.getAugmentation(ActionsInstruction.class).getAction().size());\r
- Action action1 = i5.getAugmentation(ActionsInstruction.class).getAction().get(0);\r
- Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output",\r
- action1.getType().getName());\r
- Assert.assertEquals("Wrong action", 37, action1.getAugmentation(PortAction.class).getPort().getValue().intValue());\r
- Assert.assertEquals("Wrong action", 53, action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
- Action action2 = i5.getAugmentation(ActionsInstruction.class).getAction().get(1);\r
- Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group",\r
- action2.getType().getName());\r
- Assert.assertEquals("Wrong action", 80, action2.getAugmentation(GroupIdAction.class).getGroupId().intValue());\r
- Instruction i6 = instructions.get(5);\r
- Assert.assertEquals("Wrong type - i6", "org.opendaylight.yang.gen.v1.urn."\r
- + "opendaylight.openflow.common.instruction.rev130731.ApplyActions", i6.getType().getName());\r
- Assert.assertEquals("Wrong instructions - i6", 2, i6.getAugmentation(ActionsInstruction.class).getAction().size());\r
- action1 = i6.getAugmentation(ActionsInstruction.class).getAction().get(0);\r
- Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue",\r
- action1.getType().getName());\r
- Assert.assertEquals("Wrong action", 37, action1.getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
- action2 = i6.getAugmentation(ActionsInstruction.class).getAction().get(1);\r
- Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl",\r
- action2.getType().getName());\r
- Assert.assertEquals("Wrong action", 5, action2.getAugmentation(MplsTtlAction.class).getMplsTtl().intValue());\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionsDeserializerTest {
+
+
+ private DeserializerRegistry registry;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ registry = new DeserializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing instructions translation
+ */
+ @Test
+ public void test() {
+ ByteBuf message = BufferHelper.buildBuffer("00 01 00 08 0A 00 00 00 00 02 00 18 00 00 00 00 "
+ + "00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 30 00 05 00 08 00 00 00 00 00 06 00 08 "
+ + "00 01 02 03 00 03 00 20 00 00 00 00 00 00 00 10 00 00 00 25 00 35 00 00 00 00 00 00 "
+ + "00 16 00 08 00 00 00 50 00 04 00 18 00 00 00 00 00 15 00 08 00 00 00 25 00 0F 00 08 05 00 00 00");
+
+ message.skipBytes(4); // skip XID
+
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ List<Instruction> instructions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
+ message.readableBytes(), message, keyMaker, registry);
+ Instruction i1 = instructions.get(0);
+ Assert.assertEquals("Wrong type - i1", "org.opendaylight.yang.gen.v1.urn."
+ + "opendaylight.openflow.common.instruction.rev130731.GotoTable", i1.getType().getName());
+ Assert.assertEquals("Wrong table-id - i1", 10, i1.getAugmentation(TableIdInstruction.class).getTableId().intValue());
+ Instruction i2 = instructions.get(1);
+ Assert.assertEquals("Wrong type - i2", "org.opendaylight.yang.gen.v1.urn."
+ + "opendaylight.openflow.common.instruction.rev130731.WriteMetadata", i2.getType().getName());
+ Assert.assertArrayEquals("Wrong metadata - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 20"),
+ i2.getAugmentation(MetadataInstruction.class).getMetadata());
+ Assert.assertArrayEquals("Wrong metadata-mask - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 30"),
+ i2.getAugmentation(MetadataInstruction.class).getMetadataMask());
+ Instruction i3 = instructions.get(2);
+ Assert.assertEquals("Wrong type - i3", "org.opendaylight.yang.gen.v1.urn."
+ + "opendaylight.openflow.common.instruction.rev130731.ClearActions", i3.getType().getName());
+ Assert.assertEquals("Wrong instructions - i3", 0, i3.getAugmentation(ActionsInstruction.class).getAction().size());
+ Instruction i4 = instructions.get(3);
+ Assert.assertEquals("Wrong type - i4", "org.opendaylight.yang.gen.v1.urn."
+ + "opendaylight.openflow.common.instruction.rev130731.Meter", i4.getType().getName());
+ Assert.assertEquals("Wrong meterId - i4", 66051, i4.getAugmentation(MeterIdInstruction.class).getMeterId().intValue());
+ Instruction i5 = instructions.get(4);
+ Assert.assertEquals("Wrong type - i5", "org.opendaylight.yang.gen.v1.urn."
+ + "opendaylight.openflow.common.instruction.rev130731.WriteActions", i5.getType().getName());
+ Assert.assertEquals("Wrong instructions - i5", 2, i5.getAugmentation(ActionsInstruction.class).getAction().size());
+ Action action1 = i5.getAugmentation(ActionsInstruction.class).getAction().get(0);
+ Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output",
+ action1.getType().getName());
+ Assert.assertEquals("Wrong action", 37, action1.getAugmentation(PortAction.class).getPort().getValue().intValue());
+ Assert.assertEquals("Wrong action", 53, action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());
+ Action action2 = i5.getAugmentation(ActionsInstruction.class).getAction().get(1);
+ Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group",
+ action2.getType().getName());
+ Assert.assertEquals("Wrong action", 80, action2.getAugmentation(GroupIdAction.class).getGroupId().intValue());
+ Instruction i6 = instructions.get(5);
+ Assert.assertEquals("Wrong type - i6", "org.opendaylight.yang.gen.v1.urn."
+ + "opendaylight.openflow.common.instruction.rev130731.ApplyActions", i6.getType().getName());
+ Assert.assertEquals("Wrong instructions - i6", 2, i6.getAugmentation(ActionsInstruction.class).getAction().size());
+ action1 = i6.getAugmentation(ActionsInstruction.class).getAction().get(0);
+ Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue",
+ action1.getType().getName());
+ Assert.assertEquals("Wrong action", 37, action1.getAugmentation(QueueIdAction.class).getQueueId().intValue());
+ action2 = i6.getAugmentation(ActionsInstruction.class).getAction().get(1);
+ Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl",
+ action2.getType().getName());
+ Assert.assertEquals("Wrong action", 5, action2.getAugmentation(MplsTtlAction.class).getMplsTtl().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.openflowjava.protocol.impl.util;\r
-\r
-import java.util.List;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class ListDeserializerTest {\r
-\r
- @Mock CodeKeyMaker keyMaker;\r
- @Mock DeserializerRegistry registry;\r
-\r
- /**\r
- * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- List<DataObject> list = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
- 42, buffer, keyMaker, registry);\r
-\r
- Assert.assertNull("List is not null", list);\r
- }\r
-\r
- /**\r
- * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}\r
- */\r
- @Test\r
- public void test2() {\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- List<DataObject> list = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,\r
- 42, buffer, keyMaker, registry);\r
-\r
- Assert.assertNull("List is not null", list);\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.openflowjava.protocol.impl.util;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ListDeserializerTest {
+
+ @Mock CodeKeyMaker keyMaker;
+ @Mock DeserializerRegistry registry;
+
+ /**
+ * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ List<DataObject> list = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
+ 42, buffer, keyMaker, registry);
+
+ Assert.assertNull("List is not null", list);
+ }
+
+ /**
+ * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}
+ */
+ @Test
+ public void test2() {
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ List<DataObject> list = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,
+ 42, buffer, keyMaker, registry);
+
+ Assert.assertNull("List is not null", list);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class ListSerializerTest {\r
-\r
- @Mock TypeKeyMaker<Action> keyMaker;\r
- @Mock SerializerRegistry registry;\r
-\r
- /**\r
- * Tests {@link ListSerializer#serializeHeaderList(List, TypeKeyMaker, SerializerRegistry, ByteBuf)}\r
- * with null List\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
- ListSerializer.serializeHeaderList(null, keyMaker, registry, buffer);\r
-\r
- Assert.assertEquals("Data written to buffer", 0, buffer.readableBytes());\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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ListSerializerTest {
+
+ @Mock TypeKeyMaker<Action> keyMaker;
+ @Mock SerializerRegistry registry;
+
+ /**
+ * Tests {@link ListSerializer#serializeHeaderList(List, TypeKeyMaker, SerializerRegistry, ByteBuf)}
+ * with null List
+ */
+ @Test
+ public void test() {
+ ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ ListSerializer.serializeHeaderList(null, keyMaker, registry, buffer);
+
+ Assert.assertEquals("Data written to buffer", 0, buffer.readableBytes());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchDeserializerTest {\r
-\r
- private OFDeserializer<Match> matchDeserializer;\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * Initializes deserializer registry and lookups correct deserializer\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- matchDeserializer = registry.getDeserializer(\r
- new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,\r
- EncodeConstants.EMPTY_VALUE, Match.class));\r
- }\r
-\r
- /**\r
- * Testing Ipv4 address deserialization\r
- */\r
- @Test\r
- public void testIpv4Address() {\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");\r
-\r
- MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 0x8000, 12);\r
- key.setExperimenterId(null);\r
- OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);\r
- MatchEntries entry = entryDeserializer.deserialize(buffer);\r
- Assert.assertEquals("Wrong Ipv4 address format", new Ipv4Address("0.1.2.3"),\r
- entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
- }\r
- \r
- /**\r
- * Testing Ipv6 address deserialization\r
- */\r
- @Test\r
- public void testIpv6Address() {\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 34 10 00 00 00 01 00 02 00 03 00 04 00 05 00 06 0F 07");\r
- \r
- MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 0x8000, 26);\r
- key.setExperimenterId(null);\r
- OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);\r
- MatchEntries entry = entryDeserializer.deserialize(buffer);\r
- Assert.assertEquals("Wrong Ipv6 address format", new Ipv6Address("0000:0001:0002:0003:0004:0005:0006:0F07"),\r
- entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
- }\r
- \r
- /**\r
- * Testing match deserialization\r
- */\r
- @Test\r
- public void testMatch() {\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 01 AC "\r
- + "80 00 00 04 00 00 00 01 "\r
- + "80 00 02 04 00 00 00 02 "\r
- + "80 00 05 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 04 "\r
- + "80 00 07 0C 00 00 00 00 00 05 00 00 00 00 00 06 "\r
- + "80 00 09 0C 00 00 00 00 00 07 00 00 00 00 00 08 "\r
- + "80 00 0A 02 00 09 "\r
- + "80 00 0D 04 00 0A 00 0B "\r
- + "80 00 0E 01 0C "\r
- + "80 00 10 01 0D "\r
- + "80 00 12 01 0E "\r
- + "80 00 14 01 0F "\r
- + "80 00 17 08 0A 00 00 01 00 00 FF 00 "\r
- + "80 00 19 08 0A 00 00 02 00 00 00 FF "\r
- + "80 00 1A 02 00 03 "\r
- + "80 00 1C 02 00 04 "\r
- + "80 00 1E 02 00 05 "\r
- + "80 00 20 02 00 06 "\r
- + "80 00 22 02 00 07 "\r
- + "80 00 24 02 00 08 "\r
- + "80 00 26 01 05 "\r
- + "80 00 28 01 07 "\r
- + "80 00 2A 02 00 10 "\r
- + "80 00 2D 08 0A 00 00 09 00 00 FF 00 "\r
- + "80 00 2F 08 0A 00 00 0A 00 00 00 FF "\r
- + "80 00 31 0C 00 00 00 00 00 01 00 00 00 00 00 03 "\r
- + "80 00 33 0C 00 00 00 00 00 02 00 00 00 00 00 04 "\r
- + "80 00 35 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 "\r
- + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 "\r
- + "80 00 37 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 "\r
- + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 "\r
- + "80 00 39 08 00 00 00 02 00 00 00 03 "\r
- + "80 00 3A 01 15 "\r
- + "80 00 3C 01 17 "\r
- + "80 00 3E 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 " //ipv6ndtarget\r
- + "80 00 40 06 00 05 00 00 00 01 "\r
- + "80 00 42 06 00 05 00 00 00 02 "\r
- + "80 00 44 04 00 00 02 03 "\r
- + "80 00 46 01 03 "\r
- + "80 00 48 01 01 "\r
- + "80 00 4B 06 00 00 02 00 00 01 "\r
- + "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF "\r
- + "80 00 4F 04 00 00 03 04 "\r
- + "00 00 00 00");\r
-\r
- Match match = matchDeserializer.deserialize(buffer);\r
- Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());\r
- Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntries().size());\r
- List<MatchEntries> entries = match.getMatchEntries();\r
- MatchEntries entry0 = entries.get(0);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry0.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", InPort.class, entry0.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry0.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 1,\r
- entry0.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
- MatchEntries entry1 = entries.get(1);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry1.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", InPhyPort.class, entry1.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry1.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 2,\r
- entry1.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
- MatchEntries entry2 = entries.get(2);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry2.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Metadata.class, entry2.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry2.isHasMask());\r
- Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), \r
- entry2.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 04"), \r
- entry2.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry3 = entries.get(3);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry3.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", EthDst.class, entry3.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry3.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:05"), \r
- entry3.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 06"), \r
- entry3.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry4 = entries.get(4);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry4.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", EthSrc.class, entry4.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry4.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:07"), \r
- entry4.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 08"), \r
- entry4.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry5 = entries.get(5);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry5.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", EthType.class, entry5.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry5.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 9,\r
- entry5.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().intValue());\r
- MatchEntries entry6 = entries.get(6);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry6.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", VlanVid.class, entry6.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry6.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 10,\r
- entry6.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());\r
- Assert.assertEquals("Wrong entry value", false, \r
- entry6.getAugmentation(VlanVidMatchEntry.class).isCfiBit());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 0B"), \r
- entry6.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry7 = entries.get(7);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry7.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", VlanPcp.class, entry7.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry7.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 12,\r
- entry7.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().intValue());\r
- MatchEntries entry8 = entries.get(8);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry8.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", IpDscp.class, entry8.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry8.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 13,\r
- entry8.getAugmentation(DscpMatchEntry.class).getDscp().getValue().intValue());\r
- MatchEntries entry9 = entries.get(9);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry9.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", IpEcn.class, entry9.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry9.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 14,\r
- entry9.getAugmentation(EcnMatchEntry.class).getEcn().intValue());\r
- MatchEntries entry10 = entries.get(10);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry10.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", IpProto.class, entry10.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry10.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 15,\r
- entry10.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber().intValue());\r
- MatchEntries entry11 = entries.get(11);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry11.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv4Src.class, entry11.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry11.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.1"),\r
- entry11.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), \r
- entry11.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry12 = entries.get(12);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry12.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry12.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry12.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.2"),\r
- entry12.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), \r
- entry12.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry13 = entries.get(13);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry13.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", TcpSrc.class, entry13.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry13.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 3,\r
- entry13.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- MatchEntries entry14 = entries.get(14);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry14.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", TcpDst.class, entry14.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry14.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 4,\r
- entry14.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- MatchEntries entry15 = entries.get(15);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry15.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", UdpSrc.class, entry15.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry15.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 5,\r
- entry15.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- MatchEntries entry16 = entries.get(16);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry16.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", UdpDst.class, entry16.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry16.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 6,\r
- entry16.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- MatchEntries entry17 = entries.get(17);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry17.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", SctpSrc.class, entry17.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry17.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 7,\r
- entry17.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- MatchEntries entry18 = entries.get(18);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry18.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", SctpDst.class, entry18.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry18.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 8,\r
- entry18.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
- MatchEntries entry19 = entries.get(19);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry19.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Icmpv4Type.class, entry19.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry19.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 5,\r
- entry19.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type().intValue());\r
- MatchEntries entry20 = entries.get(20);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry20.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Icmpv4Code.class, entry20.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry20.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 7,\r
- entry20.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code().intValue());\r
- MatchEntries entry21 = entries.get(21);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry21.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", ArpOp.class, entry21.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry21.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 16,\r
- entry21.getAugmentation(OpCodeMatchEntry.class).getOpCode().intValue());\r
- MatchEntries entry22 = entries.get(22);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry22.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", ArpSpa.class, entry22.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry22.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.9"),\r
- entry22.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), \r
- entry22.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry23 = entries.get(23);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry23.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", ArpTpa.class, entry23.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry23.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.10"),\r
- entry23.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), \r
- entry23.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry24 = entries.get(24);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry24.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", ArpSha.class, entry24.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry24.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:01"), \r
- entry24.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 03"), \r
- entry24.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry25 = entries.get(25);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry25.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", ArpTha.class, entry25.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry25.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:02"), \r
- entry25.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 04"), \r
- entry25.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry26 = entries.get(26);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry26.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6Src.class, entry26.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry26.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0015"), \r
- entry26.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
- Assert.assertArrayEquals("Wrong entry mask",\r
- ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16"), \r
- entry26.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry27 = entries.get(27);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry27.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6Dst.class, entry27.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry27.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0017"), \r
- entry27.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
- Assert.assertArrayEquals("Wrong entry mask",\r
- ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18"), \r
- entry27.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry28 = entries.get(28);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry28.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry28.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry28.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 2, \r
- entry28.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 03"),\r
- entry28.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry29 = entries.get(29);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry29.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Icmpv6Type.class, entry29.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry29.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 21, \r
- entry29.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type().intValue());\r
- MatchEntries entry30 = entries.get(30);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry30.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Icmpv6Code.class, entry30.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry30.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 23, \r
- entry30.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code().intValue());\r
- MatchEntries entry31 = entries.get(31);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry31.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6NdTarget.class, entry31.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry31.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0020"), \r
- entry31.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
- MatchEntries entry32 = entries.get(32);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry32.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6NdSll.class, entry32.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry32.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:01"), \r
- entry32.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
- MatchEntries entry33 = entries.get(33);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry33.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6NdTll.class, entry33.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry33.isHasMask());\r
- Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:02"),\r
- entry33.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
- MatchEntries entry34 = entries.get(34);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry34.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", MplsLabel.class, entry34.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry34.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 515,\r
- entry34.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());\r
- MatchEntries entry35 = entries.get(35);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry35.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", MplsTc.class, entry35.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry35.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 3,\r
- entry35.getAugmentation(TcMatchEntry.class).getTc().intValue());\r
- MatchEntries entry36 = entries.get(36);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry36.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", MplsBos.class, entry36.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry36.isHasMask());\r
- Assert.assertEquals("Wrong entry value", true,\r
- entry36.getAugmentation(BosMatchEntry.class).isBos());\r
- MatchEntries entry37 = entries.get(37);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry37.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", PbbIsid.class, entry37.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry37.isHasMask());\r
- Assert.assertEquals("Wrong entry value", 2,\r
- entry37.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 01"),\r
- entry37.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry38 = entries.get(38);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry38.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", TunnelId.class, entry38.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry38.isHasMask());\r
- Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 07"),\r
- entry38.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 FF"),\r
- entry38.getAugmentation(MaskMatchEntry.class).getMask());\r
- MatchEntries entry39 = entries.get(39);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry39.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry39.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", true, entry39.isHasMask());\r
- Assert.assertEquals("Wrong entry value",\r
- new Ipv6ExthdrFlags(false, false, false, false, false, false, false, false, false),\r
- entry39.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());\r
- Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("03 04"),\r
- entry39.getAugmentation(MaskMatchEntry.class).getMask());\r
- Assert.assertTrue("Unread data", buffer.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Testing header deserialization\r
- */\r
- @Test\r
- public void testHeaders() {\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");\r
-\r
- MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 0x8000, 12);\r
- key.setExperimenterId(null);\r
- HeaderDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);\r
- MatchEntries entry = entryDeserializer.deserializeHeader(buffer);\r
- Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
- Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry.getOxmMatchField());\r
- Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
- Assert.assertEquals("Wrong Ipv4 address", null, entry.getAugmentation(Ipv4AddressMatchEntry.class));\r
- }\r
-\r
- /**\r
- * Testing standard match type\r
- */\r
- @Test\r
- public void testStandardMatch() {\r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 10 80 00 04 08 00 00 00 00 00 00 00 01");\r
-\r
- Match match = matchDeserializer.deserialize(buffer);\r
-\r
- Assert.assertEquals("Wrong match type", StandardMatchType.class, match.getType());\r
- Assert.assertEquals("Wrong match entries size", 1, match.getMatchEntries().size());\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchDeserializerTest {
+
+ private OFDeserializer<Match> matchDeserializer;
+ private DeserializerRegistry registry;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ registry = new DeserializerRegistryImpl();
+ registry.init();
+ matchDeserializer = registry.getDeserializer(
+ new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,
+ EncodeConstants.EMPTY_VALUE, Match.class));
+ }
+
+ /**
+ * Testing Ipv4 address deserialization
+ */
+ @Test
+ public void testIpv4Address() {
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");
+
+ MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 0x8000, 12);
+ key.setExperimenterId(null);
+ OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);
+ MatchEntries entry = entryDeserializer.deserialize(buffer);
+ Assert.assertEquals("Wrong Ipv4 address format", new Ipv4Address("0.1.2.3"),
+ entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+ }
+
+ /**
+ * Testing Ipv6 address deserialization
+ */
+ @Test
+ public void testIpv6Address() {
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 34 10 00 00 00 01 00 02 00 03 00 04 00 05 00 06 0F 07");
+
+ MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 0x8000, 26);
+ key.setExperimenterId(null);
+ OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);
+ MatchEntries entry = entryDeserializer.deserialize(buffer);
+ Assert.assertEquals("Wrong Ipv6 address format", new Ipv6Address("0000:0001:0002:0003:0004:0005:0006:0F07"),
+ entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+ }
+
+ /**
+ * Testing match deserialization
+ */
+ @Test
+ public void testMatch() {
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 01 AC "
+ + "80 00 00 04 00 00 00 01 "
+ + "80 00 02 04 00 00 00 02 "
+ + "80 00 05 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 04 "
+ + "80 00 07 0C 00 00 00 00 00 05 00 00 00 00 00 06 "
+ + "80 00 09 0C 00 00 00 00 00 07 00 00 00 00 00 08 "
+ + "80 00 0A 02 00 09 "
+ + "80 00 0D 04 00 0A 00 0B "
+ + "80 00 0E 01 0C "
+ + "80 00 10 01 0D "
+ + "80 00 12 01 0E "
+ + "80 00 14 01 0F "
+ + "80 00 17 08 0A 00 00 01 00 00 FF 00 "
+ + "80 00 19 08 0A 00 00 02 00 00 00 FF "
+ + "80 00 1A 02 00 03 "
+ + "80 00 1C 02 00 04 "
+ + "80 00 1E 02 00 05 "
+ + "80 00 20 02 00 06 "
+ + "80 00 22 02 00 07 "
+ + "80 00 24 02 00 08 "
+ + "80 00 26 01 05 "
+ + "80 00 28 01 07 "
+ + "80 00 2A 02 00 10 "
+ + "80 00 2D 08 0A 00 00 09 00 00 FF 00 "
+ + "80 00 2F 08 0A 00 00 0A 00 00 00 FF "
+ + "80 00 31 0C 00 00 00 00 00 01 00 00 00 00 00 03 "
+ + "80 00 33 0C 00 00 00 00 00 02 00 00 00 00 00 04 "
+ + "80 00 35 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 "
+ + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 "
+ + "80 00 37 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 "
+ + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 "
+ + "80 00 39 08 00 00 00 02 00 00 00 03 "
+ + "80 00 3A 01 15 "
+ + "80 00 3C 01 17 "
+ + "80 00 3E 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 " //ipv6ndtarget
+ + "80 00 40 06 00 05 00 00 00 01 "
+ + "80 00 42 06 00 05 00 00 00 02 "
+ + "80 00 44 04 00 00 02 03 "
+ + "80 00 46 01 03 "
+ + "80 00 48 01 01 "
+ + "80 00 4B 06 00 00 02 00 00 01 "
+ + "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF "
+ + "80 00 4F 04 00 00 03 04 "
+ + "00 00 00 00");
+
+ Match match = matchDeserializer.deserialize(buffer);
+ Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());
+ Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntries().size());
+ List<MatchEntries> entries = match.getMatchEntries();
+ MatchEntries entry0 = entries.get(0);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry0.getOxmClass());
+ Assert.assertEquals("Wrong entry field", InPort.class, entry0.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry0.isHasMask());
+ Assert.assertEquals("Wrong entry value", 1,
+ entry0.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+ MatchEntries entry1 = entries.get(1);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry1.getOxmClass());
+ Assert.assertEquals("Wrong entry field", InPhyPort.class, entry1.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry1.isHasMask());
+ Assert.assertEquals("Wrong entry value", 2,
+ entry1.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+ MatchEntries entry2 = entries.get(2);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry2.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Metadata.class, entry2.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry2.isHasMask());
+ Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"),
+ entry2.getAugmentation(MetadataMatchEntry.class).getMetadata());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 04"),
+ entry2.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry3 = entries.get(3);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry3.getOxmClass());
+ Assert.assertEquals("Wrong entry field", EthDst.class, entry3.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry3.isHasMask());
+ Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:05"),
+ entry3.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 06"),
+ entry3.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry4 = entries.get(4);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry4.getOxmClass());
+ Assert.assertEquals("Wrong entry field", EthSrc.class, entry4.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry4.isHasMask());
+ Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:07"),
+ entry4.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 08"),
+ entry4.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry5 = entries.get(5);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry5.getOxmClass());
+ Assert.assertEquals("Wrong entry field", EthType.class, entry5.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry5.isHasMask());
+ Assert.assertEquals("Wrong entry value", 9,
+ entry5.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().intValue());
+ MatchEntries entry6 = entries.get(6);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry6.getOxmClass());
+ Assert.assertEquals("Wrong entry field", VlanVid.class, entry6.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry6.isHasMask());
+ Assert.assertEquals("Wrong entry value", 10,
+ entry6.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());
+ Assert.assertEquals("Wrong entry value", false,
+ entry6.getAugmentation(VlanVidMatchEntry.class).isCfiBit());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 0B"),
+ entry6.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry7 = entries.get(7);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry7.getOxmClass());
+ Assert.assertEquals("Wrong entry field", VlanPcp.class, entry7.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry7.isHasMask());
+ Assert.assertEquals("Wrong entry value", 12,
+ entry7.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().intValue());
+ MatchEntries entry8 = entries.get(8);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry8.getOxmClass());
+ Assert.assertEquals("Wrong entry field", IpDscp.class, entry8.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry8.isHasMask());
+ Assert.assertEquals("Wrong entry value", 13,
+ entry8.getAugmentation(DscpMatchEntry.class).getDscp().getValue().intValue());
+ MatchEntries entry9 = entries.get(9);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry9.getOxmClass());
+ Assert.assertEquals("Wrong entry field", IpEcn.class, entry9.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry9.isHasMask());
+ Assert.assertEquals("Wrong entry value", 14,
+ entry9.getAugmentation(EcnMatchEntry.class).getEcn().intValue());
+ MatchEntries entry10 = entries.get(10);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry10.getOxmClass());
+ Assert.assertEquals("Wrong entry field", IpProto.class, entry10.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry10.isHasMask());
+ Assert.assertEquals("Wrong entry value", 15,
+ entry10.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber().intValue());
+ MatchEntries entry11 = entries.get(11);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry11.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv4Src.class, entry11.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry11.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.1"),
+ entry11.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"),
+ entry11.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry12 = entries.get(12);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry12.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry12.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry12.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.2"),
+ entry12.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"),
+ entry12.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry13 = entries.get(13);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry13.getOxmClass());
+ Assert.assertEquals("Wrong entry field", TcpSrc.class, entry13.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry13.isHasMask());
+ Assert.assertEquals("Wrong entry value", 3,
+ entry13.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ MatchEntries entry14 = entries.get(14);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry14.getOxmClass());
+ Assert.assertEquals("Wrong entry field", TcpDst.class, entry14.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry14.isHasMask());
+ Assert.assertEquals("Wrong entry value", 4,
+ entry14.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ MatchEntries entry15 = entries.get(15);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry15.getOxmClass());
+ Assert.assertEquals("Wrong entry field", UdpSrc.class, entry15.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry15.isHasMask());
+ Assert.assertEquals("Wrong entry value", 5,
+ entry15.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ MatchEntries entry16 = entries.get(16);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry16.getOxmClass());
+ Assert.assertEquals("Wrong entry field", UdpDst.class, entry16.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry16.isHasMask());
+ Assert.assertEquals("Wrong entry value", 6,
+ entry16.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ MatchEntries entry17 = entries.get(17);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry17.getOxmClass());
+ Assert.assertEquals("Wrong entry field", SctpSrc.class, entry17.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry17.isHasMask());
+ Assert.assertEquals("Wrong entry value", 7,
+ entry17.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ MatchEntries entry18 = entries.get(18);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry18.getOxmClass());
+ Assert.assertEquals("Wrong entry field", SctpDst.class, entry18.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry18.isHasMask());
+ Assert.assertEquals("Wrong entry value", 8,
+ entry18.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+ MatchEntries entry19 = entries.get(19);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry19.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Icmpv4Type.class, entry19.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry19.isHasMask());
+ Assert.assertEquals("Wrong entry value", 5,
+ entry19.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type().intValue());
+ MatchEntries entry20 = entries.get(20);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry20.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Icmpv4Code.class, entry20.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry20.isHasMask());
+ Assert.assertEquals("Wrong entry value", 7,
+ entry20.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code().intValue());
+ MatchEntries entry21 = entries.get(21);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry21.getOxmClass());
+ Assert.assertEquals("Wrong entry field", ArpOp.class, entry21.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry21.isHasMask());
+ Assert.assertEquals("Wrong entry value", 16,
+ entry21.getAugmentation(OpCodeMatchEntry.class).getOpCode().intValue());
+ MatchEntries entry22 = entries.get(22);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry22.getOxmClass());
+ Assert.assertEquals("Wrong entry field", ArpSpa.class, entry22.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry22.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.9"),
+ entry22.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"),
+ entry22.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry23 = entries.get(23);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry23.getOxmClass());
+ Assert.assertEquals("Wrong entry field", ArpTpa.class, entry23.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry23.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.10"),
+ entry23.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"),
+ entry23.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry24 = entries.get(24);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry24.getOxmClass());
+ Assert.assertEquals("Wrong entry field", ArpSha.class, entry24.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry24.isHasMask());
+ Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:01"),
+ entry24.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 03"),
+ entry24.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry25 = entries.get(25);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry25.getOxmClass());
+ Assert.assertEquals("Wrong entry field", ArpTha.class, entry25.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry25.isHasMask());
+ Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:02"),
+ entry25.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 04"),
+ entry25.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry26 = entries.get(26);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry26.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6Src.class, entry26.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry26.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0015"),
+ entry26.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+ Assert.assertArrayEquals("Wrong entry mask",
+ ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16"),
+ entry26.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry27 = entries.get(27);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry27.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6Dst.class, entry27.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry27.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0017"),
+ entry27.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+ Assert.assertArrayEquals("Wrong entry mask",
+ ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18"),
+ entry27.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry28 = entries.get(28);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry28.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry28.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry28.isHasMask());
+ Assert.assertEquals("Wrong entry value", 2,
+ entry28.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 03"),
+ entry28.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry29 = entries.get(29);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry29.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Icmpv6Type.class, entry29.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry29.isHasMask());
+ Assert.assertEquals("Wrong entry value", 21,
+ entry29.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type().intValue());
+ MatchEntries entry30 = entries.get(30);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry30.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Icmpv6Code.class, entry30.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry30.isHasMask());
+ Assert.assertEquals("Wrong entry value", 23,
+ entry30.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code().intValue());
+ MatchEntries entry31 = entries.get(31);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry31.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6NdTarget.class, entry31.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry31.isHasMask());
+ Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0020"),
+ entry31.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+ MatchEntries entry32 = entries.get(32);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry32.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6NdSll.class, entry32.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry32.isHasMask());
+ Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:01"),
+ entry32.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+ MatchEntries entry33 = entries.get(33);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry33.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6NdTll.class, entry33.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry33.isHasMask());
+ Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:02"),
+ entry33.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+ MatchEntries entry34 = entries.get(34);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry34.getOxmClass());
+ Assert.assertEquals("Wrong entry field", MplsLabel.class, entry34.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry34.isHasMask());
+ Assert.assertEquals("Wrong entry value", 515,
+ entry34.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());
+ MatchEntries entry35 = entries.get(35);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry35.getOxmClass());
+ Assert.assertEquals("Wrong entry field", MplsTc.class, entry35.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry35.isHasMask());
+ Assert.assertEquals("Wrong entry value", 3,
+ entry35.getAugmentation(TcMatchEntry.class).getTc().intValue());
+ MatchEntries entry36 = entries.get(36);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry36.getOxmClass());
+ Assert.assertEquals("Wrong entry field", MplsBos.class, entry36.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry36.isHasMask());
+ Assert.assertEquals("Wrong entry value", true,
+ entry36.getAugmentation(BosMatchEntry.class).isBos());
+ MatchEntries entry37 = entries.get(37);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry37.getOxmClass());
+ Assert.assertEquals("Wrong entry field", PbbIsid.class, entry37.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry37.isHasMask());
+ Assert.assertEquals("Wrong entry value", 2,
+ entry37.getAugmentation(IsidMatchEntry.class).getIsid().intValue());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 01"),
+ entry37.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry38 = entries.get(38);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry38.getOxmClass());
+ Assert.assertEquals("Wrong entry field", TunnelId.class, entry38.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry38.isHasMask());
+ Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 07"),
+ entry38.getAugmentation(MetadataMatchEntry.class).getMetadata());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 FF"),
+ entry38.getAugmentation(MaskMatchEntry.class).getMask());
+ MatchEntries entry39 = entries.get(39);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry39.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry39.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", true, entry39.isHasMask());
+ Assert.assertEquals("Wrong entry value",
+ new Ipv6ExthdrFlags(false, false, false, false, false, false, false, false, false),
+ entry39.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());
+ Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("03 04"),
+ entry39.getAugmentation(MaskMatchEntry.class).getMask());
+ Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
+ }
+
+ /**
+ * Testing header deserialization
+ */
+ @Test
+ public void testHeaders() {
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");
+
+ MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+ 0x8000, 12);
+ key.setExperimenterId(null);
+ HeaderDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);
+ MatchEntries entry = entryDeserializer.deserializeHeader(buffer);
+ Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+ Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry.getOxmMatchField());
+ Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+ Assert.assertEquals("Wrong Ipv4 address", null, entry.getAugmentation(Ipv4AddressMatchEntry.class));
+ }
+
+ /**
+ * Testing standard match type
+ */
+ @Test
+ public void testStandardMatch() {
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 10 80 00 04 08 00 00 00 00 00 00 00 01");
+
+ Match match = matchDeserializer.deserialize(buffer);
+
+ Assert.assertEquals("Wrong match type", StandardMatchType.class, match.getType());
+ Assert.assertEquals("Wrong match entries size", 1, match.getMatchEntries().size());
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10ActionsDeserializerTest {\r
-\r
- private DeserializerRegistry registry;\r
-\r
- /**\r
- * Initializes deserializer registry and lookups correct deserializer\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new DeserializerRegistryImpl();\r
- registry.init();\r
- }\r
-\r
- /**\r
- * Testing correct deserialization of actions (OF v1.0)\r
- */\r
- @Test\r
- public void test() {\r
- ByteBuf message = BufferHelper.buildBuffer("00 00 00 08 00 10 20 00 "\r
- + "00 01 00 08 10 10 00 00 "\r
- + "00 02 00 08 25 00 00 00 "\r
- + "00 03 00 08 00 00 00 00 "\r
- + "00 04 00 10 01 02 03 04 05 06 00 00 00 00 00 00 "\r
- + "00 05 00 10 02 03 04 05 06 07 00 00 00 00 00 00 "\r
- + "00 06 00 08 0A 00 00 01 "\r
- + "00 07 00 08 0B 00 00 02 "\r
- + "00 08 00 08 01 00 00 00 "\r
- + "00 09 00 08 00 02 00 00 "\r
- + "00 0A 00 08 00 03 00 00 "\r
- + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30");\r
- \r
- message.skipBytes(4); // skip XID\r
- CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);\r
- List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID,\r
- message.readableBytes(), message, keyMaker, registry);\r
- Assert.assertEquals("Wrong number of actions", 12, actions.size());\r
- Action action1 = actions.get(0);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.Output", action1.getType().getName());\r
- Assert.assertEquals("Wrong port", 16,\r
- action1.getAugmentation(PortAction.class).getPort().getValue().intValue());\r
- Assert.assertEquals("Wrong max-length", 8192,\r
- action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
- Action action2 = actions.get(1);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetVlanVid", action2.getType().getName());\r
- Assert.assertEquals("Wrong vlan-vid", 4112,\r
- action2.getAugmentation(VlanVidAction.class).getVlanVid().intValue());\r
- Action action3 = actions.get(2);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetVlanPcp", action3.getType().getName());\r
- Assert.assertEquals("Wrong vlan-pcp", 37,\r
- action3.getAugmentation(VlanPcpAction.class).getVlanPcp().intValue());\r
- Action action4 = actions.get(3);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.StripVlan", action4.getType().getName());\r
- Action action5 = actions.get(4);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetDlSrc", action5.getType().getName());\r
- Assert.assertArrayEquals("Wrong dl-src", ByteBufUtils.macAddressToBytes("01:02:03:04:05:06"),\r
- ByteBufUtils.macAddressToBytes(action5.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
- Action action6 = actions.get(5);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetDlDst", action6.getType().getName());\r
- Assert.assertArrayEquals("Wrong dl-dst", ByteBufUtils.macAddressToBytes("02:03:04:05:06:07"), \r
- ByteBufUtils.macAddressToBytes(action6.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
- Action action7 = actions.get(6);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetNwSrc", action7.getType().getName());\r
- Assert.assertEquals("Wrong nw-src", new Ipv4Address("10.0.0.1"),\r
- action7.getAugmentation(IpAddressAction.class).getIpAddress());\r
- Action action8 = actions.get(7);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetNwDst", action8.getType().getName());\r
- Assert.assertEquals("Wrong nw-dst", new Ipv4Address("11.0.0.2"),\r
- action8.getAugmentation(IpAddressAction.class).getIpAddress());\r
- Action action9 = actions.get(8);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetNwTos", action9.getType().getName());\r
- Assert.assertEquals("Wrong nw-tos", 1, action9.getAugmentation(NwTosAction.class).getNwTos().intValue());\r
- Action action10 = actions.get(9);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetTpSrc", action10.getType().getName());\r
- Assert.assertEquals("Wrong port", 2, action10.getAugmentation(PortAction.class)\r
- .getPort().getValue().intValue());\r
- Action action11 = actions.get(10);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.SetTpDst", action11.getType().getName());\r
- Assert.assertEquals("Wrong port", 3, action11.getAugmentation(PortAction.class)\r
- .getPort().getValue().intValue());\r
- Action action12 = actions.get(11);\r
- Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
- + ".openflow.common.action.rev130731.Enqueue", action12.getType().getName());\r
- Assert.assertEquals("Wrong port", 4, action12.getAugmentation(PortAction.class)\r
- .getPort().getValue().intValue());\r
- Assert.assertEquals("Wrong queue-id", 48,\r
- action12.getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10ActionsDeserializerTest {
+
+ private DeserializerRegistry registry;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ registry = new DeserializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing correct deserialization of actions (OF v1.0)
+ */
+ @Test
+ public void test() {
+ ByteBuf message = BufferHelper.buildBuffer("00 00 00 08 00 10 20 00 "
+ + "00 01 00 08 10 10 00 00 "
+ + "00 02 00 08 25 00 00 00 "
+ + "00 03 00 08 00 00 00 00 "
+ + "00 04 00 10 01 02 03 04 05 06 00 00 00 00 00 00 "
+ + "00 05 00 10 02 03 04 05 06 07 00 00 00 00 00 00 "
+ + "00 06 00 08 0A 00 00 01 "
+ + "00 07 00 08 0B 00 00 02 "
+ + "00 08 00 08 01 00 00 00 "
+ + "00 09 00 08 00 02 00 00 "
+ + "00 0A 00 08 00 03 00 00 "
+ + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30");
+
+ message.skipBytes(4); // skip XID
+ CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
+ List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID,
+ message.readableBytes(), message, keyMaker, registry);
+ Assert.assertEquals("Wrong number of actions", 12, actions.size());
+ Action action1 = actions.get(0);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.Output", action1.getType().getName());
+ Assert.assertEquals("Wrong port", 16,
+ action1.getAugmentation(PortAction.class).getPort().getValue().intValue());
+ Assert.assertEquals("Wrong max-length", 8192,
+ action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());
+ Action action2 = actions.get(1);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetVlanVid", action2.getType().getName());
+ Assert.assertEquals("Wrong vlan-vid", 4112,
+ action2.getAugmentation(VlanVidAction.class).getVlanVid().intValue());
+ Action action3 = actions.get(2);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetVlanPcp", action3.getType().getName());
+ Assert.assertEquals("Wrong vlan-pcp", 37,
+ action3.getAugmentation(VlanPcpAction.class).getVlanPcp().intValue());
+ Action action4 = actions.get(3);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.StripVlan", action4.getType().getName());
+ Action action5 = actions.get(4);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetDlSrc", action5.getType().getName());
+ Assert.assertArrayEquals("Wrong dl-src", ByteBufUtils.macAddressToBytes("01:02:03:04:05:06"),
+ ByteBufUtils.macAddressToBytes(action5.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));
+ Action action6 = actions.get(5);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetDlDst", action6.getType().getName());
+ Assert.assertArrayEquals("Wrong dl-dst", ByteBufUtils.macAddressToBytes("02:03:04:05:06:07"),
+ ByteBufUtils.macAddressToBytes(action6.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));
+ Action action7 = actions.get(6);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetNwSrc", action7.getType().getName());
+ Assert.assertEquals("Wrong nw-src", new Ipv4Address("10.0.0.1"),
+ action7.getAugmentation(IpAddressAction.class).getIpAddress());
+ Action action8 = actions.get(7);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetNwDst", action8.getType().getName());
+ Assert.assertEquals("Wrong nw-dst", new Ipv4Address("11.0.0.2"),
+ action8.getAugmentation(IpAddressAction.class).getIpAddress());
+ Action action9 = actions.get(8);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetNwTos", action9.getType().getName());
+ Assert.assertEquals("Wrong nw-tos", 1, action9.getAugmentation(NwTosAction.class).getNwTos().intValue());
+ Action action10 = actions.get(9);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetTpSrc", action10.getType().getName());
+ Assert.assertEquals("Wrong port", 2, action10.getAugmentation(PortAction.class)
+ .getPort().getValue().intValue());
+ Action action11 = actions.get(10);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.SetTpDst", action11.getType().getName());
+ Assert.assertEquals("Wrong port", 3, action11.getAugmentation(PortAction.class)
+ .getPort().getValue().intValue());
+ Action action12 = actions.get(11);
+ Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.Enqueue", action12.getType().getName());
+ Assert.assertEquals("Wrong port", 4, action12.getAugmentation(PortAction.class)
+ .getPort().getValue().intValue());
+ Assert.assertEquals("Wrong queue-id", 48,
+ action12.getAugmentation(QueueIdAction.class).getQueueId().intValue());
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10ActionsSerializerTest {\r
-\r
- private SerializerRegistry registry;\r
-\r
- /**\r
- * Initializes serializer table and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- }\r
-\r
- /**\r
- * Testing correct serialization of actions (OF v1.0) \r
- */\r
- @Test\r
- public void test() {\r
- List<Action> actions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Output.class);\r
- PortActionBuilder portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber(42L));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
- maxLen.setMaxLength(32);\r
- actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetVlanVid.class);\r
- VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();\r
- vlanBuilder.setVlanVid(15);\r
- actionBuilder.addAugmentation(VlanVidAction.class, vlanBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetVlanPcp.class);\r
- VlanPcpActionBuilder pcpBuilder = new VlanPcpActionBuilder();\r
- pcpBuilder.setVlanPcp((short) 16);\r
- actionBuilder.addAugmentation(VlanPcpAction.class, pcpBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(StripVlan.class);\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetDlSrc.class);\r
- DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();\r
- dlBuilder.setDlAddress(new MacAddress("00:00:00:02:03:04"));\r
- actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetDlDst.class);\r
- dlBuilder = new DlAddressActionBuilder();\r
- dlBuilder.setDlAddress(new MacAddress("00:00:00:01:02:03"));\r
- actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetNwSrc.class);\r
- IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();\r
- ipBuilder.setIpAddress(new Ipv4Address("10.0.0.1"));\r
- actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetNwDst.class);\r
- ipBuilder = new IpAddressActionBuilder();\r
- ipBuilder.setIpAddress(new Ipv4Address("10.0.0.3"));\r
- actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetNwTos.class);\r
- NwTosActionBuilder tosBuilder = new NwTosActionBuilder();\r
- tosBuilder.setNwTos((short) 204);\r
- actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetTpSrc.class);\r
- portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber(6653L));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetTpDst.class);\r
- portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber(6633L));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Enqueue.class);\r
- portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber(6613L));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();\r
- queueBuilder.setQueueId(400L);\r
- actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
- actions.add(actionBuilder.build());\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- ListSerializer.serializeList(actions, TypeKeyMakerFactory\r
- .createActionKeyMaker(EncodeConstants.OF10_VERSION_ID), registry, out);\r
- \r
- Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong port", 42, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong max-length", 32, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong vlan-vid", 15, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong vlan-pcp", 16, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- byte[] data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
- out.readBytes(data);\r
- Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:02:03:04"), data);\r
- out.skipBytes(6);\r
- Assert.assertEquals("Wrong action type", 5, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
- out.readBytes(data);\r
- Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:01:02:03"), data);\r
- out.skipBytes(6);\r
- Assert.assertEquals("Wrong action type", 6, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong ip-address(4)", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong action type", 7, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong ip-address(4)", 3, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong action type", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong nw-tos", 204, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong action type", 9, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong port", 6653, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 10, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong port", 6633, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());\r
- out.skipBytes(6);\r
- Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());\r
- Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);\r
- }\r
- \r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10ActionsSerializerTest {
+
+ private SerializerRegistry registry;
+
+ /**
+ * Initializes serializer table and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing correct serialization of actions (OF v1.0)
+ */
+ @Test
+ public void test() {
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Output.class);
+ PortActionBuilder portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber(42L));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+ maxLen.setMaxLength(32);
+ actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetVlanVid.class);
+ VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();
+ vlanBuilder.setVlanVid(15);
+ actionBuilder.addAugmentation(VlanVidAction.class, vlanBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetVlanPcp.class);
+ VlanPcpActionBuilder pcpBuilder = new VlanPcpActionBuilder();
+ pcpBuilder.setVlanPcp((short) 16);
+ actionBuilder.addAugmentation(VlanPcpAction.class, pcpBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(StripVlan.class);
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetDlSrc.class);
+ DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();
+ dlBuilder.setDlAddress(new MacAddress("00:00:00:02:03:04"));
+ actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetDlDst.class);
+ dlBuilder = new DlAddressActionBuilder();
+ dlBuilder.setDlAddress(new MacAddress("00:00:00:01:02:03"));
+ actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetNwSrc.class);
+ IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();
+ ipBuilder.setIpAddress(new Ipv4Address("10.0.0.1"));
+ actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetNwDst.class);
+ ipBuilder = new IpAddressActionBuilder();
+ ipBuilder.setIpAddress(new Ipv4Address("10.0.0.3"));
+ actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetNwTos.class);
+ NwTosActionBuilder tosBuilder = new NwTosActionBuilder();
+ tosBuilder.setNwTos((short) 204);
+ actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetTpSrc.class);
+ portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber(6653L));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetTpDst.class);
+ portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber(6633L));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Enqueue.class);
+ portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber(6613L));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();
+ queueBuilder.setQueueId(400L);
+ actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());
+ actions.add(actionBuilder.build());
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ ListSerializer.serializeList(actions, TypeKeyMakerFactory
+ .createActionKeyMaker(EncodeConstants.OF10_VERSION_ID), registry, out);
+
+ Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong port", 42, out.readUnsignedShort());
+ Assert.assertEquals("Wrong max-length", 32, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong vlan-vid", 15, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong vlan-pcp", 16, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ byte[] data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+ out.readBytes(data);
+ Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:02:03:04"), data);
+ out.skipBytes(6);
+ Assert.assertEquals("Wrong action type", 5, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+ out.readBytes(data);
+ Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:01:02:03"), data);
+ out.skipBytes(6);
+ Assert.assertEquals("Wrong action type", 6, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());
+ Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong ip-address(4)", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong action type", 7, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());
+ Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong ip-address(4)", 3, out.readUnsignedByte());
+ Assert.assertEquals("Wrong action type", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong nw-tos", 204, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong action type", 9, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong port", 6653, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 10, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong port", 6633, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());
+ out.skipBytes(6);
+ Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());
+ Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);
+ }
+
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.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.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * \r
- */\r
-public class OF13ActionsSerializerTest {\r
-\r
- private SerializerRegistry registry;\r
-\r
- /**\r
- * Initializes serializer table and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- }\r
-\r
- /**\r
- * Testing correct serialization of actions\r
- */\r
- @Test\r
- public void test() {\r
- List<Action> actions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Output.class);\r
- PortActionBuilder port = new PortActionBuilder();\r
- port.setPort(new PortNumber(42L));\r
- actionBuilder.addAugmentation(PortAction.class, port.build());\r
- MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
- maxLen.setMaxLength(52);\r
- actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(CopyTtlOut.class);\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(CopyTtlIn.class);\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetMplsTtl.class);\r
- MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();\r
- mplsTtl.setMplsTtl((short) 4);\r
- actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtl.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(DecMplsTtl.class);\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PushVlan.class);\r
- EthertypeActionBuilder etherType = new EthertypeActionBuilder();\r
- etherType.setEthertype(new EtherType(16));\r
- actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PopVlan.class);\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PushMpls.class);\r
- etherType = new EthertypeActionBuilder();\r
- etherType.setEthertype(new EtherType(17));\r
- actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PopMpls.class);\r
- etherType = new EthertypeActionBuilder();\r
- etherType.setEthertype(new EtherType(18));\r
- actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetQueue.class);\r
- QueueIdActionBuilder queueId = new QueueIdActionBuilder();\r
- queueId.setQueueId(1234L);\r
- actionBuilder.addAugmentation(QueueIdAction.class, queueId.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Group.class);\r
- GroupIdActionBuilder group = new GroupIdActionBuilder();\r
- group.setGroupId(555L);\r
- actionBuilder.addAugmentation(GroupIdAction.class, group.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetNwTtl.class);\r
- NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
- nwTtl.setNwTtl((short) 8);\r
- actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(DecNwTtl.class);\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetField.class);\r
- OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
- List<MatchEntries> entries = new ArrayList<>();\r
- MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();\r
- matchBuilder.setOxmClass(OpenflowBasicClass.class);\r
- matchBuilder.setOxmMatchField(InPort.class);\r
- matchBuilder.setHasMask(false);\r
- PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();\r
- portBuilder.setPortNumber(new PortNumber(1L));\r
- matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());\r
- entries.add(matchBuilder.build());\r
- matchEntries.setMatchEntries(entries);\r
- actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PushPbb.class);\r
- etherType = new EthertypeActionBuilder();\r
- etherType.setEthertype(new EtherType(19));\r
- actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PopPbb.class);\r
- actions.add(actionBuilder.build());\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- ListSerializer.serializeList(actions, TypeKeyMakerFactory\r
- .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
- \r
- Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action port", 42, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong action max-length", 52, out.readUnsignedShort());\r
- out.skipBytes(6);\r
- Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 12, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 15, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action mpls-ttl", 4, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong action type", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action ethertype", 16, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 19, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action ethertype", 17, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 20, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action ethertype", 18, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 21, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action queue-id", 1234, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong action type", 22, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action group", 555, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action nw-ttl", 8, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong action type", 24, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & mask", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedInt());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 26, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action ethertype", 19, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Testing correct serialization of actions\r
- */\r
- @Test\r
- public void testHeaders() {\r
- List<Action> actions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Output.class);\r
- PortActionBuilder port = new PortActionBuilder();\r
- port.setPort(new PortNumber(42L));\r
- actionBuilder.addAugmentation(PortAction.class, port.build());\r
- MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
- maxLen.setMaxLength(52);\r
- actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetField.class);\r
- OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
- List<MatchEntries> entries = new ArrayList<>();\r
- MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();\r
- matchBuilder.setOxmClass(OpenflowBasicClass.class);\r
- matchBuilder.setOxmMatchField(InPort.class);\r
- matchBuilder.setHasMask(false);\r
- PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();\r
- portBuilder.setPortNumber(new PortNumber(1L));\r
- matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());\r
- entries.add(matchBuilder.build());\r
- matchEntries.setMatchEntries(entries);\r
- actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
- actions.add(actionBuilder.build());\r
-\r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- ListSerializer.serializeHeaderList(actions, TypeKeyMakerFactory\r
- .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
-\r
- Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.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.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13ActionsSerializerTest {
+
+ private SerializerRegistry registry;
+
+ /**
+ * Initializes serializer table and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing correct serialization of actions
+ */
+ @Test
+ public void test() {
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Output.class);
+ PortActionBuilder port = new PortActionBuilder();
+ port.setPort(new PortNumber(42L));
+ actionBuilder.addAugmentation(PortAction.class, port.build());
+ MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+ maxLen.setMaxLength(52);
+ actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(CopyTtlOut.class);
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(CopyTtlIn.class);
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetMplsTtl.class);
+ MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();
+ mplsTtl.setMplsTtl((short) 4);
+ actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtl.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(DecMplsTtl.class);
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PushVlan.class);
+ EthertypeActionBuilder etherType = new EthertypeActionBuilder();
+ etherType.setEthertype(new EtherType(16));
+ actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PopVlan.class);
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PushMpls.class);
+ etherType = new EthertypeActionBuilder();
+ etherType.setEthertype(new EtherType(17));
+ actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PopMpls.class);
+ etherType = new EthertypeActionBuilder();
+ etherType.setEthertype(new EtherType(18));
+ actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetQueue.class);
+ QueueIdActionBuilder queueId = new QueueIdActionBuilder();
+ queueId.setQueueId(1234L);
+ actionBuilder.addAugmentation(QueueIdAction.class, queueId.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Group.class);
+ GroupIdActionBuilder group = new GroupIdActionBuilder();
+ group.setGroupId(555L);
+ actionBuilder.addAugmentation(GroupIdAction.class, group.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetNwTtl.class);
+ NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+ nwTtl.setNwTtl((short) 8);
+ actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(DecNwTtl.class);
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetField.class);
+ OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+ List<MatchEntries> entries = new ArrayList<>();
+ MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();
+ matchBuilder.setOxmClass(OpenflowBasicClass.class);
+ matchBuilder.setOxmMatchField(InPort.class);
+ matchBuilder.setHasMask(false);
+ PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();
+ portBuilder.setPortNumber(new PortNumber(1L));
+ matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());
+ entries.add(matchBuilder.build());
+ matchEntries.setMatchEntries(entries);
+ actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PushPbb.class);
+ etherType = new EthertypeActionBuilder();
+ etherType.setEthertype(new EtherType(19));
+ actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PopPbb.class);
+ actions.add(actionBuilder.build());
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ ListSerializer.serializeList(actions, TypeKeyMakerFactory
+ .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+ Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action port", 42, out.readUnsignedInt());
+ Assert.assertEquals("Wrong action max-length", 52, out.readUnsignedShort());
+ out.skipBytes(6);
+ Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 12, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 15, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action mpls-ttl", 4, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong action type", 16, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action ethertype", 16, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 19, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action ethertype", 17, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 20, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action ethertype", 18, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 21, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action queue-id", 1234, out.readUnsignedInt());
+ Assert.assertEquals("Wrong action type", 22, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action group", 555, out.readUnsignedInt());
+ Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action nw-ttl", 8, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong action type", 24, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & mask", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedInt());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 26, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action ethertype", 19, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
+
+ /**
+ * Testing correct serialization of actions
+ */
+ @Test
+ public void testHeaders() {
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Output.class);
+ PortActionBuilder port = new PortActionBuilder();
+ port.setPort(new PortNumber(42L));
+ actionBuilder.addAugmentation(PortAction.class, port.build());
+ MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+ maxLen.setMaxLength(52);
+ actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetField.class);
+ OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+ List<MatchEntries> entries = new ArrayList<>();
+ MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();
+ matchBuilder.setOxmClass(OpenflowBasicClass.class);
+ matchBuilder.setOxmMatchField(InPort.class);
+ matchBuilder.setHasMask(false);
+ PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();
+ portBuilder.setPortNumber(new PortNumber(1L));
+ matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());
+ entries.add(matchBuilder.build());
+ matchEntries.setMatchEntries(entries);
+ actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+ actions.add(actionBuilder.build());
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ ListSerializer.serializeHeaderList(actions, TypeKeyMakerFactory
+ .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+ Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+ Assert.assertTrue("Unread data", out.readableBytes() == 0);
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\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
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13InstructionsSerializerTest {\r
-\r
- private SerializerRegistry registry;\r
-\r
- /**\r
- * Initializes serializer table and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- }\r
-\r
- /**\r
- * Testing instructions translation\r
- */\r
- @Test\r
- public void test() {\r
- List<Instruction> instructions = new ArrayList<>();\r
- // Goto_table instruction\r
- InstructionBuilder builder = new InstructionBuilder();\r
- builder.setType(GotoTable.class);\r
- TableIdInstructionBuilder tableIdBuilder = new TableIdInstructionBuilder();\r
- tableIdBuilder.setTableId((short) 5);\r
- builder.addAugmentation(TableIdInstruction.class, tableIdBuilder.build());\r
- instructions.add(builder.build());\r
- builder = new InstructionBuilder();\r
- // Write_metadata instruction\r
- builder.setType(WriteMetadata.class);\r
- MetadataInstructionBuilder metaBuilder = new MetadataInstructionBuilder();\r
- metaBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));\r
- metaBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));\r
- builder.addAugmentation(MetadataInstruction.class, metaBuilder.build());\r
- instructions.add(builder.build());\r
- // Clear_actions instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(ClearActions.class);\r
- instructions.add(builder.build());\r
- // Meter instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(Meter.class);\r
- MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();\r
- meterBuilder.setMeterId(42L);\r
- builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());\r
- instructions.add(builder.build());\r
- // Write_actions instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(WriteActions.class);\r
- ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();\r
- List<Action> actions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Output.class);\r
- PortActionBuilder portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber(45L));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- MaxLengthActionBuilder maxBuilder = new MaxLengthActionBuilder();\r
- maxBuilder.setMaxLength(55);\r
- actionBuilder.addAugmentation(MaxLengthAction.class, maxBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetNwTtl.class);\r
- NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
- nwTtl.setNwTtl((short) 64);\r
- actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
- actions.add(actionBuilder.build());\r
- actionsBuilder.setAction(actions);\r
- builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
- instructions.add(builder.build());\r
- // Apply_actions instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(ApplyActions.class);\r
- actionsBuilder = new ActionsInstructionBuilder();\r
- actions = new ArrayList<>();\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PushVlan.class);\r
- EthertypeActionBuilder ethertypeBuilder = new EthertypeActionBuilder();\r
- ethertypeBuilder.setEthertype(new EtherType(14));\r
- actionBuilder.addAugmentation(EthertypeAction.class, ethertypeBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PopPbb.class);\r
- actions.add(actionBuilder.build());\r
- actionsBuilder.setAction(actions);\r
- builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
- instructions.add(builder.build());\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- ListSerializer.serializeList(instructions, TypeKeyMakerFactory\r
- .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
- \r
- Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- byte[] actual = new byte[8];\r
- out.readBytes(actual);\r
- Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07",\r
- ByteBufUtils.bytesToHexString(actual));\r
- actual = new byte[8];\r
- out.readBytes(actual);\r
- Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00",\r
- ByteBufUtils.bytesToHexString(actual));\r
- Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());\r
- out.skipBytes(6);\r
- Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action ethertype", 14, out.readUnsignedShort());\r
- out.skipBytes(2);\r
- Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertTrue("Not all data were read", out.readableBytes() == 0);\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+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;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13InstructionsSerializerTest {
+
+ private SerializerRegistry registry;
+
+ /**
+ * Initializes serializer table and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing instructions translation
+ */
+ @Test
+ public void test() {
+ List<Instruction> instructions = new ArrayList<>();
+ // Goto_table instruction
+ InstructionBuilder builder = new InstructionBuilder();
+ builder.setType(GotoTable.class);
+ TableIdInstructionBuilder tableIdBuilder = new TableIdInstructionBuilder();
+ tableIdBuilder.setTableId((short) 5);
+ builder.addAugmentation(TableIdInstruction.class, tableIdBuilder.build());
+ instructions.add(builder.build());
+ builder = new InstructionBuilder();
+ // Write_metadata instruction
+ builder.setType(WriteMetadata.class);
+ MetadataInstructionBuilder metaBuilder = new MetadataInstructionBuilder();
+ metaBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));
+ metaBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));
+ builder.addAugmentation(MetadataInstruction.class, metaBuilder.build());
+ instructions.add(builder.build());
+ // Clear_actions instruction
+ builder = new InstructionBuilder();
+ builder.setType(ClearActions.class);
+ instructions.add(builder.build());
+ // Meter instruction
+ builder = new InstructionBuilder();
+ builder.setType(Meter.class);
+ MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();
+ meterBuilder.setMeterId(42L);
+ builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());
+ instructions.add(builder.build());
+ // Write_actions instruction
+ builder = new InstructionBuilder();
+ builder.setType(WriteActions.class);
+ ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Output.class);
+ PortActionBuilder portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber(45L));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ MaxLengthActionBuilder maxBuilder = new MaxLengthActionBuilder();
+ maxBuilder.setMaxLength(55);
+ actionBuilder.addAugmentation(MaxLengthAction.class, maxBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetNwTtl.class);
+ NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+ nwTtl.setNwTtl((short) 64);
+ actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());
+ actions.add(actionBuilder.build());
+ actionsBuilder.setAction(actions);
+ builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+ instructions.add(builder.build());
+ // Apply_actions instruction
+ builder = new InstructionBuilder();
+ builder.setType(ApplyActions.class);
+ actionsBuilder = new ActionsInstructionBuilder();
+ actions = new ArrayList<>();
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PushVlan.class);
+ EthertypeActionBuilder ethertypeBuilder = new EthertypeActionBuilder();
+ ethertypeBuilder.setEthertype(new EtherType(14));
+ actionBuilder.addAugmentation(EthertypeAction.class, ethertypeBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PopPbb.class);
+ actions.add(actionBuilder.build());
+ actionsBuilder.setAction(actions);
+ builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+ instructions.add(builder.build());
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ ListSerializer.serializeList(instructions, TypeKeyMakerFactory
+ .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+ Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
+ out.skipBytes(4);
+ byte[] actual = new byte[8];
+ out.readBytes(actual);
+ Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07",
+ ByteBufUtils.bytesToHexString(actual));
+ actual = new byte[8];
+ out.readBytes(actual);
+ Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00",
+ ByteBufUtils.bytesToHexString(actual));
+ Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());
+ Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());
+ Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());
+ out.skipBytes(6);
+ Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action ethertype", 14, out.readUnsignedShort());
+ out.skipBytes(2);
+ Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertTrue("Not all data were read", out.readableBytes() == 0);
+ }
+
+}
-/*\r
- * Copyright (c) 2013 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
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\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.Ipv6ExthdrFlags;\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.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.MatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13MatchSerializer02Test {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<Match> matchSerializer;\r
-\r
- /**\r
- * Initializes serializer table and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- matchSerializer = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));\r
- }\r
-\r
- /**\r
- * Testing serialization of match\r
- */\r
- @Test\r
- public void testEmptyMatch() {\r
- MatchBuilder builder = new MatchBuilder();\r
- builder.setType(OxmMatchType.class);\r
- Match match = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- matchSerializer.serialize(match, out);\r
- \r
- Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match length", 4, out.readUnsignedShort());\r
- Assert.assertTrue("Wrong padding", out.readableBytes() == 4);\r
- }\r
- \r
- /**\r
- * Testing serialization of match\r
- */\r
- @Test\r
- public void test() {\r
- MatchBuilder builder = new MatchBuilder();\r
- builder.setType(OxmMatchType.class);\r
- List<MatchEntries> entries = new ArrayList<>();\r
- MatchEntriesBuilder entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(InPort.class);\r
- entryBuilder.setHasMask(false);\r
- PortNumberMatchEntryBuilder portNumberBuilder = new PortNumberMatchEntryBuilder();\r
- portNumberBuilder.setPortNumber(new PortNumber(42L));\r
- entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(InPhyPort.class);\r
- entryBuilder.setHasMask(false);\r
- portNumberBuilder = new PortNumberMatchEntryBuilder();\r
- portNumberBuilder.setPortNumber(new PortNumber(43L));\r
- entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Metadata.class);\r
- entryBuilder.setHasMask(true);\r
- MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
- metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});\r
- entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
- MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(EthDst.class);\r
- entryBuilder.setHasMask(true);\r
- MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));\r
- entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,0,0,5});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(EthSrc.class);\r
- entryBuilder.setHasMask(true);\r
- macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));\r
- entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,0,0,2});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(EthType.class);\r
- entryBuilder.setHasMask(false);\r
- EthTypeMatchEntryBuilder ethBuilder = new EthTypeMatchEntryBuilder();\r
- ethBuilder.setEthType(new EtherType(46));\r
- entryBuilder.addAugmentation(EthTypeMatchEntry.class, ethBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(VlanVid.class);\r
- entryBuilder.setHasMask(true);\r
- VlanVidMatchEntryBuilder vidBuilder = new VlanVidMatchEntryBuilder();\r
- vidBuilder.setCfiBit(true);\r
- vidBuilder.setVlanVid(45);\r
- entryBuilder.addAugmentation(VlanVidMatchEntry.class, vidBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,9});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(VlanPcp.class);\r
- entryBuilder.setHasMask(false);\r
- VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();\r
- pcpBuilder.setVlanPcp((short) 14);\r
- entryBuilder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(IpDscp.class);\r
- entryBuilder.setHasMask(false);\r
- DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
- dscpBuilder.setDscp(new Dscp((short) 48));\r
- entryBuilder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(IpEcn.class);\r
- entryBuilder.setHasMask(false);\r
- EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();\r
- ecnBuilder.setEcn((short) 49);\r
- entryBuilder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(IpProto.class);\r
- entryBuilder.setHasMask(false);\r
- ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();\r
- protoBuilder.setProtocolNumber((short) 50);\r
- entryBuilder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv4Src.class);\r
- entryBuilder.setHasMask(true);\r
- Ipv4AddressMatchEntryBuilder ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
- ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.1"));\r
- entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,14});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv4Dst.class);\r
- entryBuilder.setHasMask(true);\r
- ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
- ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.2"));\r
- entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,15});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(TcpSrc.class);\r
- entryBuilder.setHasMask(false);\r
- PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
- .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6653));\r
- entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(TcpDst.class);\r
- entryBuilder.setHasMask(false);\r
- portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
- .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6654));\r
- entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(UdpSrc.class);\r
- entryBuilder.setHasMask(false);\r
- portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
- .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6655));\r
- entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(UdpDst.class);\r
- entryBuilder.setHasMask(false);\r
- portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
- .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6656));\r
- entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(SctpSrc.class);\r
- entryBuilder.setHasMask(false);\r
- portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
- .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6657));\r
- entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(SctpDst.class);\r
- entryBuilder.setHasMask(false);\r
- portBuilder = new PortMatchEntryBuilder();\r
- portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
- .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6658));\r
- entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Icmpv4Type.class);\r
- entryBuilder.setHasMask(false);\r
- Icmpv4TypeMatchEntryBuilder icmpv4typeBuilder = new Icmpv4TypeMatchEntryBuilder();\r
- icmpv4typeBuilder.setIcmpv4Type((short) 51);\r
- entryBuilder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4typeBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Icmpv4Code.class);\r
- entryBuilder.setHasMask(false);\r
- Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();\r
- icmpv4CodeBuilder.setIcmpv4Code((short) 52);\r
- entryBuilder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(ArpOp.class);\r
- entryBuilder.setHasMask(false);\r
- OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();\r
- opBuilder.setOpCode(53);\r
- entryBuilder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(ArpSpa.class);\r
- entryBuilder.setHasMask(true);\r
- ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
- ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.4"));\r
- entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,16});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(ArpTpa.class);\r
- entryBuilder.setHasMask(true);\r
- ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
- ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.5"));\r
- entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,17});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(ArpSha.class);\r
- entryBuilder.setHasMask(true);\r
- macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress("00:01:02:03:04:05"));\r
- entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,4,0,0,6});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(ArpTha.class);\r
- entryBuilder.setHasMask(true);\r
- macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress("00:00:00:00:00:03"));\r
- entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,6,0,0,4});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6Src.class);\r
- entryBuilder.setHasMask(true);\r
- Ipv6AddressMatchEntryBuilder ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
- ipv6Builder.setIpv6Address(new Ipv6Address("0:0:0:0:0:0:0:1"));\r
- entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6Dst.class);\r
- entryBuilder.setHasMask(true);\r
- ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
- ipv6Builder.setIpv6Address(new Ipv6Address("0:0:1:0:1:0:0:1"));\r
- entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6Flabel.class);\r
- entryBuilder.setHasMask(true);\r
- Ipv6FlabelMatchEntryBuilder flabelBuilder = new Ipv6FlabelMatchEntryBuilder();\r
- flabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(58L));\r
- entryBuilder.addAugmentation(Ipv6FlabelMatchEntry.class, flabelBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,1,0,2});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Icmpv6Type.class);\r
- entryBuilder.setHasMask(false);\r
- Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();\r
- icmpv6TypeBuilder.setIcmpv6Type((short) 59);\r
- entryBuilder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Icmpv6Code.class);\r
- entryBuilder.setHasMask(false);\r
- Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();\r
- icmpv6CodeBuilder.setIcmpv6Code((short) 60);\r
- entryBuilder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6NdTarget.class);\r
- entryBuilder.setHasMask(false);\r
- ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
- ipv6Builder.setIpv6Address(new Ipv6Address("F:0:0::0:0:0:1"));\r
- entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6NdSll.class);\r
- entryBuilder.setHasMask(false);\r
- macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));\r
- entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6NdTll.class);\r
- entryBuilder.setHasMask(false);\r
- macBuilder = new MacAddressMatchEntryBuilder();\r
- macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));\r
- entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(MplsLabel.class);\r
- entryBuilder.setHasMask(false);\r
- MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();\r
- labelBuilder.setMplsLabel(61L);\r
- entryBuilder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(MplsTc.class);\r
- entryBuilder.setHasMask(false);\r
- TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
- tcBuilder.setTc((short) 62);\r
- entryBuilder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
- entries.add(entryBuilder.build());\r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(MplsBos.class);\r
- entryBuilder.setHasMask(false);\r
- BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
- bosBuilder.setBos(true);\r
- entryBuilder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
- entries.add(entryBuilder.build());\r
- \r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(PbbIsid.class);\r
- entryBuilder.setHasMask(true);\r
- IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
- isidBuilder.setIsid(64L);\r
- entryBuilder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,1,2});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- \r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(TunnelId.class);\r
- entryBuilder.setHasMask(true);\r
- metadataBuilder = new MetadataMatchEntryBuilder();\r
- metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});\r
- entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- \r
- entryBuilder = new MatchEntriesBuilder();\r
- entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
- entryBuilder.setOxmMatchField(Ipv6Exthdr.class);\r
- entryBuilder.setHasMask(true);\r
- PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
- pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));\r
- entryBuilder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
- maskBuilder = new MaskMatchEntryBuilder();\r
- maskBuilder.setMask(new byte[]{0,2});\r
- entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
- entries.add(entryBuilder.build());\r
- \r
- \r
- \r
- builder.setMatchEntries(entries);\r
- Match match = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- matchSerializer.serialize(match, out);\r
- \r
- Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match length", 428, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 0, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 42, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 43, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 5, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 1L, out.readLong());\r
- Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 7, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
- byte[] array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,5}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 9, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,2}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 10, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 46, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 13, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 4141, out.readUnsignedShort());\r
- array = new byte[2];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,9}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 14, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 14, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 16, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 48, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 18, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 49, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 20, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 50, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 23, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,1}, array);\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,14}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 25, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,2}, array);\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,15}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 26, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 6653, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 28, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 6654, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 30, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 6655, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 32, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 6656, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 34, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 6657, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 36, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 6658, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 38, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 51, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 40, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 52, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 42, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 53, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 45, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,4}, array);\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,16}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 47, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,5}, array);\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,17}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 49, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,1,2,3,4,5}, array);\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,4,0,0,6}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 51, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,3}, array);\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,6,0,0,4}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 53, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());\r
- array = new byte[16];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
- array = new byte[16];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 55, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());\r
- array = new byte[16];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1}, array);\r
- array = new byte[16];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 57, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 58, out.readUnsignedInt());\r
- array = new byte[4];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,0,2}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 58, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 59, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 60, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 60, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 62, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
- array = new byte[16];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 64, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 66, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
- array = new byte[6];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 68, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 61, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 70, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 62, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 72, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 75, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 64, out.readUnsignedMedium());\r
- array = new byte[3];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,2}, array);\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 77, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 1L, out.readLong());\r
- Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());\r
- Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong match entry field & hasMask", 79, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
- Assert.assertEquals("Wrong match entry value", 358, out.readUnsignedShort());\r
- array = new byte[2];\r
- out.readBytes(array);\r
- Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,2}, array);\r
- Assert.assertTrue("Wrong padding", out.readableBytes() == 4);\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
+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.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13MatchSerializer02Test {
+
+ private SerializerRegistry registry;
+ private OFSerializer<Match> matchSerializer;
+
+ /**
+ * Initializes serializer table and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ matchSerializer = registry.getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));
+ }
+
+ /**
+ * Testing serialization of match
+ */
+ @Test
+ public void testEmptyMatch() {
+ MatchBuilder builder = new MatchBuilder();
+ builder.setType(OxmMatchType.class);
+ Match match = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ matchSerializer.serialize(match, out);
+
+ Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match length", 4, out.readUnsignedShort());
+ Assert.assertTrue("Wrong padding", out.readableBytes() == 4);
+ }
+
+ /**
+ * Testing serialization of match
+ */
+ @Test
+ public void test() {
+ MatchBuilder builder = new MatchBuilder();
+ builder.setType(OxmMatchType.class);
+ List<MatchEntries> entries = new ArrayList<>();
+ MatchEntriesBuilder entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(InPort.class);
+ entryBuilder.setHasMask(false);
+ PortNumberMatchEntryBuilder portNumberBuilder = new PortNumberMatchEntryBuilder();
+ portNumberBuilder.setPortNumber(new PortNumber(42L));
+ entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(InPhyPort.class);
+ entryBuilder.setHasMask(false);
+ portNumberBuilder = new PortNumberMatchEntryBuilder();
+ portNumberBuilder.setPortNumber(new PortNumber(43L));
+ entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Metadata.class);
+ entryBuilder.setHasMask(true);
+ MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();
+ metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});
+ entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+ MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(EthDst.class);
+ entryBuilder.setHasMask(true);
+ MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));
+ entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,0,0,5});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(EthSrc.class);
+ entryBuilder.setHasMask(true);
+ macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));
+ entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,0,0,2});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(EthType.class);
+ entryBuilder.setHasMask(false);
+ EthTypeMatchEntryBuilder ethBuilder = new EthTypeMatchEntryBuilder();
+ ethBuilder.setEthType(new EtherType(46));
+ entryBuilder.addAugmentation(EthTypeMatchEntry.class, ethBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(VlanVid.class);
+ entryBuilder.setHasMask(true);
+ VlanVidMatchEntryBuilder vidBuilder = new VlanVidMatchEntryBuilder();
+ vidBuilder.setCfiBit(true);
+ vidBuilder.setVlanVid(45);
+ entryBuilder.addAugmentation(VlanVidMatchEntry.class, vidBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,9});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(VlanPcp.class);
+ entryBuilder.setHasMask(false);
+ VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();
+ pcpBuilder.setVlanPcp((short) 14);
+ entryBuilder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(IpDscp.class);
+ entryBuilder.setHasMask(false);
+ DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();
+ dscpBuilder.setDscp(new Dscp((short) 48));
+ entryBuilder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(IpEcn.class);
+ entryBuilder.setHasMask(false);
+ EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();
+ ecnBuilder.setEcn((short) 49);
+ entryBuilder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(IpProto.class);
+ entryBuilder.setHasMask(false);
+ ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();
+ protoBuilder.setProtocolNumber((short) 50);
+ entryBuilder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv4Src.class);
+ entryBuilder.setHasMask(true);
+ Ipv4AddressMatchEntryBuilder ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+ ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.1"));
+ entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,14});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv4Dst.class);
+ entryBuilder.setHasMask(true);
+ ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+ ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.2"));
+ entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,15});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(TcpSrc.class);
+ entryBuilder.setHasMask(false);
+ PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6653));
+ entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(TcpDst.class);
+ entryBuilder.setHasMask(false);
+ portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6654));
+ entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(UdpSrc.class);
+ entryBuilder.setHasMask(false);
+ portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6655));
+ entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(UdpDst.class);
+ entryBuilder.setHasMask(false);
+ portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6656));
+ entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(SctpSrc.class);
+ entryBuilder.setHasMask(false);
+ portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6657));
+ entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(SctpDst.class);
+ entryBuilder.setHasMask(false);
+ portBuilder = new PortMatchEntryBuilder();
+ portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6658));
+ entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Icmpv4Type.class);
+ entryBuilder.setHasMask(false);
+ Icmpv4TypeMatchEntryBuilder icmpv4typeBuilder = new Icmpv4TypeMatchEntryBuilder();
+ icmpv4typeBuilder.setIcmpv4Type((short) 51);
+ entryBuilder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4typeBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Icmpv4Code.class);
+ entryBuilder.setHasMask(false);
+ Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();
+ icmpv4CodeBuilder.setIcmpv4Code((short) 52);
+ entryBuilder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(ArpOp.class);
+ entryBuilder.setHasMask(false);
+ OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();
+ opBuilder.setOpCode(53);
+ entryBuilder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(ArpSpa.class);
+ entryBuilder.setHasMask(true);
+ ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+ ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.4"));
+ entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,16});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(ArpTpa.class);
+ entryBuilder.setHasMask(true);
+ ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+ ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.5"));
+ entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,17});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(ArpSha.class);
+ entryBuilder.setHasMask(true);
+ macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress("00:01:02:03:04:05"));
+ entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,4,0,0,6});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(ArpTha.class);
+ entryBuilder.setHasMask(true);
+ macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress("00:00:00:00:00:03"));
+ entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,6,0,0,4});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6Src.class);
+ entryBuilder.setHasMask(true);
+ Ipv6AddressMatchEntryBuilder ipv6Builder = new Ipv6AddressMatchEntryBuilder();
+ ipv6Builder.setIpv6Address(new Ipv6Address("0:0:0:0:0:0:0:1"));
+ entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6Dst.class);
+ entryBuilder.setHasMask(true);
+ ipv6Builder = new Ipv6AddressMatchEntryBuilder();
+ ipv6Builder.setIpv6Address(new Ipv6Address("0:0:1:0:1:0:0:1"));
+ entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6Flabel.class);
+ entryBuilder.setHasMask(true);
+ Ipv6FlabelMatchEntryBuilder flabelBuilder = new Ipv6FlabelMatchEntryBuilder();
+ flabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(58L));
+ entryBuilder.addAugmentation(Ipv6FlabelMatchEntry.class, flabelBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,1,0,2});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Icmpv6Type.class);
+ entryBuilder.setHasMask(false);
+ Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();
+ icmpv6TypeBuilder.setIcmpv6Type((short) 59);
+ entryBuilder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Icmpv6Code.class);
+ entryBuilder.setHasMask(false);
+ Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();
+ icmpv6CodeBuilder.setIcmpv6Code((short) 60);
+ entryBuilder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6NdTarget.class);
+ entryBuilder.setHasMask(false);
+ ipv6Builder = new Ipv6AddressMatchEntryBuilder();
+ ipv6Builder.setIpv6Address(new Ipv6Address("F:0:0::0:0:0:1"));
+ entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6NdSll.class);
+ entryBuilder.setHasMask(false);
+ macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));
+ entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6NdTll.class);
+ entryBuilder.setHasMask(false);
+ macBuilder = new MacAddressMatchEntryBuilder();
+ macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));
+ entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(MplsLabel.class);
+ entryBuilder.setHasMask(false);
+ MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();
+ labelBuilder.setMplsLabel(61L);
+ entryBuilder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(MplsTc.class);
+ entryBuilder.setHasMask(false);
+ TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();
+ tcBuilder.setTc((short) 62);
+ entryBuilder.addAugmentation(TcMatchEntry.class, tcBuilder.build());
+ entries.add(entryBuilder.build());
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(MplsBos.class);
+ entryBuilder.setHasMask(false);
+ BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();
+ bosBuilder.setBos(true);
+ entryBuilder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
+ entries.add(entryBuilder.build());
+
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(PbbIsid.class);
+ entryBuilder.setHasMask(true);
+ IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();
+ isidBuilder.setIsid(64L);
+ entryBuilder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,1,2});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(TunnelId.class);
+ entryBuilder.setHasMask(true);
+ metadataBuilder = new MetadataMatchEntryBuilder();
+ metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});
+ entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+
+ entryBuilder = new MatchEntriesBuilder();
+ entryBuilder.setOxmClass(OpenflowBasicClass.class);
+ entryBuilder.setOxmMatchField(Ipv6Exthdr.class);
+ entryBuilder.setHasMask(true);
+ PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();
+ pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));
+ entryBuilder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
+ maskBuilder = new MaskMatchEntryBuilder();
+ maskBuilder.setMask(new byte[]{0,2});
+ entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+ entries.add(entryBuilder.build());
+
+
+
+ builder.setMatchEntries(entries);
+ Match match = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ matchSerializer.serialize(match, out);
+
+ Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match length", 428, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 0, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 42, out.readUnsignedInt());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 43, out.readUnsignedInt());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 5, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 1L, out.readLong());
+ Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 7, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+ byte[] array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,5}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 9, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,2}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 10, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 46, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 13, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 4141, out.readUnsignedShort());
+ array = new byte[2];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,9}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 14, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 14, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 16, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 48, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 18, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 49, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 20, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 50, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 23, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,1}, array);
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,14}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 25, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,2}, array);
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,15}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 26, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 6653, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 28, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 6654, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 30, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 6655, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 32, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 6656, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 34, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 6657, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 36, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 6658, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 38, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 51, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 40, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 52, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 42, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 53, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 45, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,4}, array);
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,16}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 47, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,5}, array);
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,17}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 49, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,1,2,3,4,5}, array);
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,4,0,0,6}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 51, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,3}, array);
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,6,0,0,4}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 53, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());
+ array = new byte[16];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);
+ array = new byte[16];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 55, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());
+ array = new byte[16];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1}, array);
+ array = new byte[16];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 57, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 58, out.readUnsignedInt());
+ array = new byte[4];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,0,2}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 58, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 59, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 60, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 60, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 62, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());
+ array = new byte[16];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 64, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 66, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());
+ array = new byte[6];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 68, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 61, out.readUnsignedInt());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 70, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 62, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 72, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 75, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 64, out.readUnsignedMedium());
+ array = new byte[3];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,2}, array);
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 77, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 1L, out.readLong());
+ Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());
+ Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+ Assert.assertEquals("Wrong match entry field & hasMask", 79, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+ Assert.assertEquals("Wrong match entry value", 358, out.readUnsignedShort());
+ array = new byte[2];
+ out.readBytes(array);
+ Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,2}, array);
+ Assert.assertTrue("Wrong padding", out.readableBytes() == 4);
+ }
+
+}
-/*\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.openflowjava.protocol.impl.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OpenflowUtilsTest {\r
-\r
- /**\r
- * Tests {@link OpenflowUtils#createPortState(long)}\r
- */\r
- @Test\r
- public void testPortState() {\r
- PortStateV10 state = OpenflowUtils.createPortState(512L);\r
- Assert.assertEquals("Wrong port state",\r
- new PortStateV10(false, false, false, false, true, false, true, false), state);\r
-\r
- state = OpenflowUtils.createPortState(1793L);\r
- Assert.assertEquals("Wrong port state",\r
- new PortStateV10(false, true, false, true, true, true, false, true), state);\r
-\r
- state = OpenflowUtils.createPortState(1L);\r
- Assert.assertEquals("Wrong port state",\r
- new PortStateV10(false, true, false, false, false, false, true, false), state);\r
- }\r
-\r
- /**\r
- * Tests {@link OpenflowUtils#createPortConfig(long)}\r
- */\r
- @Test\r
- public void testPortConfig() {\r
- PortConfigV10 config = OpenflowUtils.createPortConfig(127L);\r
- Assert.assertEquals("Wrong port config",\r
- new PortConfigV10(true, true, true, true, true, true, true), config);\r
-\r
- config = OpenflowUtils.createPortConfig(0L);\r
- Assert.assertEquals("Wrong port config",\r
- new PortConfigV10(false, false, false, false, false, false, false), config);\r
- }\r
-\r
- /**\r
- * Tests {@link OpenflowUtils#createPortFeatures(long)}\r
- */\r
- @Test\r
- public void testPortFeatures() {\r
- PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);\r
- Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,\r
- true, true, true, true, true), features);\r
-\r
- features = OpenflowUtils.createPortFeatures(0L);\r
- Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,\r
- false, false, false, false, false, false), features);\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.openflowjava.protocol.impl.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OpenflowUtilsTest {
+
+ /**
+ * Tests {@link OpenflowUtils#createPortState(long)}
+ */
+ @Test
+ public void testPortState() {
+ PortStateV10 state = OpenflowUtils.createPortState(512L);
+ Assert.assertEquals("Wrong port state",
+ new PortStateV10(false, false, false, false, true, false, true, false), state);
+
+ state = OpenflowUtils.createPortState(1793L);
+ Assert.assertEquals("Wrong port state",
+ new PortStateV10(false, true, false, true, true, true, false, true), state);
+
+ state = OpenflowUtils.createPortState(1L);
+ Assert.assertEquals("Wrong port state",
+ new PortStateV10(false, true, false, false, false, false, true, false), state);
+ }
+
+ /**
+ * Tests {@link OpenflowUtils#createPortConfig(long)}
+ */
+ @Test
+ public void testPortConfig() {
+ PortConfigV10 config = OpenflowUtils.createPortConfig(127L);
+ Assert.assertEquals("Wrong port config",
+ new PortConfigV10(true, true, true, true, true, true, true), config);
+
+ config = OpenflowUtils.createPortConfig(0L);
+ Assert.assertEquals("Wrong port config",
+ new PortConfigV10(false, false, false, false, false, false, false), config);
+ }
+
+ /**
+ * Tests {@link OpenflowUtils#createPortFeatures(long)}
+ */
+ @Test
+ public void testPortFeatures() {
+ PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);
+ Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,
+ true, true, true, true, true), features);
+
+ features = OpenflowUtils.createPortFeatures(0L);
+ Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,
+ false, false, false, false, false, false), features);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeKeyMakerFactoryTest {\r
-\r
- /**\r
- * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}\r
- */\r
- @Test\r
- public void testActionKeyMaker() {\r
- TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(Output.class);\r
- Action action = builder.build();\r
- MessageTypeKey<?> key = keyMaker.make(action);\r
-\r
- Assert.assertNotNull("Null key", key);\r
- Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- Output.class, null), key);\r
- }\r
-\r
- /**\r
- * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}\r
- */\r
- @Test\r
- public void testExperimenterActionKeyMaker() {\r
- TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
- ActionBuilder builder = new ActionBuilder();\r
- builder.setType(Experimenter.class);\r
- ExperimenterIdActionBuilder expIdBuilder = new ExperimenterIdActionBuilder();\r
- expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
- expIdBuilder.setSubType(ActionSubtypeClass.class);\r
- builder.addAugmentation(ExperimenterIdAction.class, expIdBuilder.build());\r
- Action action = builder.build();\r
- MessageTypeKey<?> key = keyMaker.make(action);\r
-\r
- Assert.assertNotNull("Null key", key);\r
- Assert.assertEquals("Wrong key", new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L,\r
- ActionSubtypeClass.class), key);\r
- }\r
-\r
- /**\r
- * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}\r
- */\r
- @Test\r
- public void testInstructionKeyMaker() {\r
- TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
- InstructionBuilder builder = new InstructionBuilder();\r
- builder.setType(GotoTable.class);\r
- Instruction instruction = builder.build();\r
- MessageTypeKey<?> key = keyMaker.make(instruction);\r
-\r
- Assert.assertNotNull("Null key", key);\r
- Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- GotoTable.class, null), key);\r
- }\r
-\r
- /**\r
- * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}\r
- */\r
- @Test\r
- public void testExperimenterInstructionKeyMaker() {\r
- TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
- InstructionBuilder builder = new InstructionBuilder();\r
- builder.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow\r
- .common.instruction.rev130731.Experimenter.class);\r
- ExperimenterIdInstructionBuilder expIdBuilder = new ExperimenterIdInstructionBuilder();\r
- expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
- builder.addAugmentation(ExperimenterIdInstruction.class, expIdBuilder.build());\r
- Instruction instruction = builder.build();\r
- MessageTypeKey<?> key = keyMaker.make(instruction);\r
-\r
- Assert.assertNotNull("Null key", key);\r
- Assert.assertEquals("Wrong key", new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID,\r
- 42L), key);\r
- }\r
-\r
- /**\r
- * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
- */\r
- @Test\r
- public void testMatchEntriesKeyMaker() {\r
- TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(OpenflowBasicClass.class);\r
- builder.setOxmMatchField(InPort.class);\r
- builder.setHasMask(true);\r
- MatchEntries entry = builder.build();\r
- MessageTypeKey<?> key = keyMaker.make(entry);\r
-\r
- Assert.assertNotNull("Null key", key);\r
- MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- OpenflowBasicClass.class, InPort.class);\r
- Assert.assertEquals("Wrong key", comparationKey, key);\r
- }\r
-\r
- /**\r
- * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
- */\r
- @Test\r
- public void testExperimenterMatchEntriesKeyMaker() {\r
- TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
- Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
- MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
- builder.setOxmClass(ExperimenterClass.class);\r
- builder.setOxmMatchField(OxmMatchFieldClass.class);\r
- builder.setHasMask(true);\r
- ExperimenterIdMatchEntryBuilder expIdBuilder = new ExperimenterIdMatchEntryBuilder();\r
- expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
- builder.addAugmentation(ExperimenterIdMatchEntry.class, expIdBuilder.build());\r
- MatchEntries entry = builder.build();\r
- MessageTypeKey<?> key = keyMaker.make(entry);\r
-\r
- Assert.assertNotNull("Null key", key);\r
- MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
- ExperimenterClass.class, OxmMatchFieldClass.class);\r
- comparationKey.setExperimenterId(42L);\r
- Assert.assertEquals("Wrong key", comparationKey, key);\r
- }\r
-\r
- private class ActionSubtypeClass extends ExperimenterActionSubType {\r
- // only for testing purposes\r
- }\r
-\r
- private class OxmMatchFieldClass extends MatchField {\r
- // only for testing purposes\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.openflowjava.protocol.impl.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeKeyMakerFactoryTest {
+
+ /**
+ * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}
+ */
+ @Test
+ public void testActionKeyMaker() {
+ TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null keyMaker", keyMaker);
+
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(Output.class);
+ Action action = builder.build();
+ MessageTypeKey<?> key = keyMaker.make(action);
+
+ Assert.assertNotNull("Null key", key);
+ Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ Output.class, null), key);
+ }
+
+ /**
+ * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}
+ */
+ @Test
+ public void testExperimenterActionKeyMaker() {
+ TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null keyMaker", keyMaker);
+
+ ActionBuilder builder = new ActionBuilder();
+ builder.setType(Experimenter.class);
+ ExperimenterIdActionBuilder expIdBuilder = new ExperimenterIdActionBuilder();
+ expIdBuilder.setExperimenter(new ExperimenterId(42L));
+ expIdBuilder.setSubType(ActionSubtypeClass.class);
+ builder.addAugmentation(ExperimenterIdAction.class, expIdBuilder.build());
+ Action action = builder.build();
+ MessageTypeKey<?> key = keyMaker.make(action);
+
+ Assert.assertNotNull("Null key", key);
+ Assert.assertEquals("Wrong key", new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L,
+ ActionSubtypeClass.class), key);
+ }
+
+ /**
+ * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}
+ */
+ @Test
+ public void testInstructionKeyMaker() {
+ TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null keyMaker", keyMaker);
+
+ InstructionBuilder builder = new InstructionBuilder();
+ builder.setType(GotoTable.class);
+ Instruction instruction = builder.build();
+ MessageTypeKey<?> key = keyMaker.make(instruction);
+
+ Assert.assertNotNull("Null key", key);
+ Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ GotoTable.class, null), key);
+ }
+
+ /**
+ * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}
+ */
+ @Test
+ public void testExperimenterInstructionKeyMaker() {
+ TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null keyMaker", keyMaker);
+
+ InstructionBuilder builder = new InstructionBuilder();
+ builder.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+ .common.instruction.rev130731.Experimenter.class);
+ ExperimenterIdInstructionBuilder expIdBuilder = new ExperimenterIdInstructionBuilder();
+ expIdBuilder.setExperimenter(new ExperimenterId(42L));
+ builder.addAugmentation(ExperimenterIdInstruction.class, expIdBuilder.build());
+ Instruction instruction = builder.build();
+ MessageTypeKey<?> key = keyMaker.make(instruction);
+
+ Assert.assertNotNull("Null key", key);
+ Assert.assertEquals("Wrong key", new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID,
+ 42L), key);
+ }
+
+ /**
+ * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ */
+ @Test
+ public void testMatchEntriesKeyMaker() {
+ TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null keyMaker", keyMaker);
+
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(OpenflowBasicClass.class);
+ builder.setOxmMatchField(InPort.class);
+ builder.setHasMask(true);
+ MatchEntries entry = builder.build();
+ MessageTypeKey<?> key = keyMaker.make(entry);
+
+ Assert.assertNotNull("Null key", key);
+ MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ OpenflowBasicClass.class, InPort.class);
+ Assert.assertEquals("Wrong key", comparationKey, key);
+ }
+
+ /**
+ * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ */
+ @Test
+ public void testExperimenterMatchEntriesKeyMaker() {
+ TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ Assert.assertNotNull("Null keyMaker", keyMaker);
+
+ MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ builder.setOxmClass(ExperimenterClass.class);
+ builder.setOxmMatchField(OxmMatchFieldClass.class);
+ builder.setHasMask(true);
+ ExperimenterIdMatchEntryBuilder expIdBuilder = new ExperimenterIdMatchEntryBuilder();
+ expIdBuilder.setExperimenter(new ExperimenterId(42L));
+ builder.addAugmentation(ExperimenterIdMatchEntry.class, expIdBuilder.build());
+ MatchEntries entry = builder.build();
+ MessageTypeKey<?> key = keyMaker.make(entry);
+
+ Assert.assertNotNull("Null key", key);
+ MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+ ExperimenterClass.class, OxmMatchFieldClass.class);
+ comparationKey.setExperimenterId(42L);
+ Assert.assertEquals("Wrong key", comparationKey, key);
+ }
+
+ private class ActionSubtypeClass extends ExperimenterActionSubType {
+ // only for testing purposes
+ }
+
+ private class OxmMatchFieldClass extends MatchField {
+ // only for testing purposes
+ }
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
-\r
- <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
- <layout class="org.apache.log4j.PatternLayout">\r
- <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
- </layout>\r
- </appender>\r
-\r
- <logger name="org.opendaylight.openflowjava.protocol.impl.integration" additivity="false">\r
- <level value="DEBUG" />\r
- <appender-ref ref="console" />\r
- </logger>\r
- <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">\r
- <level value="DEBUG" />\r
- <appender-ref ref="console" />\r
- </logger>\r
-\r
- <root>\r
- <priority value="INFO" />\r
- <appender-ref ref="console" />\r
- </root>\r
-</log4j:configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />
+ </layout>
+ </appender>
+
+ <logger name="org.opendaylight.openflowjava.protocol.impl.integration" additivity="false">
+ <level value="DEBUG" />
+ <appender-ref ref="console" />
+ </logger>
+ <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">
+ <level value="DEBUG" />
+ <appender-ref ref="console" />
+ </logger>
+
+ <root>
+ <priority value="INFO" />
+ <appender-ref ref="console" />
+ </root>
+</log4j:configuration>
-/*\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.openflowjava.protocol.spi.statistics;\r
-\r
-/**\r
- * Used for JConsole service\r
- * \r
- * @author michal.polkorab\r
- */\r
-public interface StatisticsHandler {\r
-\r
- /**\r
- * Resets all counters\r
- */\r
- public void resetCounters();\r
-\r
- /**\r
- * Prints statistics\r
- * @return statistics\r
- */\r
- public String printStatistics();\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.openflowjava.protocol.spi.statistics;
+
+/**
+ * Used for JConsole service
+ *
+ * @author michal.polkorab
+ */
+public interface StatisticsHandler {
+
+ /**
+ * Resets all counters
+ */
+ public void resetCounters();
+
+ /**
+ * Prints statistics
+ * @return statistics
+ */
+ public String printStatistics();
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. \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
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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 -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
-\r
- <modelVersion>4.0.0</modelVersion>\r
-\r
- <parent>\r
- <groupId>org.opendaylight.openflowjava</groupId>\r
- <artifactId>openflow-protocol-parent</artifactId>\r
- <version>0.6.0-SNAPSHOT</version>\r
- </parent>\r
- <artifactId>openflowjava-config</artifactId>\r
- <description>Configuration files for openflowjava statistics</description>\r
- <packaging>jar</packaging>\r
- <name>Openflow Protocol Library - CONFIG</name>\r
- <scm>\r
- <url>https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main</url>\r
- <tag>HEAD</tag>\r
- </scm>\r
- <properties>\r
- <configfile>45-openflowjava-stats.xml</configfile>\r
- </properties>\r
- <build>\r
- <plugins>\r
- <plugin>\r
- <groupId>org.codehaus.mojo</groupId>\r
- <artifactId>build-helper-maven-plugin</artifactId>\r
- <executions>\r
- <execution>\r
- <id>attach-artifacts</id>\r
- <goals>\r
- <goal>attach-artifact</goal>\r
- </goals>\r
- <phase>package</phase>\r
- <configuration>\r
- <artifacts>\r
- <artifact>\r
- <file>${project.build.directory}/classes/${configfile}</file>\r
- <type>xml</type>\r
- <classifier>configstats</classifier>\r
- </artifact>\r
- </artifacts>\r
- </configuration>\r
- </execution>\r
- </executions>\r
- </plugin>\r
- </plugins>\r
- </build>\r
-</project>\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.openflowjava</groupId>
+ <artifactId>openflow-protocol-parent</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>openflowjava-config</artifactId>
+ <description>Configuration files for openflowjava statistics</description>
+ <packaging>jar</packaging>
+ <name>Openflow Protocol Library - CONFIG</name>
+ <scm>
+ <url>https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main</url>
+ <tag>HEAD</tag>
+ </scm>
+ <properties>
+ <configfile>45-openflowjava-stats.xml</configfile>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${configfile}</file>
+ <type>xml</type>
+ <classifier>configstats</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- vi: set et smarttab sw=4 tabstop=4: -->\r
-<!--\r
-Copyright (c) 2013 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
-<snapshot>\r
- <required-capabilities>\r
- <!-- openflowjava -->\r
- <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl?module=openflow-switch-connection-provider-impl&revision=2014-03-28</capability>\r
- <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider?module=openflow-switch-connection-provider&revision=2014-03-28</capability>\r
- </required-capabilities>\r
-\r
- <configuration>\r
-\r
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">\r
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">\r
- <module>\r
- <type xmlns:stats="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl">stats:statistics-collection-service-impl</type>\r
- <name>statistics-collection-service-impl</name>\r
- <statistics>\r
- <statistics-collect>true</statistics-collect>\r
- <log-report-delay>10000</log-report-delay>\r
- </statistics>\r
- <openflow-switch-connection-provider>\r
- <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>\r
- <name>openflow-switch-connection-provider-default</name>\r
- </openflow-switch-connection-provider>\r
- <openflow-switch-connection-provider>\r
- <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>\r
- <name>openflow-switch-connection-provider-legacy</name>\r
- </openflow-switch-connection-provider>\r
- </module>\r
- </modules>\r
- </data>\r
-\r
- </configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright (c) 2013 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
+-->
+<snapshot>
+ <required-capabilities>
+ <!-- openflowjava -->
+ <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl?module=openflow-switch-connection-provider-impl&revision=2014-03-28</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider?module=openflow-switch-connection-provider&revision=2014-03-28</capability>
+ </required-capabilities>
+
+ <configuration>
+
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+ <type xmlns:stats="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl">stats:statistics-collection-service-impl</type>
+ <name>statistics-collection-service-impl</name>
+ <statistics>
+ <statistics-collect>true</statistics-collect>
+ <log-report-delay>10000</log-report-delay>
+ </statistics>
+ <openflow-switch-connection-provider>
+ <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>
+ <name>openflow-switch-connection-provider-default</name>
+ </openflow-switch-connection-provider>
+ <openflow-switch-connection-provider>
+ <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>
+ <name>openflow-switch-connection-provider-legacy</name>
+ </openflow-switch-connection-provider>
+ </module>
+ </modules>
+ </data>
+
+ </configuration>
</snapshot>
\ No newline at end of file
-/*\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.openflowjava.protocol.impl.clients;\r
-\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * Unifying interface for simple clients / switch simulators\r
- * \r
- * @author michal.polkorab\r
- */\r
-public interface OFClient extends Runnable {\r
-\r
- /**\r
- * @return the isOnlineFuture which is set when client is started\r
- */\r
- SettableFuture<Boolean> getIsOnlineFuture();\r
-\r
- /**\r
- * @return the scenarioDone when scenario is successfully finished\r
- */\r
- SettableFuture<Boolean> getScenarioDone();\r
-\r
- /**\r
- * @param scenario list of desired actions\r
- */\r
- void setScenarioHandler(ScenarioHandler scenario);\r
-\r
- /**\r
- * @param securedClient true is client should use encrypted communication,\r
- * false otherwise\r
- */\r
- void setSecuredClient(boolean securedClient);\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.openflowjava.protocol.impl.clients;
+
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * Unifying interface for simple clients / switch simulators
+ *
+ * @author michal.polkorab
+ */
+public interface OFClient extends Runnable {
+
+ /**
+ * @return the isOnlineFuture which is set when client is started
+ */
+ SettableFuture<Boolean> getIsOnlineFuture();
+
+ /**
+ * @return the scenarioDone when scenario is successfully finished
+ */
+ SettableFuture<Boolean> getScenarioDone();
+
+ /**
+ * @param scenario list of desired actions
+ */
+ void setScenarioHandler(ScenarioHandler scenario);
+
+ /**
+ * @param securedClient true is client should use encrypted communication,
+ * false otherwise
+ */
+ void setSecuredClient(boolean securedClient);
}
\ No newline at end of file
-/*\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.openflowjava.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class ExperimenterDeserializerKeyFactory {\r
-\r
- /**\r
- * @param version openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdDeserializerKey createExperimenterErrorDeserializerKey(\r
- short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, ErrorMessage.class);\r
- }\r
-\r
- /**\r
- * @param version openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdDeserializerKey createExperimenterMessageDeserializerKey(\r
- short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterMessage.class);\r
- }\r
-\r
- /**\r
- * @param version openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdDeserializerKey createMultipartReplyMessageDeserializerKey(\r
- short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyExperimenterCase.class);\r
- }\r
-\r
- /**\r
- * @param version openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdDeserializerKey createMultipartReplyTFDeserializerKey(\r
- short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, TableFeatureProperties.class);\r
- }\r
-\r
- /**\r
- * @param version openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdDeserializerKey createQueuePropertyDeserializerKey(\r
- short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, QueueProperty.class);\r
- }\r
-\r
- /**\r
- * @param version openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdDeserializerKey createMeterBandDeserializerKey(\r
- short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, MeterBandExperimenterCase.class);\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.openflowjava.util;
+
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class ExperimenterDeserializerKeyFactory {
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createExperimenterErrorDeserializerKey(
+ short version, Long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, ErrorMessage.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createExperimenterMessageDeserializerKey(
+ short version, Long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterMessage.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createMultipartReplyMessageDeserializerKey(
+ short version, Long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyExperimenterCase.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createMultipartReplyTFDeserializerKey(
+ short version, Long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, TableFeatureProperties.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createQueuePropertyDeserializerKey(
+ short version, Long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, QueueProperty.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createMeterBandDeserializerKey(
+ short version, Long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, MeterBandExperimenterCase.class);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class ExperimenterSerializerKeyFactory {\r
-\r
- /**\r
- * @param msgVersion openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdSerializerKey<ExperimenterInput> createExperimenterMessageSerializerKey(\r
- short msgVersion, Long experimenterId) {\r
- return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, ExperimenterInput.class);\r
- }\r
-\r
- /**\r
- * @param msgVersion openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> createMultipartRequestSerializerKey(\r
- short msgVersion, Long experimenterId) {\r
- return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MultipartRequestExperimenterCase.class);\r
- }\r
-\r
- /**\r
- * @param msgVersion openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(\r
- short msgVersion, Long experimenterId) {\r
- return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);\r
- }\r
-\r
- /**\r
- * @param msgVersion openflow wire version\r
- * @param experimenterId experimenter / vendor ID\r
- * @return key instance\r
- */\r
- public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(\r
- short msgVersion, Long experimenterId) {\r
- return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MeterBandExperimenterCase.class);\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.openflowjava.util;
+
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class ExperimenterSerializerKeyFactory {
+
+ /**
+ * @param msgVersion openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdSerializerKey<ExperimenterInput> createExperimenterMessageSerializerKey(
+ short msgVersion, Long experimenterId) {
+ return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, ExperimenterInput.class);
+ }
+
+ /**
+ * @param msgVersion openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> createMultipartRequestSerializerKey(
+ short msgVersion, Long experimenterId) {
+ return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MultipartRequestExperimenterCase.class);
+ }
+
+ /**
+ * @param msgVersion openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(
+ short msgVersion, Long experimenterId) {
+ return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);
+ }
+
+ /**
+ * @param msgVersion openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
+ short msgVersion, Long experimenterId) {
+ return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MeterBandExperimenterCase.class);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterDeserializerKeyFactoryTest {\r
-\r
- /**\r
- * Test ExperimenterDeserializerKeyFactory key creation\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory\r
- .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- ExperimenterIdDeserializerKey comparationKey =\r
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, ErrorMessage.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, 43L);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- 43L, ExperimenterMessage.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, ExperimenterMessage.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, 44L);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- 44L, MeterBandExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, MeterBandExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, 45L);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- 45L, MultipartReplyExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, MultipartReplyExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, TableFeatureProperties.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, TableFeatureProperties.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, QueueProperty.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
- null, QueueProperty.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\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.openflowjava.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterDeserializerKeyFactoryTest {
+
+ /**
+ * Test ExperimenterDeserializerKeyFactory key creation
+ */
+ @Test
+ public void test() {
+ ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory
+ .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ ExperimenterIdDeserializerKey comparationKey =
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, ErrorMessage.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 43L);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 43L, ExperimenterMessage.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, ExperimenterMessage.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 44L);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 44L, MeterBandExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, MeterBandExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 45L);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 45L, MultipartReplyExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, MultipartReplyExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, TableFeatureProperties.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, TableFeatureProperties.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, QueueProperty.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ null, QueueProperty.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ }
}
\ No newline at end of file
-/*\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.openflowjava.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterSerializerKeyFactoryTest {\r
-\r
- /**\r
- * Test ExperimenterSerializerKeyFactory key creation\r
- */\r
- @Test\r
- public void test() {\r
- ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory\r
- .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
- ExperimenterIdSerializerKey<?> comparationKey =\r
- new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- null, ExperimenterInput.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, 43L);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- 43L, MeterBandExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- null, MeterBandExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, 44L);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- 44L, MultipartRequestExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- null, MultipartRequestExperimenterCase.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, 45L);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- 45L, TableFeatureProperties.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
- createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(\r
- EncodeConstants.OF10_VERSION_ID, null);\r
- comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
- null, TableFeatureProperties.class);\r
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);\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.openflowjava.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterSerializerKeyFactoryTest {
+
+ /**
+ * Test ExperimenterSerializerKeyFactory key creation
+ */
+ @Test
+ public void test() {
+ ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory
+ .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+ ExperimenterIdSerializerKey<?> comparationKey =
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ null, ExperimenterInput.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, 43L);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 43L, MeterBandExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ null, MeterBandExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, 44L);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 44L, MultipartRequestExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ null, MultipartRequestExperimenterCase.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, 45L);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 45L, TableFeatureProperties.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
+ EncodeConstants.OF10_VERSION_ID, null);
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ null, TableFeatureProperties.class);
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ }
}
\ No newline at end of file