From: Ed Warnicke Date: Sat, 8 Jun 2013 14:08:53 +0000 (+0000) Subject: Revert "Checkstyle enforcer" X-Git-Tag: releasepom-0.1.0~385^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=e2f7aaa41e482815ca1d4495eb85c8653cd903ab Revert "Checkstyle enforcer" This reverts commit 541d0a36997f292bb037a2199463431eee538358 We are going to talk a bit more about this before doing it. Change-Id: I788ecea18796c6eb325285dfaa83a6aae300634c --- diff --git a/.gitignore b/.gitignore index d1b82619fd..b92845c8d7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ target .project .settings MANIFEST.MF -opendaylight/northbound/integrationtest/logs/* diff --git a/opendaylight/arphandler/src/test/java/org/opendaylight/controller/arphandler/internal/ArphandlerTest.java b/opendaylight/arphandler/src/test/java/org/opendaylight/controller/arphandler/internal/ArphandlerTest.java index 19c8b4d35b..5a6641c685 100644 --- a/opendaylight/arphandler/src/test/java/org/opendaylight/controller/arphandler/internal/ArphandlerTest.java +++ b/opendaylight/arphandler/src/test/java/org/opendaylight/controller/arphandler/internal/ArphandlerTest.java @@ -16,14 +16,14 @@ import org.junit.Assert; import org.junit.Test; public class ArphandlerTest extends TestCase { - - @Test - public void testArphandlerCreation() { - - ArpHandler ah = null; - ah = new ArpHandler(); - Assert.assertTrue(ah != null); - - } + + @Test + public void testArphandlerCreation() { + + ArpHandler ah = null; + ah = new ArpHandler(); + Assert.assertTrue(ah != null); + + } } diff --git a/opendaylight/clustering/integrationtest/src/test/resources/logback.xml b/opendaylight/clustering/integrationtest/src/test/resources/logback.xml index 6d9dfda9a3..2d63ce5744 100644 --- a/opendaylight/clustering/integrationtest/src/test/resources/logback.xml +++ b/opendaylight/clustering/integrationtest/src/test/resources/logback.xml @@ -1,4 +1,5 @@ + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/opendaylight/clustering/test/src/test/java/org/opendaylight/controller/clustering/test/internal/TestClusteringTest.java b/opendaylight/clustering/test/src/test/java/org/opendaylight/controller/clustering/test/internal/TestClusteringTest.java index 1142909f85..fa00c7f455 100644 --- a/opendaylight/clustering/test/src/test/java/org/opendaylight/controller/clustering/test/internal/TestClusteringTest.java +++ b/opendaylight/clustering/test/src/test/java/org/opendaylight/controller/clustering/test/internal/TestClusteringTest.java @@ -17,51 +17,51 @@ import junit.framework.TestCase; public class TestClusteringTest extends TestCase { - @Test - public void testComplexClass() { - ComplexClass cc = new ComplexClass("cplxc1"); - Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc1")); - cc.IAm("cplxc2"); - Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc2")); - } - - @Test - public void testComplexClass1() { - ComplexClass1 cc1 = new ComplexClass1("cplxc1a"); - Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1a")); - cc1.IAm("cplxc1b"); - Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1b")); - } - - - @Test - public void testComplexContainer() { - ComplexContainer cplxcontnr1 = new ComplexContainer("cct1", 5); - Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct1]-[ComplexClass1_cct1]")); - Assert.assertTrue(cplxcontnr1.getState() == 5); - - cplxcontnr1.setIdentity("cct2"); - Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct2]-[ComplexClass1_cct2]")); - - Assert.assertTrue(cplxcontnr1.toString().equals( - "{ID:[ComplexClass_cct2]-[ComplexClass1_cct2],STATE:5}")); - } - - @Test - public void testStringContainer() { - StringContainer strcontainer1 = new StringContainer(); - Assert.assertTrue(strcontainer1.getMystring() == null); - Assert.assertTrue(strcontainer1.hashCode() == 0); - - StringContainer strcontainer2 = new StringContainer("foo"); - Assert.assertTrue(strcontainer2.getMystring() != null); - Assert.assertTrue(strcontainer2.hashCode() != 0); - - strcontainer1.setMystring("foo"); - Assert.assertTrue(strcontainer2.equals(strcontainer1)); - - Assert.assertTrue(strcontainer2.toString().equals("{foo}")); - } - + @Test + public void testComplexClass() { + ComplexClass cc = new ComplexClass("cplxc1"); + Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc1")); + cc.IAm("cplxc2"); + Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc2")); + } + + @Test + public void testComplexClass1() { + ComplexClass1 cc1 = new ComplexClass1("cplxc1a"); + Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1a")); + cc1.IAm("cplxc1b"); + Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1b")); + } + + + @Test + public void testComplexContainer() { + ComplexContainer cplxcontnr1 = new ComplexContainer("cct1", 5); + Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct1]-[ComplexClass1_cct1]")); + Assert.assertTrue(cplxcontnr1.getState() == 5); + + cplxcontnr1.setIdentity("cct2"); + Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct2]-[ComplexClass1_cct2]")); + + Assert.assertTrue(cplxcontnr1.toString().equals( + "{ID:[ComplexClass_cct2]-[ComplexClass1_cct2],STATE:5}")); + } + + @Test + public void testStringContainer() { + StringContainer strcontainer1 = new StringContainer(); + Assert.assertTrue(strcontainer1.getMystring() == null); + Assert.assertTrue(strcontainer1.hashCode() == 0); + + StringContainer strcontainer2 = new StringContainer("foo"); + Assert.assertTrue(strcontainer2.getMystring() != null); + Assert.assertTrue(strcontainer2.hashCode() != 0); + + strcontainer1.setMystring("foo"); + Assert.assertTrue(strcontainer2.equals(strcontainer1)); + + Assert.assertTrue(strcontainer2.toString().equals("{foo}")); + } + } diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Acceptor.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Acceptor.java index 9e9774e266..9d34dfb8a7 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Acceptor.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Acceptor.java @@ -12,7 +12,7 @@ package org.opendaylight.controller.concepts.transform; public interface Acceptor { /** - * + * * @param input * @return true if input is accepted. */ diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/AggregateTransformer.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/AggregateTransformer.java index 061a57fc15..23bcb563d3 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/AggregateTransformer.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/AggregateTransformer.java @@ -10,7 +10,7 @@ package org.opendaylight.controller.concepts.transform; import java.util.Collection; /** - * + * * @author Tony Tkacik * * @param diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/CompositeClassBasedTransformer.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/CompositeClassBasedTransformer.java index dae949912b..fa6408d3d1 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/CompositeClassBasedTransformer.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/CompositeClassBasedTransformer.java @@ -17,26 +17,26 @@ import java.util.concurrent.ConcurrentHashMap; /** * Transformer which aggregates multiple implementations of * {@link InputClassBasedTransformer}. - * + * * The transformation process is driven by {@link Class} of input. The selection * of used {@link InputClassBasedTransformer} is done by using the {@link Class} * of input as a key to select the transformer. - * + * * This approach provides quick resolution of transformer, but does not support * registering a super type of input to provide transformation support for all * subclasses, one must register a new instance of transformer for each valid * input class. - * + * * If you need more flexible selection of transformation consider using * {@link CompositeConditionalTransformer} which is slower but most flexible or * {@link RuleBasedTransformer} which provides declarative approach for * transformation. - * + * * See {@link #transform(Object)} for more information about tranformation * process. - * + * * @author Tony Tkacik - * + * * @param * Input super-type * @param

@@ -50,18 +50,18 @@ public abstract class CompositeClassBasedTransformer implements /** * Transforms an input into instance of Product class. - * + * * The final registered transformer is the one which match following * condition: - * + * * input.getClass() == transformer.getInputClass() - * + * * This means that transformers are not resolved by class hierarchy, only * selected based on final class of the input. If you need more flexible * selection of transformation consider using * {@link CompositeConditionalTransformer} which is slower but more * flexible. - * + * */ @Override public P transform(I input) { @@ -76,11 +76,11 @@ public abstract class CompositeClassBasedTransformer implements /** * Registers a new transformer. - * + * * The transformer is registered for class returned by * {@link InputClassBasedTransformer#getInputClass()}. Only one transformer * can be registered for particular input class. - * + * */ public void addTransformer( InputClassBasedTransformer transformer) @@ -95,9 +95,9 @@ public abstract class CompositeClassBasedTransformer implements /** * Removes an registered transformer. - * + * * Note: Removal is currently unsupported. - * + * * @param transformer * Tranformer to be removed. * @throws IllegalArgumentException @@ -108,7 +108,7 @@ public abstract class CompositeClassBasedTransformer implements throws IllegalArgumentException { throw new UnsupportedOperationException("Not implemented yet"); } - + @Override public Collection

transformAll(Collection inputs) { Collection

ret = new ArrayList

(); diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/InputClassBasedTransformer.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/InputClassBasedTransformer.java index 1ad849bddc..3e6b39abf5 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/InputClassBasedTransformer.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/InputClassBasedTransformer.java @@ -10,15 +10,15 @@ package org.opendaylight.controller.concepts.transform; /** * Input class based transformer - * + * * {@link Transformer} which accepts / transforms only specific classes of * input, and is useful if the selection of transformer should be based on the * class of the input and there is one-to-one mapping between input class and * transformer. - * - * + * + * * @author Tony Tkacik - * + * * @param * Common supertype of input * @param @@ -31,7 +31,7 @@ public interface InputClassBasedTransformer extends /** * Returns an {@link Class} of input which is acceptable for transformation. - * + * * @return {@link Class} of input which is acceptable for transformation. */ Class getInputClass(); diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/RuleBasedTransformer.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/RuleBasedTransformer.java index 820b94a7ac..9f717eaa5b 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/RuleBasedTransformer.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/RuleBasedTransformer.java @@ -12,15 +12,15 @@ import java.util.Set; /** * Transformer with set of acceptance rules - * + * * The transformer provides a set of {@link Acceptor}s, which could be used to * verify if the input will produce result using the transformer. - * + * * The transormer is able to produce result if ANY of associated * {@link Acceptor}s accepted result. - * + * * @author Tony Tkacik - * + * * @param * Input class for transformation * @param

@@ -31,10 +31,10 @@ public interface RuleBasedTransformer extends Transformer { /** * Set of {@link Acceptor}, which could be used to verify if the input is * usable by transformer. - * + * * The transformer is able to produce result if ANY of associated * {@link Acceptor}s accepted result. - * + * * @return Set of input acceptance rules associated to this transformer. */ Set> getRules(); diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/SimpleConditionalTransformer.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/SimpleConditionalTransformer.java index 4d0aa03e15..81e43c39d1 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/SimpleConditionalTransformer.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/SimpleConditionalTransformer.java @@ -10,15 +10,15 @@ package org.opendaylight.controller.concepts.transform; /** * Simple condition-based transformer - * + * * The transformer provides {@link #isAcceptable(Object)} method, * which could be used to query transformer if the input will produce * result. - * + * * This interface is simplified version of {@link RuleBasedTransformer} - does not * provide decoupling of Acceptance rule from transformer, and should be used only * for simple use-cases. - * + * * @author Tony Tkacik * * @param Input class for transformation @@ -28,9 +28,9 @@ public interface SimpleConditionalTransformer extends Transformer, Ac /** - * Checks if the input is acceptable + * Checks if the input is acceptable * for processing by the transformer. - * + * * @return true it the input is acceptable for processing by transformer. */ @Override diff --git a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Transformer.java b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Transformer.java index 18184e122a..f80ccfffd8 100644 --- a/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Transformer.java +++ b/opendaylight/commons/concepts/src/main/java/org/opendaylight/controller/concepts/transform/Transformer.java @@ -10,7 +10,7 @@ package org.opendaylight.controller.concepts.transform; /** * Factory which produces product based on input object - * + * * @author Tony Tkacik * * @param Input @@ -19,7 +19,7 @@ package org.opendaylight.controller.concepts.transform; public interface Transformer { /** * Transforms input into instance of product. - * + * * @param input Input which drives transformation * @return Instance of product which was created from supplied input. */ diff --git a/opendaylight/commons/integrationtest/logback.xml b/opendaylight/commons/integrationtest/logback.xml deleted file mode 100644 index 043ceef329..0000000000 --- a/opendaylight/commons/integrationtest/logback.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/opendaylight/commons/integrationtest/space_and_tabs_checks.xml b/opendaylight/commons/integrationtest/space_and_tabs_checks.xml deleted file mode 100644 index 49a5802444..0000000000 --- a/opendaylight/commons/integrationtest/space_and_tabs_checks.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/opendaylight/commons/integrationtest/sun_coding_style.xml b/opendaylight/commons/integrationtest/sun_coding_style.xml deleted file mode 100644 index f4516b913d..0000000000 --- a/opendaylight/commons/integrationtest/sun_coding_style.xml +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 2792adcb7b..9814b5f91c 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -279,23 +279,6 @@ ${project.parent.relativePath}/sun_coding_style.xml - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.10 - - - process-sources - - check - - - - - true - ${project.parent.relativePath}/space_and_tabs_checks.xml - - org.apache.maven.plugins maven-failsafe-plugin @@ -362,30 +345,17 @@ - - org.ops4j.pax.exam - maven-paxexam-plugin - [1.2.4,) - - generate-depends-file - - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [2.0,) - - check - - - - - + + org.ops4j.pax.exam + maven-paxexam-plugin + [1.2.4,) + + generate-depends-file + + + + + diff --git a/opendaylight/commons/opendaylight/space_and_tabs_checks.xml b/opendaylight/commons/opendaylight/space_and_tabs_checks.xml deleted file mode 100644 index 49a5802444..0000000000 --- a/opendaylight/commons/opendaylight/space_and_tabs_checks.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImpl.java b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImpl.java index 9fb0c23b36..3d0c5659d6 100644 --- a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImpl.java +++ b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImpl.java @@ -51,9 +51,9 @@ public class ConfigurationContainerImpl implements } public int getConfigurationAwareListSize() { - return this.configurationAwareList.size(); + return this.configurationAwareList.size(); } - + public void removeConfigurationContainerAware( IConfigurationContainerAware configurationAware) { this.configurationAwareList.remove(configurationAware); @@ -88,16 +88,16 @@ public class ConfigurationContainerImpl implements Status status = configurationAware.saveConfiguration(); if (!status.isSuccess()) { - success = false; - logger.info("Failed to save config for {}", - configurationAware.getClass().getSimpleName()); + success = false; + logger.info("Failed to save config for {}", + configurationAware.getClass().getSimpleName()); } } if (success) { return new Status(StatusCode.SUCCESS, null); } else { return new Status(StatusCode.INTERNALERROR, - "Failed to Save All Configurations"); + "Failed to Save All Configurations"); } } diff --git a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationImpl.java b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationImpl.java index 20821f1028..ee15b4a9c2 100644 --- a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationImpl.java +++ b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationImpl.java @@ -41,11 +41,11 @@ public class ConfigurationImpl implements IConfigurationService { private Set configurationAwareList = (Set) Collections .synchronizedSet(new HashSet()); - + public int getConfigurationAwareListSize() { - return this.configurationAwareList.size(); + return this.configurationAwareList.size(); } - + public void addConfigurationAware(IConfigurationAware configurationAware) { if (!this.configurationAwareList.contains(configurationAware)) { this.configurationAwareList.add(configurationAware); @@ -81,18 +81,18 @@ public class ConfigurationImpl implements IConfigurationService { public Status saveConfigurations() { boolean success = true; for (IConfigurationAware configurationAware : configurationAwareList) { - Status status = configurationAware.saveConfiguration(); + Status status = configurationAware.saveConfiguration(); if (!status.isSuccess()) { - success = false; - logger.info("Failed to save config for {}", - configurationAware.getClass().getName()); + success = false; + logger.info("Failed to save config for {}", + configurationAware.getClass().getName()); } } if (success) { return new Status(StatusCode.SUCCESS, null); } else { return new Status(StatusCode.INTERNALERROR, - "Failed to Save All Configurations"); + "Failed to Save All Configurations"); } } diff --git a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationAwareTest.java b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationAwareTest.java index c9dd5e2f39..e93b467b9a 100644 --- a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationAwareTest.java +++ b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationAwareTest.java @@ -22,11 +22,11 @@ import org.opendaylight.controller.sal.utils.Status; public class ConfigurationAwareTest implements IConfigurationAware { - - @Override - public Status saveConfiguration() { - return null; - } + + @Override + public Status saveConfiguration() { + return null; + } } diff --git a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerAwareTest.java b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerAwareTest.java index c5d6bdc5d6..52f3776e6d 100644 --- a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerAwareTest.java +++ b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerAwareTest.java @@ -23,13 +23,13 @@ import org.opendaylight.controller.sal.utils.Status; public class ConfigurationContainerAwareTest implements IConfigurationContainerAware { - - - - @Override - public Status saveConfiguration() { - return null; - } - - + + + + @Override + public Status saveConfiguration() { + return null; + } + + } diff --git a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImplTest.java b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImplTest.java index a82a9f23d8..1d704a1937 100644 --- a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImplTest.java +++ b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationContainerImplTest.java @@ -14,51 +14,52 @@ import org.opendaylight.controller.configuration.IConfigurationContainerAware; -public class ConfigurationContainerImplTest { - - - @Test - public void testAddRemoveSaveConfiguration() { - - ConfigurationContainerImpl configurationContainerImpl = new ConfigurationContainerImpl(); - IConfigurationContainerAware testConfigurationContainerAware = new ConfigurationContainerAwareTest(); - - configurationContainerImpl.addConfigurationContainerAware(testConfigurationContainerAware); - configurationContainerImpl.addConfigurationContainerAware(testConfigurationContainerAware); - - Assert.assertEquals(1, configurationContainerImpl.getConfigurationAwareListSize()); - - IConfigurationContainerAware testConfigurationAware1 = new ConfigurationContainerAwareTest(); - configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware1); - - Assert.assertEquals(2, configurationContainerImpl.getConfigurationAwareListSize()); - - IConfigurationContainerAware testConfigurationAware2 = new ConfigurationContainerAwareTest(); - configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware2); - - Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize()); - - IConfigurationContainerAware testConfigurationAware3 = new ConfigurationContainerAwareTest(); - configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware3); - - Assert.assertEquals(4, configurationContainerImpl.getConfigurationAwareListSize()); - - configurationContainerImpl.removeConfigurationContainerAware(testConfigurationContainerAware); - Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize()); - - configurationContainerImpl.removeConfigurationContainerAware(testConfigurationContainerAware); - Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize()); - - configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware3); - Assert.assertEquals(2, configurationContainerImpl.getConfigurationAwareListSize()); - - configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware2); - Assert.assertEquals(1, configurationContainerImpl.getConfigurationAwareListSize()); - - configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware1); - Assert.assertEquals(0, configurationContainerImpl.getConfigurationAwareListSize()); - - - } - +public class ConfigurationContainerImplTest { + + + @Test + public void testAddRemoveSaveConfiguration() { + + ConfigurationContainerImpl configurationContainerImpl = new ConfigurationContainerImpl(); + IConfigurationContainerAware testConfigurationContainerAware = new ConfigurationContainerAwareTest(); + + configurationContainerImpl.addConfigurationContainerAware(testConfigurationContainerAware); + configurationContainerImpl.addConfigurationContainerAware(testConfigurationContainerAware); + + Assert.assertEquals(1, configurationContainerImpl.getConfigurationAwareListSize()); + + IConfigurationContainerAware testConfigurationAware1 = new ConfigurationContainerAwareTest(); + configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware1); + + Assert.assertEquals(2, configurationContainerImpl.getConfigurationAwareListSize()); + + IConfigurationContainerAware testConfigurationAware2 = new ConfigurationContainerAwareTest(); + configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware2); + + Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize()); + + IConfigurationContainerAware testConfigurationAware3 = new ConfigurationContainerAwareTest(); + configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware3); + + Assert.assertEquals(4, configurationContainerImpl.getConfigurationAwareListSize()); + + configurationContainerImpl.removeConfigurationContainerAware(testConfigurationContainerAware); + Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize()); + + configurationContainerImpl.removeConfigurationContainerAware(testConfigurationContainerAware); + Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize()); + + configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware3); + Assert.assertEquals(2, configurationContainerImpl.getConfigurationAwareListSize()); + + configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware2); + Assert.assertEquals(1, configurationContainerImpl.getConfigurationAwareListSize()); + + configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware1); + Assert.assertEquals(0, configurationContainerImpl.getConfigurationAwareListSize()); + + + } + } + diff --git a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationImplTest.java b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationImplTest.java index 816c6ce2bd..71d768d907 100644 --- a/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationImplTest.java +++ b/opendaylight/configuration/implementation/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationImplTest.java @@ -12,51 +12,52 @@ package org.opendaylight.controller.configuration.internal; import org.junit.*; import org.opendaylight.controller.configuration.IConfigurationAware; -public class ConfigurationImplTest { - - - @Test - public void testAddRemoveSaveConfiguration() { - - ConfigurationImpl configurationImpl = new ConfigurationImpl(); - IConfigurationAware testConfigurationAware = new ConfigurationAwareTest(); - - configurationImpl.addConfigurationAware(testConfigurationAware); - configurationImpl.addConfigurationAware(testConfigurationAware); - - Assert.assertEquals(1, configurationImpl.getConfigurationAwareListSize()); - - ConfigurationAwareTest testConfigurationAware1 = new ConfigurationAwareTest(); - configurationImpl.addConfigurationAware(testConfigurationAware1); - - Assert.assertEquals(2, configurationImpl.getConfigurationAwareListSize()); - - ConfigurationAwareTest testConfigurationAware2 = new ConfigurationAwareTest(); - configurationImpl.addConfigurationAware(testConfigurationAware2); - - Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize()); - - ConfigurationAwareTest testConfigurationAware3 = new ConfigurationAwareTest(); - configurationImpl.addConfigurationAware(testConfigurationAware3); - - Assert.assertEquals(4, configurationImpl.getConfigurationAwareListSize()); - - - configurationImpl.removeConfigurationAware(testConfigurationAware); - Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize()); - - configurationImpl.removeConfigurationAware(testConfigurationAware); - Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize()); - - configurationImpl.removeConfigurationAware(testConfigurationAware3); - Assert.assertEquals(2, configurationImpl.getConfigurationAwareListSize()); - - configurationImpl.removeConfigurationAware(testConfigurationAware1); - Assert.assertEquals(1, configurationImpl.getConfigurationAwareListSize()); - - configurationImpl.removeConfigurationAware(testConfigurationAware2); - Assert.assertEquals(0, configurationImpl.getConfigurationAwareListSize()); - - } - +public class ConfigurationImplTest { + + + @Test + public void testAddRemoveSaveConfiguration() { + + ConfigurationImpl configurationImpl = new ConfigurationImpl(); + IConfigurationAware testConfigurationAware = new ConfigurationAwareTest(); + + configurationImpl.addConfigurationAware(testConfigurationAware); + configurationImpl.addConfigurationAware(testConfigurationAware); + + Assert.assertEquals(1, configurationImpl.getConfigurationAwareListSize()); + + ConfigurationAwareTest testConfigurationAware1 = new ConfigurationAwareTest(); + configurationImpl.addConfigurationAware(testConfigurationAware1); + + Assert.assertEquals(2, configurationImpl.getConfigurationAwareListSize()); + + ConfigurationAwareTest testConfigurationAware2 = new ConfigurationAwareTest(); + configurationImpl.addConfigurationAware(testConfigurationAware2); + + Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize()); + + ConfigurationAwareTest testConfigurationAware3 = new ConfigurationAwareTest(); + configurationImpl.addConfigurationAware(testConfigurationAware3); + + Assert.assertEquals(4, configurationImpl.getConfigurationAwareListSize()); + + + configurationImpl.removeConfigurationAware(testConfigurationAware); + Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize()); + + configurationImpl.removeConfigurationAware(testConfigurationAware); + Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize()); + + configurationImpl.removeConfigurationAware(testConfigurationAware3); + Assert.assertEquals(2, configurationImpl.getConfigurationAwareListSize()); + + configurationImpl.removeConfigurationAware(testConfigurationAware1); + Assert.assertEquals(1, configurationImpl.getConfigurationAwareListSize()); + + configurationImpl.removeConfigurationAware(testConfigurationAware2); + Assert.assertEquals(0, configurationImpl.getConfigurationAwareListSize()); + + } + } + diff --git a/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManager.java b/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManager.java index b956d76a2e..f057959ee8 100644 --- a/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManager.java +++ b/opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/IContainerManager.java @@ -23,14 +23,14 @@ public interface IContainerManager { /** * Returns a list of Containers that currently exist. * - * @return array of String Container names + * @return array of String Container names */ public boolean hasNonDefaultContainer(); /** * Returns a list of Containers that currently exist. * - * @return array of String Container names + * @return array of String Container names */ public List getContainerNames(); @@ -39,7 +39,7 @@ public interface IContainerManager { * TODO : REMOVE THIS FUNCTION and make Save as a service rather than the * current hack of calling individual save routines. * - * @return status code + * @return status code */ public Status saveContainerConfig(); } diff --git a/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerImplTest.java b/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerImplTest.java index 2d6439954a..4bdd6797d6 100644 --- a/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerImplTest.java +++ b/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerImplTest.java @@ -20,41 +20,41 @@ import org.opendaylight.controller.sal.utils.NodeCreator; public class ContainerImplTest { - @Test - public void test() { - - ContainerImpl container1 = new ContainerImpl(); - - //Create Component for init - ComponentImpl component1 = new ComponentImpl(null, null, null); - component1.setInterface("serviceTestName", null); - - //container1 does not have name yet - container1.init(component1); - assertNull(container1.getName()); - - //Sets container1 name to TestName - Hashtable properties = new Hashtable(); - properties.put("dummyKey", "dummyValue"); - properties.put("containerName", "TestName"); - component1.setInterface("serviceTestName", properties); - - container1.init(component1); - assertEquals("TestName", container1.getName()); - - //getContainerFlows always returns null for now - assertNull(container1.getContainerFlows()); - - //getTag always returns 0 for now - Node n = NodeCreator.createOFNode(1L); - assertEquals(0, container1.getTag(n)); - - //getNodeConnectors always returns null for now - assertNull(container1.getNodeConnectors()); - - //getNodes always returns null for now - assertNull(container1.getNodes()); - - } + @Test + public void test() { + + ContainerImpl container1 = new ContainerImpl(); + + //Create Component for init + ComponentImpl component1 = new ComponentImpl(null, null, null); + component1.setInterface("serviceTestName", null); + + //container1 does not have name yet + container1.init(component1); + assertNull(container1.getName()); + + //Sets container1 name to TestName + Hashtable properties = new Hashtable(); + properties.put("dummyKey", "dummyValue"); + properties.put("containerName", "TestName"); + component1.setInterface("serviceTestName", properties); + + container1.init(component1); + assertEquals("TestName", container1.getName()); + + //getContainerFlows always returns null for now + assertNull(container1.getContainerFlows()); + + //getTag always returns 0 for now + Node n = NodeCreator.createOFNode(1L); + assertEquals(0, container1.getTag(n)); + + //getNodeConnectors always returns null for now + assertNull(container1.getNodeConnectors()); + + //getNodes always returns null for now + assertNull(container1.getNodes()); + + } } diff --git a/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerManagerTest.java b/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerManagerTest.java index c7e35a069c..b5e7a11097 100644 --- a/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerManagerTest.java +++ b/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerManagerTest.java @@ -18,21 +18,21 @@ import org.opendaylight.controller.sal.utils.GlobalConstants; public class ContainerManagerTest { - @Test - public void test() { - ContainerManager cm = new ContainerManager(); - - cm.init(); - - ArrayList names = (ArrayList) cm.getContainerNames(); - assertEquals(1, names.size()); - assertEquals(GlobalConstants.DEFAULT.toString(), names.get(0)); - - assertFalse(cm.hasNonDefaultContainer()); - assertNull(cm.saveContainerConfig()); - - cm.destroy(); - - } + @Test + public void test() { + ContainerManager cm = new ContainerManager(); + + cm.init(); + + ArrayList names = (ArrayList) cm.getContainerNames(); + assertEquals(1, names.size()); + assertEquals(GlobalConstants.DEFAULT.toString(), names.get(0)); + + assertFalse(cm.hasNonDefaultContainer()); + assertNull(cm.saveContainerConfig()); + + cm.destroy(); + + } } diff --git a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/IForwardingStaticRouting.java b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/IForwardingStaticRouting.java index 0166d279f6..5fabb2629d 100644 --- a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/IForwardingStaticRouting.java +++ b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/IForwardingStaticRouting.java @@ -12,14 +12,14 @@ package org.opendaylight.controller.forwarding.staticrouting; import java.net.InetAddress; import java.util.concurrent.ConcurrentMap; /** - * + * * This interface provides APIs to configure and manage static routes. * */ import org.opendaylight.controller.sal.utils.Status; /** - * + * * This Interface provides APIs to manage and query the static routes * */ diff --git a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java index ceacebffb0..262c0170db 100644 --- a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java +++ b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java @@ -151,18 +151,18 @@ public class StaticRouteConfig implements Serializable { public Status isValid() { if ((name == null) || (name.trim().length() < 1)) { return new Status(StatusCode.BADREQUEST, - "Invalid Static Route name"); + "Invalid Static Route name"); } if (!isValidStaticRouteEntry()) { return new Status(StatusCode.BADREQUEST, - "Invalid Static Route entry. Please use the " + - "IPAddress/mask format. Default gateway " + - "(0.0.0.0/0) is NOT supported."); + "Invalid Static Route entry. Please use the " + + "IPAddress/mask format. Default gateway " + + "(0.0.0.0/0) is NOT supported."); } if (!isValidNextHop()) { return new Status(StatusCode.BADREQUEST, - "Invalid NextHop IP Address configuration. " + - "Please use the X.X.X.X format."); + "Invalid NextHop IP Address configuration. " + + "Please use the X.X.X.X format."); } return new Status(StatusCode.SUCCESS, null); diff --git a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java index 8819be3988..1ac923c15e 100644 --- a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java +++ b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java @@ -131,7 +131,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, } } - + private Status saveConfig() { // Publish the save config event to the cluster nodes configSaveEvent.put(new Date().getTime(), SAVE); @@ -154,7 +154,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, } @SuppressWarnings("deprecation") - private void allocateCaches() { + private void allocateCaches() { if (this.clusterContainerService == null) { log .info("un-initialized clusterContainerService, can't create cache"); @@ -207,7 +207,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, } @SuppressWarnings("deprecation") - private void destroyCaches() { + private void destroyCaches() { if (this.clusterContainerService == null) { log .info("un-initialized clusterContainerService, can't destroy cache"); @@ -390,16 +390,16 @@ public class StaticRoutingImplementation implements IfNewHostNotify, return status; } if (staticRouteConfigs.get(config.getName()) != null) { - return new Status(StatusCode.CONFLICT, - "A valid Static Route configuration with this name " + - "already exists. Please use a different name"); + return new Status(StatusCode.CONFLICT, + "A valid Static Route configuration with this name " + + "already exists. Please use a different name"); } for (StaticRouteConfig s : staticRouteConfigs.values()) { if (s.equals(config)) { - return new Status(StatusCode.CONFLICT, - "This conflicts with an existing Static Route " + - "Configuration. Please check the configuration " + - "and try again"); + return new Status(StatusCode.CONFLICT, + "This conflicts with an existing Static Route " + + "Configuration. Please check the configuration " + + "and try again"); } } @@ -407,7 +407,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, StaticRoute sRoute = new StaticRoute(config); staticRoutes.put(config.getName(), sRoute); checkAndUpdateListeners(sRoute, true); - return status; + return status; } public Status removeStaticRoute(String name) { @@ -417,8 +417,8 @@ public class StaticRoutingImplementation implements IfNewHostNotify, checkAndUpdateListeners(sRoute, false); return new Status(StatusCode.SUCCESS, null); } - return new Status(StatusCode.NOTFOUND, - "Static Route with name " + name + " is not found"); + return new Status(StatusCode.NOTFOUND, + "Static Route with name " + name + " is not found"); } void setClusterContainerService(IClusterContainerServices s) { diff --git a/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfigTest.java b/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfigTest.java index 7cd085f896..84ec54b807 100644 --- a/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfigTest.java +++ b/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfigTest.java @@ -18,93 +18,94 @@ import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.controller.sal.utils.StatusCode; public class StaticRouteConfigTest { - - @Test - public void testStaticRouteSetGet() { - StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig(); - staticRouteConfig1.setName("route"); - staticRouteConfig1.setStaticRoute("10.1.1.2/32"); - staticRouteConfig1.setNextHop("200.2.2.2"); - staticRouteConfig1.setNextHopType(NextHopType.IPADDRESS.toString()); - StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route", "10.1.1.2/32", "200.2.2.2"); - - Assert.assertEquals(staticRouteConfig2.getName(), staticRouteConfig1.getName()); - Assert.assertEquals(staticRouteConfig2.getStaticRoute(), staticRouteConfig1.getStaticRoute()); - Assert.assertEquals(staticRouteConfig2.getNextHop(), staticRouteConfig1.getNextHop()); - Assert.assertEquals("nexthop-ip", staticRouteConfig1.getNextHopType()); - } - - @Test - public void testStaticRouteisValid() { + + @Test + public void testStaticRouteSetGet() { + StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig(); + staticRouteConfig1.setName("route"); + staticRouteConfig1.setStaticRoute("10.1.1.2/32"); + staticRouteConfig1.setNextHop("200.2.2.2"); + staticRouteConfig1.setNextHopType(NextHopType.IPADDRESS.toString()); + StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route", "10.1.1.2/32", "200.2.2.2"); + + Assert.assertEquals(staticRouteConfig2.getName(), staticRouteConfig1.getName()); + Assert.assertEquals(staticRouteConfig2.getStaticRoute(), staticRouteConfig1.getStaticRoute()); + Assert.assertEquals(staticRouteConfig2.getNextHop(), staticRouteConfig1.getNextHop()); + Assert.assertEquals("nexthop-ip", staticRouteConfig1.getNextHopType()); + } + + @Test + public void testStaticRouteisValid() { StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig("route1", "10.1.1.254/24", "100.1.1.1"); - Status receivedResponse1 = staticRouteConfig1.isValid(); - Status expectedResponse1 = new Status(StatusCode.SUCCESS, null); - Assert.assertEquals(expectedResponse1.toString(), receivedResponse1.toString()); - + Status receivedResponse1 = staticRouteConfig1.isValid(); + Status expectedResponse1 = new Status(StatusCode.SUCCESS, null); + Assert.assertEquals(expectedResponse1.toString(), receivedResponse1.toString()); + StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("", "", "100.1.1.1"); - Status receivedResponse2 = staticRouteConfig2.isValid(); - Status expectedResponse2 = new Status(StatusCode.BADREQUEST, - "Invalid Static Route name"); - Assert.assertEquals(expectedResponse2.toString(), receivedResponse2.toString()); + Status receivedResponse2 = staticRouteConfig2.isValid(); + Status expectedResponse2 = new Status(StatusCode.BADREQUEST, + "Invalid Static Route name"); + Assert.assertEquals(expectedResponse2.toString(), receivedResponse2.toString()); StaticRouteConfig staticRouteConfig3 = new StaticRouteConfig("route1", "10.1.1.254", "100.1.1.1"); - Status receivedResponse3 = staticRouteConfig3.isValid(); - Status expectedResponse3 = new Status(StatusCode.BADREQUEST, - "Invalid Static Route entry. Please use the " + - "IPAddress/mask format. Default gateway " + - "(0.0.0.0/0) is NOT supported."); - Assert.assertEquals(expectedResponse3.toString(), receivedResponse3.toString()); + Status receivedResponse3 = staticRouteConfig3.isValid(); + Status expectedResponse3 = new Status(StatusCode.BADREQUEST, + "Invalid Static Route entry. Please use the " + + "IPAddress/mask format. Default gateway " + + "(0.0.0.0/0) is NOT supported."); + Assert.assertEquals(expectedResponse3.toString(), receivedResponse3.toString()); StaticRouteConfig staticRouteConfig4 = new StaticRouteConfig("route1", "289.1.1.254/24", "100.1.1.1"); - Status receivedResponse4 = staticRouteConfig4.isValid(); - Status expectedResponse4 = new Status(StatusCode.BADREQUEST, - "Invalid Static Route entry. Please use the " + - "IPAddress/mask format. Default gateway " + - "(0.0.0.0/0) is NOT supported."); - Assert.assertEquals(expectedResponse4.toString(), receivedResponse4.toString()); - + Status receivedResponse4 = staticRouteConfig4.isValid(); + Status expectedResponse4 = new Status(StatusCode.BADREQUEST, + "Invalid Static Route entry. Please use the " + + "IPAddress/mask format. Default gateway " + + "(0.0.0.0/0) is NOT supported."); + Assert.assertEquals(expectedResponse4.toString(), receivedResponse4.toString()); + StaticRouteConfig staticRouteConfig5 = new StaticRouteConfig("route1", "10.1.1.254/24", "100.1.1"); - Status receivedResponse5 = staticRouteConfig5.isValid(); - Status expectedResponse5 = new Status(StatusCode.BADREQUEST, - "Invalid NextHop IP Address configuration. " + - "Please use the X.X.X.X format."); - Assert.assertEquals(expectedResponse5.toString(), receivedResponse5.toString()); - } - - @Test - public void testGetStaticRouteIP() { + Status receivedResponse5 = staticRouteConfig5.isValid(); + Status expectedResponse5 = new Status(StatusCode.BADREQUEST, + "Invalid NextHop IP Address configuration. " + + "Please use the X.X.X.X format."); + Assert.assertEquals(expectedResponse5.toString(), receivedResponse5.toString()); + } + + @Test + public void testGetStaticRouteIP() { StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig("route1", "10.1.1.0/24", "100.1.1.1"); InetAddress ip1 = staticRouteConfig1.getStaticRouteIP(); - Assert.assertEquals("10.1.1.0", ip1.getHostAddress()); - + Assert.assertEquals("10.1.1.0", ip1.getHostAddress()); + StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route1", "10.1.1.0/80", "100.1.1.1"); InetAddress ip2 = staticRouteConfig2.getStaticRouteIP(); - Assert.assertEquals(null, ip2); - - } + Assert.assertEquals(null, ip2); - @Test - public void testGetStaticRouteMask() { + } + + @Test + public void testGetStaticRouteMask() { StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig("route1", "10.1.1.0/24", "100.1.1.1"); - Short receivedMaskLen1 = staticRouteConfig1.getStaticRouteMask(); - Short expectedMaskLen1 = 24; - Assert.assertEquals(expectedMaskLen1, receivedMaskLen1); - - StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route1", "10.1.1.0/40", "100.1.1.1"); - Short receivedMaskLen2 = staticRouteConfig2.getStaticRouteMask(); - Short expectedMaskLen2 = 0; - Assert.assertEquals(expectedMaskLen2, receivedMaskLen2); - } - - @Test - public void testGetNextHopIP() { + Short receivedMaskLen1 = staticRouteConfig1.getStaticRouteMask(); + Short expectedMaskLen1 = 24; + Assert.assertEquals(expectedMaskLen1, receivedMaskLen1); + + StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route1", "10.1.1.0/40", "100.1.1.1"); + Short receivedMaskLen2 = staticRouteConfig2.getStaticRouteMask(); + Short expectedMaskLen2 = 0; + Assert.assertEquals(expectedMaskLen2, receivedMaskLen2); + } + + @Test + public void testGetNextHopIP() { StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig("route1", "10.1.1.254/24", "100.1.1.1"); InetAddress ip1 = staticRouteConfig1.getNextHopIP(); - Assert.assertEquals("100.1.1.1", ip1.getHostAddress()); + Assert.assertEquals("100.1.1.1", ip1.getHostAddress()); - StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route1", "10.1.1.254/24", "100.1.1"); + StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route1", "10.1.1.254/24", "100.1.1"); InetAddress ip2 = staticRouteConfig2.getNextHopIP(); - Assert.assertEquals(null, ip2); - } - + Assert.assertEquals(null, ip2); + } + } + diff --git a/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteTest.java b/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteTest.java index 4a497a058c..f05b10c9cf 100644 --- a/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteTest.java +++ b/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteTest.java @@ -23,35 +23,35 @@ import org.opendaylight.controller.sal.utils.NodeConnectorCreator; import org.opendaylight.controller.sal.utils.NodeCreator; public class StaticRouteTest { - - @Test - public void testStaticRouteGetSet() { - StaticRoute staticRoute = new StaticRoute(); - InetAddress networkAddress = null; - InetAddress mask = null; - InetAddress nextHopAddress = null; - try { - networkAddress = InetAddress.getByName("10.1.1.0"); - mask = InetAddress.getByName("255.255.255.0"); - nextHopAddress = InetAddress.getByName("200.0.0.1"); - - } catch (UnknownHostException e) { - Assert.assertTrue(false); - } - staticRoute.setNetworkAddress(networkAddress); - Assert.assertEquals(networkAddress.getHostAddress(), staticRoute.getNetworkAddress().getHostAddress()); - staticRoute.setMask(mask); - Assert.assertEquals(mask.getHostAddress(), staticRoute.getMask().getHostAddress()); - staticRoute.setType(NextHopType.IPADDRESS); - Assert.assertEquals("nexthop-ip", staticRoute.getType().toString()); - staticRoute.setNextHopAddress(nextHopAddress); - Assert.assertEquals(nextHopAddress.getHostAddress(), staticRoute.getNextHopAddress().getHostAddress()); - Node node = NodeCreator.createOFNode(((long)10)); - staticRoute.setNode(node); - Assert.assertEquals(node, staticRoute.getNode()); - NodeConnector nc0 = NodeConnectorCreator.createOFNodeConnector((short)20, node); - staticRoute.setPort(nc0); - Assert.assertEquals(nc0, staticRoute.getPort()); + + @Test + public void testStaticRouteGetSet() { + StaticRoute staticRoute = new StaticRoute(); + InetAddress networkAddress = null; + InetAddress mask = null; + InetAddress nextHopAddress = null; + try { + networkAddress = InetAddress.getByName("10.1.1.0"); + mask = InetAddress.getByName("255.255.255.0"); + nextHopAddress = InetAddress.getByName("200.0.0.1"); + + } catch (UnknownHostException e) { + Assert.assertTrue(false); + } + staticRoute.setNetworkAddress(networkAddress); + Assert.assertEquals(networkAddress.getHostAddress(), staticRoute.getNetworkAddress().getHostAddress()); + staticRoute.setMask(mask); + Assert.assertEquals(mask.getHostAddress(), staticRoute.getMask().getHostAddress()); + staticRoute.setType(NextHopType.IPADDRESS); + Assert.assertEquals("nexthop-ip", staticRoute.getType().toString()); + staticRoute.setNextHopAddress(nextHopAddress); + Assert.assertEquals(nextHopAddress.getHostAddress(), staticRoute.getNextHopAddress().getHostAddress()); + Node node = NodeCreator.createOFNode(((long)10)); + staticRoute.setNode(node); + Assert.assertEquals(node, staticRoute.getNode()); + NodeConnector nc0 = NodeConnectorCreator.createOFNodeConnector((short)20, node); + staticRoute.setPort(nc0); + Assert.assertEquals(nc0, staticRoute.getPort()); InetAddress ip1 = null; HostNodeConnector h1 = null; try { @@ -66,10 +66,10 @@ public class StaticRouteTest { } staticRoute.setHost(h1); Assert.assertEquals(h1, staticRoute.getHost()); - } - - @Test - public void testStaticRouteComparison() { + } + + @Test + public void testStaticRouteComparison() { StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig("route1", "10.1.1.0/24", "100.1.1.1"); StaticRouteConfig staticRouteConfig2 = new StaticRouteConfig("route2", "10.1.1.0/24", "100.2.1.1"); StaticRouteConfig staticRouteConfig3 = new StaticRouteConfig("route3", "10.2.1.0/24", "100.3.1.1"); @@ -82,28 +82,28 @@ public class StaticRouteTest { Assert.assertTrue(staticRoute1.equals(staticRoute2)); Assert.assertFalse(staticRoute1.equals(staticRoute3)); Assert.assertFalse(staticRoute1.equals(staticRoute4)); - + Assert.assertTrue(staticRoute1.compareTo(staticRoute2) == 0 ? true : false); Assert.assertFalse(staticRoute1.compareTo(staticRoute3) == 0 ? true : false); Assert.assertTrue(staticRoute1.compareTo(staticRoute4) == 0 ? true : false); - - } - - @Test - public void testLongestPrefixMatch() { + + } + + @Test + public void testLongestPrefixMatch() { StaticRouteConfig staticRouteConfig1 = new StaticRouteConfig("route1", "10.1.1.254/24", "100.1.1.1"); StaticRoute staticRoute1 = new StaticRoute(staticRouteConfig1); - InetAddress ip1 = null; - InetAddress ip2 = null; - try { - ip1 = InetAddress.getByName("10.1.0.2"); - ip2 = InetAddress.getByName("10.1.1.2"); - } catch (UnknownHostException e) { - Assert.assertTrue(false); - } + InetAddress ip1 = null; + InetAddress ip2 = null; + try { + ip1 = InetAddress.getByName("10.1.0.2"); + ip2 = InetAddress.getByName("10.1.1.2"); + } catch (UnknownHostException e) { + Assert.assertTrue(false); + } InetAddress rxdIp1 = staticRoute1.longestPrefixMatch(ip1); InetAddress rxdIp2 = staticRoute1.longestPrefixMatch(ip2); - Assert.assertEquals(null, rxdIp1); - Assert.assertEquals("10.1.1.0", rxdIp2.getHostAddress()); - } + Assert.assertEquals(null, rxdIp1); + Assert.assertEquals("10.1.1.0", rxdIp2.getHostAddress()); + } } diff --git a/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementationTest.java b/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementationTest.java index 4c9d4ab1f3..4df0590b1d 100644 --- a/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementationTest.java +++ b/opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementationTest.java @@ -13,12 +13,16 @@ import org.junit.Assert; import org.junit.Test; public class StaticRoutingImplementationTest { - - @Test - public void isIPv4AddressValidTest() { - StaticRoutingImplementation staticRouteImpl = new StaticRoutingImplementation(); - Assert.assertTrue(staticRouteImpl.isIPv4AddressValid("192.168.100.0/24")); - Assert.assertFalse(staticRouteImpl.isIPv4AddressValid("192.168.100.0/36")); - Assert.assertFalse(staticRouteImpl.isIPv4AddressValid("192.168.300.0/32")); - } + + @Test + public void isIPv4AddressValidTest() { + StaticRoutingImplementation staticRouteImpl = new StaticRoutingImplementation(); + Assert.assertTrue(staticRouteImpl.isIPv4AddressValid("192.168.100.0/24")); + Assert.assertFalse(staticRouteImpl.isIPv4AddressValid("192.168.100.0/36")); + Assert.assertFalse(staticRouteImpl.isIPv4AddressValid("192.168.300.0/32")); + } } + + + + diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntry.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntry.java index 8a055329e1..6aa5b07e2a 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntry.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntry.java @@ -51,7 +51,7 @@ public class FlowEntry implements Cloneable, Serializable { /** * Return the actual Flow contained in this entry - * + * * @return the flow */ public Flow getFlow() { @@ -147,12 +147,12 @@ public class FlowEntry implements Cloneable, Serializable { /** * Merges the current Flow with the passed Container Flow - * + * * Note: Container Flow merging is not an injective function. Be m1 and m2 * two different matches, and be f() the flow merge function, such that y1 = * f(m1) and y2 = f(m2) are the two merged matches, we may have: y1 = y2 - * - * + * + * * @param containerFlow * @return this merged FlowEntry */ diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java index 311d2f96ac..18255bc021 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java @@ -17,10 +17,10 @@ import org.opendaylight.controller.sal.core.Node; * install, the container flow with which that entry had to be merged and the * resultant merged flow entry, which is the one that was eventually installed * on the network node - * + * * Note: If the container flow is null, the install entry will be a clone of the * original entry - * + * */ public class FlowEntryInstall { private FlowEntry original; @@ -115,7 +115,7 @@ public class FlowEntryInstall { public void setRequestId(long rid) { this.requestId = rid; } - + public long getRequestId() { return requestId; } diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java index b3d0c8acdf..087c0bc878 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java @@ -18,7 +18,7 @@ import org.opendaylight.controller.sal.utils.Status; /** * Interface that describes methods for installing or removing forwarding rules * and to access to the flows database. - * + * */ public interface IForwardingRulesManager { @@ -27,7 +27,7 @@ public interface IForwardingRulesManager { * SDN protocol plugin to install the flow on the network node. Based on the * result of this operation FRM will update its database accordingly and * will return the proper {@code Status} code. - * + * * @param flow * the flow entry to install * @return the {@code Status} object indicating the result of this action. @@ -39,7 +39,7 @@ public interface IForwardingRulesManager { * protocol plugin to uninstall the flow from the network node. Based on the * result of this operation FRM will update its database accordingly and * will return the proper {@code Status} code. - * + * * @param flow * the flow entry to uninstall * @return the {@code Status} object indicating the result of this action @@ -53,7 +53,7 @@ public interface IForwardingRulesManager { * modify message depending on the SDN protocol specifications If the * current flow is equal to the new one it will be a no op and success code * is returned. - * + * * @param current * the current flow entry to modify * @param newone @@ -72,8 +72,8 @@ public interface IForwardingRulesManager { * it, it will request plugin to add the new flow. If the passed entry is * not valid an error code is returned. If the existing flow is equal to the * passed one it will be a no op and success code is returned. - * - * + * + * * @param newone * the new flow entry to install * @return the {@code Status} object indicating the result of this action @@ -86,7 +86,7 @@ public interface IForwardingRulesManager { * SDN protocol plugin to install the flow on the network node. As immediate * result of this asynchronous call, FRM will update its flow database as if * the flow was successfully installed. - * + * * @param flow * the flow entry to install * @return the status of this request containing the request id associated @@ -100,7 +100,7 @@ public interface IForwardingRulesManager { * SDN protocol plugin to uninstall the flow from the network node. As * immediate result of this asynchronous call, FRM will update its flow * database as if the flow was successfully installed. - * + * * @param flow * the flow entry to uninstall * @return the status of this request containing the unique id associated to @@ -115,7 +115,7 @@ public interface IForwardingRulesManager { * this message to the network node. It could be a delete + add or a single * modify message depending on the SDN protocol specifications. If the * current flow is equal to the new one it will be a no op. - * + * * @param current * the current flow entry to modify * @param newone @@ -136,7 +136,7 @@ public interface IForwardingRulesManager { * it, it will request plugin to add the new flow. If the passed entry is * not valid a zero request id is returned. If the existing flow is equal to * the passed one it will be a no op. - * + * * @param newone * the new flow entry to install * @return the unique id associated to this request. In case of not @@ -154,7 +154,7 @@ public interface IForwardingRulesManager { * blocked until the solicitation response is received from the network node * or receive timeout. Otherwise, it is a non-blocking call and does not * guarantee the node will respond in any given time. - * + * * @param node * The network node to solicit a response * @param blocking @@ -166,7 +166,7 @@ public interface IForwardingRulesManager { /** * Check whether the passed flow entry conflicts with the Container flows - * + * * @param flow * the flow entry to test * @return true if conflicts, false otherwise @@ -176,7 +176,7 @@ public interface IForwardingRulesManager { /** * Returns the list of Flow entries across network nodes which are part of * the same flow group, policy - * + * * @param group * the group name * @return the list of flow entries belonging to the specified group @@ -186,7 +186,7 @@ public interface IForwardingRulesManager { /** * Add a list of output port to the flow with the specified name on the * specified network node - * + * * @param node * the network node * @param flowName @@ -200,7 +200,7 @@ public interface IForwardingRulesManager { /** * Remove a list of output port from the flow with the specified name on the * specified network node - * + * * @param node * the network node * @param flowName @@ -214,7 +214,7 @@ public interface IForwardingRulesManager { /** * Replace the current output port in the specified flow with the specified * one - * + * * @param node * the network node * @param groupName @@ -229,7 +229,7 @@ public interface IForwardingRulesManager { /** * Returns the output port configured on the specified flow - * + * * @param node * the network node * @param flowName @@ -242,14 +242,14 @@ public interface IForwardingRulesManager { * Returns all the troubleshooting information that applications have set * along with the policy they have configured through forwarding rules * manger. - * + * * @return the collection of troubleshooting objects */ public Map getTSPolicyData(); /** * Set the troubleshooting information for the policy - * + * * @param policyname * the flow group name * @param o @@ -262,7 +262,7 @@ public interface IForwardingRulesManager { /** * Returns the troubleshooting information that was set for the specified * policy - * + * * @param groupName * the flows group name * @return the troubleshooting info object @@ -272,7 +272,7 @@ public interface IForwardingRulesManager { /** * Returns the specifications of all the flows configured for all the * switches on the current container - * + * * @return the list of flow configurations present in the database */ public List getStaticFlows(); @@ -280,7 +280,7 @@ public interface IForwardingRulesManager { /** * Returns the specifications of all the flows configured for the given * switch on the current container - * + * * @param node * the network node identifier * @return the list of {@code FlowConfig} objects @@ -290,7 +290,7 @@ public interface IForwardingRulesManager { /** * Returns the specification of the flow configured for the given network * node on the current container - * + * * @param name * the flow name * @param n @@ -302,7 +302,7 @@ public interface IForwardingRulesManager { /** * Returns the list of names of flows configured for the given Network node * on the current container - * + * * @param node * the network node identifier * @return the list of flow names @@ -311,14 +311,14 @@ public interface IForwardingRulesManager { /** * Returns the list of Node(s) for which a static flow has been configured - * + * * @return the list of network nodes */ public List getListNodeWithConfiguredFlows(); /** * Save the flow configured so far to file - * + * * @return the {@code Status} object indicating the result of this action. */ public Status saveConfig(); @@ -326,7 +326,7 @@ public interface IForwardingRulesManager { /** * Add a flow specified by the {@code FlowConfig} object on the current * container - * + * * @param config * the {@code FlowConfig} object representing the static flow * @param restore @@ -339,7 +339,7 @@ public interface IForwardingRulesManager { /** * Remove a flow specified by the {@code FlowConfig} object on the current * container - * + * * @param config * the {@code FlowConfig} object representing the static flow * @return the {@code Status} object indicating the result of this action @@ -350,7 +350,7 @@ public interface IForwardingRulesManager { * Replace the flow identified by the {@code FlowConfig.name} name for the * {@code FlowConfig.node} network node with the new flow specified by * {@code FlowConfig} object - * + * * @param config * the {@code FlowConfig} object * @returnthe {@code Status} object indicating the result of this action @@ -359,7 +359,7 @@ public interface IForwardingRulesManager { /** * Remove the flow specified by name on the passed network node - * + * * @param name * for the static flow * @param node @@ -372,7 +372,7 @@ public interface IForwardingRulesManager { * Toggle the installation status of the specified configured flow If the * flow configuration status is active, this call will change the flow * status to inactive and vice-versa - * + * * @param configObject * the {@code FlowConfig} object * @return the {@code Status} object indicating the result of this action @@ -383,7 +383,7 @@ public interface IForwardingRulesManager { * Toggle the installation status of the specified configured flow If the * flow configuration status is active, this call will change the flow * status to inactive and vice-versa - * + * * @param name * for the static flow * @param node diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManagerAware.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManagerAware.java index 952b3cdff7..43d1b29a75 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManagerAware.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManagerAware.java @@ -11,14 +11,14 @@ package org.opendaylight.controller.forwardingrulesmanager; /** * The interface which describes the methods forwarding rules manager will call * for notifying the listeners of policy installation updates. - * + * */ public interface IForwardingRulesManagerAware { /** * Inform the listeners that a troubleshooting information was added or * removed for the specified policy. - * + * * @param policyName * the policy affected * @param add @@ -31,7 +31,7 @@ public interface IForwardingRulesManagerAware { * Inform listeners that the network node has notified us about a failure in * executing the controller generated asynchronous request identified by the * passed unique id. - * + * * @param requestId * the unique id associated with the request which failed to be * executed on the network node diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroup.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroup.java index 95e9b00d14..5acd3e2ebc 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroup.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroup.java @@ -14,11 +14,11 @@ import java.util.Set; /** * PortGroup is a simple data-structure to represent any arbitrary group of * ports on a Switch (that is represented using its switch-ID). - * + * * PortGroup is used by PortGroupProvider application to signal a set of ports * that represent a configured PortGroupConfig. - * - * + * + * */ public class PortGroup { private long matrixSwitchId; @@ -26,7 +26,7 @@ public class PortGroup { /** * PortGroup Constructor using Switch and Ports. - * + * * @param matrixSwitchId * Switch Id that represents an openflow Switch * @param ports @@ -40,7 +40,7 @@ public class PortGroup { /** * PortGroup Constructor using Switch. - * + * * @param matrixSwitchId * Switch-Id that represents an openflow Switch */ @@ -51,7 +51,7 @@ public class PortGroup { /** * Returns the switchId representing the Switch that makes this PortGroup. - * + * * @return long switchId */ public long getMatrixSwitchId() { @@ -60,7 +60,7 @@ public class PortGroup { /** * Assigns a Switch to this PortGroup - * + * * @param matrixSwitchId * Switch-Id that represents an openflow Switch */ @@ -70,7 +70,7 @@ public class PortGroup { /** * Returns the Set of Ports that makes this PortGroup. - * + * * @return Set of short values representing openflow port-ids. */ public Set getPorts() { @@ -79,7 +79,7 @@ public class PortGroup { /** * Assigns a set of openflow ports to this PortGroup - * + * * @param ports * Set of short values representing openflow port-ids. */ @@ -89,7 +89,7 @@ public class PortGroup { /** * Adds a port to this PortGroup - * + * * @param port * Short value of a openflow port. */ diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupChangeListener.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupChangeListener.java index 77ff64014b..7c8ade5b89 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupChangeListener.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupChangeListener.java @@ -15,14 +15,14 @@ import org.opendaylight.controller.sal.core.Node; /** * PortGroupChangeListener listens to the PortGroup updates provided by the * PortGroupProvider. - * - * + * + * */ public interface PortGroupChangeListener { /** * This method is invoked by PortGroupProvider whenever it detects a change * in PortGroup membership for a given PortGroupConfig. - * + * * @param config * Port Group Configuration * @param portGroupData diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupConfig.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupConfig.java index b45f4898bf..164f26484e 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupConfig.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupConfig.java @@ -16,12 +16,12 @@ import java.util.List; /** * PortGroupConfig class represents the User's Configuration with a Opaque * Regular Expression String that is parsed and handled by PortGroupProvider. - * + * * Typically, the opaque matchString will be a Regular Expression String * supported by a particular PortGroupProvider based on Customer requirements. - * - * - * + * + * + * */ public class PortGroupConfig implements Serializable { private static final long serialVersionUID = 1L; @@ -41,7 +41,7 @@ public class PortGroupConfig implements Serializable { /** * Constructor to create a Port Group Configuration using a Group Name and * an Opaque String that is managed by PortGroupProvider. - * + * * @param name * Group Name representing a Port Group configuration * @param matchString @@ -55,7 +55,7 @@ public class PortGroupConfig implements Serializable { /** * Returns the user configured PortGroup Configuration name. - * + * * @return Configuration Name */ public String getName() { @@ -64,7 +64,7 @@ public class PortGroupConfig implements Serializable { /** * Assigns a name to the configuration - * + * * @param name * configuration name */ @@ -74,7 +74,7 @@ public class PortGroupConfig implements Serializable { /** * Returns the Opaque string - * + * * @return */ public String getMatchString() { @@ -83,7 +83,7 @@ public class PortGroupConfig implements Serializable { /** * Assigns an opaque String to the Configuration. - * + * * @param matchString * Opaque string handled by PortGroupProvider */ @@ -94,7 +94,7 @@ public class PortGroupConfig implements Serializable { /** * Returns the names of all the configurable fields in PortGroupConfig. This * method is typically used by NorthBound apis. - * + * * @return List of Field names that can be configured. */ public static List getFieldsNames() { @@ -113,7 +113,7 @@ public class PortGroupConfig implements Serializable { * Returns the names of all the configurable fields in PortGroupConfig in * human readable format for UI purposes. This method is typically used by * Web/UI apis. - * + * * @return List of Human readable Strings that corresponds to the * configurable field names. */ diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupProvider.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupProvider.java index 5a9281aea8..37cbcd17e6 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupProvider.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/PortGroupProvider.java @@ -17,15 +17,15 @@ import org.opendaylight.controller.sal.core.Node; * application to implement in order to provide Port Grouping Service. Custom * Application that implements this interface will have to handle the opaque * match criteria passed to it via PortGroupConfig. - * - * - * + * + * + * */ public interface PortGroupProvider { /** * This method is invoked by the Controller towards the Provider when a new * port group is configured. - * + * * @param config * New PortGroupConfig object created by user Configuration. * @return true if successful. false otherwise. @@ -35,7 +35,7 @@ public interface PortGroupProvider { /** * This method is invoked by the Controller towards the Provider when an * existing port group is deleted. - * + * * @param config * Existing Port Group Configuration deleted by the user. * @return true if successful. false otherwise. @@ -47,7 +47,7 @@ public interface PortGroupProvider { * Configuration. Its the PortGroupProvider Application's responsibility to * manage the Switches & the Set of its Ports that correspond to each of the * Configuration and return it to the Controller when requested. - * + * * @param config * User Configuration * @see PortGroupConfig @@ -61,7 +61,7 @@ public interface PortGroupProvider { * PortGroupProvider Application's responsibility to manage the Switches & * the Set of its Ports that correspond to each of the Configuration and * return it to the Controller when requested. - * + * * @param config * User Configuration * @param matrixSwitchId @@ -76,7 +76,7 @@ public interface PortGroupProvider { /** * Registers a Listener for Port Group membership changes based on Custom * application algorithm. - * + * * @param listener * A Controller module that listens to events from the Custom * Port Grouping Application. @@ -89,7 +89,7 @@ public interface PortGroupProvider { * implement Custom Algorithm for Port Grouping. This method exposes the * custom algorithm to the user so that the user can configure the * matchString regular expression in PortGroupConfig appropriately. - * + * * @return Usage string. */ public String getApplicationDrivenMatchCriteriaUsage(); @@ -97,7 +97,7 @@ public interface PortGroupProvider { /** * Returns the name of the Custom Application that implements * PortGroupProvider interface. - * + * * @return Provider Name */ public String getProviderName(); @@ -105,7 +105,7 @@ public interface PortGroupProvider { /** * Controller uses this method to check with the Provider supports the * matchCriteria String configured by the User. - * + * * @param matchCriteria * @return true if the Provider supports the matchCriteria String. false * otherwise. diff --git a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/Activator.java b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/Activator.java index 969287719d..d0a370276f 100644 --- a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/Activator.java +++ b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/Activator.java @@ -40,7 +40,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function called when the activator starts just after some initializations * are done by the ComponentActivatorAbstractBase. - * + * */ public void init() { @@ -49,7 +49,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function called when the activator stops just before the cleanup done by * ComponentActivatorAbstractBase - * + * */ public void destroy() { @@ -58,8 +58,8 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function that is used to communicate to dependency manager the list of * known implementations for services inside a container - * - * + * + * * @return An array containing all the CLASS objects that will be * instantiated in order to get an fully working implementation * Object @@ -72,7 +72,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function that is called when configuration of the dependencies is * required. - * + * * @param c * dependency manager Component object, used for configuring the * dependencies exported and imported diff --git a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java index db1186e6b7..5fbe12bd1c 100644 --- a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java +++ b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java @@ -135,7 +135,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * Adds a flow entry onto the network node It runs various validity checks * and derive the final container flows merged entries that will be * attempted to be installed - * + * * @param flowEntry * the original flow entry application requested to add * @param async @@ -144,7 +144,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * will contain the unique id assigned to this request */ private Status addEntry(FlowEntry flowEntry, boolean async) { - + // Sanity Check if (flowEntry == null || flowEntry.getNode() == null) { String msg = "Invalid FlowEntry"; @@ -209,7 +209,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * complication for now and assume we will always deal with * one flow only per request */ - succeded = ret; + succeded = ret; } else { error = ret; log.warn("Failed to install the entry: {}. The failure is: {}", @@ -228,7 +228,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * flow entry is congruent with all the N container flows, then the output * install entry list will contain N entries. If the output list is empty, * it means the passed flow entry conflicts with all the container flows. - * + * * @param cFlowList * The list of container flows * @return the list of container flow merged entries good to be installed on @@ -260,7 +260,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /** * Modify a flow entry with a new one It runs various validity check and * derive the final container flows merged flow entries to work with - * + * * @param currentFlowEntry * @param newFlowEntry * @param async @@ -335,13 +335,13 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * This is only possible when the new entry and current entry have * different match. In this scenario the modification would ultimately * be handled as a remove and add operations in the protocol plugin. - * + * * Also, if any of the new flow entries would clash with an existing * one, we cannot proceed with the modify operation, because it would * fail for some entries and leave stale entries on the network node. * Modify path can be taken only if it can be performed completely, for * all entries. - * + * * So, for the above two cases, to simplify, let's decouple the modify * in: 1) remove current entries 2) install new entries */ @@ -384,7 +384,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * (and might be wrong) that the same container flows that were * satisfied by the current entries are the same that are satisfied * by the new entries. Let's take the risk for now. - * + * * Note: modification has to be complete. If any entry modification * fails, we need to stop, restore the already modified entries, and * declare failure. @@ -440,7 +440,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * This is the function that modifies the final container flows merged * entries on the network node and update the database. It expects that all * the validity checks are passed - * + * * @param currentEntries * @param newEntries * @param async @@ -451,7 +451,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, private Status modifyEntryInternal(FlowEntryInstall currentEntries, FlowEntryInstall newEntries, boolean async) { // Modify the flow on the network node - Status status = (async)? + Status status = (async)? programmer.modifyFlowAsync(currentEntries.getNode(), currentEntries.getInstall().getFlow(), newEntries.getInstall() .getFlow()) : @@ -481,7 +481,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /** * Remove a flow entry. If the entry is not present in the software view * (entry or node not present), it return successfully - * + * * @param flowEntry * the flow entry to remove * @param async @@ -554,7 +554,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * This is the function that removes the final container flows merged entry * from the network node and update the database. It expects that all the * validity checks are passed - * + * * @param entry * the flow entry to remove * @param async @@ -572,7 +572,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, .getInstall().getFlow()) : programmer.removeFlow(entry.getNode(), entry .getInstall().getFlow()); - + if (!status.isSuccess()) { log.warn( @@ -593,7 +593,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * on the network node and updates the database. It expects that all the * validity and conflict checks are passed. That means it does not check * whether this flow would conflict or overwrite an existing one. - * + * * @param entry * the flow entry to install * @param async @@ -631,7 +631,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * means that if the function returns true, the passed flow entry is * congruent with at least one container flow, hence it is good to be * installed on this container. - * + * * @param flowEntry * @return true if flow conflicts with all the container flows, false * otherwise @@ -837,7 +837,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } return status; } - + @Override public Status modifyFlowEntry(FlowEntry currentFlowEntry, FlowEntry newFlowEntry) { @@ -908,13 +908,13 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } } - + /** * Try to find in the database if a Flow with the same Match and priority of * the passed one already exists for the specified network node. Flow, * priority and network node are all specified in the FlowEntry If found, * the respective FlowEntryInstall Object is returned - * + * * @param flowEntry * the FlowEntry to be tested against the ones installed * @param looseCheck @@ -1409,9 +1409,9 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * multiple entry configuration (PortGroup) and hardware installation is * NOT done directly on this event. 3. The User prefers to retain the * configuration in Controller and skip hardware installation. - * + * * Hence it is safe to update the StaticFlow DB at this point. - * + * * Note : For the case of PortGrouping, it is essential to have this DB * populated before the PortGroupListeners can query for the DB * triggered using portGroupChanged event... @@ -1924,7 +1924,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /** * Remove from the databases all the flows installed on the node - * + * * @param node */ private synchronized void cleanDatabaseForNode(Node node) { @@ -2210,7 +2210,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { frmAware = Collections @@ -2245,7 +2245,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { destroyCaches(); @@ -2254,7 +2254,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { /* @@ -2270,7 +2270,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { } @@ -2541,8 +2541,8 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /* * If this was for a flow install, remove the corresponding entry * from the software view. If it was a Looking for the rid going through the - * software database. - * TODO: A more efficient rid <-> FlowEntryInstall mapping will + * software database. + * TODO: A more efficient rid <-> FlowEntryInstall mapping will * have to be added in future */ Set entries = nodeFlows.get(node); @@ -2559,7 +2559,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, this.updateLocalDatabase(target, false); } } - + // Notify listeners if (frmAware != null) { synchronized (frmAware) { @@ -2573,19 +2573,19 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } } } - + @Override public Status solicitStatusResponse(Node node, boolean blocking) { Status rv = new Status(StatusCode.INTERNALERROR); - + if (this.programmer != null) { if (blocking) { rv = programmer.syncSendBarrierMessage(node); } else { - rv = programmer.asyncSendBarrierMessage(node); + rv = programmer.asyncSendBarrierMessage(node); } } - + return rv; } } diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfHostListener.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfHostListener.java index d7c6fdbb3d..cb15fb09fd 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfHostListener.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfHostListener.java @@ -26,7 +26,7 @@ public interface IfHostListener { * of coming up a new Host. For the hosts which it has already * learned, it refreshes them. * - * @param host Host info encapsulated in HostNodeConnector class + * @param host Host info encapsulated in HostNodeConnector class */ public void hostListener(HostNodeConnector host); } diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java index fdb1e72b3f..554da42f4a 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java @@ -32,10 +32,10 @@ public interface IfIptoHost { * Northbound APIs. If a binding is unknown, then an ARP request is initiated * immediately to discover the host. * - * @param networkAddress IP Address of the Host encapsulated in class InetAddress - * @return {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector} - * Class that contains the Host info such as its MAC address, - * Switch ID, port, VLAN. If Host is not found, returns NULL + * @param networkAddress IP Address of the Host encapsulated in class InetAddress + * @return {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector} + * Class that contains the Host info such as its MAC address, + * Switch ID, port, VLAN. If Host is not found, returns NULL */ public HostNodeConnector hostFind(InetAddress networkAddress); @@ -43,10 +43,10 @@ public interface IfIptoHost { * Checks the local Host Database to see if a Host has been learned for a * given IP address. * - * @param networkAddress IP Address of the Host encapsulated in class InetAddress - * @return {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector} - * Class that contains the Host info such as its MAC address, - * Switch ID, port, VLAN. If Host is not found, returns NULL + * @param networkAddress IP Address of the Host encapsulated in class InetAddress + * @return {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector} + * Class that contains the Host info such as its MAC address, + * Switch ID, port, VLAN. If Host is not found, returns NULL * */ public HostNodeConnector hostQuery(InetAddress networkAddress); @@ -55,8 +55,8 @@ public interface IfIptoHost { * Initiates an immediate discovery of the Host for a given IP address. This * provides for the calling applications to block on the host discovery. * - * @param networkAddress IP address encapsulated in InetAddress class - * @return Future {@link org.opendaylight.controller.hosttracker.HostTrackerCallable} + * @param networkAddress IP address encapsulated in InetAddress class + * @return Future {@link org.opendaylight.controller.hosttracker.HostTrackerCallable} */ public Future discoverHost(InetAddress networkAddress); @@ -64,8 +64,8 @@ public interface IfIptoHost { * Returns the Network Hierarchy for a given Host. This API is typically used by * applications like Hadoop for Rack Awareness functionality. * - * @param IP address of the Host encapsulated in InetAddress class - * @return List of String ArrayList containing the Hierarchies. + * @param IP address of the Host encapsulated in InetAddress class + * @return List of String ArrayList containing the Hierarchies. */ public List> getHostNetworkHierarchy(InetAddress hostAddress); @@ -73,9 +73,9 @@ public interface IfIptoHost { * Returns all the the Hosts either learned dynamically or added statically via * Northbound APIs. * - * @return Set of {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}. - * Class that contains the Host info such as its MAC address, - * Switch ID, port, VLAN. + * @return Set of {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}. + * Class that contains the Host info such as its MAC address, + * Switch ID, port, VLAN. */ public Set getAllHosts(); @@ -84,9 +84,9 @@ public interface IfIptoHost { * are categorized as "Active" because the Switch and Port they are connected to, are in * up state. * - * @return Set of {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}. - * Class that contains the Host info such as MAC address, - * Switch ID, port, VLAN. If Host is not found, returns NULL + * @return Set of {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}. + * Class that contains the Host info such as MAC address, + * Switch ID, port, VLAN. If Host is not found, returns NULL */ public Set getActiveStaticHosts(); @@ -95,10 +95,10 @@ public interface IfIptoHost { * are categorized as "Inactive" because either the Switch or the Port they are connected * to, is in down state. * - * @return Set of HostNodeConnector {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}. - * HostNodeConnector is Class that - * contains the Host info such as its MAC address, OpenFlowNode - * ID, port, VLAN. + * @return Set of HostNodeConnector {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}. + * HostNodeConnector is Class that + * contains the Host info such as its MAC address, OpenFlowNode + * ID, port, VLAN. */ public Set getInactiveStaticHosts(); @@ -106,12 +106,12 @@ public interface IfIptoHost { * Hosts can be learned dynamically or added statically. This method allows the addition * of a Host to the local database statically. * - * @param networkAddress IP Address of the Host - * @param dataLayerAddress MAC Address of the Host - * @param nc NodeConnector to which the host is attached - * @param vlan VLAN the host belongs to - * @return The status object as described in {@code Status} - * indicating the result of this action. + * @param networkAddress IP Address of the Host + * @param dataLayerAddress MAC Address of the Host + * @param nc NodeConnector to which the host is attached + * @param vlan VLAN the host belongs to + * @return The status object as described in {@code Status} + * indicating the result of this action. */ public Status addStaticHost(String networkAddress, String dataLayerAddress, NodeConnector nc, String vlan); @@ -120,8 +120,8 @@ public interface IfIptoHost { * Allows the deletion of statically learned Host * * @param networkAddress - * @return The status object as described in {@code Status} - * indicating the result of this action. + * @return The status object as described in {@code Status} + * indicating the result of this action. */ public Status removeStaticHost(String networkAddress); } diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfNewHostNotify.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfNewHostNotify.java index 561f78f5f5..88db0811d7 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfNewHostNotify.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfNewHostNotify.java @@ -13,7 +13,7 @@ import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector; /** * This Interface defines the methods for client applications of - * Host Tracker to get notifications when a new host is learned or + * Host Tracker to get notifications when a new host is learned or * existing host is removed from the network. * */ @@ -21,7 +21,7 @@ public interface IfNewHostNotify { /** * Notifies the HostTracker Clients that a new Host has been learned * - * @param host Host Info encapsulated in HostNodeConnector class + * @param host Host Info encapsulated in HostNodeConnector class */ public void notifyHTClient(HostNodeConnector host); @@ -30,7 +30,7 @@ public interface IfNewHostNotify { * the past has been removed either due to switch/port down event or * due to ARP Aging * - * @param host Host Info encapsulated in HostNodeConnector class + * @param host Host Info encapsulated in HostNodeConnector class */ public void notifyHTClientHostRemoved(HostNodeConnector host); } diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/IHostFinder.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/IHostFinder.java index 533e7599bd..5ea7fb0e49 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/IHostFinder.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/IHostFinder.java @@ -26,7 +26,7 @@ public interface IHostFinder { * by query of an application to the HostTracker. The requested IP address * doesn't exist in the local database at this point. * - * @param networkAddress IP Address encapsulated in InetAddress class + * @param networkAddress IP Address encapsulated in InetAddress class * */ public void find(InetAddress networkAddress); @@ -35,7 +35,7 @@ public interface IHostFinder { * This method is called by HostTracker to see if a learned Host is still in the network. * Used mostly for ARP Aging. * - * @param host The Host that needs to be probed + * @param host The Host that needs to be probed */ public void probe(HostNodeConnector host); } diff --git a/opendaylight/hosttracker/api/src/test/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnectorTest.java b/opendaylight/hosttracker/api/src/test/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnectorTest.java index 2c2c49bfe1..c29e5b1645 100644 --- a/opendaylight/hosttracker/api/src/test/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnectorTest.java +++ b/opendaylight/hosttracker/api/src/test/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnectorTest.java @@ -29,61 +29,61 @@ import org.opendaylight.controller.sal.utils.NodeCreator; public class HostNodeConnectorTest extends TestCase { - @Test - public void testHostNodeConnector() throws UnknownHostException { - HostNodeConnector hostnodeconnector_1, hostnodeconnector_2, hostnodeconnector_3; - InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8"); - InetAddress hostIP_2 = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0"); - InetAddress hostIP_3 = InetAddress.getByName("192.168.0.28"); - byte[] hostMAC_2 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x22,(byte)0x22,(byte)0x22}; - byte[] hostMAC_3 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x33,(byte)0x33,(byte)0x33}; - - Node node = NodeCreator.createOFNode(1L); - NodeConnector nc1 = NodeConnectorCreator.createOFNodeConnector((short) 2, node); - NodeConnector nc2 = NodeConnectorCreator.createOFNodeConnector((short) 1, node); - - try { - hostnodeconnector_1 = new HostNodeConnector(hostIP_1); - Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1)); - Assert.assertTrue(hostnodeconnector_1.isV4Host()); - Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1)); - } catch (ConstructionException e) { - Assert.assertTrue(false); - } - - try { - hostnodeconnector_2 = new HostNodeConnector( - hostMAC_2, hostIP_2, nc1, (short)2); - Assert.assertTrue(hostnodeconnector_2.isV6Host()); - Assert.assertTrue(hostnodeconnector_2.getnodeConnector().equals(nc1)); - Assert.assertTrue(hostnodeconnector_2.getnodeconnectorNode().equals(node)); + @Test + public void testHostNodeConnector() throws UnknownHostException { + HostNodeConnector hostnodeconnector_1, hostnodeconnector_2, hostnodeconnector_3; + InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8"); + InetAddress hostIP_2 = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0"); + InetAddress hostIP_3 = InetAddress.getByName("192.168.0.28"); + byte[] hostMAC_2 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x22,(byte)0x22,(byte)0x22}; + byte[] hostMAC_3 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x33,(byte)0x33,(byte)0x33}; + + Node node = NodeCreator.createOFNode(1L); + NodeConnector nc1 = NodeConnectorCreator.createOFNodeConnector((short) 2, node); + NodeConnector nc2 = NodeConnectorCreator.createOFNodeConnector((short) 1, node); + + try { + hostnodeconnector_1 = new HostNodeConnector(hostIP_1); + Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1)); + Assert.assertTrue(hostnodeconnector_1.isV4Host()); + Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1)); + } catch (ConstructionException e) { + Assert.assertTrue(false); + } + + try { + hostnodeconnector_2 = new HostNodeConnector( + hostMAC_2, hostIP_2, nc1, (short)2); + Assert.assertTrue(hostnodeconnector_2.isV6Host()); + Assert.assertTrue(hostnodeconnector_2.getnodeConnector().equals(nc1)); + Assert.assertTrue(hostnodeconnector_2.getnodeconnectorNode().equals(node)); Assert.assertTrue(node.equals(hostnodeconnector_2.getnodeconnectorNode())); - } catch (ConstructionException e) { - Assert.assertTrue(false); - } - - try { - hostnodeconnector_3 = new HostNodeConnector( - new EthernetAddress(hostMAC_3), hostIP_3, nc2, (short)3); - byte[] hostMAC_3_rb = hostnodeconnector_3.getDataLayerAddressBytes(); - HostNodeConnector hostnodeconnector_3rb = new HostNodeConnector( - new EthernetAddress(hostMAC_3_rb), hostIP_3, nc2, (short)3); - Assert.assertTrue(hostnodeconnector_3.equals(hostnodeconnector_3rb)); - - Assert.assertTrue(hostnodeconnector_3.getVlan() == (short)3); - - hostnodeconnector_3.setStaticHost(true); - Assert.assertTrue(hostnodeconnector_3.isStaticHost()); - - Assert.assertTrue(hostnodeconnector_3.isRewriteEnabled()); - - hostnodeconnector_3.initArpSendCountDown().setArpSendCountDown((short) 10); - Assert.assertTrue(hostnodeconnector_3.getArpSendCountDown() == (short)10); - - } catch (ConstructionException e) { - Assert.assertTrue(false); - } - - } + } catch (ConstructionException e) { + Assert.assertTrue(false); + } + + try { + hostnodeconnector_3 = new HostNodeConnector( + new EthernetAddress(hostMAC_3), hostIP_3, nc2, (short)3); + byte[] hostMAC_3_rb = hostnodeconnector_3.getDataLayerAddressBytes(); + HostNodeConnector hostnodeconnector_3rb = new HostNodeConnector( + new EthernetAddress(hostMAC_3_rb), hostIP_3, nc2, (short)3); + Assert.assertTrue(hostnodeconnector_3.equals(hostnodeconnector_3rb)); + + Assert.assertTrue(hostnodeconnector_3.getVlan() == (short)3); + + hostnodeconnector_3.setStaticHost(true); + Assert.assertTrue(hostnodeconnector_3.isStaticHost()); + + Assert.assertTrue(hostnodeconnector_3.isRewriteEnabled()); + + hostnodeconnector_3.initArpSendCountDown().setArpSendCountDown((short) 10); + Assert.assertTrue(hostnodeconnector_3.getArpSendCountDown() == (short)10); + + } catch (ConstructionException e) { + Assert.assertTrue(false); + } + + } } diff --git a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTrackerCallable.java b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTrackerCallable.java index 1230d340eb..0af523aaa9 100644 --- a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTrackerCallable.java +++ b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTrackerCallable.java @@ -15,8 +15,8 @@ package org.opendaylight.controller.hosttracker.internal; /** * This Class provides methods to discover Host through a blocking call - * mechanism. Applications can make use of these methods if they don't - * find a host in HostTracker's database and want to discover the host + * mechanism. Applications can make use of these methods if they don't + * find a host in HostTracker's database and want to discover the host * in the same thread without being called by a callback function. */ import java.net.InetAddress; diff --git a/opendaylight/hosttracker/implementation/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerTest.java b/opendaylight/hosttracker/implementation/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerTest.java index a99100b295..9bd28c8e45 100644 --- a/opendaylight/hosttracker/implementation/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerTest.java +++ b/opendaylight/hosttracker/implementation/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerTest.java @@ -22,38 +22,38 @@ import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector; public class HostTrackerTest extends TestCase { - @Test - public void testHostTrackerCallable() throws UnknownHostException { - - HostTracker hostTracker = null; - hostTracker = new HostTracker(); - Assert.assertFalse(hostTracker== null); - - InetAddress hostIP = InetAddress.getByName("192.168.0.8"); - - HostTrackerCallable htCallable = new HostTrackerCallable (hostTracker, hostIP); - Assert.assertTrue(htCallable.trackedHost.equals(hostIP)); - Assert.assertTrue(htCallable.hostTracker.equals(hostTracker)); - - long count = htCallable.latch.getCount(); - htCallable.wakeup(); - Assert.assertTrue(htCallable.latch.getCount() == --count ); - } - - - - @Test - public void testHostTracker() throws UnknownHostException { - HostTracker hostTracker = null; - hostTracker = new HostTracker(); - Assert.assertFalse(hostTracker== null); - - InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8"); - InetAddress hostIP_2 = InetAddress.getByName("192.168.0.18"); - Future dschost = hostTracker.discoverHost(hostIP_1); - dschost = hostTracker.discoverHost(hostIP_2); - hostTracker.nonClusterObjectCreate(); - } - + @Test + public void testHostTrackerCallable() throws UnknownHostException { + + HostTracker hostTracker = null; + hostTracker = new HostTracker(); + Assert.assertFalse(hostTracker== null); + + InetAddress hostIP = InetAddress.getByName("192.168.0.8"); + + HostTrackerCallable htCallable = new HostTrackerCallable (hostTracker, hostIP); + Assert.assertTrue(htCallable.trackedHost.equals(hostIP)); + Assert.assertTrue(htCallable.hostTracker.equals(hostTracker)); + + long count = htCallable.latch.getCount(); + htCallable.wakeup(); + Assert.assertTrue(htCallable.latch.getCount() == --count ); + } + + + + @Test + public void testHostTracker() throws UnknownHostException { + HostTracker hostTracker = null; + hostTracker = new HostTracker(); + Assert.assertFalse(hostTracker== null); + + InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8"); + InetAddress hostIP_2 = InetAddress.getByName("192.168.0.18"); + Future dschost = hostTracker.discoverHost(hostIP_1); + dschost = hostTracker.discoverHost(hostIP_2); + hostTracker.nonClusterObjectCreate(); + } + } diff --git a/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/Activator.java b/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/Activator.java index 7061954e80..6bafee0b2c 100644 --- a/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/Activator.java +++ b/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/Activator.java @@ -56,7 +56,7 @@ public class Activator implements BundleActivator { this.listener.logged(entry); } } - + /* * Install the default exception handler so that the uncaught * exceptions are handled by our customized handler. This new @@ -65,13 +65,13 @@ public class Activator implements BundleActivator { */ Thread.setDefaultUncaughtExceptionHandler(new org.opendaylight. controller.logging.bridge.internal.UncaughtExceptionHandler()); - + /* * Install the Shutdown handler. This will intercept SIGTERM signal and * close the system bundle. This allows for a graceful closing of OSGI * framework. */ - + Runtime.getRuntime().addShutdownHook(new shutdownHandler(context)); } else { this.log.error("Cannot register the LogListener because " @@ -95,13 +95,13 @@ public class Activator implements BundleActivator { this.listener = null; this.log = null; } - + private class shutdownHandler extends Thread { BundleContext bundlecontext; public shutdownHandler(BundleContext ctxt) { this.bundlecontext = ctxt; } - + public void run () { try { this.bundlecontext.getBundle(0).stop(); @@ -109,7 +109,7 @@ public class Activator implements BundleActivator { } catch (BundleException e) { log.debug("Bundle couldn't be stopped"); } - } + } } } diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/package-info.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/package-info.java index d1f182b7dd..db2a13379b 100644 --- a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/package-info.java +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/package-info.java @@ -12,3 +12,4 @@ * */ package org.opendaylight.controller.northbound.commons.exception; + diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java index 3fedd0c9f8..7069ff041f 100644 --- a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java @@ -9,11 +9,11 @@ import org.opendaylight.controller.usermanager.IUserManager; public class NorthboundUtils { - + /** * Returns whether the current user has the required privilege on the * specified container - * + * * @param userName * The user name * @param containerName @@ -21,21 +21,21 @@ public class NorthboundUtils { * @param required * Operation to be performed - READ/WRITE * @param bundle - * Class from where the function is invoked + * Class from where the function is invoked * @return The Status of the request, either Success or Unauthorized */ public static boolean isAuthorized(String userName, String containerName, Privilege required,Object bundle) { - + if (containerName.equals(GlobalConstants.DEFAULT.toString())) { IUserManager auth = (IUserManager) ServiceHelper.getGlobalInstance( IUserManager.class, bundle); - + switch (required) { case WRITE: return (auth.getUserLevel(userName).ordinal() <= UserLevel.NETWORKADMIN.ordinal()); case READ: - return (auth.getUserLevel(userName).ordinal() <= UserLevel.NETWORKOPERATOR.ordinal()); + return (auth.getUserLevel(userName).ordinal() <= UserLevel.NETWORKOPERATOR.ordinal()); default: return false; } @@ -56,5 +56,5 @@ public class NorthboundUtils { } return true; } - + } diff --git a/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowConfigs.java b/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowConfigs.java index 4b3761219f..f6a757ec29 100644 --- a/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowConfigs.java +++ b/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowConfigs.java @@ -21,22 +21,22 @@ import org.opendaylight.controller.forwardingrulesmanager.FlowConfig; @XmlAccessorType(XmlAccessType.NONE) public class FlowConfigs { - @XmlElement - List flowConfig; - //To satisfy JAXB - private FlowConfigs() { - - } - - public FlowConfigs(List flowConfig) { - this.flowConfig = flowConfig; - } - - public List getFlowConfig() { - return flowConfig; - } - - public void setFlowConfig(List flowConfig) { - this.flowConfig = flowConfig; - } + @XmlElement + List flowConfig; + //To satisfy JAXB + private FlowConfigs() { + + } + + public FlowConfigs(List flowConfig) { + this.flowConfig = flowConfig; + } + + public List getFlowConfig() { + return flowConfig; + } + + public void setFlowConfig(List flowConfig) { + this.flowConfig = flowConfig; + } } diff --git a/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java b/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java index b419a9b29d..99452b4b21 100644 --- a/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java +++ b/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java @@ -48,7 +48,7 @@ import org.opendaylight.controller.switchmanager.ISwitchManager; /** * Flow Configuration Northbound API - * + * *
*
* Authentication scheme : HTTP Basic
@@ -60,7 +60,7 @@ import org.opendaylight.controller.switchmanager.ISwitchManager; * trusted authority.
* More info : * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * + * */ @Path("/") public class FlowProgrammerNorthbound { @@ -147,7 +147,7 @@ public class FlowProgrammerNorthbound { /** * Returns a list of Flows configured on the given container - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -177,7 +177,7 @@ public class FlowProgrammerNorthbound { /** * Returns a list of Flows configured on a Node in a given container - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -217,7 +217,7 @@ public class FlowProgrammerNorthbound { /** * Returns the flow configuration matching a human-readable name and nodeId * on a given Container. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -266,7 +266,7 @@ public class FlowProgrammerNorthbound { /** * Add a flow configuration - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -330,9 +330,9 @@ public class FlowProgrammerNorthbound { /** * Delete a Flow configuration - * + * * DELETE /flows/{containerName}/{nodeType}/{nodeId}/{name} - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -392,7 +392,7 @@ public class FlowProgrammerNorthbound { /** * Toggle a Flow configuration - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". diff --git a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java index dbc99d06e4..a9f210e0ec 100644 --- a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java +++ b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java @@ -56,7 +56,7 @@ import org.opendaylight.controller.sal.authorization.Privilege; * Location is represented by Host node connector which is essentially a logical * entity that represents a Switch/Port. A host is represented by it's * IP-address and mac-address. - * + * *
*
* Authentication scheme : HTTP Basic
@@ -68,7 +68,7 @@ import org.opendaylight.controller.sal.authorization.Privilege; * trusted authority.
* More info : * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * + * */ @Path("/") @@ -120,7 +120,7 @@ public class HostTrackerNorthbound { /** * Returns a list of all Hosts : both configured via PUT API and dynamically * learnt on the network. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -135,7 +135,7 @@ public class HostTrackerNorthbound { @ResponseCode(code = 404, condition = "The containerName is not found"), @ResponseCode(code = 503, condition = "One or more of Controller Services are unavailable") }) public Hosts getActiveHosts(@PathParam("containerName") String containerName) { - + if (!NorthboundUtils.isAuthorized( getUserName(), containerName, Privilege.READ, this)) { throw new UnauthorizedException( @@ -154,7 +154,7 @@ public class HostTrackerNorthbound { /** * Returns a list of Hosts that are statically configured and are connected * to a NodeConnector that is down. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -187,7 +187,7 @@ public class HostTrackerNorthbound { /** * Returns a host that matches the IP Address value passed as parameter. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -236,7 +236,7 @@ public class HostTrackerNorthbound { /** * Add a Static Host configuration - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -320,7 +320,7 @@ public class HostTrackerNorthbound { /** * Delete a Static Host configuration - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -342,7 +342,7 @@ public class HostTrackerNorthbound { public Response deleteFlow( @PathParam(value = "containerName") String containerName, @PathParam(value = "networkAddress") String networkAddress) { - + if (!NorthboundUtils.isAuthorized( getUserName(), containerName, Privilege.WRITE, this)) { throw new UnauthorizedException( diff --git a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/Hosts.java b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/Hosts.java index c9ada2aeed..463b493536 100644 --- a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/Hosts.java +++ b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/Hosts.java @@ -21,18 +21,18 @@ import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector; @XmlAccessorType(XmlAccessType.NONE) public class Hosts { - @XmlElement (name="host") - Set hostNodeConnector; - - public Hosts() { - } - public Hosts (Set hostNodeConnector) { - this.hostNodeConnector = hostNodeConnector; - } - public Set getHostNodeConnector() { - return hostNodeConnector; - } - public void setHostNodeConnector(Set hostNodeConnector) { - this.hostNodeConnector = hostNodeConnector; - } + @XmlElement (name="host") + Set hostNodeConnector; + + public Hosts() { + } + public Hosts (Set hostNodeConnector) { + this.hostNodeConnector = hostNodeConnector; + } + public Set getHostNodeConnector() { + return hostNodeConnector; + } + public void setHostNodeConnector(Set hostNodeConnector) { + this.hostNodeConnector = hostNodeConnector; + } } diff --git a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java index 0065cb5a08..24eb3d7a4c 100644 --- a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java +++ b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java @@ -403,7 +403,7 @@ public class NorthboundIT { fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc); Assert.assertTrue(httpResponseCode == 201); - + // check that request returns both flows given node. result = getJsonResult(baseURL + "STUB/51966/", "GET"); jt = new JSONTokener(result); diff --git a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutes.java b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutes.java index 683a9a2d90..9511b8c7ca 100644 --- a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutes.java +++ b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutes.java @@ -21,22 +21,22 @@ import org.opendaylight.controller.forwardingrulesmanager.FlowConfig; @XmlAccessorType(XmlAccessType.NONE) public class StaticRoutes { - @XmlElement - List staticRoute; - //To satisfy JAXB - private StaticRoutes() { - - } - - public StaticRoutes(List staticRoute) { - this.staticRoute = staticRoute; - } - - public List getFlowConfig() { - return staticRoute; - } - - public void setFlowConfig(List staticRoute) { - this.staticRoute = staticRoute; - } + @XmlElement + List staticRoute; + //To satisfy JAXB + private StaticRoutes() { + + } + + public StaticRoutes(List staticRoute) { + this.staticRoute = staticRoute; + } + + public List getFlowConfig() { + return staticRoute; + } + + public void setFlowConfig(List staticRoute) { + this.staticRoute = staticRoute; + } } diff --git a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java index b85f5641c7..c48d7ec026 100644 --- a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java +++ b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java @@ -51,7 +51,7 @@ import org.opendaylight.controller.sal.utils.Status; * Authentication realm : opendaylight
* Transport : HTTP and HTTPS
*
- * HTTPS Authentication is disabled by default. Administrator can enable it in tomcat-server.xml after adding + * HTTPS Authentication is disabled by default. Administrator can enable it in tomcat-server.xml after adding * a proper keystore / SSL certificate from a trusted authority.
* More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration */ @@ -59,18 +59,18 @@ import org.opendaylight.controller.sal.utils.Status; public class StaticRoutingNorthbound { - private String username; - + private String username; + @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + username = context.getUserPrincipal().getName(); } protected String getUserName() { return username; } + - - + private List getStaticRoutesInternal(String containerName) { IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper @@ -109,9 +109,9 @@ public class StaticRoutingNorthbound { public StaticRoutes getStaticRoutes( @PathParam("containerName") String containerName) { - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } @@ -136,9 +136,9 @@ public class StaticRoutingNorthbound { @PathParam("containerName") String containerName, @PathParam("name") String name) { - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } @@ -174,10 +174,10 @@ public class StaticRoutingNorthbound { @PathParam(value = "name") String name, @TypeHint(StaticRoute.class) JAXBElement staticRouteData) { - - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } @@ -221,10 +221,10 @@ public class StaticRoutingNorthbound { public Response removeStaticRoute( @PathParam(value = "containerName") String containerName, @PathParam(value = "name") String name) { - - if(!NorthboundUtils.isAuthorized(getUserName(), containerName, + + if(!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)){ - throw new + throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName); } diff --git a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllFlowStatistics.java b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllFlowStatistics.java index 7f37afec21..0e96c5411c 100644 --- a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllFlowStatistics.java +++ b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllFlowStatistics.java @@ -19,22 +19,22 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class AllFlowStatistics { - @XmlElement - List flowStatistics; - //To satisfy JAXB - private AllFlowStatistics() { - } - - public AllFlowStatistics(List flowStatistics) { - this.flowStatistics = flowStatistics; - } - - public List getFlowStatistics() { - return flowStatistics; - } - - public void setFlowStatistics(List flowStatistics) { - this.flowStatistics = flowStatistics; - } + @XmlElement + List flowStatistics; + //To satisfy JAXB + private AllFlowStatistics() { + } + + public AllFlowStatistics(List flowStatistics) { + this.flowStatistics = flowStatistics; + } + + public List getFlowStatistics() { + return flowStatistics; + } + + public void setFlowStatistics(List flowStatistics) { + this.flowStatistics = flowStatistics; + } } diff --git a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllPortStatistics.java b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllPortStatistics.java index e377de2b88..a1bf1904e4 100644 --- a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllPortStatistics.java +++ b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/AllPortStatistics.java @@ -19,22 +19,22 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class AllPortStatistics { - @XmlElement - List portStatistics; - //To satisfy JAXB - private AllPortStatistics() { - } - - public AllPortStatistics(List portStatistics) { - this.portStatistics = portStatistics; - } - - public List getPortStatistics() { - return portStatistics; - } - - public void setPortStatistics(List portStatistics) { - this.portStatistics = portStatistics; - } + @XmlElement + List portStatistics; + //To satisfy JAXB + private AllPortStatistics() { + } + + public AllPortStatistics(List portStatistics) { + this.portStatistics = portStatistics; + } + + public List getPortStatistics() { + return portStatistics; + } + + public void setPortStatistics(List portStatistics) { + this.portStatistics = portStatistics; + } } diff --git a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/FlowStatistics.java b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/FlowStatistics.java index 25b671c1a8..146e95ab32 100644 --- a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/FlowStatistics.java +++ b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/FlowStatistics.java @@ -27,7 +27,7 @@ public class FlowStatistics { // To satisfy JAXB @SuppressWarnings("unused") - private FlowStatistics() { + private FlowStatistics() { } public FlowStatistics(Node node, List flowStat) { diff --git a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/PortStatistics.java b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/PortStatistics.java index 876bb7f7b0..068baa15fa 100644 --- a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/PortStatistics.java +++ b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/PortStatistics.java @@ -28,7 +28,7 @@ public class PortStatistics { // To satisfy JAXB @SuppressWarnings("unused") - private PortStatistics() { + private PortStatistics() { } public PortStatistics(Node node, List portStats) { diff --git a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java index 197ebabf91..dee52932bd 100644 --- a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java +++ b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java @@ -40,7 +40,7 @@ import org.opendaylight.controller.switchmanager.ISwitchManager; /** * Northbound APIs that returns various Statistics exposed by the Southbound * plugins such as Openflow. - * + * *
*
* Authentication scheme : HTTP Basic
@@ -52,7 +52,7 @@ import org.opendaylight.controller.switchmanager.ISwitchManager; * trusted authority.
* More info : * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * + * */ @Path("/") public class StatisticsNorthbound { @@ -102,7 +102,7 @@ public class StatisticsNorthbound { /** * Returns a list of all Flow Statistics from all the Nodes. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -154,7 +154,7 @@ public class StatisticsNorthbound { /** * Returns a list of Flow Statistics for a given Node. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -204,7 +204,7 @@ public class StatisticsNorthbound { /** * Returns a list of all the Port Statistics across all the NodeConnectors * on all the Nodes. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". @@ -255,7 +255,7 @@ public class StatisticsNorthbound { /** * Returns a list of all the Port Statistics across all the NodeConnectors * in a given Node. - * + * * @param containerName * Name of the Container. The Container name for the base * controller is "default". diff --git a/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetConfigs.java b/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetConfigs.java index 3361f1b3d2..60062edd29 100644 --- a/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetConfigs.java +++ b/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetConfigs.java @@ -21,22 +21,22 @@ import org.opendaylight.controller.switchmanager.SubnetConfig; @XmlAccessorType(XmlAccessType.NONE) public class SubnetConfigs { - @XmlElement - List subnetConfig; - //To satisfy JAXB - private SubnetConfigs() { - - } - - public SubnetConfigs(List subnetConfig) { - this.subnetConfig = subnetConfig; - } - - public List getSubnetConfig() { - return subnetConfig; - } - - public void setSubnetConfig(List subnetConfig) { - this.subnetConfig = subnetConfig; - } + @XmlElement + List subnetConfig; + //To satisfy JAXB + private SubnetConfigs() { + + } + + public SubnetConfigs(List subnetConfig) { + this.subnetConfig = subnetConfig; + } + + public List getSubnetConfig() { + return subnetConfig; + } + + public void setSubnetConfig(List subnetConfig) { + this.subnetConfig = subnetConfig; + } } diff --git a/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundJAXRS.java b/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundJAXRS.java index 5c327c4f72..05bb5b1dd9 100644 --- a/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundJAXRS.java +++ b/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundJAXRS.java @@ -55,10 +55,10 @@ public class SubnetsNorthboundJAXRS { /** * List all the subnets in a given container - * + * * @param containerName * container in which we want to query the subnets - * + * * @return a List of SubnetConfig */ @Path("/{containerName}") @@ -86,12 +86,12 @@ public class SubnetsNorthboundJAXRS { /** * List the configuration of a subnet in a given container - * + * * @param containerName * container in which we want to query the subnet * @param subnetName * of the subnet being queried - * + * * @return a SubnetConfig */ @Path("/{containerName}/{subnetName}") @@ -129,7 +129,7 @@ public class SubnetsNorthboundJAXRS { /** * Add/Update a subnet to a container - * + * * @param containerName * container in which we want to add/update the subnet * @param subnetName @@ -137,7 +137,7 @@ public class SubnetsNorthboundJAXRS { * @param subnet * pair default gateway IP/mask that identify the subnet being * added modified - * + * */ @Path("/{containerName}/{subnetName}") @POST @@ -183,12 +183,12 @@ public class SubnetsNorthboundJAXRS { /** * Delete a subnet from a container - * + * * @param containerName * container in which we want to delete the subnet by name * @param subnetName * of the subnet to be remove. - * + * */ @Path("/{containerName}/{subnetName}") @DELETE @@ -225,56 +225,56 @@ public class SubnetsNorthboundJAXRS { } /* - * + * * Add or remove switch ports to a subnet POST subnets/green/sw - * + * * @param model - * + * * @param containerName - * + * * @param name - * + * * @param subnet: the subnet name name - * + * * @param switchports: datapath ID/port list => * xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y - * + * * @return - * + * * @RequestMapping(value = "/{containerName}/{name}", method = * RequestMethod.POST) - * + * * public View addSwitchports(Map model, - * + * * @PathVariable(value = "containerName") String containerName, - * + * * @PathVariable(value = "name") String name, - * + * * @RequestParam(value = "nodeports") String nodePorts, - * + * * @RequestParam(value = "action") String action) { - * + * * checkDefaultDisabled(containerName); ISwitchManager switchManager = null; * try { BundleContext bCtx = FrameworkUtil.getBundle(this.getClass()) * .getBundleContext(); - * + * * ServiceReference[] services = bCtx.getServiceReferences( * ISwitchManager.class.getName(), "(containerName=" + containerName + ")"); - * + * * if (services != null) { switchManager = (ISwitchManager) * bCtx.getService(services[0]); logger.debug("Switch manager reference is:" * + switchManager); } } catch (Exception e) { * logger.error("Switch Manager reference is NULL"); } - * + * * checkContainerExists(switchManager); - * + * * String ret; if (action.equals("add")) { ret = * switchManager.addPortsToSubnet(name, nodePorts); } else if * (action.equals("remove")) { ret = * switchManager.removePortsFromSubnet(name, nodePorts); } else { throw new * UnsupportedMediaTypeException(RestMessages.UNKNOWNACTION .toString() + * ": " + action); } - * + * * return returnViewOrThrowConflicEx(model, ret); } */ } diff --git a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/NodeConnectors.java b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/NodeConnectors.java index 4a31317d95..ac9be4d075 100644 --- a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/NodeConnectors.java +++ b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/NodeConnectors.java @@ -19,22 +19,22 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class NodeConnectors { - @XmlElement - List nodeConnectorProperties; - //To satisfy JAXB - private NodeConnectors() { - - } - - public NodeConnectors(List nodeConnectorProperties) { - this.nodeConnectorProperties = nodeConnectorProperties; - } - - public List getNodeConnectorProperties() { - return nodeConnectorProperties; - } - - public void setNodeConnectorProperties(List nodeConnectorProperties) { - this.nodeConnectorProperties = nodeConnectorProperties; - } + @XmlElement + List nodeConnectorProperties; + //To satisfy JAXB + private NodeConnectors() { + + } + + public NodeConnectors(List nodeConnectorProperties) { + this.nodeConnectorProperties = nodeConnectorProperties; + } + + public List getNodeConnectorProperties() { + return nodeConnectorProperties; + } + + public void setNodeConnectorProperties(List nodeConnectorProperties) { + this.nodeConnectorProperties = nodeConnectorProperties; + } } diff --git a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/Nodes.java b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/Nodes.java index b7f1c53ae8..07d7b7c33b 100644 --- a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/Nodes.java +++ b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/Nodes.java @@ -19,22 +19,22 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class Nodes { - @XmlElement - List nodeProperties; - //To satisfy JAXB - private Nodes() { - - } - - public Nodes(List nodeProperties) { - this.nodeProperties = nodeProperties; - } - - public List getNodeProperties() { - return nodeProperties; - } - - public void setNodeProperties(List nodeProperties) { - this.nodeProperties = nodeProperties; - } + @XmlElement + List nodeProperties; + //To satisfy JAXB + private Nodes() { + + } + + public Nodes(List nodeProperties) { + this.nodeProperties = nodeProperties; + } + + public List getNodeProperties() { + return nodeProperties; + } + + public void setNodeProperties(List nodeProperties) { + this.nodeProperties = nodeProperties; + } } diff --git a/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java b/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java index 5386d4142f..a8b18d5637 100644 --- a/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java +++ b/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java @@ -18,58 +18,58 @@ import org.opendaylight.controller.sal.utils.NodeCreator; public class SwitchManagerNorthboundTest extends TestCase { - @Test - public void testNodes() { - List nodeProperties = new ArrayList(); - Nodes nodes = new Nodes(nodeProperties); - Assert.assertTrue(nodes.getNodeProperties().equals(nodeProperties)); - nodes.setNodeProperties(null); - Assert.assertTrue(nodes.getNodeProperties() == null); - } + @Test + public void testNodes() { + List nodeProperties = new ArrayList(); + Nodes nodes = new Nodes(nodeProperties); + Assert.assertTrue(nodes.getNodeProperties().equals(nodeProperties)); + nodes.setNodeProperties(null); + Assert.assertTrue(nodes.getNodeProperties() == null); + } + + @Test + public void testNodeProperties() { + Node node = NodeCreator.createOFNode(1L); + NodeProperties np= new NodeProperties(node, null); + Assert.assertTrue(np.getNode().equals(node)); + Assert.assertTrue(np.getProperties() == null); + + Node node2 = NodeCreator.createOFNode(2L); + np.setNode(node2); + Assert.assertTrue(np.getNode().equals(node2)); - @Test - public void testNodeProperties() { - Node node = NodeCreator.createOFNode(1L); - NodeProperties np= new NodeProperties(node, null); - Assert.assertTrue(np.getNode().equals(node)); - Assert.assertTrue(np.getProperties() == null); + Set props = new HashSet(); + np.setProperties(props); + Assert.assertTrue(np.getProperties().equals(props)); + } - Node node2 = NodeCreator.createOFNode(2L); - np.setNode(node2); - Assert.assertTrue(np.getNode().equals(node2)); - - Set props = new HashSet(); - np.setProperties(props); - Assert.assertTrue(np.getProperties().equals(props)); - } - - @Test - public void testNodeConnectors() { - List nodeConnectorProperties = new ArrayList(); - NodeConnectors ncs = new NodeConnectors(nodeConnectorProperties); - Assert.assertTrue(ncs.getNodeConnectorProperties().equals(nodeConnectorProperties)); - ncs.setNodeConnectorProperties(null); - Assert.assertTrue(ncs.getNodeConnectorProperties() == null); - } - - @Test - public void testNodeConnectorProperties() { - Node node = NodeCreator.createOFNode(1L); + @Test + public void testNodeConnectors() { + List nodeConnectorProperties = new ArrayList(); + NodeConnectors ncs = new NodeConnectors(nodeConnectorProperties); + Assert.assertTrue(ncs.getNodeConnectorProperties().equals(nodeConnectorProperties)); + ncs.setNodeConnectorProperties(null); + Assert.assertTrue(ncs.getNodeConnectorProperties() == null); + } + + @Test + public void testNodeConnectorProperties() { + Node node = NodeCreator.createOFNode(1L); NodeConnector port = NodeConnectorCreator.createOFNodeConnector( (short) 24, node); - + NodeConnectorProperties ncp= new NodeConnectorProperties(port, null); - Assert.assertTrue(ncp.getProperties() == null); - Assert.assertTrue(ncp.getNodeConnector().equals(port)); - + Assert.assertTrue(ncp.getProperties() == null); + Assert.assertTrue(ncp.getNodeConnector().equals(port)); + NodeConnector port2 = NodeConnectorCreator.createOFNodeConnector( (short) 33, node); - ncp.setNodeConnector(port2); - Assert.assertTrue(ncp.getNodeConnector().equals(port2)); - - Set props = new HashSet(); - ncp.setProperties(props); - Assert.assertTrue(ncp.getProperties().equals(props)); - } + ncp.setNodeConnector(port2); + Assert.assertTrue(ncp.getNodeConnector().equals(port2)); + Set props = new HashSet(); + ncp.setProperties(props); + Assert.assertTrue(ncp.getProperties().equals(props)); + } + } diff --git a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/Topology.java b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/Topology.java index 15548d9428..bfc86cf34b 100644 --- a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/Topology.java +++ b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/Topology.java @@ -19,22 +19,22 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class Topology { - @XmlElement - List edgeProperties; - //To satisfy JAXB - private Topology() { - - } - - public Topology(List edgeProperties) { - this.edgeProperties = edgeProperties; - } - - public List getEdgeProperties() { - return edgeProperties; - } - - public void setEdgeProperties(List edgeProperties) { - this.edgeProperties = edgeProperties; - } + @XmlElement + List edgeProperties; + //To satisfy JAXB + private Topology() { + + } + + public Topology(List edgeProperties) { + this.edgeProperties = edgeProperties; + } + + public List getEdgeProperties() { + return edgeProperties; + } + + public void setEdgeProperties(List edgeProperties) { + this.edgeProperties = edgeProperties; + } } diff --git a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java index 323e2d2211..10480bc4ec 100644 --- a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java +++ b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java @@ -45,7 +45,7 @@ import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig; /** * Topology Northbound REST API - * + * *
*
* Authentication scheme : HTTP Basic
@@ -74,12 +74,12 @@ public class TopologyNorthboundJAXRS { } /** - * + * * Retrieve the Topology - * + * * @param containerName * The container for which we want to retrieve the topology - * + * * @return A List of EdgeProps each EdgeProp represent an Edge of the grap * with the corresponding properties attached to it. */ @@ -119,10 +119,10 @@ public class TopologyNorthboundJAXRS { /** * Retrieve the user configured links - * + * * @param containerName * The container for which we want to retrieve the user links - * + * * @return A List of user configured links */ @Path("/{containerName}/userLink") @@ -159,7 +159,7 @@ public class TopologyNorthboundJAXRS { /** * Add an User Link - * + * * @param containerName * Name of the Container. The base Container is "default". * @param TopologyUserLinkConfig @@ -202,7 +202,7 @@ public class TopologyNorthboundJAXRS { /** * Delete an User Link - * + * * @param containerName * Name of the Container. The base Container is "default". * @param name diff --git a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyUserLinks.java b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyUserLinks.java index db24755a29..1b19edc5f6 100644 --- a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyUserLinks.java +++ b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyUserLinks.java @@ -22,23 +22,23 @@ import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig; @XmlAccessorType(XmlAccessType.NONE) public class TopologyUserLinks { - @XmlElement - List userLinks; - - //To satisfy JAXB - private TopologyUserLinks() { - - } - - public List getUserLinks() { - return userLinks; - } - - public void setUserLinks(List userLinks) { - this.userLinks = userLinks; - } - - public TopologyUserLinks(List userLinks) { - this.userLinks = new ArrayList(userLinks); - } + @XmlElement + List userLinks; + + //To satisfy JAXB + private TopologyUserLinks() { + + } + + public List getUserLinks() { + return userLinks; + } + + public void setUserLinks(List userLinks) { + this.userLinks = userLinks; + } + + public TopologyUserLinks(List userLinks) { + this.userLinks = new ArrayList(userLinks); + } } diff --git a/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java b/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java index 1e5ea0f2c5..85d31c3c8f 100644 --- a/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java +++ b/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java @@ -113,6 +113,6 @@ public class TopologyTest { assertEquals(2, getEdgePropList.size()); } - + } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java index 9bcd7c0dc4..6b328961fc 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java @@ -24,22 +24,22 @@ public interface IInventoryShimInternalListener { /** * Updates node and its properties * - * @param node {@link org.opendaylight.controller.sal.core.Node} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.Tier} etc. + * @param node {@link org.opendaylight.controller.sal.core.Node} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.Tier} etc. */ public void updateNode(Node node, UpdateType type, Set props); /** * Updates node connector and its properties * - * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.State} etc. + * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.State} etc. */ public void updateNodeConnector(NodeConnector nodeConnector, UpdateType type, Set props); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsManager.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsManager.java index d619b73776..74dc84aec9 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsManager.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsManager.java @@ -80,7 +80,7 @@ public interface IOFStatisticsManager { * For port statistics, it is the port id. If null the query * will be performed for all the targets for the specified * statistics type. - * + * * @param timeout the timeout in milliseconds the system will wait for a response * from the switch, before declaring failure * @return the list of openflow statistics diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IRefreshInternalProvider.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IRefreshInternalProvider.java index 9fca60f1a0..fd762d4aa9 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IRefreshInternalProvider.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IRefreshInternalProvider.java @@ -10,10 +10,10 @@ package org.opendaylight.controller.protocol_plugin.openflow; /** - * @file IRefreshInternalProvider.java + * @file IRefreshInternalProvider.java * - * @brief Topology refresh notifications requested by application - * to be fetched from the plugin + * @brief Topology refresh notifications requested by application + * to be fetched from the plugin * * For example, an application that has been started late, will want to * be up to date with the latest topology. Hence, it requests for a diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IStatisticsListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IStatisticsListener.java index d837e01c01..4f15a1055a 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IStatisticsListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IStatisticsListener.java @@ -8,6 +8,6 @@ import org.openflow.protocol.statistics.OFDescriptionStatistics; * is updated with new one. */ public interface IStatisticsListener { - public void descriptionRefreshed(Long switchId, - OFDescriptionStatistics description); + public void descriptionRefreshed(Long switchId, + OFDescriptionStatistics description); } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java index 45c0025b54..e90823726c 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java @@ -22,7 +22,7 @@ import org.opendaylight.controller.sal.topology.TopoEdgeUpdate; public interface ITopologyServiceShimListener { /** * Called to update on Edge in the topology graph - * + * * @param topoedgeupdateList * List of topoedgeupdates Each topoedgeupdate includes edge, its * Properties ( BandWidth and/or Latency etc) and update type. @@ -32,7 +32,7 @@ public interface ITopologyServiceShimListener { /** * Called when an Edge utilization is above the safe threshold configured on * the controller - * + * * @param {@link org.opendaylight.controller.sal.core.Edge} */ public void edgeOverUtilized(Edge edge); @@ -40,7 +40,7 @@ public interface ITopologyServiceShimListener { /** * Called when the Edge utilization is back to normal, below the safety * threshold level configured on the controller - * + * * @param {@link org.opendaylight.controller.sal.core.Edge} */ public void edgeUtilBackToNormal(Edge edge); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IController.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IController.java index 9e3c21c65e..2cacafe779 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IController.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IController.java @@ -58,5 +58,5 @@ public interface IController { * @return ISwitch if present, null otherwise */ public ISwitch getSwitch(Long switchId); - + } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IMessageReadWrite.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IMessageReadWrite.java index ce91e1f275..8fb9a6acb8 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IMessageReadWrite.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/IMessageReadWrite.java @@ -19,35 +19,35 @@ import org.openflow.protocol.OFMessage; * encryption and decryption of the network data. */ public interface IMessageReadWrite { - /** - * Sends the OF message out over the socket channel. For secure - * communication, the data will be encrypted. - * - * @param msg OF message to be sent - * @throws Exception - */ - public void asyncSend(OFMessage msg) throws Exception; - - /** - * Resumes sending the remaining messages in the outgoing buffer - * @throws Exception - */ - public void resumeSend() throws Exception; - - /** - * Reads the incoming network data from the socket and retrieves the OF - * messages. For secure communication, the data will be decrypted first. - * - * @return list of OF messages - * @throws Exception - */ + /** + * Sends the OF message out over the socket channel. For secure + * communication, the data will be encrypted. + * + * @param msg OF message to be sent + * @throws Exception + */ + public void asyncSend(OFMessage msg) throws Exception; + + /** + * Resumes sending the remaining messages in the outgoing buffer + * @throws Exception + */ + public void resumeSend() throws Exception; + + /** + * Reads the incoming network data from the socket and retrieves the OF + * messages. For secure communication, the data will be decrypted first. + * + * @return list of OF messages + * @throws Exception + */ public List readMessages() throws Exception; - - /** - * Proper clean up when the switch connection is closed - * - * @return - * @throws Exception - */ + + /** + * Proper clean up when the switch connection is closed + * + * @return + * @throws Exception + */ public void stop() throws Exception; } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/ISwitch.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/ISwitch.java index 41da311fd9..196fbbfb4c 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/ISwitch.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/ISwitch.java @@ -19,54 +19,54 @@ import org.openflow.protocol.OFStatisticsRequest; /** * This interface defines an abstraction of an Open Flow Switch. - * + * */ public interface ISwitch { /** * Gets a unique XID. - * + * * @return XID */ public int getNextXid(); /** * Returns the Switch's ID. - * + * * @return the Switch's ID */ public Long getId(); /** * Returns the Switch's table numbers supported by datapath - * + * * @return the tables */ public Byte getTables(); /** * Returns the Switch's bitmap of supported ofp_action_type - * + * * @return the actions */ public Integer getActions(); /** * Returns the Switch's bitmap of supported ofp_capabilities - * + * * @return the capabilities */ public Integer getCapabilities(); /** * Returns the Switch's buffering capacity in Number of Pkts - * + * * @return the buffers */ public Integer getBuffers(); /** * Returns the Date when the switch was connected. - * + * * @return Date The date when the switch was connected */ public Date getConnectedDate(); @@ -77,7 +77,7 @@ public interface ISwitch { * should be used for non-critical messages such as statistics request, * discovery packets, etc. An unique XID is generated automatically and * inserted into the message. - * + * * @param msg * The OF message to be sent * @return The XID used @@ -89,7 +89,7 @@ public interface ISwitch { * priority. It will be served after high priority messages. The method * should be used for non-critical messages such as statistics request, * discovery packets, etc. The specified XID is inserted into the message. - * + * * @param msg * The OF message to be Sent * @param xid @@ -104,7 +104,7 @@ public interface ISwitch { * method should be used for critical messages such as hello, echo reply * etc. An unique XID is generated automatically and inserted into the * message. - * + * * @param msg * The OF message to be sent * @return The XID used @@ -116,7 +116,7 @@ public interface ISwitch { * priority. It will be served first before normal priority messages. The * method should be used for critical messages such as hello, echo reply * etc. The specified XID is inserted into the message. - * + * * @param msg * The OF message to be sent * @return The XID used @@ -126,7 +126,7 @@ public interface ISwitch { /** * Sends the OF message followed by a Barrier Request with a unique XID * which is automatically generated, and waits for a result from the switch. - * + * * @param msg * The message to be sent * @return An Object which has one of the followings instances/values: @@ -141,21 +141,21 @@ public interface ISwitch { /** * Returns a map containing all OFPhysicalPorts of this switch. - * + * * @return The Map of OFPhysicalPort */ public Map getPhysicalPorts(); /** * Returns a Set containing all port IDs of this switch. - * + * * @return The Set of port ID */ public Set getPorts(); /** * Returns OFPhysicalPort of the specified portNumber of this switch. - * + * * @param portNumber * The port ID * @return OFPhysicalPort for the specified PortNumber @@ -164,7 +164,7 @@ public interface ISwitch { /** * Returns the bandwidth of the specified portNumber of this switch. - * + * * @param portNumber * the port ID * @return bandwidth @@ -173,7 +173,7 @@ public interface ISwitch { /** * Returns True if the port is enabled, - * + * * @param portNumber * @return True if the port is enabled */ @@ -181,7 +181,7 @@ public interface ISwitch { /** * Returns True if the port is enabled. - * + * * @param port * @return True if the port is enabled */ @@ -189,7 +189,7 @@ public interface ISwitch { /** * Returns a list containing all enabled ports of this switch. - * + * * @return: List containing all enabled ports of this switch */ public List getEnabledPorts(); @@ -197,7 +197,7 @@ public interface ISwitch { /** * Sends OFStatisticsRequest with a unique XID generated automatically and * waits for a result from the switch. - * + * * @param req * the OF Statistic Request to be sent * @return Object has one of the following instances/values:: @@ -211,7 +211,7 @@ public interface ISwitch { /** * Returns true if the switch has reached the operational state (has sent * FEATURE_REPLY to the controller). - * + * * @return true if the switch is operational */ public boolean isOperational(); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java index 7fb5f9fcf1..2863070cc5 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java @@ -107,7 +107,7 @@ public class Controller implements IController, CommandProvider { /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ public void init() { logger.debug("Initializing!"); @@ -122,7 +122,7 @@ public class Controller implements IController, CommandProvider { /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ public void start() { logger.debug("Starting!"); @@ -145,7 +145,7 @@ public class Controller implements IController, CommandProvider { * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ public void stop() { for (Iterator> it = switches.entrySet().iterator(); it @@ -166,7 +166,7 @@ public class Controller implements IController, CommandProvider { * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ public void destroy() { } @@ -224,7 +224,7 @@ public class Controller implements IController, CommandProvider { instanceName); switchHandler.start(); if (sc.isConnected()) { - logger.info("Switch:{} is connected to the Controller", + logger.info("Switch:{} is connected to the Controller", sc.socket().getRemoteSocketAddress() .toString().split("/")[1]); } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/MessageReadWriteService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/MessageReadWriteService.java index fc2e0ee324..d2dab0fc94 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/MessageReadWriteService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/MessageReadWriteService.java @@ -52,7 +52,7 @@ public class MessageReadWriteService implements IMessageReadWrite { /** * Sends the OF message out over the socket channel. - * + * * @param msg * OF message to be sent * @throws Exception @@ -90,7 +90,7 @@ public class MessageReadWriteService implements IMessageReadWrite { /** * Resumes sending the remaining messages in the outgoing buffer - * + * * @throws Exception */ @Override @@ -116,7 +116,7 @@ public class MessageReadWriteService implements IMessageReadWrite { /** * Reads the incoming network data from the socket and retrieves the OF * messages. - * + * * @return list of OF messages * @throws Exception */ diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/PriorityMessage.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/PriorityMessage.java index 0386ef6f74..6a2cb9e9c4 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/PriorityMessage.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/PriorityMessage.java @@ -22,7 +22,7 @@ class PriorityMessage { final static AtomicLong seq = new AtomicLong(); final long seqNum; boolean syncReply; // set to true if we want to be blocked until the response arrives - + public PriorityMessage(OFMessage msg, int priority) { this.msg = msg; this.priority = priority; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java index 64031fd012..43a64814d8 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java @@ -71,7 +71,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Bring up secure channel using SSL Engine - * + * * @param socket * TCP socket channel * @throws Exception @@ -143,7 +143,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Sends the OF message out over the socket channel. The message is * encrypted by SSL Engine. - * + * * @param msg * OF message to be sent * @throws Exception @@ -196,7 +196,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Resumes sending the remaining messages in the outgoing buffer - * + * * @throws Exception */ @Override @@ -234,7 +234,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Reads the incoming network data from the socket, decryptes them and then * retrieves the OF messages. - * + * * @return list of OF messages * @throws Exception */ diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DataPacketMuxDemux.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DataPacketMuxDemux.java index 2d8cdd206a..dc84304a04 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DataPacketMuxDemux.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DataPacketMuxDemux.java @@ -131,7 +131,7 @@ public class DataPacketMuxDemux implements IContainerListener, /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { this.controller.addMessageListener(OFType.PACKET_IN, this); @@ -141,7 +141,7 @@ public class DataPacketMuxDemux implements IContainerListener, * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { this.controller.removeMessageListener(OFType.PACKET_IN, this); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DescStatisticsConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DescStatisticsConverter.java index ffd5fd4315..e294562886 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DescStatisticsConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DescStatisticsConverter.java @@ -28,7 +28,7 @@ public class DescStatisticsConverter { public DescStatisticsConverter(List statsList) { this.hwDesc = null; - this.ofDesc = (statsList == null || statsList.isEmpty())? + this.ofDesc = (statsList == null || statsList.isEmpty())? null : (OFDescriptionStatistics) statsList.get(0); } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java index c3833d2246..3be6f22742 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java @@ -933,20 +933,20 @@ public class DiscoveryService implements IInventoryShimExternalListener, help.append("\t pcc - Print CC info\n"); help.append("\t psize - Print sizes of all the lists\n"); help.append("\t ptm - Print timeout info\n"); - help.append("\t ecc - Enable CC\n"); - help.append("\t dcc - Disable CC\n"); + help.append("\t ecc - Enable CC\n"); + help.append("\t dcc - Disable CC\n"); help.append("\t scc [multiple] - Set/show CC multiple and interval\n"); - help.append("\t sports [ports] - Set/show max ports per batch\n"); + help.append("\t sports [ports] - Set/show max ports per batch\n"); help.append("\t spause [ticks] - Set/show pause period\n"); - help.append("\t sdi [ticks] - Set/show discovery interval in ticks\n"); + help.append("\t sdi [ticks] - Set/show discovery interval in ticks\n"); help.append("\t stm [ticks] - Set/show per timeout ticks\n"); - help.append("\t sretry [count] - Set/show num of retries\n"); - help.append("\t addsw - Add a switch\n"); - help.append("\t remsw - Remove a switch\n"); + help.append("\t sretry [count] - Set/show num of retries\n"); + help.append("\t addsw - Add a switch\n"); + help.append("\t remsw - Remove a switch\n"); help.append("\t page - Print aging info\n"); help.append("\t sage - Set/Show aging time limit\n"); - help.append("\t eage - Enable aging\n"); - help.append("\t dage - Disable aging\n"); + help.append("\t eage - Enable aging\n"); + help.append("\t dage - Disable aging\n"); help.append("\t pthrot - Print throttling\n"); help.append("\t ethrot - Enable throttling\n"); help.append("\t dthrot - Disable throttling\n"); @@ -1048,7 +1048,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, } } ci.println("\n"); - ci.println(" NodeConnector Edge "); + ci.println(" NodeConnector Edge "); Set keySet = prodMap.keySet(); if (keySet == null) { return; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java index 45c92aa91a..074774a25e 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java @@ -100,7 +100,7 @@ public class FlowConverter { /** * Returns the match in OF 1.0 (OFMatch) form or OF 1.0 + IPv6 extensions * form (V6Match) - * + * * @return */ public OFMatch getOFMatch() { @@ -262,7 +262,7 @@ public class FlowConverter { /** * Returns the list of actions in OF 1.0 form - * + * * @return */ public List getOFActions() { @@ -424,7 +424,7 @@ public class FlowConverter { /** * Utility to convert a SAL flow to an OF 1.0 (OFFlowMod) or to an OF 1.0 + * IPv6 extension (V6FlowMod) Flow modifier Message - * + * * @param sw * @param command * @param port diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerNotifier.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerNotifier.java index 2a62d6c34a..cad0dfa807 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerNotifier.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerNotifier.java @@ -37,7 +37,7 @@ public class FlowProgrammerNotifier implements IFlowProgrammerNotifier { * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { logger.debug("DESTROY called!"); @@ -46,7 +46,7 @@ public class FlowProgrammerNotifier implements IFlowProgrammerNotifier { /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { logger.debug("START called!"); @@ -56,7 +56,7 @@ public class FlowProgrammerNotifier implements IFlowProgrammerNotifier { * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { logger.debug("STOP called!"); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java index f58acf62ed..96ea6cd14f 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java @@ -110,7 +110,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { this.controller.addMessageListener(OFType.FLOW_REMOVED, this); @@ -122,7 +122,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { } @@ -130,7 +130,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { } @@ -139,7 +139,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { } @@ -201,7 +201,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, * will be inserted automatically to synchronize the * progression. */ - result = asyncMsgSend(node, sw, msg, rid); + result = asyncMsgSend(node, sw, msg, rid); } return getStatusInternal(result, action, rid); } else { @@ -392,7 +392,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, if ((rid == null) || (rid == 0)) { return; } - + /* * Notifies the caller that error has been reported for a previous flow * programming request @@ -466,7 +466,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, return new Status(StatusCode.INTERNALERROR, "Failed to send Barrier message."); } - + @Override public Status asyncSendBarrierMessage(Node node) { if (!node.getType().equals(NodeIDType.OPENFLOW)) { @@ -489,14 +489,14 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, return new Status(StatusCode.INTERNALERROR, "Failed to send Barrier message."); } - + /** * This method sends the message asynchronously until the number of messages * sent reaches a threshold. Then a Barrier message is sent automatically * for sync purpose. An unique Request ID associated with the message is * passed down by the caller. The Request ID will be returned to the caller * when an error message is received from the switch. - * + * * @param node * The node * @param msg @@ -514,25 +514,25 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, xid = sw.asyncSend(msg); addXid2Rid(swid, xid, rid); - + Map swxid2rid = this.xid2rid.get(swid); if (swxid2rid == null) { return result; } - + int size = swxid2rid.size(); if (size % barrierMessagePriorCount == 0) { result = asyncSendBarrierMessage(node); } - + return result; } - + /** * A number of async messages are sent followed by a synchronous Barrier * message. This method returns the maximum async messages that can be sent * before the Barrier message. - * + * * @return The max count of async messages sent prior to Barrier message */ private int getBarrierMessagePriorCount() { @@ -548,11 +548,11 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, return rv; } - + /** * This method returns the message Request ID previously assigned by the * caller for a given OF message xid - * + * * @param swid * The switch id * @param xid @@ -576,14 +576,14 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, /** * This method returns a copy of outstanding xid to rid mappings.for a given * switch - * + * * @param swid * The switch id * @return a copy of xid2rid mappings */ public Map getSwXid2Rid(long swid) { Map swxid2rid = this.xid2rid.get(swid); - + if (swxid2rid != null) { return new HashMap(swxid2rid); } else { @@ -593,7 +593,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, /** * Adds xid to rid mapping to the local DB - * + * * @param swid * The switch id * @param xid @@ -611,7 +611,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, /** * When an Error message is received, this method will be invoked to remove * the offending xid from the local DB. - * + * * @param swid * The switch id * @param xid @@ -626,7 +626,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, /** * Convert various result into Status - * + * * @param result * The returned result from previous action * @param action @@ -652,11 +652,11 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, "send", action, "Internal Error")); } } - + /** * When a Barrier reply is received, this method will be invoked to clear * the local DB - * + * * @param swid * The switch id */ @@ -670,7 +670,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, @Override public void updateNode(Node node, UpdateType type, Set props) { long swid = (Long)node.getID(); - + switch (type) { case ADDED: Map swxid2rid = new HashMap(); @@ -712,7 +712,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, ci.println("Please enter a valid node id"); return; } - + long sid; try { sid = HexEncode.stringToLong(st); @@ -720,7 +720,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, ci.println("Please enter a valid node id"); return; } - + Map swxid2rid = this.xid2rid.get(sid); if (swxid2rid == null) { ci.println("The node id entered does not exist"); @@ -728,7 +728,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, } ci.println("xid rid"); - + Set xidSet = swxid2rid.keySet(); if (xidSet == null) { return; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowStatisticsConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowStatisticsConverter.java index 82dbf670a9..7afe6ce5be 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowStatisticsConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowStatisticsConverter.java @@ -23,9 +23,9 @@ import org.slf4j.LoggerFactory; /** * Converts an openflow list of flow statistics in a SAL list of FlowOnNode * objects - * - * - * + * + * + * */ public class FlowStatisticsConverter { private static final Logger log = LoggerFactory diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceHelper.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceHelper.java index 5e5f056c5a..33afa94633 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceHelper.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceHelper.java @@ -108,27 +108,27 @@ public class InventoryServiceHelper { if (bw != null) { props.add(bw); } - + Bandwidth abw = InventoryServiceHelper.OFPortToBandWidth(port.getAdvertisedFeatures()); if (abw != null) { - AdvertisedBandwidth a = new AdvertisedBandwidth(abw.getValue()); - if (a != null) { - props.add(a); - } + AdvertisedBandwidth a = new AdvertisedBandwidth(abw.getValue()); + if (a != null) { + props.add(a); + } } Bandwidth sbw = InventoryServiceHelper.OFPortToBandWidth(port.getSupportedFeatures()); if (sbw != null) { - SupportedBandwidth s = new SupportedBandwidth(sbw.getValue()); - if (s != null) { - props.add(s); - } + SupportedBandwidth s = new SupportedBandwidth(sbw.getValue()); + if (s != null) { + props.add(s); + } } Bandwidth pbw = InventoryServiceHelper.OFPortToBandWidth(port.getPeerFeatures()); if (pbw != null) { - PeerBandwidth p = new PeerBandwidth(pbw.getValue()); - if (p != null) { - props.add(p); - } + PeerBandwidth p = new PeerBandwidth(pbw.getValue()); + if (p != null) { + props.add(p); + } } props.add(new Name(port.getName())); props.add(InventoryServiceHelper.OFPortToConfig(port.getConfig())); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java index 21a632e1de..78fddc7736 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java @@ -129,7 +129,7 @@ IInventoryShimExternalListener, CommandProvider { /** * Returns the average transmit rate in bps - * + * * @return the average transmit rate [bps] */ public long getAverageTxRate() { @@ -162,7 +162,7 @@ IInventoryShimExternalListener, CommandProvider { /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { flowStatistics = new ConcurrentHashMap>(); @@ -227,7 +227,7 @@ IInventoryShimExternalListener, CommandProvider { * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { } @@ -235,7 +235,7 @@ IInventoryShimExternalListener, CommandProvider { /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { // Start managed timers @@ -255,7 +255,7 @@ IInventoryShimExternalListener, CommandProvider { * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { // Stop managed timers @@ -896,7 +896,7 @@ IInventoryShimExternalListener, CommandProvider { /** * Update the cached port rates for this switch with the latest retrieved * port transmit byte count - * + * * @param switchId */ private synchronized void updatePortsTxRate(long switchId) { diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortConverter.java index 0b605ab875..410781683b 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortConverter.java @@ -20,9 +20,9 @@ import org.slf4j.LoggerFactory; /** * Abstract class which provides the utilities for converting the Openflow port * number to the equivalent NodeConnector and vice versa - * - * - * + * + * + * */ public abstract class PortConverter { private static final Logger log = LoggerFactory diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java index b18eae971b..3fbf68fbc1 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java @@ -22,9 +22,9 @@ import org.slf4j.LoggerFactory; /** * Converts an openflow list of port statistics in a SAL list of * NodeConnectorStatistics objects - * - * - * + * + * + * */ public class PortStatisticsConverter { private static final Logger log = LoggerFactory diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java index 22e8a4dc74..bcb01b1392 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java @@ -284,9 +284,9 @@ public class ReadServiceFilter implements IPluginReadServiceFilter, /** * Returns whether the passed NodeConnector belongs to the container * - * @param container container name - * @param p node connector to test - * @return true if belongs false otherwise + * @param container container name + * @param p node connector to test + * @return true if belongs false otherwise */ public boolean containerOwnsNodeConnector(String container, NodeConnector p) { // All node connectors belong to the default container @@ -300,9 +300,9 @@ public class ReadServiceFilter implements IPluginReadServiceFilter, /** * Returns whether the passed NodeConnector belongs to the container * - * @param container container name - * @param table node table to test - * @return true if belongs false otherwise + * @param container container name + * @param table node table to test + * @return true if belongs false otherwise */ public boolean containerOwnsNodeTable(String container, NodeTable table) { // All node table belong to the default container diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java index 68572fb650..b23737c520 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java @@ -32,7 +32,7 @@ public class TopologyServices implements ITopologyServiceShimListener, /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ @SuppressWarnings("unchecked") void init(Component c) { @@ -46,7 +46,7 @@ public class TopologyServices implements ITopologyServiceShimListener, * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { logger.trace("DESTROY called!"); @@ -55,7 +55,7 @@ public class TopologyServices implements ITopologyServiceShimListener, /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { logger.trace("START called!"); @@ -65,7 +65,7 @@ public class TopologyServices implements ITopologyServiceShimListener, * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { logger.trace("STOP called!"); @@ -73,7 +73,7 @@ public class TopologyServices implements ITopologyServiceShimListener, /** * Retrieve SAL service IPluginOutTopologyService - * + * * @param s * Called by Dependency Manager as soon as the SAL service is * available @@ -85,7 +85,7 @@ public class TopologyServices implements ITopologyServiceShimListener, /** * called when SAL service IPluginOutTopologyService is no longer available - * + * * @param s * Called by Dependency Manager as soon as the SAL service is * unavailable @@ -99,7 +99,7 @@ public class TopologyServices implements ITopologyServiceShimListener, /** * Retrieve OF protocol_plugin service IRefreshInternalProvider - * + * * @param s * Called by Dependency Manager as soon as the SAL service is * available @@ -112,7 +112,7 @@ public class TopologyServices implements ITopologyServiceShimListener, /** * called when OF protocol_plugin service IRefreshInternalProvider is no * longer available - * + * * @param s * Called by Dependency Manager as soon as the SAL service is * unavailable diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Utils.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Utils.java index 4f7bf4889f..f1ce03af28 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Utils.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Utils.java @@ -33,7 +33,7 @@ public abstract class Utils { er.readFrom(bb); return er.toString(); } - + // Handle OF1.0 errors here OFErrorType et = OFErrorType.values()[0xffff & error.getErrorType()]; String errorStr = "Error : " + et.toString(); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java index 9e44073e21..c52c3f56b8 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java @@ -6,21 +6,21 @@ import java.util.Arrays; import org.openflow.protocol.OFError; public class V6Error extends OFError { - private static final long serialVersionUID = 1L; - public static int MINIMUM_LENGTH = 20;//OfHdr(8) + NXET_VENDOR(2) + NXEC_VENDOR_ERROR(2) + struct nx_vendor_error(8) - public static final short NICIRA_VENDOR_ERRORTYPE = (short)0xb0c2; - protected int V6VendorId; + private static final long serialVersionUID = 1L; + public static int MINIMUM_LENGTH = 20;//OfHdr(8) + NXET_VENDOR(2) + NXEC_VENDOR_ERROR(2) + struct nx_vendor_error(8) + public static final short NICIRA_VENDOR_ERRORTYPE = (short)0xb0c2; + protected int V6VendorId; protected short V6VendorErrorType; protected short V6VendorErrorCode; protected byte[] V6ErrorData; - + public V6Error(OFError e) { this.length = (short)e.getLengthU(); this.errorType = e.getErrorType(); this.errorCode = e.getErrorCode(); this.xid = e.getXid(); } - + @Override public void readFrom(ByteBuffer data) { this.V6VendorId = data.getInt(); @@ -30,37 +30,37 @@ public class V6Error extends OFError { if (dataLength > 0) { this.V6ErrorData = new byte[dataLength]; data.get(this.V6ErrorData); - } + } } - + /** * @return the V6VendorId */ public int getVendorId() { return V6VendorId; } - + /** * @return the V6VendorErrorType */ public short getVendorErrorType() { return V6VendorErrorType; } - + /** * @return the VendorErrorType */ public short getVendorErrorCode() { return V6VendorErrorCode; } - + /** * @return the Error Bytes */ public byte[] getError() { return V6ErrorData; } - + @Override public int hashCode() { final int prime = 31; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6FlowMod.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6FlowMod.java index 81ee6dc070..53f4e1d5ad 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6FlowMod.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6FlowMod.java @@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory; /** * This class is used to create IPv6 Vendor Extension messages. Specfically, It * defines the methods used in creation of Vendor specific IPv6 Flow Mod message. - * + * * */ public class V6FlowMod extends OFVendor implements Cloneable { @@ -49,7 +49,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { private static int IPV6_EXT_MIN_HDR_LEN = 36; /** - * Constructor for the V6FlowMod class. Initializes OFVendor (parent class) + * Constructor for the V6FlowMod class. Initializes OFVendor (parent class) * fields by calling the parent class' constructor. */ public V6FlowMod() { @@ -58,7 +58,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * This method sets the match fields of V6FlowMod object - * @param match V6Match object for this V6FlowMod message + * @param match V6Match object for this V6FlowMod message */ public void setMatch(V6Match match) { this.match = match; @@ -66,7 +66,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the list of actions V6FlowMod message - * @param actions a list of ordered OFAction objects + * @param actions a list of ordered OFAction objects */ public void setActions(List actions) { this.actions = actions; @@ -74,7 +74,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the priority field of V6FlowMod message - * @param priority Priority of the message + * @param priority Priority of the message */ public void setPriority(short priority) { this.priority = priority; @@ -82,7 +82,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the cookie field of V6FlowMod message - * @param cookie Cookie of the message + * @param cookie Cookie of the message */ public void setCookie(long cookie) { this.cookie = cookie; @@ -90,7 +90,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the command field of V6FlowMod message - * @param command Command type of the message (ADD or DELETE) + * @param command Command type of the message (ADD or DELETE) */ public V6FlowMod setCommand(short command) { this.command = command; @@ -99,7 +99,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the outPort field of V6FlowMod message - * @param outPort outPort of the message + * @param outPort outPort of the message */ public V6FlowMod setOutPort(OFPort port) { this.outPort = port.getValue(); @@ -108,7 +108,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the idle_timeout of V6FlowMod message - * @param idleTimeout idle timeout for this message + * @param idleTimeout idle timeout for this message */ public void setIdleTimeout(short idleTimeout) { this.idleTimeout = idleTimeout; @@ -116,7 +116,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Sets the hardTimeout field of V6FlowMod message - * @param hardTimeout hard timeout of the message + * @param hardTimeout hard timeout of the message */ public void setHardTimeout(short hardTimeout) { this.hardTimeout = hardTimeout; @@ -124,21 +124,21 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Returns the Flow Mod message subtype for V6FlowMod message - * @return message subtype + * @return message subtype */ private int getIPv6ExtensionFlowModAddSubType() { return IPV6EXT_ADD_FLOW_MSG_TYPE; } - + /** * Returns the minimum header size for V6Flow Message type - * @return minimum header size + * @return minimum header size */ public int getV6FlowModMinHdrSize() { return IPV6_EXT_MIN_HDR_LEN; } - + /** * Sets the Vendor type in OFVendor message */ @@ -146,7 +146,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { public void setVendor() { super.setVendor(V6StatsRequest.NICIRA_VENDOR_ID); } - + /** * Get flags * @return @@ -162,12 +162,12 @@ public class V6FlowMod extends OFVendor implements Cloneable { public void setFlags(short flags) { this.flags = flags; } - + /** * This method forms the Vendor extension IPv6 Flow Mod message.It uses the - * fields in V6FlowMod class, and writes the data according to vendor + * fields in V6FlowMod class, and writes the data according to vendor * extension format. The fields include flow properties (cookie, timeout, - * priority, etc), flow match, and action list. It also takes care of + * priority, etc), flow match, and action list. It also takes care of * required padding. */ @@ -209,7 +209,7 @@ public class V6FlowMod extends OFVendor implements Cloneable { /** * Forms the clone of V6FlowMod Object. If Object is returned - * successfully, then returns the cloned object. Throws an + * successfully, then returns the cloned object. Throws an * exception if cloning is not supported. */ @Override diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java index 0edcfead0c..2da6b9b008 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java @@ -27,14 +27,14 @@ import org.slf4j.LoggerFactory; /** * This Class forms the vendor specific IPv6 Flow Match messages as well as * processes the vendor specific IPv6 Stats Reply message. - * - * For message creation, it parses the user entered IPv6 match fields, creates - * a sub-message for each field which are later used to form the complete - * message. - * + * + * For message creation, it parses the user entered IPv6 match fields, creates + * a sub-message for each field which are later used to form the complete + * message. + * * For message processing, it parses the incoming message and reads each field * of the message and stores in appropriate field of V6Match object. - * + * * */ public class V6Match extends OFMatch implements Cloneable { @@ -472,7 +472,7 @@ public class V6Match extends OFMatch implements Cloneable { /** * Sets this (V6Match) object's member variables based on a comma-separated key=value pair similar to OFMatch's fromString. - * + * * @param match a key=value comma separated string. */ @Override diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsReply.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsReply.java index bd3c2a2c04..6893fa78e2 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsReply.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsReply.java @@ -19,9 +19,9 @@ import org.openflow.util.U16; /** * This Class processes the OpenFlow Vendor Extension Reply message of a Stats * Request. It parses the reply message and initializes fields of V6StatsReply - * object. Multiple instances of this class objects are created and used by + * object. Multiple instances of this class objects are created and used by * OpenDaylight's Troubleshooting Application. - * + * */ public class V6StatsReply extends OFVendorStatistics { diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsRequest.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsRequest.java index c96419ef11..593b464d3c 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsRequest.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6StatsRequest.java @@ -16,9 +16,9 @@ import org.openflow.protocol.statistics.OFVendorStatistics; /** - * This Class creates the OpenFlow Vendor Extension IPv6 Flow Stats Request + * This Class creates the OpenFlow Vendor Extension IPv6 Flow Stats Request * messages and also reads the Reply of a stats request message. - * + * */ public class V6StatsRequest extends OFVendorStatistics { diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java index 614e70b1b8..8e4c985c06 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java @@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory; /** * stub protocol plugin Activator - * - * + * + * */ public class Activator extends ComponentActivatorAbstractBase { protected static final Logger logger = LoggerFactory @@ -38,7 +38,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function called when the activator starts just after some initializations * are done by the ComponentActivatorAbstractBase. - * + * */ public void init() { Node.NodeIDType.registerIDType("STUB", Integer.class); @@ -48,7 +48,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function called when the activator stops just before the cleanup done by * ComponentActivatorAbstractBase - * + * */ public void destroy() { Node.NodeIDType.unRegisterIDType("STUB"); @@ -58,8 +58,8 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function that is used to communicate to dependency manager the list of * known implementations for services inside a container - * - * + * + * * @return An array containing all the CLASS objects that will be * instantiated in order to get an fully working implementation * Object @@ -72,7 +72,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function that is called when configuration of the dependencies is * required. - * + * * @param c * dependency manager Component object, used for configuring the * dependencies exported and imported @@ -103,12 +103,12 @@ public class Activator extends ComponentActivatorAbstractBase { c.setInterface(IPluginInInventoryService.class.getName(), props); } } - + public Object[] getGlobalImplementations() { Object[] res = { FlowProgrammerService.class, StubNodeFactory.class, StubNodeConnectorFactory.class }; return res; } - + public void configureGlobalInstance(Component c, Object imp){ if (imp.equals(FlowProgrammerService.class)) { // export the service to be used by SAL @@ -136,6 +136,6 @@ public class Activator extends ComponentActivatorAbstractBase { props.put("protocolName", "STUB"); c.setInterface(INodeConnectorFactory.class.getName(), props); } - + } } diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java index 305829705a..834b3faceb 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java @@ -29,7 +29,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { } @@ -37,7 +37,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { } @@ -46,15 +46,15 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { } - - + + /** * Synchronously add a flow to the network node - * + * * @param node * @param flow */ @@ -64,7 +64,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Synchronously modify existing flow on the switch - * + * * @param node * @param flow */ @@ -73,7 +73,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService } /** * Synchronously remove the flow from the network node - * + * * @param node * @param flow */ @@ -83,7 +83,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Asynchronously add a flow to the network node - * + * * @param node * @param flow * @param rid @@ -94,7 +94,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Asynchronously modify existing flow on the switch - * + * * @param node * @param flow * @param rid @@ -105,7 +105,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Asynchronously remove the flow from the network node - * + * * @param node * @param flow * @param rid @@ -116,7 +116,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Remove all flows present on the network node - * + * * @param node */ public Status removeAllFlows(Node node){ @@ -126,7 +126,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Send Barrier message synchronously. The caller will be blocked until the * Barrier reply arrives. - * + * * @param node */ public Status syncSendBarrierMessage(Node node){ @@ -135,7 +135,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService /** * Send Barrier message asynchronously. The caller is not blocked. - * + * * @param node */ public Status asyncSendBarrierMessage(Node node){ diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java index b3909a775b..b4d6166d36 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java @@ -112,24 +112,24 @@ public class InventoryService implements IPluginInInventoryService { node = new Node("STUB", new Integer(0xCAFE)); }catch(ConstructionException e){ node = null; - } - + } + nodeProps.put(node, propMap); - + try{ node = new Node("STUB", 3366); }catch(ConstructionException e){ node = null; - } + } nodeProps.put(node, propMap); - + try{ node = new Node("STUB", 4477); }catch(ConstructionException e){ node = null; - } + } nodeProps.put(node, propMap); - + return nodeProps; } diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java index b580021b69..27ba897fdf 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java @@ -47,8 +47,8 @@ import org.opendaylight.controller.sal.reader.NodeDescription; import org.opendaylight.controller.sal.reader.NodeTableStatistics; /** * Stub Implementation for IPluginInReadService used by SAL - * - * + * + * */ public class ReadService implements IPluginInReadService { private static final Logger logger = LoggerFactory @@ -57,7 +57,7 @@ public class ReadService implements IPluginInReadService { /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { } @@ -66,7 +66,7 @@ public class ReadService implements IPluginInReadService { * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { } @@ -74,7 +74,7 @@ public class ReadService implements IPluginInReadService { /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { } @@ -83,7 +83,7 @@ public class ReadService implements IPluginInReadService { * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { } diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java index 53adef2427..0c1963d933 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java @@ -13,7 +13,7 @@ public class StubNodeConnectorFactory implements INodeConnectorFactory * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { } @@ -21,7 +21,7 @@ public class StubNodeConnectorFactory implements INodeConnectorFactory /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { } @@ -30,11 +30,11 @@ public class StubNodeConnectorFactory implements INodeConnectorFactory * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { } - + public NodeConnector fromStringNoNode(String typeStr, String IDStr, Node n){ if(typeStr.equals("STUB")){ diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java index 25382429fd..5b8ee12e56 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java @@ -13,7 +13,7 @@ public class StubNodeFactory implements INodeFactory * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { } @@ -21,7 +21,7 @@ public class StubNodeFactory implements INodeFactory /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { } @@ -30,11 +30,11 @@ public class StubNodeFactory implements INodeFactory * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { } - + public Node fromString(String nodeType, String nodeId){ if(nodeType.equals("STUB")) try{ diff --git a/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java b/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java index 3a0faa91d4..26ae86243b 100644 --- a/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java +++ b/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java @@ -381,7 +381,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void init() { @@ -401,7 +401,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { log.debug("Routing destroy() is called"); @@ -410,7 +410,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { log.debug("Routing start() is called"); @@ -437,7 +437,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ public void stop() { log.debug("Routing stop() is called"); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java index 332e31f6bf..d8144d7bb7 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java @@ -24,8 +24,8 @@ import org.slf4j.LoggerFactory; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @XmlSeeAlso({Controller.class, Drop.class, Flood.class, FloodAll.class, HwPath.class, Loopback.class, Output.class, - PopVlan.class, PushVlan.class, SetDlDst.class, SetDlSrc.class, SetDlType.class, SetNwDst.class, SetNwSrc.class, - SetNwTos.class, SetTpDst.class, SetTpSrc.class, SetVlanCfi.class, SetVlanId.class, SetVlanPcp.class, SwPath.class}) + PopVlan.class, PushVlan.class, SetDlDst.class, SetDlSrc.class, SetDlType.class, SetNwDst.class, SetNwSrc.class, + SetNwTos.class, SetTpDst.class, SetTpSrc.class, SetVlanCfi.class, SetVlanId.class, SetVlanPcp.class, SwPath.class}) public abstract class Action { private static final Logger logger = LoggerFactory.getLogger(Action.class); private static boolean debug = false; // Enable to find where in the code an invalid assignment is made @@ -39,9 +39,9 @@ public abstract class Action { /* public Action (ActionType type, Object value) { - this.type = type; - this.value = value; - this.isValid = true; + this.type = type; + this.value = value; + this.isValid = true; } */ /** @@ -112,7 +112,7 @@ public abstract class Action { /** * Returns whether the Action is valid or not * - * @return boolean + * @return boolean */ public boolean isValid() { return isValid; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Output.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Output.java index 774c79a543..e09968836f 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Output.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Output.java @@ -26,7 +26,7 @@ import org.opendaylight.controller.sal.core.NodeConnector; @XmlAccessorType(XmlAccessType.NONE) public class Output extends Action { - @XmlElement + @XmlElement private NodeConnector port; /* Dummy constructor for JAXB */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java index b5783d487a..f3b862fe7e 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/PushVlan.java @@ -21,7 +21,7 @@ import org.opendaylight.controller.sal.utils.EtherTypes; * Execute it multiple times to achieve QinQ * * 802.1q = [TPID(16) + TCI(16)] - * TCI = [PCP(3) + CFI(1) + VID(12)] + * TCI = [PCP(3) + CFI(1) + VID(12)] * * * diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlDst.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlDst.java index c2c40bfcc8..2413c23314 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlDst.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlDst.java @@ -45,12 +45,12 @@ public class SetDlDst extends Action { public byte[] getDlAddress() { return address.clone(); } - + @XmlElement(name = "address") public String getDlAddressString() { return HexEncode.bytesToHexString(address); } - + @Override public boolean equals(Object obj) { if (this == obj) diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlSrc.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlSrc.java index 91909993f3..3cdd5b6170 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlSrc.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlSrc.java @@ -54,7 +54,7 @@ public class SetDlSrc extends Action { public String getDlAddressString() { return HexEncode.bytesToHexString(address); } - + @Override public boolean equals(Object obj) { if (this == obj) diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlType.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlType.java index d15424ee15..f76000c649 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlType.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetDlType.java @@ -24,7 +24,7 @@ import org.opendaylight.controller.sal.utils.EtherTypes; @XmlAccessorType(XmlAccessType.NONE) public class SetDlType extends Action { - @XmlElement + @XmlElement private int dlType; /* Dummy constructor for JAXB */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwDst.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwDst.java index 2fa71f5d7b..bccca3f1f2 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwDst.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwDst.java @@ -38,15 +38,15 @@ public class SetNwDst extends Action { /** * Returns the network address this action will set * - * @return InetAddress + * @return InetAddress */ public InetAddress getAddress() { return address; } - + @XmlElement (name="address") public String getAddressAsString() { - return address.getHostAddress(); + return address.getHostAddress(); } @Override diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwSrc.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwSrc.java index c57f1a53a9..5595b610de 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwSrc.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwSrc.java @@ -38,7 +38,7 @@ public class SetNwSrc extends Action { /** * Returns the network address this action will set * - * @return InetAddress + * @return InetAddress */ public InetAddress getAddress() { return address; @@ -46,7 +46,7 @@ public class SetNwSrc extends Action { @XmlElement (name="address") public String getAddressAsString() { - return address.getHostAddress(); + return address.getHostAddress(); } @Override diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwTos.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwTos.java index 62dec0cd58..69fdd89ffb 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwTos.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNwTos.java @@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class SetNwTos extends Action { - @XmlElement + @XmlElement private int tos; /* Dummy constructor for JAXB */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpDst.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpDst.java index c32c346307..825092c54f 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpDst.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpDst.java @@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class SetTpDst extends Action { - @XmlElement + @XmlElement private int port; /* Dummy constructor for JAXB */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpSrc.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpSrc.java index d56f33d51e..cdae5aad2a 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpSrc.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetTpSrc.java @@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class SetTpSrc extends Action { - @XmlElement + @XmlElement private int port; /* Dummy constructor for JAXB */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanCfi.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanCfi.java index 0385f63d56..fc3d0a60ef 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanCfi.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanCfi.java @@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class SetVlanCfi extends Action { - @XmlElement + @XmlElement private int cfi; /* Dummy constructor for JAXB */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanId.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanId.java index 5370648227..b1e4748bc3 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanId.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanId.java @@ -22,13 +22,13 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class SetVlanId extends Action { - @XmlElement + @XmlElement private int vlanId; - private SetVlanId() { - - } - + private SetVlanId() { + + } + public SetVlanId(int vlanId) { type = ActionType.SET_VLAN_ID; this.vlanId = vlanId; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanPcp.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanPcp.java index 1ee74fdf3f..c47723ebdf 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanPcp.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetVlanPcp.java @@ -21,13 +21,13 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.NONE) public class SetVlanPcp extends Action { - @XmlElement + @XmlElement private int pcp; - private SetVlanPcp() { - - } - + private SetVlanPcp() { + + } + public SetVlanPcp(int pcp) { type = ActionType.SET_VLAN_PCP; this.pcp = pcp; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/AppRoleLevel.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/AppRoleLevel.java index 7e73dd414f..f08fc84a2c 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/AppRoleLevel.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/AppRoleLevel.java @@ -43,13 +43,13 @@ public enum AppRoleLevel implements Serializable { public String toStringPretty() { return this.prettyLevel; } - + public static AppRoleLevel fromString(String levelString) { - for (AppRoleLevel level : AppRoleLevel.values()) { - if (level.toString().equals(levelString)) { - return level; - } - } - return null; + for (AppRoleLevel level : AppRoleLevel.values()) { + if (level.toString().equals(levelString)) { + return level; + } + } + return null; } -} +} diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/IResourceAuthorization.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/IResourceAuthorization.java index 453976bf68..8f6cfa4251 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/IResourceAuthorization.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/IResourceAuthorization.java @@ -25,20 +25,20 @@ public interface IResourceAuthorization { /** * Create a Role name for the application * - * @param role the role name - * @param userLevel the user level in the application context - * @return the status of the request - */ + * @param role the role name + * @param userLevel the user level in the application context + * @return the status of the request + */ public Status createRole(String role, AppRoleLevel userLevel); /** * Remove a Role - * + * * @param role the role name * @return the status of the request */ public Status removeRole(String role); - + /** * Return the list of roles configured for the application * @@ -53,7 +53,7 @@ public interface IResourceAuthorization { * * @param roleName the role name to query * @return the application level of the given role in the application context as specified by {@link AppRoleLevel} - * if the role is not part of this application's roles, NOUSER is returned + * if the role is not part of this application's roles, NOUSER is returned */ public AppRoleLevel getApplicationRoleLevel(String roleName); @@ -61,7 +61,7 @@ public interface IResourceAuthorization { * Returns whether the specified role is part of this application's roles * * @param roleName the role name to test - * @return true if the role belongs to this application, false otherwise + * @return true if the role belongs to this application, false otherwise */ public boolean isApplicationRole(String roleName); @@ -110,16 +110,16 @@ public interface IResourceAuthorization { * @return the status of the request */ public Status assignResourceGroupToRole(String groupName, String role); - + /** * Unassign the passed resource group from the specified role - * + * * @param group * @param role * @return the status of the request */ public Status unassignResourceGroupFromRole(String group, String role); - + /** * Returns the list of resource groups the given Role is authorized to use * The returning object expresses the resource group name and the access diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/UserLevel.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/UserLevel.java index 70b41cdd8a..a2e1d1c56d 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/UserLevel.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/authorization/UserLevel.java @@ -15,11 +15,11 @@ import java.io.Serializable; * Describes the user role level in the controller space */ public enum UserLevel implements Serializable { - SYSTEMADMIN(0, "System-Admin", "System Administrator"), // can do everything - NETWORKADMIN(1, "Network-Admin", "Network Administrator"), // can do everything but setting a system admin user profile - NETWORKOPERATOR(2, "Network-Operator", "Network Operator"), // can only see what is configured anywhere - CONTAINERUSER(4, "Container-User", "Container User"), // container context user - APPUSER(5, "App-User", "Application User"), // application context user + SYSTEMADMIN(0, "System-Admin", "System Administrator"), // can do everything + NETWORKADMIN(1, "Network-Admin", "Network Administrator"), // can do everything but setting a system admin user profile + NETWORKOPERATOR(2, "Network-Operator", "Network Operator"), // can only see what is configured anywhere + CONTAINERUSER(4, "Container-User", "Container User"), // container context user + APPUSER(5, "App-User", "Application User"), // application context user NOUSER(255, "Not Authorized", "Not Authorized"); private int userLevel; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java index 135a67dcd1..3f81d0c4c5 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java @@ -22,33 +22,33 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Actions extends Property { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; @XmlElement private int actionsValue; - - public enum ActionType { - OUTPUT_PORT_ACTION(1<<0), - VLAN_VID_ACTION(1<<1), - VLAN_PCP_ACTION(1<<2), - VLAN_STRIP_ACTION(1<<3), - DLSRC_ACTION(1<<4), - DLDST_ACTION(1<<5), - NWSRC_ACTION(1<<6), - NWDST_ACTION(1<<7), - NWTOS_ACTION(1<<8), - TPTSRC_ACTION(1<<9), - TPTDST_ACTION(1<<10), - ENQUEUE_ACTION(1<<11), - VENDOR_ACTION(0xffff); - private final int at; - ActionType(int val) { - this.at = val; - } - public int getValue() { - return at; - } + + public enum ActionType { + OUTPUT_PORT_ACTION(1<<0), + VLAN_VID_ACTION(1<<1), + VLAN_PCP_ACTION(1<<2), + VLAN_STRIP_ACTION(1<<3), + DLSRC_ACTION(1<<4), + DLDST_ACTION(1<<5), + NWSRC_ACTION(1<<6), + NWDST_ACTION(1<<7), + NWTOS_ACTION(1<<8), + TPTSRC_ACTION(1<<9), + TPTDST_ACTION(1<<10), + ENQUEUE_ACTION(1<<11), + VENDOR_ACTION(0xffff); + private final int at; + ActionType(int val) { + this.at = val; + } + public int getValue() { + return at; + } } - + public static final String ActionsPropName = "actions"; /** * Construct a actions property @@ -72,12 +72,12 @@ public class Actions extends Property { public Actions clone() { return new Actions(this.actionsValue); } - + public int getValue() { - return this.actionsValue; + return this.actionsValue; } - - + + @Override public int hashCode() { final int prime = 31; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/AdvertisedBandwidth.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/AdvertisedBandwidth.java index ab546d7302..37aa60deef 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/AdvertisedBandwidth.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/AdvertisedBandwidth.java @@ -23,25 +23,25 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement @SuppressWarnings("serial") public class AdvertisedBandwidth extends Bandwidth { - public static final String AdvertisedBandwidthPropName = "advertisedBandwidth"; - - public AdvertisedBandwidth(long value) { - super(AdvertisedBandwidthPropName); - this.bandwidthValue = value; - } - - /* + public static final String AdvertisedBandwidthPropName = "advertisedBandwidth"; + + public AdvertisedBandwidth(long value) { + super(AdvertisedBandwidthPropName); + this.bandwidthValue = value; + } + + /* * Private constructor used for JAXB mapping */ private AdvertisedBandwidth() { - super(AdvertisedBandwidthPropName); - this.bandwidthValue = 0; + super(AdvertisedBandwidthPropName); + this.bandwidthValue = 0; } - - public AdvertisedBandwidth clone() { - return new AdvertisedBandwidth(this.bandwidthValue); + + public AdvertisedBandwidth clone() { + return new AdvertisedBandwidth(this.bandwidthValue); } - + @Override public String toString() { StringBuffer sb = new StringBuffer(); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java index 8048cf882c..fa5cc10827 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java @@ -66,7 +66,7 @@ public class Bandwidth extends Property { super(BandwidthPropName); this.bandwidthValue = (long) bandwidth; } - + public Bandwidth(String name) { super(name); } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java index 99089d9096..991ed688f2 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java @@ -21,16 +21,16 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement public class Buffers extends Property { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; @XmlElement private int buffersValue; - + public static final String BuffersPropName = "buffers"; - + /** * Construct a Buffers property * - * @param buffers the Buffers + * @param buffers the Buffers * @return Constructed object */ public Buffers(int buffers) { @@ -53,7 +53,7 @@ public class Buffers extends Property { public int getValue() { return this.buffersValue; } - + @Override public int hashCode() { final int prime = 31; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java index fb121d7b9a..a41a0e2290 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java @@ -21,28 +21,28 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement public class Capabilities extends Property { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; @XmlElement private int capabilitiesValue; - - public enum CapabilitiesType { - FLOW_STATS_CAPABILITY(1<<0), - TABLE_STATS_CAPABILITY(1<<1), - PORT_STATS_CAPABILITY(1<<2), - STP_CAPABILITY(1<<3), - RSVD_CAPABILITY(1<<4), - IP_REASSEM_CAPABILITY(1<<5), - QUEUE_STATS_CAPABILITY(1<<6), - ARP_MATCH_IP_CAPABILITY(1<<7); - private final int ct; - CapabilitiesType(int val) { - this.ct = val; - } - public int getValue() { - return ct; - } + + public enum CapabilitiesType { + FLOW_STATS_CAPABILITY(1<<0), + TABLE_STATS_CAPABILITY(1<<1), + PORT_STATS_CAPABILITY(1<<2), + STP_CAPABILITY(1<<3), + RSVD_CAPABILITY(1<<4), + IP_REASSEM_CAPABILITY(1<<5), + QUEUE_STATS_CAPABILITY(1<<6), + ARP_MATCH_IP_CAPABILITY(1<<7); + private final int ct; + CapabilitiesType(int val) { + this.ct = val; + } + public int getValue() { + return ct; + } } - + public static final String CapabilitiesPropName = "capabilities"; /** * Construct a Capabilities property @@ -68,9 +68,9 @@ public class Capabilities extends Property { } public int getValue() { - return this.capabilitiesValue; + return this.capabilitiesValue; } - + @Override public int hashCode() { final int prime = 31; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ComponentActivatorAbstractBase.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ComponentActivatorAbstractBase.java index 66882af5d3..039acf52e6 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ComponentActivatorAbstractBase.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ComponentActivatorAbstractBase.java @@ -354,7 +354,7 @@ abstract public class ComponentActivatorAbstractBase implements } } } - + // Register with OSGi the provider for the service IContainerAware context.registerService( IContainerAware.class.getName(), this, null); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java index bae984eaec..c547c2bb45 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java @@ -13,8 +13,8 @@ import javax.xml.bind.annotation.XmlRootElement; /** * The class represents Admin Config status - * - * + * + * */ @XmlRootElement @SuppressWarnings("serial") diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java index ebf623b7b0..2a80bd6088 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java @@ -127,7 +127,7 @@ public class ContainerFlow implements Serializable { /** * Returns whether the specified match is allowed * - * @param match the match to test + * @param match the match to test * @return true if the match is allowed, false otherwise */ public boolean allowsMatch(Match target) { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/PeerBandwidth.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/PeerBandwidth.java index a1b436ef1a..de2877597f 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/PeerBandwidth.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/PeerBandwidth.java @@ -21,27 +21,27 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement public class PeerBandwidth extends Bandwidth { - private static final long serialVersionUID = 1L; - - public static final String PeerBandwidthPropName = "peerBandwidth"; - - public PeerBandwidth(long value) { - super(PeerBandwidthPropName); - this.bandwidthValue = value; - } - - /* + private static final long serialVersionUID = 1L; + + public static final String PeerBandwidthPropName = "peerBandwidth"; + + public PeerBandwidth(long value) { + super(PeerBandwidthPropName); + this.bandwidthValue = value; + } + + /* * Private constructor used for JAXB mapping */ private PeerBandwidth() { - super(PeerBandwidthPropName); - this.bandwidthValue = 0; + super(PeerBandwidthPropName); + this.bandwidthValue = 0; } - public PeerBandwidth clone() { - return new PeerBandwidth(this.bandwidthValue); + public PeerBandwidth clone() { + return new PeerBandwidth(this.bandwidthValue); } - + @Override public String toString() { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/SupportedBandwidth.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/SupportedBandwidth.java index cd6589ed6d..5cb7b33890 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/SupportedBandwidth.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/SupportedBandwidth.java @@ -22,24 +22,24 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement public class SupportedBandwidth extends Bandwidth { - private static final long serialVersionUID = 1L; - public static final String SupportedBandwidthPropName = "supportedBandwidth"; - - public SupportedBandwidth(long value) { - super(SupportedBandwidthPropName); - this.bandwidthValue = value; - } - - /* + private static final long serialVersionUID = 1L; + public static final String SupportedBandwidthPropName = "supportedBandwidth"; + + public SupportedBandwidth(long value) { + super(SupportedBandwidthPropName); + this.bandwidthValue = value; + } + + /* * Private constructor used for JAXB mapping */ private SupportedBandwidth() { - super(SupportedBandwidthPropName); - this.bandwidthValue = 0; + super(SupportedBandwidthPropName); + this.bandwidthValue = 0; } - - public SupportedBandwidth clone() { - return new SupportedBandwidth(this.bandwidthValue); + + public SupportedBandwidth clone() { + return new SupportedBandwidth(this.bandwidthValue); } @Override diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java index 156a0b8ee0..22cff90bb5 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java @@ -21,15 +21,15 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement public class Tables extends Property { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; @XmlElement private byte tablesValue; - + public static final String TablesPropName = "tables"; /** * Construct a Tables property * - * @param tables the Tables + * @param tables the Tables * @return Constructed object */ public Tables(byte tables) { @@ -52,7 +52,7 @@ public class Tables extends Property { public byte getValue() { return this.tablesValue; } - + @Override public int hashCode() { final int prime = 31; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java index f640ac2a33..29094d34f9 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java @@ -23,11 +23,11 @@ public interface IDiscoveryService { /** * The methods is called when an edge is added/deleted/changed * - * @param edge {@link org.opendaylight.controller.sal.core.Edge} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} like - * {@link org.opendaylight.controller.sal.core.Bandwidth} and/or - * {@link org.opendaylight.controller.sal.core.Latency} etc. + * @param edge {@link org.opendaylight.controller.sal.core.Edge} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} like + * {@link org.opendaylight.controller.sal.core.Bandwidth} and/or + * {@link org.opendaylight.controller.sal.core.Latency} etc. */ public void notifyEdge(Edge edge, UpdateType type, Set props); } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java index f70e254ff5..f56c13d345 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java @@ -39,8 +39,8 @@ import org.slf4j.LoggerFactory; public class Flow implements Cloneable, Serializable { protected static final Logger logger = LoggerFactory .getLogger(Flow.class); - private static final long serialVersionUID = 1L; - @XmlElement + private static final long serialVersionUID = 1L; + @XmlElement private Match match; @XmlElement private List actions; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IFlowProgrammerService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IFlowProgrammerService.java index 0b38dda8cb..d2af1a8c7c 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IFlowProgrammerService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IFlowProgrammerService.java @@ -18,7 +18,7 @@ import org.opendaylight.controller.sal.utils.Status; public interface IFlowProgrammerService { /** * Synchronously add a flow to the network node - * + * * @param node * The target network node * @param flow @@ -29,7 +29,7 @@ public interface IFlowProgrammerService { /** * Synchronously modify existing flow on the switch - * + * * @param node * The target network node * @param oldFlow @@ -42,7 +42,7 @@ public interface IFlowProgrammerService { /** * Synchronously remove the flow from the network node - * + * * @param node * The target network node * @param flow @@ -53,7 +53,7 @@ public interface IFlowProgrammerService { /** * Asynchronously add a flow to the network node - * + * * @param node * The target network node * @param flow @@ -64,7 +64,7 @@ public interface IFlowProgrammerService { /** * Asynchronously modify existing flow on the switch - * + * * @param node * The target network node * @param oldFlow @@ -77,7 +77,7 @@ public interface IFlowProgrammerService { /** * Asynchronously remove the flow from the network node - * + * * @param node * The target network node * @param flow @@ -88,7 +88,7 @@ public interface IFlowProgrammerService { /** * Remove all flows present on the network node - * + * * @param node * The target network node * @return The status of this request containing the unique request id @@ -98,13 +98,13 @@ public interface IFlowProgrammerService { /** * Send Barrier message synchronously. The caller will be blocked until the * solicitation response arrives. - * + * * Solicit the network node to report whether all the requests sent so far * are completed. When this call is done, caller knows that all past flow * operations requested to the node in asynchronous fashion were satisfied * by the network node and that in case of any failure, a message was sent * to the controller. - * + * * @param node * The network node to solicit * @return The status of this request containing the unique request id @@ -113,13 +113,13 @@ public interface IFlowProgrammerService { /** * Send Barrier message asynchronously. The caller is not blocked. - * + * * Solicit the network node to report whether all the requests sent so far * are completed. When this call is done, caller knows that all past flow * operations requested to the node in asynchronous fashion were satisfied * by the network node and that in case of any failure, a message was sent * to the controller. - * + * * @param node * The network node to solicit * @return The status of this request containing the unique request id diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginInFlowProgrammerService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginInFlowProgrammerService.java index 5157788ce7..3c40b96cc7 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginInFlowProgrammerService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginInFlowProgrammerService.java @@ -13,13 +13,13 @@ import org.opendaylight.controller.sal.utils.Status; /** * @file IPluginOutFlowProgrammer.java - * + * * @brief Flow programmer interface to be implemented by protocol plugins */ public interface IPluginInFlowProgrammerService { /** * Synchronously add a flow to the network node - * + * * @param node * @param flow */ @@ -27,7 +27,7 @@ public interface IPluginInFlowProgrammerService { /** * Synchronously modify existing flow on the switch - * + * * @param node * @param flow */ @@ -35,7 +35,7 @@ public interface IPluginInFlowProgrammerService { /** * Synchronously remove the flow from the network node - * + * * @param node * @param flow */ @@ -43,7 +43,7 @@ public interface IPluginInFlowProgrammerService { /** * Asynchronously add a flow to the network node - * + * * @param node * @param flow * @param rid @@ -52,7 +52,7 @@ public interface IPluginInFlowProgrammerService { /** * Asynchronously modify existing flow on the switch - * + * * @param node * @param flow * @param rid @@ -61,7 +61,7 @@ public interface IPluginInFlowProgrammerService { /** * Asynchronously remove the flow from the network node - * + * * @param node * @param flow * @param rid @@ -70,7 +70,7 @@ public interface IPluginInFlowProgrammerService { /** * Remove all flows present on the network node - * + * * @param node */ Status removeAllFlows(Node node); @@ -78,14 +78,14 @@ public interface IPluginInFlowProgrammerService { /** * Send Barrier message synchronously. The caller will be blocked until the * Barrier reply arrives. - * + * * @param node */ Status syncSendBarrierMessage(Node node); /** * Send Barrier message asynchronously. The caller is not blocked. - * + * * @param node */ Status asyncSendBarrierMessage(Node node); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginOutFlowProgrammerService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginOutFlowProgrammerService.java index 1fc6741611..f1b80272d4 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginOutFlowProgrammerService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/IPluginOutFlowProgrammerService.java @@ -20,7 +20,7 @@ public interface IPluginOutFlowProgrammerService { * Inform SAL that the flow on the specified node has been removed Consumer * has to expect this notification only for flows which were installed with * an idle or hard timeout specified. - * + * * @param node * the network node on which the flow got removed * @param flow @@ -33,7 +33,7 @@ public interface IPluginOutFlowProgrammerService { * Inform SAL that an error message has been received from a switch * regarding a flow message previously sent to the switch. A Request ID * associated with the offending message is also returned. - * + * * @param node * the network node on which the error reported * @param rid diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java index 0438023165..ccfb338849 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java @@ -24,22 +24,22 @@ public interface IListenInventoryUpdates { /** * This method is called when some properties of a node are added/deleted/changed. * - * @param node {@link org.opendaylight.controller.sal.core.Node} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.Tier} etc. + * @param node {@link org.opendaylight.controller.sal.core.Node} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.Tier} etc. */ public void updateNode(Node node, UpdateType type, Set props); /** * This method is called when some properties of a node connector are added/deleted/changed. * - * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.State} etc. + * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.State} etc. */ public void updateNodeConnector(NodeConnector nodeConnector, UpdateType type, Set props); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java index bda32b88fa..42c9ab7475 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java @@ -24,22 +24,22 @@ public interface IPluginOutInventoryService { /** * This method is called when some properties of a node are added/deleted/changed. * - * @param node {@link org.opendaylight.controller.sal.core.Node} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.Tier} etc. + * @param node {@link org.opendaylight.controller.sal.core.Node} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.Tier} etc. */ public void updateNode(Node node, UpdateType type, Set props); /** * This method is called when some properties of a node connector are added/deleted/changed. * - * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.State} etc. + * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param props set of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.State} etc. */ public void updateNodeConnector(NodeConnector nodeConnector, UpdateType type, Set props); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java index 00a2f57308..2ead8cdbc4 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java @@ -38,8 +38,8 @@ import org.opendaylight.controller.sal.utils.NetUtils; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class Match implements Cloneable, Serializable { - private static final long serialVersionUID = 1L; - private static final Map reversableMatches; + private static final long serialVersionUID = 1L; + private static final Map reversableMatches; static { Map map = new HashMap(); map.put(MatchType.DL_SRC, MatchType.DL_DST); @@ -67,9 +67,9 @@ public class Match implements Cloneable, Serializable { * Generic setter for frame/packet/message's header fields against which to match * Note: For MAC addresses, please pass the cloned value to this function * - * @param type packet's header field type - * @param value field's value to assign to the match - * @param mask field's bitmask to apply to the match (has to be of the same class type of value) + * @param type packet's header field type + * @param value field's value to assign to the match + * @param mask field's bitmask to apply to the match (has to be of the same class type of value) */ public void setField(MatchType type, Object value, Object mask) { MatchField field = new MatchField(type, value, mask); @@ -83,8 +83,8 @@ public class Match implements Cloneable, Serializable { * Generic setter for frame/packet/message's header fields against which to match * Note: For MAC addresses, please pass the cloned value to this function * - * @param type packet's header field type - * @param value field's value to assign to the match + * @param type packet's header field type + * @param value field's value to assign to the match */ public void setField(MatchType type, Object value) { MatchField field = new MatchField(type, value); @@ -117,7 +117,7 @@ public class Match implements Cloneable, Serializable { /** * Generic getter for fields against which the match is programmed * - * @param type frame/packet/message's header field type + * @param type frame/packet/message's header field type * @return */ public MatchField getField(MatchType type) { @@ -137,7 +137,7 @@ public class Match implements Cloneable, Serializable { /** * Returns the list of MatchType fields the match is set for * - * @return List of individual MatchType fields. + * @return List of individual MatchType fields. */ public List getMatchesList() { return new ArrayList(fields.keySet()); @@ -146,13 +146,13 @@ public class Match implements Cloneable, Serializable { /** * Returns the list of MatchFields the match is set for * - * @return List of individual MatchField values. + * @return List of individual MatchField values. */ @XmlElement(name="matchField") public List getMatchFields() { - return new ArrayList(fields.values()); + return new ArrayList(fields.values()); } - + /** * Returns whether this match is for an IPv6 flow */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchField.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchField.java index bd5ef2bafb..7d7b29c293 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchField.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchField.java @@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory; /** * Represents the generic matching field - * + * */ @XmlRootElement @@ -42,7 +42,7 @@ public class MatchField implements Cloneable, Serializable { /** * Mask based match constructor - * + * * @param type * @param value * @param mask @@ -59,7 +59,7 @@ public class MatchField implements Cloneable, Serializable { /** * Full match constructor - * + * * @param type * @param value */ @@ -73,7 +73,7 @@ public class MatchField implements Cloneable, Serializable { /** * Returns the value set for this match field - * + * * @return */ public Object getValue() { @@ -87,7 +87,7 @@ public class MatchField implements Cloneable, Serializable { /** * Returns the type field this match field object is for - * + * * @return */ public MatchType getType() { @@ -102,7 +102,7 @@ public class MatchField implements Cloneable, Serializable { /** * Returns the mask value set for this field match A null mask means this is * a full match - * + * * @return */ public Object getMask() { @@ -116,7 +116,7 @@ public class MatchField implements Cloneable, Serializable { /** * Returns the bitmask set for this field match - * + * * @return */ public long getBitMask() { @@ -125,7 +125,7 @@ public class MatchField implements Cloneable, Serializable { /** * Returns whether the field match configuration is valid or not - * + * * @return */ public boolean isValid() { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchType.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchType.java index 62c1b435dc..5ad4bd5b66 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchType.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/MatchType.java @@ -19,9 +19,9 @@ import org.opendaylight.controller.sal.utils.NetUtils; * Represents the binding between the id, the value and mask type and the range * values of the elements type that can be matched on the network * frame/packet/message - * - * - * + * + * + * */ public enum MatchType { IN_PORT("inPort", 1 << 0, NodeConnector.class, 1, 0), @@ -73,7 +73,7 @@ public enum MatchType { /** * Perform the assignment type validation - * + * * @param value * @param mask * @return @@ -119,7 +119,7 @@ public enum MatchType { /** * Perform the value and mask range validation - * + * * @param value * @param mask * @return @@ -162,7 +162,7 @@ public enum MatchType { /** * Return the mask value in 64 bits bitmask form - * + * * @param mask * @return */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/BitBufferHelper.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/BitBufferHelper.java index c3982ae08e..5c81a1830b 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/BitBufferHelper.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/BitBufferHelper.java @@ -210,7 +210,7 @@ public abstract class BitBufferHelper { * @param int startOffset - offset to start fetching bits from data from * @param int numBits - number of bits to be fetched from data * @return byte [] - LSB aligned bits - * + * * @throws BufferException * when the startOffset and numBits parameters are not congruent * with the data buffer size @@ -291,7 +291,7 @@ public abstract class BitBufferHelper { * @param byte - input byte to be inserted * @param startOffset - offset of data[] to start inserting byte from * @param numBits - number of bits of input to be inserted into data[] - * + * * @throws BufferException * when the input, startOffset and numBits are not congruent * with the data buffer size @@ -322,7 +322,7 @@ public abstract class BitBufferHelper { /** * Returns numBits 1's in the MSB position - * + * * @param numBits * @return */ @@ -336,7 +336,7 @@ public abstract class BitBufferHelper { /** * Returns numBits 1's in the LSB position - * + * * @param numBits * @return */ @@ -350,7 +350,7 @@ public abstract class BitBufferHelper { /** * Returns the numerical value of the byte array passed - * + * * @param byte[] - array * @return long - numerical value of byte array passed */ @@ -371,7 +371,7 @@ public abstract class BitBufferHelper { /** * Returns the numerical value of the last numBits (LSB bits) of the byte * array passed - * + * * @param byte[] - array * @param int - numBits * @return long - numerical value of byte array passed @@ -404,10 +404,10 @@ public abstract class BitBufferHelper { * Accepts a number as input and returns its value in byte form in LSB * aligned form example: input = 5000 [1001110001000] bytes = 19, -120 * [00010011] [10001000] - * + * * @param Number * @return byte[] - * + * */ public static byte[] toByteArray(Number input) { @@ -443,12 +443,12 @@ public abstract class BitBufferHelper { * Accepts a number as input and returns its value in byte form in MSB * aligned form example: input = 5000 [1001110001000] bytes = -114, 64 * [10011100] [01000000] - * + * * @param Number * input * @param int numBits - the number of bits to be returned * @return byte[] - * + * */ public static byte[] toByteArray(Number input, int numBits) { Class dataType = input.getClass(); @@ -500,7 +500,7 @@ public abstract class BitBufferHelper { /** * Takes an LSB aligned byte array and returned the LSB numBits in a MSB * aligned byte array - * + * * @param inputbytes * @param numBits * @return @@ -508,10 +508,10 @@ public abstract class BitBufferHelper { /** * It aligns the last numBits bits to the head of the byte array following * them with numBits % 8 zero bits. - * + * * Example: For inputbytes = [00000111][01110001] and numBits = 12 it * returns: shiftedBytes = [01110111][00010000] - * + * * @param byte[] inputBytes * @param int numBits - number of bits to be left aligned * @return byte[] @@ -566,10 +566,10 @@ public abstract class BitBufferHelper { /** * It aligns the first numBits bits to the right end of the byte array * preceding them with numBits % 8 zero bits. - * + * * Example: For inputbytes = [01110111][00010000] and numBits = 12 it * returns: shiftedBytes = [00000111][01110001] - * + * * @param byte[] inputBytes * @param int numBits - number of bits to be right aligned * @return byte[] @@ -603,7 +603,7 @@ public abstract class BitBufferHelper { * Insert in the data buffer at position dictated by the offset the number * of bits specified from the input data byte array. The input byte array * has the bits stored starting from the LSB - * + * * @param byte[] data * @param byte[] inputdata * @param int startOffset @@ -623,8 +623,8 @@ public abstract class BitBufferHelper { int InputMSBbits = 0, InputLSBbits = 0; int i; - if (numBits == 0) { - return; + if (numBits == 0) { + return; } if (extraOffsetBits == 0) { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/ICMP.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/ICMP.java index 9bdb5d084c..0429c0dd27 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/ICMP.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/ICMP.java @@ -68,7 +68,7 @@ public class ICMP extends Packet { /** * Sets the type for the current ICMP message - * + * * @param type * The ICMP message type * @return This ICMP object @@ -81,7 +81,7 @@ public class ICMP extends Packet { /** * Sets the ICMP code (type subtype) for the current ICMP object instance - * + * * @param code * The ICMP message type subtype * @return This ICMP object @@ -136,7 +136,7 @@ public class ICMP extends Packet { /** * Computes the ICMP checksum on the serialized ICMP message - * + * * @param serialized * The data stream * @param start diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/IPv4.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/IPv4.java index 7a7a5a757f..44318aab8c 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/IPv4.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/IPv4.java @@ -378,9 +378,9 @@ public class IPv4 extends Packet { * @param checksum the checksum to set */ /*public IPv4 setChecksum() { - short ipChecksum = computeChecksum(); + short ipChecksum = computeChecksum(); byte[] checksum = BitBufferHelper.toByteArray(ipChecksum); - fieldValues.put(CHECKSUM, checksum); + fieldValues.put(CHECKSUM, checksum); return this; }*/ @@ -444,7 +444,7 @@ public class IPv4 extends Packet { /** * Computes the IPv4 header checksum on the passed stream of bytes * representing the packet - * + * * @param data * The byte stream * @param offset diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java index 6a896c6c71..562d03b7ab 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java @@ -223,7 +223,7 @@ public class LLDP extends Packet { /** * Returns the size of LLDP packet in bytes - * + * * @return int - LLDP Packet size in bytes */ private int getLLDPPacketLength() { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/PacketException.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/PacketException.java index 5685b0a58a..ee50273359 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/PacketException.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/PacketException.java @@ -11,7 +11,7 @@ package org.opendaylight.controller.sal.packet; * Describes an exception that is raised when the process of serializing or * deserializing a network packet/stream fails. This generally happens when the * packet/stream is malformed. - * + * */ public class PacketException extends Exception { private static final long serialVersionUID = 1L; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/RawPacket.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/RawPacket.java index 590f5d923e..a7956d81b3 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/RawPacket.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/RawPacket.java @@ -24,10 +24,10 @@ import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.TimeStamp; /** - * + * * Describe a raw Data Packet, this is how a packet is received from the network * and how it will be transmitted. It essentially wraps the raw bytestream - * + * */ public class RawPacket { private byte[] packetData; @@ -41,8 +41,8 @@ public class RawPacket { /** * If the packet is being sent this parameter tells where the packet is sent * toward - * - * + * + * * @return the NodeConnector toward where the packet is being sent */ public NodeConnector getOutgoingNodeConnector() { @@ -51,7 +51,7 @@ public class RawPacket { /** * Setter method for OutGoing NodeConnector - * + * * @param outgoingNodeConnector * NodeConnector toward where the packet is travelling */ @@ -61,7 +61,7 @@ public class RawPacket { /** * Return the incoming NodeConnector if the packet was received - * + * * @return NodeConnector where the packet was received from */ public NodeConnector getIncomingNodeConnector() { @@ -70,7 +70,7 @@ public class RawPacket { /** * Setter for Incoming NodeConnector - * + * * @param incomingNodeConnector * NodeConnector to be used and incoming one */ @@ -80,10 +80,10 @@ public class RawPacket { /** * Retrieve a given property attached to the packet, if exits of course - * + * * @param key * Key to retrieve the wanted property attached to the packet - * + * * @return The property attached to the packet */ public Object getProps(Object key) { @@ -95,7 +95,7 @@ public class RawPacket { /** * Generic data associated to the data packet - * + * * @param key * key for the association * @param value @@ -111,12 +111,12 @@ public class RawPacket { /** * Constructor for RawPacket - * + * * @param data * content of the packet as bytestream * @param e * datalink encapsulation for the packet - * + * */ public RawPacket(byte[] data, LinkEncap e) throws ConstructionException { if (data == null) { @@ -137,10 +137,10 @@ public class RawPacket { * Copy Constructor for RawPacket, it performs a copy of the packet so each * packet can be modified independently without worrying that source packet * content is touched - * + * * @param src * packet to copy data from - * + * */ public RawPacket(RawPacket src) throws ConstructionException { if (src == null) { @@ -164,10 +164,10 @@ public class RawPacket { /** * Constructor for RawPacket with Ethernet encapsulation - * + * * @param data * content of the packet as bytestream - * + * */ public RawPacket(byte[] data) throws ConstructionException { this(data, LinkEncap.ETHERNET); @@ -175,7 +175,7 @@ public class RawPacket { /** * Read the time stamp when the packet has entered the system - * + * * @return The time stamp when the packet has entered the system */ public TimeStamp getIncomingTime() { @@ -184,7 +184,7 @@ public class RawPacket { /** * Read the packet encapsulation - * + * * @return The encapsulation for the raw packet, necessary to start parsing * the packet */ @@ -194,7 +194,7 @@ public class RawPacket { /** * Get bytestream of the packet body - * + * * @return The raw bytestream composing the packet */ public byte[] getPacketData() { @@ -204,7 +204,7 @@ public class RawPacket { /** * Returns the time at which the current instance of RawPacket was created * as a copy of the original one. - * + * * @return The time stamp at which this RawPacket instance was created. null * if this is the original instance. */ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java index b9bed9a67d..fba3f5c917 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/UDP.java @@ -110,7 +110,7 @@ public class UDP extends Packet { */ public void setHeaderField(String headerField, byte[] readValue) { /*if (headerField.equals("Protocol")) { - payloadClass = decodeMap.get(readValue); + payloadClass = decodeMap.get(readValue); }*/ hdrFieldsMap.put(headerField, readValue); } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java index fe93d1c985..431f589563 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java @@ -40,7 +40,7 @@ public class FlowOnNode { /* Dummy constructor for JAXB */ private FlowOnNode () { } - + public FlowOnNode(Flow flow) { this.flow = flow; } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java index 49018d83ed..a8c83e7913 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java @@ -25,37 +25,37 @@ import org.opendaylight.controller.sal.core.NodeConnector; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class NodeConnectorStatistics { - @XmlElement + @XmlElement private NodeConnector nodeConnector; - @XmlElement + @XmlElement private long receivePackets; - @XmlElement + @XmlElement private long transmitPackets; - @XmlElement + @XmlElement private long receiveBytes; - @XmlElement + @XmlElement private long transmitBytes; - @XmlElement + @XmlElement private long receiveDrops; - @XmlElement + @XmlElement private long transmitDrops; - @XmlElement + @XmlElement private long receiveErrors; - @XmlElement + @XmlElement private long transmitErrors; - @XmlElement + @XmlElement private long receiveFrameError; - @XmlElement + @XmlElement private long receiveOverRunError; - @XmlElement + @XmlElement private long receiveCrcError; - @XmlElement + @XmlElement private long collisionCount; - //To Satisfy JAXB - public NodeConnectorStatistics() { - - } + //To Satisfy JAXB + public NodeConnectorStatistics() { + + } /** * Set the node connector * @param port diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeDescription.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeDescription.java index 26c8e1dec3..65efd3c29d 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeDescription.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeDescription.java @@ -67,7 +67,7 @@ public class NodeDescription { @Override public String toString() { return "HwDescription[manufacturer=" + manufacturer + ", hardware=" - + hardware + ", software=" + software + ", serialNumber=" - + serialNumber + ", description=" + description + "]"; + + hardware + ", software=" + software + ", serialNumber=" + + serialNumber + ", description=" + description + "]"; } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeTableStatistics.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeTableStatistics.java index 46448bd098..3ccf8f5929 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeTableStatistics.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeTableStatistics.java @@ -17,7 +17,7 @@ import org.opendaylight.controller.sal.core.NodeTable; /** * @author Aditya Prakash Vaja * Represents the Table statistics for the node - * + * */ @XmlRootElement diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IListenTopoUpdates.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IListenTopoUpdates.java index 11cdc99013..b4c44c00d9 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IListenTopoUpdates.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IListenTopoUpdates.java @@ -25,12 +25,12 @@ import org.opendaylight.controller.sal.core.Edge; /** * Topology notifications provided by SAL toward the application - * + * */ public interface IListenTopoUpdates { /** * Called to update on Edge in the topology graph - * + * * @param topoedgeupdateList * List of topoedgeupdates Each topoedgeupdate includes edge, its * Properties ( BandWidth and/or Latency etc) and update type. @@ -40,7 +40,7 @@ public interface IListenTopoUpdates { /** * Called when an Edge utilization is above the safety threshold configured * on the controller - * + * * @param edge * The edge which bandwidth usage is above the safety level */ @@ -49,7 +49,7 @@ public interface IListenTopoUpdates { /** * Called when the Edge utilization is back to normal, below the safety * threshold level configured on the controller - * + * * @param edge */ public void edgeUtilBackToNormal(Edge edge); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IPluginOutTopologyService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IPluginOutTopologyService.java index 6667628b0d..b85eec8428 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IPluginOutTopologyService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/IPluginOutTopologyService.java @@ -27,13 +27,13 @@ import org.opendaylight.controller.sal.core.UpdateType; /** * Methods that are invoked from Protocol Plugin toward SAL - * + * */ public interface IPluginOutTopologyService { /** * Called to update on Edge in the topology graph - * + * * @param topoedgeupdateList * List of topoedgeupdates Each topoedgeupdate includes edge, its * Properties ( BandWidth and/or Latency etc) and update type. @@ -43,7 +43,7 @@ public interface IPluginOutTopologyService { /** * Called when an Edge utilization is above the safety threshold configured * on the controller - * + * * @param edge */ public void edgeOverUtilized(Edge edge); @@ -51,7 +51,7 @@ public interface IPluginOutTopologyService { /** * Called when the Edge utilization is back to normal, below the safety * threshold level configured on the controller - * + * * @param edge */ public void edgeUtilBackToNormal(Edge edge); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/GlobalConstants.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/GlobalConstants.java index 0ebf633c55..6f60a522fd 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/GlobalConstants.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/GlobalConstants.java @@ -14,11 +14,11 @@ package org.opendaylight.controller.sal.utils; * */ public enum GlobalConstants { - DEFAULT("default"), - CONTAINERMANAGER("containermanager"), - CONTAINERNAME("name"), - STATICVLAN("staticvlan"), - CLUSTERINGSERVICES("clusteringservices"), + DEFAULT("default"), + CONTAINERMANAGER("containermanager"), + CONTAINERNAME("name"), + STATICVLAN("staticvlan"), + CLUSTERINGSERVICES("clusteringservices"), STARTUPHOME("configuration/startup/"); private GlobalConstants(String name) { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/HexEncode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/HexEncode.java index 37661358cd..41b4b7a57d 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/HexEncode.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/HexEncode.java @@ -19,7 +19,7 @@ import java.math.BigInteger; public class HexEncode { /** * This method converts byte array into String format without ":" inserted. - * + * * @param bytes * The byte array to convert to string * @return The hexadecimal representation of the byte array. If bytes is diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/IPProtocols.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/IPProtocols.java index cdb4463c02..416018d98e 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/IPProtocols.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/IPProtocols.java @@ -23,14 +23,14 @@ import java.util.List; // Openflow 1.0 supports the IP Proto match only for ICMP, TCP and UDP public enum IPProtocols { ANY("any", 0), - /* HOPOPT("HOPOPT",0), + /* HOPOPT("HOPOPT",0), */ICMP("ICMP", 1), - /* IGMP("IGMP",2), + /* IGMP("IGMP",2), GGP("GGP",3), IPV4("IPv4",4), ST("ST",5), */TCP("TCP", 6), - /* CBT("CBT",7), + /* CBT("CBT",7), EGP("EGP",8), IGP("IGP",9), BBNRCCMON("BBN-RCC-MON",10), @@ -41,7 +41,7 @@ public enum IPProtocols { XNET("XNET",15), CHAOS("CHAOS",16), */UDP("UDP", 17), - /* MUX("MUX",18), + /* MUX("MUX",18), DCNMEAS("DCN-MEAS",19), HMP("HMP",20), PRM("PRM",21), @@ -82,7 +82,7 @@ public enum IPProtocols { TLSP("TLSP",56), SKIP("SKIP",57), */IPV6ICMP("IPv6-ICMP", 58); - /* IPV6NoNxt("IPv6-NoNxt",59), + /* IPV6NoNxt("IPv6-NoNxt",59), IPV6Opts("IPv6-Opts",60), ANYHOST("ANY-HOST",61), CFTP("CFTP",62), diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java index 23d785e0c7..691ddc9356 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java @@ -36,8 +36,8 @@ public abstract class NetUtils { /** * Converts a 4 bytes array into an integer number * - * @param ba the 4 bytes long byte array - * @return the integer number + * @param ba the 4 bytes long byte array + * @return the integer number */ public static int byteArray4ToInt(byte[] ba) { if (ba == null || ba.length != 4) @@ -62,8 +62,8 @@ public abstract class NetUtils { * Converts an IP address passed as integer value into the * respective InetAddress object * - * @param address the IP address in integer form - * @return the IP address in InetAddress form + * @param address the IP address in integer form + * @return the IP address in InetAddress form */ public static InetAddress getInetAddress(int address) { InetAddress ip = null; @@ -80,8 +80,8 @@ public abstract class NetUtils { * The prefix bit mask indicates the contiguous leading bits that are NOT masked out. * Example: A prefix bit mask length of 8 will give an InetAddress Network Mask of 255.0.0.0 * - * @param prefixMaskLength integer representing the length of the prefix network mask - * @param isV6 boolean representing the IP version of the returned address + * @param prefixMaskLength integer representing the length of the prefix network mask + * @param isV6 boolean representing the IP version of the returned address * @return */ public static InetAddress getInetNetworkMask(int prefixMaskLength, @@ -121,8 +121,8 @@ public abstract class NetUtils { * while ff.00.00.00 will return a subnet mask length of 24. * If the passed prefixMask object is null, 0 is returned * - * @param prefixMask the prefix mask as byte array - * @return the length of the prefix network mask + * @param prefixMask the prefix mask as byte array + * @return the length of the prefix network mask */ public static int getSubnetMaskLength(byte[] prefixMask) { int maskLength = 0; @@ -149,8 +149,8 @@ public abstract class NetUtils { * while ff.00.00.00 will return a subnet mask length of 24 * If the passed prefixMask object is null, 0 is returned * - * @param prefixMask the prefix mask as InetAddress - * @return the length of the prefix network mask + * @param prefixMask the prefix mask as InetAddress + * @return the length of the prefix network mask */ public static int getSubnetMaskLength(InetAddress prefixMask) { return (prefixMask == null) ? 0 : NetUtils @@ -162,9 +162,9 @@ public abstract class NetUtils { * the equivalent subnet prefix IP address * Example: for ip = "172.28.30.254" and maskLen = 25 it will return "172.28.30.128" * - * @param ip the IP address in InetAddress form - * @param maskLen the length of the prefix network mask - * @return the subnet prefix IP address in InetAddress form + * @param ip the IP address in InetAddress form + * @param maskLen the length of the prefix network mask + * @return the subnet prefix IP address in InetAddress form */ public static InetAddress getSubnetPrefix(InetAddress ip, int maskLen) { int bytes = maskLen / 8; @@ -219,13 +219,13 @@ public abstract class NetUtils { if (isAny(testAddress) || isAny(filterAddress)) { return false; } - + int testMaskLen = (testMask != null) ? NetUtils.getSubnetMaskLength(testMask.getAddress()) : 0; int filterMaskLen = (filterMask != null) ? NetUtils.getSubnetMaskLength(filterMask.getAddress()) : 0; - + int testPrefixLen = (testAddress instanceof Inet6Address) ? (128 - testMaskLen) : (32 - testMaskLen); int filterPrefixLen = (filterAddress instanceof Inet6Address) ? (128 - filterMaskLen) : (32 - filterMaskLen); - + // Mask length check. Test mask has to be more specific than filter one if (testPrefixLen < filterPrefixLen) { return true; @@ -240,8 +240,8 @@ public abstract class NetUtils { /** * Returns true if the passed MAC address is all zero * - * @param mac the byte array representing the MAC address - * @return true if all MAC bytes are zero + * @param mac the byte array representing the MAC address + * @return true if all MAC bytes are zero */ public static boolean isZeroMAC(byte[] mac) { for (short i = 0; i < 6; i++) { @@ -255,8 +255,8 @@ public abstract class NetUtils { /** * Returns true if the passed InetAddress contains all zero * - * @param ip the IP address to test - * @return true if the address is all zero + * @param ip the IP address to test + * @return true if the address is all zero */ public static boolean isAny(InetAddress ip) { for (byte b : ip.getAddress()) { @@ -341,29 +341,29 @@ public abstract class NetUtils { } return true; } - + /* - * Following utilities are useful when you need to + * Following utilities are useful when you need to * compare or bit shift java primitive type variable * which are inerently signed */ /** * Returns the unsigned value of the passed byte variable - * - * @param b the byte value + * + * @param b the byte value * @return the int variable containing the unsigned byte value */ public static int getUnsignedByte(byte b) { - return (b > 0)? (int)b : ((int)b & 0x7F | 0x80); - } - + return (b > 0)? (int)b : ((int)b & 0x7F | 0x80); + } + /** * Return the unsigned value of the passed short variable - * + * * @param s the short value * @return the int variable containing the unsigned short value */ - public static int getUnsignedShort(short s) { - return (s > 0)? (int)s : ((int)s & 0x7FFF | 0x8000); - } + public static int getUnsignedShort(short s) { + return (s > 0)? (int)s : ((int)s & 0x7FFF | 0x8000); + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/Status.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/Status.java index 1d7ce224b5..2fbb3e55f8 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/Status.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/Status.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013 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, @@ -23,7 +23,7 @@ public class Status { * for internal API2 function calls. This constructor allows to specify, * beside the Status Code, a custom human readable description to add more * information about the status. - * + * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} @@ -42,7 +42,7 @@ public class Status { * Generates an instance of the Status class based on the passed StatusCode * only. The description field of the Status object will be inferred by the * status code. - * + * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} @@ -59,7 +59,7 @@ public class Status { * asynchronous call. It is supposed to be created by the underlying * infrastructure only when it was successful in allocating the asynchronous * request id, hence caller should expect StatusCode to be successful. - * + * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} @@ -76,7 +76,7 @@ public class Status { /** * Returns the status code - * + * * @return the {@code StatusCode} representing the status code */ public StatusCode getCode() { @@ -85,7 +85,7 @@ public class Status { /** * Returns a human readable description of the failure if any - * + * * @return a string representing the reason of failure */ public String getDescription() { @@ -94,7 +94,7 @@ public class Status { /** * Tells whether the status is successful - * + * * @return true if the Status code is {@code StatusCode.SUCCESS} */ public boolean isSuccess() { @@ -105,7 +105,7 @@ public class Status { * Return the request id assigned by underlying infrastructure in case of * asynchronous request. In case of synchronous requests, the returned id * is expected to be 0 - * + * * @return The request id assigned for this asynchronous request */ public long getRequestId() { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/StatusCode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/StatusCode.java index ce91ff440d..8500d6398d 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/StatusCode.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/StatusCode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013 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, @@ -10,39 +10,39 @@ package org.opendaylight.controller.sal.utils; /** * The enum which describes the generic error conditions. - * Each enum value is associated with a minimal description string. + * Each enum value is associated with a minimal description string. * */ public enum StatusCode { - SUCCESS("Success"), - - BADREQUEST("Bad Request"), - UNAUTHORIZED("UnAuthorized"), - FORBIDDEN("Forbidden"), - NOTFOUND("Not Found"), - NOTALLOWED("Method Not Allowed"), - NOTACCEPTABLE("Request Not Acceptable"), - TIMEOUT("Request Timeout"), - CONFLICT("Resource Conflict"), - GONE("Resource Gone"), - UNSUPPORTED("Unsupported"), - - INTERNALERROR("Internal Error"), - NOTIMPLEMENTED("Not Implemented"), - NOSERVICE("Service Not Available"), - - UNDEFINED("Undefined Error"); - - private String description; - private StatusCode(String description) { - this.description = description; - } - - /** - * Prints the description associated to the code value - */ - public String toString() { - return description; - } + SUCCESS("Success"), + + BADREQUEST("Bad Request"), + UNAUTHORIZED("UnAuthorized"), + FORBIDDEN("Forbidden"), + NOTFOUND("Not Found"), + NOTALLOWED("Method Not Allowed"), + NOTACCEPTABLE("Request Not Acceptable"), + TIMEOUT("Request Timeout"), + CONFLICT("Resource Conflict"), + GONE("Resource Gone"), + UNSUPPORTED("Unsupported"), + + INTERNALERROR("Internal Error"), + NOTIMPLEMENTED("Not Implemented"), + NOSERVICE("Service Not Available"), + + UNDEFINED("Undefined Error"); + + private String description; + private StatusCode(String description) { + this.description = description; + } + + /** + * Prints the description associated to the code value + */ + public String toString() { + return description; + } } diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java index 89e8ea2b54..6858494283 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java @@ -172,7 +172,7 @@ public class ActionTest { action = new SetNwTos(0x40); Assert.assertFalse(action.isValid()); - + action = new SetNwTos(0xff1); Assert.assertFalse(action.isValid()); diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java index 869d7ff520..55adfdac51 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java @@ -8,7 +8,7 @@ */ package org.opendaylight.controller.sal.authorization; - + import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -19,59 +19,59 @@ import org.junit.Test; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.utils.NodeCreator; - - public class AuthorizationTest { - - @Test - public void testResources () { - Privilege p = Privilege.WRITE; - ResourceGroup resourceGroup = new ResourceGroup("NodeGroup", p); - Map> resourceMap = new HashMap>(); - ArrayList resourceList = new ArrayList(); - - for (int i = 0; i < 5; i++) { - Node node = NodeCreator.createOFNode((long)i); - Resource resource = new Resource (node, p); - resourceList.add(resource); - } - - resourceMap.put(resourceGroup, resourceList); - - ArrayList retrievedResourceList = resourceMap.get(resourceGroup); - for (Entry> entry : resourceMap.entrySet()) { - ResourceGroup rGroup = entry.getKey(); - Assert.assertTrue(rGroup.getGroupName().equals(resourceGroup.getGroupName())); - for (int i = 0; i < 5; i++) { - Resource resource = retrievedResourceList.get(i); - Assert.assertTrue(resource.getPrivilege().equals(Privilege.WRITE)); - Assert.assertTrue(((Long)((Node)resource.getResource()).getID()).equals((long)i)); - } - } - } - - @Test - public void testAppRoleLevel() { - AppRoleLevel appRoleLevel = AppRoleLevel.APPOPERATOR; - Assert.assertTrue(appRoleLevel.toString().equals("App-Operator")); - Assert.assertTrue(appRoleLevel.toNumber() == 2); - Assert.assertTrue(appRoleLevel.toStringPretty().equals("Application Operator")); - } - - @Test - public void testUserLevel() { - UserLevel userLevel = UserLevel.SYSTEMADMIN; - Assert.assertTrue(userLevel.toString().equals("System-Admin")); - Assert.assertTrue(userLevel.toNumber() == 0); - Assert.assertTrue(userLevel.toStringPretty().equals("System Administrator")); - } - - @Test - public void testAppRoleLevelFromString() { - Assert.assertTrue(AppRoleLevel.fromString("App-Admin") == AppRoleLevel.APPADMIN); - Assert.assertTrue(AppRoleLevel.fromString("App-User") == AppRoleLevel.APPUSER); - Assert.assertTrue(AppRoleLevel.fromString("App-Operator") == AppRoleLevel.APPOPERATOR); - Assert.assertTrue(AppRoleLevel.fromString(" ") == null); - Assert.assertTrue(AppRoleLevel.fromString("") == null); - Assert.assertTrue(AppRoleLevel.fromString("App-Admini") == null); - } + + public class AuthorizationTest { + + @Test + public void testResources () { + Privilege p = Privilege.WRITE; + ResourceGroup resourceGroup = new ResourceGroup("NodeGroup", p); + Map> resourceMap = new HashMap>(); + ArrayList resourceList = new ArrayList(); + + for (int i = 0; i < 5; i++) { + Node node = NodeCreator.createOFNode((long)i); + Resource resource = new Resource (node, p); + resourceList.add(resource); + } + + resourceMap.put(resourceGroup, resourceList); + + ArrayList retrievedResourceList = resourceMap.get(resourceGroup); + for (Entry> entry : resourceMap.entrySet()) { + ResourceGroup rGroup = entry.getKey(); + Assert.assertTrue(rGroup.getGroupName().equals(resourceGroup.getGroupName())); + for (int i = 0; i < 5; i++) { + Resource resource = retrievedResourceList.get(i); + Assert.assertTrue(resource.getPrivilege().equals(Privilege.WRITE)); + Assert.assertTrue(((Long)((Node)resource.getResource()).getID()).equals((long)i)); + } + } + } + + @Test + public void testAppRoleLevel() { + AppRoleLevel appRoleLevel = AppRoleLevel.APPOPERATOR; + Assert.assertTrue(appRoleLevel.toString().equals("App-Operator")); + Assert.assertTrue(appRoleLevel.toNumber() == 2); + Assert.assertTrue(appRoleLevel.toStringPretty().equals("Application Operator")); + } + + @Test + public void testUserLevel() { + UserLevel userLevel = UserLevel.SYSTEMADMIN; + Assert.assertTrue(userLevel.toString().equals("System-Admin")); + Assert.assertTrue(userLevel.toNumber() == 0); + Assert.assertTrue(userLevel.toStringPretty().equals("System Administrator")); + } + + @Test + public void testAppRoleLevelFromString() { + Assert.assertTrue(AppRoleLevel.fromString("App-Admin") == AppRoleLevel.APPADMIN); + Assert.assertTrue(AppRoleLevel.fromString("App-User") == AppRoleLevel.APPUSER); + Assert.assertTrue(AppRoleLevel.fromString("App-Operator") == AppRoleLevel.APPOPERATOR); + Assert.assertTrue(AppRoleLevel.fromString(" ") == null); + Assert.assertTrue(AppRoleLevel.fromString("") == null); + Assert.assertTrue(AppRoleLevel.fromString("App-Admini") == null); + } } diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/NodeTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/NodeTest.java index c6697196d4..c081e10645 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/NodeTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/NodeTest.java @@ -396,7 +396,7 @@ public class NodeTest { public void testExtensibleNode() { // Add a new ID type Assert.assertTrue(Node.NodeIDType.registerIDType("FOO", Integer.class)); - + // Trying to re-register the node must fail Assert.assertFalse(Node.NodeIDType.registerIDType("FOO", Integer.class)); @@ -408,7 +408,7 @@ public class NodeTest { // Got an unexpected exception Assert.assertTrue(false); } - + // Now unregister the type and make sure the node doesn't get // created Node.NodeIDType.unRegisterIDType("FOO"); diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java index 5ec7d089b6..f257befd3c 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java @@ -313,13 +313,13 @@ public class MatchTest { InetAddress ipMask2 = null; short ethertype = EtherTypes.IPv4.shortValue(); short ethertype2 = EtherTypes.IPv4.shortValue(); - + /* * Create a SAL Flow aFlow */ Match match1 = new Match(); Match match2 = new Match(); - + match1.setField(MatchType.DL_TYPE, ethertype); match1.setField(MatchType.NW_SRC, srcIP, ipMask); @@ -327,7 +327,7 @@ public class MatchTest { match2.setField(MatchType.NW_SRC, srcIP2, ipMask2); Assert.assertTrue(match1.equals(match2)); - + ipMask2 = InetAddress.getByName("255.255.255.255"); match2.setField(MatchType.NW_SRC, srcIP2, ipMask2); @@ -337,7 +337,7 @@ public class MatchTest { ipMask2 = InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"); ethertype = EtherTypes.IPv6.shortValue(); ethertype2 = EtherTypes.IPv6.shortValue(); - + match1.setField(MatchType.DL_TYPE, ethertype); match1.setField(MatchType.NW_SRC, srcIP, ipMask); @@ -346,7 +346,7 @@ public class MatchTest { Assert.assertTrue(match1.equals(match2)); } - + @Test public void testCloning() throws Exception { Node node = NodeCreator.createOFNode(7l); diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java index 9f74fcab9e..b1c5e945d6 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java @@ -374,7 +374,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data2[3] == 80); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] // OUTPUT: [01001011] [01101000] = {75, 104} + // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] // OUTPUT: [01001011] [01101000] = {75, 104} byte data10[] = new byte[2]; startOffset = 0; numBits = 13; @@ -383,7 +383,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data10[1] == 104); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] // OUTPUT: [01001000] = {72} + // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] // OUTPUT: [01001000] = {72} byte data11[] = new byte[4]; startOffset = 8; numBits = 6; @@ -391,7 +391,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data11[1] == 72); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [01001011] [01101110] [01101000] = {75, 110, 105} + // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [01001011] [01101110] [01101000] = {75, 110, 105} byte data12[] = new byte[4]; startOffset = 0; numBits = 23; @@ -401,7 +401,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data12[2] == 106); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [01001011] [01101110] [01100000] = {75, 110, 96} + // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [01001011] [01101110] [01100000] = {75, 110, 96} byte data13[] = new byte[4]; startOffset = 8; numBits = 20; @@ -411,7 +411,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data13[3] == 96); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [01001011] [01101110] [01101011] [10100000]= {75, 110, 107, 80} + // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [01001011] [01101110] [01101011] [10100000]= {75, 110, 107, 80} byte data14[] = new byte[4]; startOffset = 0; numBits = 30; @@ -423,7 +423,7 @@ public class BitBufferHelperTest { //CASE 3: startOffset%8 != 0, numBits%8 = 0 // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00001001] [11000000] = {72, 96} + // [01001011] [01101110] [01101011] [10100000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00001001] [11000000] = {72, 96} byte data16[] = new byte[5]; startOffset = 3; numBits = 8; @@ -433,7 +433,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data16[2] == 0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [00000100] [1011 0110] [1110 0000] = {4, -54, -96} startOffset = 3; @@ -458,7 +458,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data18[2] == -64); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [0000 1001] [0110 1101] [1100 1101] [0110 1010] [0000 0001] = {9, 109, -51, 106, 0} startOffset = 3; @@ -472,7 +472,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data19[4] == 0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: data[4, 5, 6] = [0 010 0101] [1 011 0111] [0 000 0000] = {37, -73, 0} startOffset = 33; numBits = 16; @@ -484,7 +484,7 @@ public class BitBufferHelperTest { //CASE 4: extranumBits != 0 AND extraOffsetBits != 0 // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [0000 1001] [0100 0000] = {9, 96} startOffset = 3; numBits = 7; @@ -495,7 +495,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data21[2] == 0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: data = [00000 010] [01011 011] [01110 000] = {37, -73, 0} startOffset = 5; numBits = 17; @@ -506,7 +506,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data22[2] == 112); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [0000 1001] [0110 1101] [110 01101] [01 00000] = {9, 109, -51, 64} startOffset = 3; numBits = 23; @@ -518,7 +518,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data23[3] == 64); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [0000 1001] [0110 1101] = {9, 109} startOffset = 3; numBits = 13; @@ -529,7 +529,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data24[2] == 0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [0000 0100] [1011 0110] [1110 0110] = {4, -74, -26} startOffset = 4; numBits = 20; @@ -541,7 +541,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data25[3] == -0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [0000 0010] [0101 1011] = {0, 2, 91, 0} startOffset = 13; numBits = 11; @@ -553,7 +553,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data26[3] == 0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [000 01001] [011 01101] [110 0 0000] = {9, 109, -64, 0} startOffset = 3; numBits = 17; @@ -565,7 +565,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data27[3] == 0); // INPUT: {75, 110, 107, 80, 10, 12, 35, 100, 125, 65} = - // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} + // [01001011] [01101110] [01101011] [01010000] [00001010] [00001100] [00100011] [01100100] [11111101] [01000001] //OUTPUT: [00000000] [00000100] [10110110] [11100000]= {0, 4, -54, -96} // OUTPUT: [00 000000] [00 000000] [00 010010] [11 011011] [10 011010] [11 010100] [0000 0000] = {0, 0, 18, -37,-102,-44,0} startOffset = 18; numBits = 34; diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/PacketTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/PacketTest.java index 8049000fa7..8d856b08cd 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/PacketTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/PacketTest.java @@ -59,29 +59,29 @@ public class PacketTest { Assert.assertTrue(sMAC[5] == -97); Assert.assertTrue(etherType == 0x806); - + ARP arpPacket = (ARP) eth.getPayload(); - + Assert.assertTrue(arpPacket.getHardwareType() == (byte)0x1); Assert.assertTrue(arpPacket.getProtocolType() == 2048); Assert.assertTrue(arpPacket.getHardwareAddressLength() == (byte)0x6); Assert.assertTrue(arpPacket.getProtocolAddressLength() == (byte)0x4); Assert.assertTrue(arpPacket.getOpCode() == 1); - + byte[] senderHwAddress = arpPacket.getSenderHardwareAddress(); - byte[] senderProtocolAddress = arpPacket.getSenderProtocolAddress(); - + byte[] senderProtocolAddress = arpPacket.getSenderProtocolAddress(); + byte[] targetHwAddress = arpPacket.getTargetHardwareAddress(); - byte[] targetProtocolAddress = arpPacket.getTargetProtocolAddress(); - + byte[] targetProtocolAddress = arpPacket.getTargetProtocolAddress(); + Assert.assertTrue(senderHwAddress[0] == (byte)0xA6); Assert.assertTrue(senderHwAddress[1] == (byte)0xEC); Assert.assertTrue(senderHwAddress[2] == (byte)0x9C); Assert.assertTrue(senderHwAddress[3] == (byte)0xAE); Assert.assertTrue(senderHwAddress[4] == (byte)0xB2); Assert.assertTrue(senderHwAddress[5] == (byte)0x9F); - + Assert.assertTrue(senderProtocolAddress[0] == (byte)0x9); Assert.assertTrue(senderProtocolAddress[1] == (byte)0x9); Assert.assertTrue(senderProtocolAddress[2] == (byte)0x9); @@ -102,7 +102,7 @@ public class PacketTest { Assert.assertTrue(targetProtocolAddress[0] == (byte)0x9); Assert.assertTrue(targetProtocolAddress[1] == (byte)0x9); Assert.assertTrue(targetProtocolAddress[2] == (byte)0x9); - Assert.assertTrue(targetProtocolAddress[3] == (byte)0xFE); + Assert.assertTrue(targetProtocolAddress[3] == (byte)0xFE); } @Test diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/FlowOnNodeTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/FlowOnNodeTest.java index 21377be853..61f34aa63a 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/FlowOnNodeTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/FlowOnNodeTest.java @@ -22,38 +22,38 @@ import org.opendaylight.controller.sal.reader.FlowOnNode; import org.opendaylight.controller.sal.utils.EtherTypes; import org.opendaylight.controller.sal.utils.NodeConnectorCreator; import org.opendaylight.controller.sal.utils.NodeCreator; - + public class FlowOnNodeTest { - @Test - public void testFlowOnNodeMethods () { - Match match = new Match(); - NodeConnector inNC = NodeConnectorCreator.createNodeConnector((short)10, NodeCreator.createOFNode((long)10)); - NodeConnector outNC = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20)); - - match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue()); - match.setField(MatchType.IN_PORT, inNC); - - Output output = new Output(outNC); - ArrayList action = new ArrayList(); - action.add(output); - - Flow flow = new Flow (match, action); - - FlowOnNode flowOnNode = new FlowOnNode (flow); - - Assert.assertTrue(flowOnNode.getFlow().equals(flow)); - - flowOnNode.setPacketCount((long)100); - flowOnNode.setByteCount((long)800); - flowOnNode.setTableId((byte)0x55); - flowOnNode.setDurationNanoseconds(40); - flowOnNode.setDurationSeconds(45); - - Assert.assertTrue(flowOnNode.getPacketCount() == 100); - Assert.assertTrue(flowOnNode.getByteCount() == 800); - Assert.assertTrue(flowOnNode.getDurationNanoseconds() == 40); - Assert.assertTrue(flowOnNode.getDurationSeconds() == 45); - Assert.assertTrue(flowOnNode.getTableId() == (byte)0x55); - } + @Test + public void testFlowOnNodeMethods () { + Match match = new Match(); + NodeConnector inNC = NodeConnectorCreator.createNodeConnector((short)10, NodeCreator.createOFNode((long)10)); + NodeConnector outNC = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20)); + + match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue()); + match.setField(MatchType.IN_PORT, inNC); + + Output output = new Output(outNC); + ArrayList action = new ArrayList(); + action.add(output); + + Flow flow = new Flow (match, action); + + FlowOnNode flowOnNode = new FlowOnNode (flow); + + Assert.assertTrue(flowOnNode.getFlow().equals(flow)); + + flowOnNode.setPacketCount((long)100); + flowOnNode.setByteCount((long)800); + flowOnNode.setTableId((byte)0x55); + flowOnNode.setDurationNanoseconds(40); + flowOnNode.setDurationSeconds(45); + + Assert.assertTrue(flowOnNode.getPacketCount() == 100); + Assert.assertTrue(flowOnNode.getByteCount() == 800); + Assert.assertTrue(flowOnNode.getDurationNanoseconds() == 40); + Assert.assertTrue(flowOnNode.getDurationSeconds() == 45); + Assert.assertTrue(flowOnNode.getTableId() == (byte)0x55); + } } \ No newline at end of file diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeConnectorStatisticsTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeConnectorStatisticsTest.java index c123e4e7c7..8c2d2e6e34 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeConnectorStatisticsTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeConnectorStatisticsTest.java @@ -18,34 +18,35 @@ import org.junit.Assert; public class NodeConnectorStatisticsTest { - @Test - public void testNodeConnectorStatisticsMethods() { - NodeConnector nc = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20)); - NodeConnectorStatistics ncStats = new NodeConnectorStatistics(); - ncStats.setNodeConnector(nc); - ncStats.setReceiveByteCount(800); - ncStats.setReceiveCRCErrorCount(10); - ncStats.setReceiveDropCount(5); - ncStats.setReceiveErrorCount(20); - ncStats.setReceiveFrameErrorCount(25); - ncStats.setReceiveOverRunErrorCount(30); - ncStats.setReceivePacketCount(100); - ncStats.setTransmitByteCount(400); - ncStats.setTransmitDropCount(15); - ncStats.setTransmitErrorCount(18); - ncStats.setTransmitPacketCount(50); - ncStats.setCollisionCount(2); - - Assert.assertTrue(ncStats.getCollisionCount() == 2); - Assert.assertTrue(ncStats.getTransmitPacketCount() == 50); - Assert.assertTrue(ncStats.getTransmitErrorCount() == 18); - Assert.assertTrue(ncStats.getTransmitDropCount() == 15); - Assert.assertTrue(ncStats.getReceivePacketCount() == 100); - Assert.assertTrue(ncStats.getReceiveOverRunErrorCount() == 30); - Assert.assertTrue(ncStats.getReceiveFrameErrorCount() == 25); - Assert.assertTrue(ncStats.getReceiveDropCount() == 5); - Assert.assertTrue(ncStats.getReceiveCRCErrorCount() == 10); - Assert.assertTrue(ncStats.getReceiveByteCount() == 800); - Assert.assertTrue(ncStats.getNodeConnector().equals(nc)); - } + @Test + public void testNodeConnectorStatisticsMethods() { + NodeConnector nc = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20)); + NodeConnectorStatistics ncStats = new NodeConnectorStatistics(); + ncStats.setNodeConnector(nc); + ncStats.setReceiveByteCount(800); + ncStats.setReceiveCRCErrorCount(10); + ncStats.setReceiveDropCount(5); + ncStats.setReceiveErrorCount(20); + ncStats.setReceiveFrameErrorCount(25); + ncStats.setReceiveOverRunErrorCount(30); + ncStats.setReceivePacketCount(100); + ncStats.setTransmitByteCount(400); + ncStats.setTransmitDropCount(15); + ncStats.setTransmitErrorCount(18); + ncStats.setTransmitPacketCount(50); + ncStats.setCollisionCount(2); + + Assert.assertTrue(ncStats.getCollisionCount() == 2); + Assert.assertTrue(ncStats.getTransmitPacketCount() == 50); + Assert.assertTrue(ncStats.getTransmitErrorCount() == 18); + Assert.assertTrue(ncStats.getTransmitDropCount() == 15); + Assert.assertTrue(ncStats.getReceivePacketCount() == 100); + Assert.assertTrue(ncStats.getReceiveOverRunErrorCount() == 30); + Assert.assertTrue(ncStats.getReceiveFrameErrorCount() == 25); + Assert.assertTrue(ncStats.getReceiveDropCount() == 5); + Assert.assertTrue(ncStats.getReceiveCRCErrorCount() == 10); + Assert.assertTrue(ncStats.getReceiveByteCount() == 800); + Assert.assertTrue(ncStats.getNodeConnector().equals(nc)); + } } + diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeDescriptionTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeDescriptionTest.java index d4b1f8c25d..a720bdf680 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeDescriptionTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/reader/NodeDescriptionTest.java @@ -14,27 +14,30 @@ import org.junit.Test; import org.opendaylight.controller.sal.reader.NodeDescription; public class NodeDescriptionTest { - - @Test - public void testNodeDescriptionMethods() { - NodeDescription ncDesc = new NodeDescription(); - ncDesc.setHardware("Hardware1"); - ncDesc.setManufacturer("Manufacturer1"); - ncDesc.setDescription("SDNProtocol1"); - ncDesc.setSerialNumber("serialNumber1"); - ncDesc.setSoftware("Software1"); - - Assert.assertTrue(ncDesc.getHardware().equals("Hardware1")); - Assert.assertTrue(ncDesc.getManufacturer().equals("Manufacturer1")); - Assert.assertTrue(ncDesc.getDescription().equals("SDNProtocol1")); - Assert.assertTrue(ncDesc.getSerialNumber().equals("serialNumber1")); - Assert.assertTrue(ncDesc.getSoftware().equals("Software1")); - - Assert.assertFalse(ncDesc.getHardware().equals("Hardware2")); - Assert.assertFalse(ncDesc.getManufacturer().equals("Manufacturer2")); - Assert.assertFalse(ncDesc.getDescription().equals("SDNProtocol2")); - Assert.assertFalse(ncDesc.getSerialNumber().equals("serialNumber2")); - Assert.assertFalse(ncDesc.getSoftware().equals("Software2")); - - } + + @Test + public void testNodeDescriptionMethods() { + NodeDescription ncDesc = new NodeDescription(); + ncDesc.setHardware("Hardware1"); + ncDesc.setManufacturer("Manufacturer1"); + ncDesc.setDescription("SDNProtocol1"); + ncDesc.setSerialNumber("serialNumber1"); + ncDesc.setSoftware("Software1"); + + Assert.assertTrue(ncDesc.getHardware().equals("Hardware1")); + Assert.assertTrue(ncDesc.getManufacturer().equals("Manufacturer1")); + Assert.assertTrue(ncDesc.getDescription().equals("SDNProtocol1")); + Assert.assertTrue(ncDesc.getSerialNumber().equals("serialNumber1")); + Assert.assertTrue(ncDesc.getSoftware().equals("Software1")); + + Assert.assertFalse(ncDesc.getHardware().equals("Hardware2")); + Assert.assertFalse(ncDesc.getManufacturer().equals("Manufacturer2")); + Assert.assertFalse(ncDesc.getDescription().equals("SDNProtocol2")); + Assert.assertFalse(ncDesc.getSerialNumber().equals("serialNumber2")); + Assert.assertFalse(ncDesc.getSoftware().equals("Software2")); + + } } + + + diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/EtherTypesTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/EtherTypesTest.java index 5beb8713f9..117da55de8 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/EtherTypesTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/EtherTypesTest.java @@ -12,60 +12,63 @@ package org.opendaylight.controller.sal.utils; import java.util.ArrayList; import org.junit.Assert; import org.junit.Test; - + public class EtherTypesTest { + + @Test + public void testEthertypesCreation() { + + EtherTypes arp = EtherTypes.ARP; + + Assert.assertTrue(arp.toString().equals("ARP")); + Assert.assertTrue(arp.intValue() == 2054); + Assert.assertTrue(arp.shortValue() == (short)2054); + } + + @Test + public void testGetEtherTypesString() { + + Assert.assertTrue(EtherTypes.getEtherTypeName(34984).equals("QINQ")); + Assert.assertTrue(EtherTypes.getEtherTypeName((short)2048).equals("IPv4")); + Assert.assertTrue(EtherTypes.getEtherTypeName(0x010B).equals("PVSTP")); + + Assert.assertFalse(EtherTypes.getEtherTypeName(0x800).equals("ARP")); + } + + @Test + public void testGetEtherTypesNumber() { + Assert.assertTrue(EtherTypes.getEtherTypeNumberInt("VLAN Tagged") == 33024); + Assert.assertTrue(EtherTypes.getEtherTypeNumberShort("ARP") == 2054); + + Assert.assertFalse(EtherTypes.getEtherTypeNumberInt("CDP") == 1000); + } + + @Test + public void testGetEtherTypesList() { + ArrayList etherTypeNames = (ArrayList) EtherTypes.getEtherTypesNameList(); + Assert.assertTrue(etherTypeNames.get(0).equals("PVSTP")); + Assert.assertTrue(etherTypeNames.get(1).equals("CDP")); + Assert.assertTrue(etherTypeNames.get(2).equals("VTP")); + Assert.assertTrue(etherTypeNames.get(3).equals("IPv4")); + Assert.assertTrue(etherTypeNames.get(4).equals("ARP")); + Assert.assertTrue(etherTypeNames.get(5).equals("Reverse ARP")); + Assert.assertTrue(etherTypeNames.get(6).equals("VLAN Tagged")); + Assert.assertTrue(etherTypeNames.get(7).equals("IPv6")); + Assert.assertTrue(etherTypeNames.get(8).equals("MPLS Unicast")); + Assert.assertTrue(etherTypeNames.get(9).equals("MPLS Multicast")); + Assert.assertTrue(etherTypeNames.get(10).equals("QINQ")); + Assert.assertTrue(etherTypeNames.get(11).equals("LLDP")); + Assert.assertTrue(etherTypeNames.get(12).equals("Old QINQ")); + Assert.assertTrue(etherTypeNames.get(13).equals("Cisco QINQ")); + } + + @Test + public void testGetEtherTypesloadFromString() { + Assert.assertTrue(EtherTypes.loadFromString("37376").equals(EtherTypes.CISCOQINQ)); + Assert.assertTrue(EtherTypes.loadFromString("100") == null); + } - @Test - public void testEthertypesCreation() { - - EtherTypes arp = EtherTypes.ARP; - - Assert.assertTrue(arp.toString().equals("ARP")); - Assert.assertTrue(arp.intValue() == 2054); - Assert.assertTrue(arp.shortValue() == (short)2054); - } - - @Test - public void testGetEtherTypesString() { - - Assert.assertTrue(EtherTypes.getEtherTypeName(34984).equals("QINQ")); - Assert.assertTrue(EtherTypes.getEtherTypeName((short)2048).equals("IPv4")); - Assert.assertTrue(EtherTypes.getEtherTypeName(0x010B).equals("PVSTP")); - - Assert.assertFalse(EtherTypes.getEtherTypeName(0x800).equals("ARP")); - } - - @Test - public void testGetEtherTypesNumber() { - Assert.assertTrue(EtherTypes.getEtherTypeNumberInt("VLAN Tagged") == 33024); - Assert.assertTrue(EtherTypes.getEtherTypeNumberShort("ARP") == 2054); - - Assert.assertFalse(EtherTypes.getEtherTypeNumberInt("CDP") == 1000); - } +} - @Test - public void testGetEtherTypesList() { - ArrayList etherTypeNames = (ArrayList) EtherTypes.getEtherTypesNameList(); - Assert.assertTrue(etherTypeNames.get(0).equals("PVSTP")); - Assert.assertTrue(etherTypeNames.get(1).equals("CDP")); - Assert.assertTrue(etherTypeNames.get(2).equals("VTP")); - Assert.assertTrue(etherTypeNames.get(3).equals("IPv4")); - Assert.assertTrue(etherTypeNames.get(4).equals("ARP")); - Assert.assertTrue(etherTypeNames.get(5).equals("Reverse ARP")); - Assert.assertTrue(etherTypeNames.get(6).equals("VLAN Tagged")); - Assert.assertTrue(etherTypeNames.get(7).equals("IPv6")); - Assert.assertTrue(etherTypeNames.get(8).equals("MPLS Unicast")); - Assert.assertTrue(etherTypeNames.get(9).equals("MPLS Multicast")); - Assert.assertTrue(etherTypeNames.get(10).equals("QINQ")); - Assert.assertTrue(etherTypeNames.get(11).equals("LLDP")); - Assert.assertTrue(etherTypeNames.get(12).equals("Old QINQ")); - Assert.assertTrue(etherTypeNames.get(13).equals("Cisco QINQ")); - } - @Test - public void testGetEtherTypesloadFromString() { - Assert.assertTrue(EtherTypes.loadFromString("37376").equals(EtherTypes.CISCOQINQ)); - Assert.assertTrue(EtherTypes.loadFromString("100") == null); - } -} diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/HexEncodeTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/HexEncodeTest.java index 3cfa747be5..b9b5f45927 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/HexEncodeTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/HexEncodeTest.java @@ -8,60 +8,63 @@ */ package org.opendaylight.controller.sal.utils; - + import org.junit.Assert; import org.junit.Test; - + public class HexEncodeTest { + + @Test + public void testbytesToHexString() { + byte[] bytes1 = {(byte)0x01, (byte)0x02, (byte)0x03}; + String str1 = HexEncode.bytesToHexString(bytes1); + Assert.assertTrue(str1.equals("010203")); + + byte[] bytes2 = {(byte)0x11, (byte)0x22, (byte)0x33}; + String str2 = HexEncode.bytesToHexString(bytes2); + Assert.assertFalse(str2.equals("010203")); + + } + + @Test + public void testLongToHexString() { + long value1 = 12345678L; + String str1 = HexEncode.longToHexString(value1); + Assert.assertTrue(str1.equals("00:00:00:00:00:bc:61:4e")); + + long value2 = 98765432L; + String str2 = HexEncode.longToHexString(value2); + Assert.assertFalse(str2.equals("00:44:33:22:11:bc:61:4e")); + + } + + @Test + public void testBytesFromHexString() { + String byteStr1 = "00:11:22:33:44:55"; + byte byteArray1[] = new byte[(byteStr1.length() + 1)/3]; + byteArray1 = HexEncode.bytesFromHexString(byteStr1); + + Assert.assertTrue(byteArray1[0] == (byte)0x0); + Assert.assertTrue(byteArray1[1] == (byte)0x11); + Assert.assertTrue(byteArray1[2] == (byte)0x22); + Assert.assertTrue(byteArray1[3] == (byte)0x33); + Assert.assertTrue(byteArray1[4] == (byte)0x44); + Assert.assertTrue(byteArray1[5] == (byte)0x55); + + String byteStr2 = "00:11:22:33:44:55"; + byte byteArray2[] = new byte[(byteStr2.length() + 1)/3]; + byteArray2 = HexEncode.bytesFromHexString(byteStr2); + + Assert.assertFalse(byteArray2[0] == (byte)0x55); + Assert.assertFalse(byteArray2[1] == (byte)0x44); + Assert.assertFalse(byteArray2[2] == (byte)0x33); + Assert.assertFalse(byteArray2[3] == (byte)0x22); + Assert.assertFalse(byteArray2[4] == (byte)0x11); + Assert.assertFalse(byteArray2[5] == (byte)0x0); + + } + +} - @Test - public void testbytesToHexString() { - byte[] bytes1 = {(byte)0x01, (byte)0x02, (byte)0x03}; - String str1 = HexEncode.bytesToHexString(bytes1); - Assert.assertTrue(str1.equals("010203")); - - byte[] bytes2 = {(byte)0x11, (byte)0x22, (byte)0x33}; - String str2 = HexEncode.bytesToHexString(bytes2); - Assert.assertFalse(str2.equals("010203")); - - } - - @Test - public void testLongToHexString() { - long value1 = 12345678L; - String str1 = HexEncode.longToHexString(value1); - Assert.assertTrue(str1.equals("00:00:00:00:00:bc:61:4e")); - - long value2 = 98765432L; - String str2 = HexEncode.longToHexString(value2); - Assert.assertFalse(str2.equals("00:44:33:22:11:bc:61:4e")); - - } - - @Test - public void testBytesFromHexString() { - String byteStr1 = "00:11:22:33:44:55"; - byte byteArray1[] = new byte[(byteStr1.length() + 1)/3]; - byteArray1 = HexEncode.bytesFromHexString(byteStr1); - - Assert.assertTrue(byteArray1[0] == (byte)0x0); - Assert.assertTrue(byteArray1[1] == (byte)0x11); - Assert.assertTrue(byteArray1[2] == (byte)0x22); - Assert.assertTrue(byteArray1[3] == (byte)0x33); - Assert.assertTrue(byteArray1[4] == (byte)0x44); - Assert.assertTrue(byteArray1[5] == (byte)0x55); - - String byteStr2 = "00:11:22:33:44:55"; - byte byteArray2[] = new byte[(byteStr2.length() + 1)/3]; - byteArray2 = HexEncode.bytesFromHexString(byteStr2); - - Assert.assertFalse(byteArray2[0] == (byte)0x55); - Assert.assertFalse(byteArray2[1] == (byte)0x44); - Assert.assertFalse(byteArray2[2] == (byte)0x33); - Assert.assertFalse(byteArray2[3] == (byte)0x22); - Assert.assertFalse(byteArray2[4] == (byte)0x11); - Assert.assertFalse(byteArray2[5] == (byte)0x0); - } -} diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java index e16612759c..2d16afbd3d 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java @@ -273,7 +273,7 @@ public class NetUtilsTest { .isIPv6AddressValid("fe80:::0:0:0:204:61ff:fe9d/-1")); //not valid both } - + @Test public void testInetAddressConflict() throws UnknownHostException { diff --git a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Activator.java b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Activator.java index 41e4d2a7fc..99690802e3 100644 --- a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Activator.java +++ b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Activator.java @@ -38,7 +38,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function called when the activator starts just after some initializations * are done by the ComponentActivatorAbstractBase. - * + * */ public void init() { @@ -47,7 +47,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function called when the activator stops just before the cleanup done by * ComponentActivatorAbstractBase - * + * */ public void destroy() { @@ -56,8 +56,8 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function that is used to communicate to dependency manager the list of * known implementations for services inside a container - * - * + * + * * @return An array containing all the CLASS objects that will be * instantiated in order to get an fully working implementation * Object @@ -72,7 +72,7 @@ public class Activator extends ComponentActivatorAbstractBase { /** * Function that is called when configuration of the dependencies is * required. - * + * * @param c * dependency manager Component object, used for configuring the * dependencies exported and imported diff --git a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/FlowProgrammerService.java b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/FlowProgrammerService.java index d6feebd4a3..6bea306669 100644 --- a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/FlowProgrammerService.java +++ b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/FlowProgrammerService.java @@ -75,7 +75,7 @@ public class FlowProgrammerService implements IFlowProgrammerService, /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { logger.debug("INIT called!"); @@ -85,7 +85,7 @@ public class FlowProgrammerService implements IFlowProgrammerService, * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { // Clear previous registration to avoid they are left hanging @@ -96,7 +96,7 @@ public class FlowProgrammerService implements IFlowProgrammerService, /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { logger.debug("START called!"); @@ -108,7 +108,7 @@ public class FlowProgrammerService implements IFlowProgrammerService, * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { logger.debug("STOP called!"); @@ -305,7 +305,7 @@ public class FlowProgrammerService implements IFlowProgrammerService, } ci.println(this.addFlow(node, getSampleFlow(node))); } - + public void _modifyflow(CommandInterpreter ci) throws UnknownHostException { Node node = null; String nodeId = ci.nextArgument(); @@ -494,7 +494,7 @@ public class FlowProgrammerService implements IFlowProgrammerService, /** * This Request ID generator starts with 1. Each aysnc message is * associated with an unique Request ID (!= 0). - * + * * @return Request ID */ private long getNextRid() { diff --git a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Topology.java b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Topology.java index 2f517488a9..f965d7f2c4 100644 --- a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Topology.java +++ b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/Topology.java @@ -60,7 +60,7 @@ public class Topology implements IPluginOutTopologyService, ITopologyService { /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { } @@ -69,7 +69,7 @@ public class Topology implements IPluginOutTopologyService, ITopologyService { * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { // Make sure to clear all the data structure we use to track diff --git a/opendaylight/sal/implementation/src/test/java/org/opendaylight/controller/sal/implementation/DataPacketServiceTest.java b/opendaylight/sal/implementation/src/test/java/org/opendaylight/controller/sal/implementation/DataPacketServiceTest.java index 3a07288a9f..730764a24e 100644 --- a/opendaylight/sal/implementation/src/test/java/org/opendaylight/controller/sal/implementation/DataPacketServiceTest.java +++ b/opendaylight/sal/implementation/src/test/java/org/opendaylight/controller/sal/implementation/DataPacketServiceTest.java @@ -20,14 +20,14 @@ import org.opendaylight.controller.sal.packet.RawPacket; public class DataPacketServiceTest { - @Test - public void DataPacketServiceDecodeTest() throws ConstructionException, InstantiationException, IllegalAccessException { - - DataPacketService dService = new DataPacketService(); - RawPacket rawPkt = null; - - Assert.assertTrue(dService.decodeDataPacket(rawPkt) == null); - + @Test + public void DataPacketServiceDecodeTest() throws ConstructionException, InstantiationException, IllegalAccessException { + + DataPacketService dService = new DataPacketService(); + RawPacket rawPkt = null; + + Assert.assertTrue(dService.decodeDataPacket(rawPkt) == null); + byte[] data = { 10, 12, 14, 20, 55, 69, //DMAC -90, -20, -100, -82, -78, -97, //SMAC 8, 6, //ethype @@ -40,35 +40,35 @@ public class DataPacketServiceTest { 9, 9, 9, 1, // src proto 0, 0, 0, 0, 0, 0, // target hw addr 9, 9, 9, -2 }; // target proto - + rawPkt = new RawPacket(data); - + Packet decodedPkt = dService.decodeDataPacket(rawPkt); Class payloadClass = ARP.class; Assert.assertTrue(payloadClass == decodedPkt.getPayload().getClass()); - + ARP arpPacket = (ARP) decodedPkt.getPayload(); - + Assert.assertTrue(arpPacket.getHardwareType() == (byte)0x1); Assert.assertTrue(arpPacket.getProtocolType() == 2048); Assert.assertTrue(arpPacket.getHardwareAddressLength() == (byte)0x6); Assert.assertTrue(arpPacket.getProtocolAddressLength() == (byte)0x4); Assert.assertTrue(arpPacket.getOpCode() == 1); - + byte[] senderHwAddress = arpPacket.getSenderHardwareAddress(); - byte[] senderProtocolAddress = arpPacket.getSenderProtocolAddress(); - + byte[] senderProtocolAddress = arpPacket.getSenderProtocolAddress(); + byte[] targetHwAddress = arpPacket.getTargetHardwareAddress(); - byte[] targetProtocolAddress = arpPacket.getTargetProtocolAddress(); - + byte[] targetProtocolAddress = arpPacket.getTargetProtocolAddress(); + Assert.assertTrue(senderHwAddress[0] == (byte)0xA6); Assert.assertTrue(senderHwAddress[1] == (byte)0xEC); Assert.assertTrue(senderHwAddress[2] == (byte)0x9C); Assert.assertTrue(senderHwAddress[3] == (byte)0xAE); Assert.assertTrue(senderHwAddress[4] == (byte)0xB2); Assert.assertTrue(senderHwAddress[5] == (byte)0x9F); - + Assert.assertTrue(senderProtocolAddress[0] == (byte)0x9); Assert.assertTrue(senderProtocolAddress[1] == (byte)0x9); Assert.assertTrue(senderProtocolAddress[2] == (byte)0x9); @@ -89,36 +89,36 @@ public class DataPacketServiceTest { Assert.assertTrue(targetProtocolAddress[0] == (byte)0x9); Assert.assertTrue(targetProtocolAddress[1] == (byte)0x9); Assert.assertTrue(targetProtocolAddress[2] == (byte)0x9); - Assert.assertTrue(targetProtocolAddress[3] == (byte)0xFE); - } - - @Test - public void DataPacketServiceEncodeTest() throws ConstructionException, InstantiationException, IllegalAccessException { - - DataPacketService dService = new DataPacketService(); - Ethernet eth = new Ethernet(); + Assert.assertTrue(targetProtocolAddress[3] == (byte)0xFE); + } + + @Test + public void DataPacketServiceEncodeTest() throws ConstructionException, InstantiationException, IllegalAccessException { + + DataPacketService dService = new DataPacketService(); + Ethernet eth = new Ethernet(); ARP arp = new ARP(); - byte[] data = null; - RawPacket rawPkt; + byte[] data = null; + RawPacket rawPkt; byte[] dMAC = { 10, 12, 14, 20, 55, 69 }; byte[] sMAC = { 82, 97, 109, 117, 127, -50 }; short etherType = 2054; - + eth.setDestinationMACAddress(dMAC); eth.setSourceMACAddress(sMAC); eth.setEtherType(etherType); - + arp.setHardwareType((short)1); arp.setProtocolType((short)2048); arp.setHardwareAddressLength((byte)0x6); arp.setProtocolAddressLength((byte)0x4); arp.setOpCode((byte)0x1); - + byte[] senderHardwareAddress = {(byte)0xA6, (byte)0xEC, (byte)0x9C, (byte)0xAE, - (byte)0xB2, (byte)0x9F}; + (byte)0xB2, (byte)0x9F}; byte[] senderProtocolAddress = {(byte)0x09, (byte)0x09, (byte)0x09, (byte)0x01}; byte[] targetProtocolAddress = {(byte)0x09, (byte)0x09, (byte)0x09, (byte)0xFE}; byte[] targetHardwareAddress = {(byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0}; @@ -126,13 +126,13 @@ public class DataPacketServiceTest { arp.setSenderProtocolAddress(senderProtocolAddress); arp.setTargetHardwareAddress(targetHardwareAddress); arp.setTargetProtocolAddress(targetProtocolAddress); - + arp.setParent(eth); eth.setPayload(arp); - + rawPkt = dService.encodeDataPacket(eth); data = rawPkt.getPacketData(); - + Assert.assertTrue(data[0] == (byte)0x0A);//Destination MAC Assert.assertTrue(data[1] == (byte)0x0C); Assert.assertTrue(data[2] == (byte)0x0E); @@ -174,7 +174,7 @@ public class DataPacketServiceTest { Assert.assertTrue(data[38] == (byte)0x09);//Target Protocol Address Assert.assertTrue(data[39] == (byte)0x09); Assert.assertTrue(data[40] == (byte)0x09); - Assert.assertTrue(data[41] == (byte)0xFE); - } + Assert.assertTrue(data[41] == (byte)0xFE); + } } diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/ConfigManager.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/ConfigManager.java index ff91e93f58..3cacab7846 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/ConfigManager.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/ConfigManager.java @@ -19,36 +19,36 @@ import org.slf4j.LoggerFactory; /** * This class represents a configuration manager for the Load Balancer service. - * This class is responsible for managing(store/update/delete) the load balancer + * This class is responsible for managing(store/update/delete) the load balancer * configuration that it receives through REST APIs or from any other applications * present in the controller. * */ public class ConfigManager implements IConfigManager{ - + /* * Logger instance */ private static final Logger cmLogger = LoggerFactory.getLogger(ConfigManager.class); - + /* - * All the available VIPs + * All the available VIPs */ private HashMap vips = new HashMap(); - + /* * All the available Pools */ private HashMap pools = new HashMap(); - + public ConfigManager(){ } - + @Override public boolean vipExists(String name) { return this.vips.containsKey(name); } - + @Override public boolean vipExists(VIP vip){ if(vip.getName()==null){ @@ -64,80 +64,80 @@ public class ConfigManager implements IConfigManager{ } return true; } - + @Override public boolean vipExists(String name,String ip,String protocol,short protocolPort,String poolName){ - + VIP vip = new VIP(name,ip,protocol,protocolPort,poolName); - + //Check VIP with the same name - + if(!vips.containsKey(name)){ //Check VIP with the same ip, protocol and protocolPort if(!vips.containsValue(vip)){ - + //if you reach here, means this VIP don't exist return false; } } - + //Yeah, i have it. - return true; + return true; } - + @Override public Set getAllVIPs(){ return new HashSet(this.vips.values()); } - + public VIP getVIPWithPoolName(VIP vip){ cmLogger.info("Search a VIP with name:{}",vip); for(VIP vipTemp: this.vips.values()){ if(vipTemp.equals(vip)){ - + cmLogger.info("Found VIP with pool detail : {}",vipTemp); return vipTemp; } } - + cmLogger.info("VIP with pool detail not found "); return null; } - + @Override public VIP createVIP(String name,String ip,String protocol,short protocolPort,String poolName){ - + cmLogger.info("Create VIP with the following details :[ name : "+name +" ip : "+ip +" protocol : "+protocol +" protocol_port : "+protocolPort +" pool name : "+poolName); - + VIP vip = new VIP(name,ip,protocol,protocolPort,poolName); - + if(poolName !=null && !poolName.isEmpty()){ if(pools.containsKey(poolName)){ pools.get(poolName).addVIP(vip); } } - + vip.setStatus(LBConst.STATUS_ACTIVE); this.vips.put(name, vip); - + cmLogger.info("New VIP created : "+vip.toString()); return vip; } - + @Override public String getVIPAttachedPool(String name) { return this.vips.get(name).getPoolName(); } - + @Override public VIP updateVIP(String name, String poolName){ - + cmLogger.info("Updating VIP : "+name+" pool name to "+poolName); - + if(vips.containsKey(name)){ VIP vip = vips.get(name); if(vip.getPoolName() == null){ @@ -150,30 +150,30 @@ public class ConfigManager implements IConfigManager{ cmLogger.error("VIP with name: "+name+" does not exist"); return null; } - + @Override public VIP deleteVIP(String name){ - + cmLogger.info("Deleting VIP : "+name); - + VIP vip = vips.get(name); - + String poolName = vip.getPoolName(); - + if(poolName != null){ if(pools.containsKey(poolName)){ Pool pool = pools.get(poolName); pool.removeVIP(vip.getName()); } } - + cmLogger.info("VIP removed : "+vip.toString()); - + vips.remove(vip.getName()); - + return vip; } - + @Override public boolean memberExists(String name, String poolName) { if(this.pools.containsKey(poolName)){ @@ -182,89 +182,89 @@ public class ConfigManager implements IConfigManager{ } return false; } - + @Override public boolean memberExists(String name, String memberIP,String poolName){ if(!this.pools.containsKey(poolName)) return false; - + return this.pools.get(poolName).poolMemberExists(new PoolMember(name, memberIP, poolName)); } - + @Override public PoolMember addPoolMember(String name, String memberIP, String poolName){ - + PoolMember pm = new PoolMember(name,memberIP,poolName); - + cmLogger.info("Adding pool member : "+pm.toString()); - + pools.get(poolName).addMember(pm); - + return pm; } - + @Override public PoolMember removePoolMember(String name, String poolName){ - + cmLogger.info("Removing pool member : {} from pool {}",name, poolName); - + Pool pool = pools.get(poolName); - + PoolMember pm = pool.getMember(name); - + pool.removeMember(name); - + cmLogger.info("Pool member {} removed from {} ",name,poolName); - + return pm; } - + @Override public Set getAllPools(){ return new HashSet(this.pools.values()); } - + @Override public boolean poolExists(String name) { return this.pools.containsKey(name); } - + @Override public boolean poolExists(String name, String lbMethod){ - + return pools.containsValue(new Pool(name,lbMethod)); } - + @Override public Pool createPool(String name, String lbMethod){ - + Pool newPool = new Pool(name,lbMethod); - + cmLogger.info("New pool created : " + newPool.toString()); - + pools.put(name, newPool); - + return newPool; } - + @Override public Pool deletePool(String poolName){ - + Pool pool = pools.get(poolName); - + for(VIP vip:pool.getAllVip()){ - + vip.setPoolName(null); - + } - + cmLogger.info("Pool removed : "+pool.toString()); - + pools.remove(poolName); - + return pool; } - + @Override public Pool getPool( String poolName){ if(pools.containsKey(poolName)){ @@ -272,16 +272,16 @@ public class ConfigManager implements IConfigManager{ } return null; } - + @Override public Set getAllPoolMembers(String poolName) { - + if(pools.containsKey(poolName)){ return new HashSet(pools.get(poolName).getAllMembers()); } return null; } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/IConfigManager.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/IConfigManager.java index 5e55b2a3dd..df35b0ae1f 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/IConfigManager.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/IConfigManager.java @@ -18,164 +18,164 @@ import org.opendaylight.controller.samples.loadbalancer.entities.VIP; * */ public interface IConfigManager { - + /** * Return all existing VIPs * @return Set of VIP's * if there is no VIP, it will return empty set. */ public Set getAllVIPs(); - + /** * Check if VIP with the 'name' exists - * @param name Name of the VIP - * @return true if exists - * false else + * @param name Name of the VIP + * @return true if exists + * false else */ public boolean vipExists(String name); /** - * Check if VIP exists with the details 'VIP' - * @param vip Search for this VIP - * @return true if exists - * false else + * Check if VIP exists with the details 'VIP' + * @param vip Search for this VIP + * @return true if exists + * false else */ public boolean vipExists(VIP vip); /** * Check if VIP with the provided details exists - * @param name Name of the VIP - * @param ip IP of the VIP - * @param protocol IP Protocol of the VIP (TCP/UDP) - * @param protocolPort Transport port of the VIP (e.g 5550) - * @param poolName Name of the pool attached with the VIP - * @return true if exists - * false else + * @param name Name of the VIP + * @param ip IP of the VIP + * @param protocol IP Protocol of the VIP (TCP/UDP) + * @param protocolPort Transport port of the VIP (e.g 5550) + * @param poolName Name of the pool attached with the VIP + * @return true if exists + * false else */ public boolean vipExists(String name,String ip,String protocol,short protocolPort,String poolName); - + /** * Add VIP to the configuration - * @param name Name of the VIP - * @param ip IP of the VIP - * @param protocol IP Protocol of the VIP (TCP/UDP) - * @param protocolPort Transport port of the VIP - * @param poolName Name of the pool that VIP will use for load balancing its traffic - * @return Newly created VIP + * @param name Name of the VIP + * @param ip IP of the VIP + * @param protocol IP Protocol of the VIP (TCP/UDP) + * @param protocolPort Transport port of the VIP + * @param poolName Name of the pool that VIP will use for load balancing its traffic + * @return Newly created VIP */ public VIP createVIP(String name,String ip,String protocol,short protocolPort,String poolName); - + /** * Return pool attached to VIP * @param name Name of the VIP - * @return Name of the pool attached to VIP - * else null + * @return Name of the pool attached to VIP + * else null */ public String getVIPAttachedPool(String name); /** * Update pool name of the VIP. - * @param name Name of the VIP - * @param poolName Attach this pool to VIP - * @return Updated VIP If successful - * null If this VIP is already attached to any existing pool. - */ + * @param name Name of the VIP + * @param poolName Attach this pool to VIP + * @return Updated VIP If successful + * null If this VIP is already attached to any existing pool. + */ public VIP updateVIP(String name, String poolName); - + /** * Delete the VIP - * @param name Delete VIP with this name - * @return Details of the deleted VIP + * @param name Delete VIP with this name + * @return Details of the deleted VIP */ public VIP deleteVIP(String name); /** - * Check if pool member with the 'name' present in the pool with name 'poolName' - * @param name Name of the pool member - * @param poolName Name of the pool, you want to search for pool member - * @return true If exist - * false else + * Check if pool member with the 'name' present in the pool with name 'poolName' + * @param name Name of the pool member + * @param poolName Name of the pool, you want to search for pool member + * @return true If exist + * false else */ public boolean memberExists(String name, String poolName); /** * Check if pool member with name 'name' and IP 'memberIP' exist in the pool 'poolName' - * @param name Name of the pool member - * @param memberIP IP of the pool member - * @param poolName Name of the pool member you want to search - * @return true If Exist - * false else + * @param name Name of the pool member + * @param memberIP IP of the pool member + * @param poolName Name of the pool member you want to search + * @return true If Exist + * false else */ public boolean memberExists(String name, String memberIP,String poolName); - + /** * Return all pool members of the pool 'poolName' - * @param poolName Name of the pool - * @return Set of all the pool members if pool with the name present in the configuration - * null else - * + * @param poolName Name of the pool + * @return Set of all the pool members if pool with the name present in the configuration + * null else + * */ public Set getAllPoolMembers(String poolName); - + /** * Add new pool member to the configuration - * @param name Name of the pool - * @param memberIP IP of the pool - * @param poolName Attach pool member to this pool - * @return Newly created pool member + * @param name Name of the pool + * @param memberIP IP of the pool + * @param poolName Attach pool member to this pool + * @return Newly created pool member */ public PoolMember addPoolMember(String name, String memberIP, String poolName); - + /** * Remove pool member from the pool - * @param name Name of the pool member - * @param poolName Name of the pool - * @return Details of the removed pool member + * @param name Name of the pool member + * @param poolName Name of the pool + * @return Details of the removed pool member */ public PoolMember removePoolMember(String name, String poolName); /** * Return all the existing pools - * @return Set of Pools + * @return Set of Pools */ public Set getAllPools(); - + /** * Return pool with input name - * @param poolName Name of the pool - * @return Details of the pool if pool exist - * null else + * @param poolName Name of the pool + * @return Details of the pool if pool exist + * null else */ public Pool getPool(String poolName); - + /** - * Check if pool exists with the input name - * @param name Name of the pool - * @return true If exists - * false else + * Check if pool exists with the input name + * @param name Name of the pool + * @return true If exists + * false else */ public boolean poolExists(String name); /** * Check if pool exists with the input name and loadbalancing method. - * @param name Name of the pool - * @param lbMethod Load balancing method name - * @return true If exists - * false else + * @param name Name of the pool + * @param lbMethod Load balancing method name + * @return true If exists + * false else */ public boolean poolExists(String name, String lbMethod); - + /** * Create new pool with the provided details - * @param name Name of the pool - * @param lbMethod Load balancing method this pool will use - * @return Details of the newly created pool + * @param name Name of the pool + * @param lbMethod Load balancing method this pool will use + * @return Details of the newly created pool */ public Pool createPool(String name, String lbMethod); - + /** * Delete pool with the provided name - * @param poolName Name of the pool - * @return Details of the deleted pool + * @param poolName Name of the pool + * @return Details of the deleted pool */ public Pool deletePool(String poolName); diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBConst.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBConst.java index bd6fb473c1..7e93304de1 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBConst.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBConst.java @@ -12,21 +12,22 @@ package org.opendaylight.controller.samples.loadbalancer; * */ public class LBConst { - + public static final int FORWARD_DIRECTION_LB_FLOW = 0; - + public static final int REVERSE_DIRECTION_LB_FLOW = 1; - + public static final String ROUND_ROBIN_LB_METHOD = "roundrobin"; - + public static final String RANDOM_LB_METHOD = "random"; - + public static final String STATUS_ACTIVE="active"; - + public static final String STATUS_INACTIVE="inactive"; - + public static final String STATUS_PENDING="pending"; - + public static final String STATUS_ERROR="error"; - + } + diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBUtil.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBUtil.java index aa195a34e9..c320250084 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBUtil.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBUtil.java @@ -19,36 +19,36 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Class defines utilty methods that will be used by different components - * of the load balancer service + * Class defines utilty methods that will be used by different components + * of the load balancer service * */ public class LBUtil { - + private static final Logger lbuLogger = LoggerFactory.getLogger(LBUtil.class); - + public LBUtil(){} - + /** - * Extract the details of the source machine that sent this packet 'inPkt' - * @param inPkt Packet that is received by the controller - * @return Details of the source machine in Client object. + * Extract the details of the source machine that sent this packet 'inPkt' + * @param inPkt Packet that is received by the controller + * @return Details of the source machine in Client object. */ public Client getClientFromPacket(IPv4 inPkt){ lbuLogger.info("Find client information from packet : {}",inPkt.toString()); - + String ip = NetUtils.getInetAddress(inPkt.getSourceAddress()).getHostAddress(); - + String protocol = IPProtocols.getProtocolName(inPkt.getProtocol()); - + lbuLogger.info("client ip {} and protocl {}",ip,protocol); - + Packet tpFrame= inPkt.getPayload(); - + lbuLogger.info("Get protocol layer {}",tpFrame.toString()); - + short port = 0; - + if(protocol.equals(IPProtocols.TCP.toString())){ TCP tcpFrame = (TCP)tpFrame; port = tcpFrame.getSourcePort(); @@ -56,47 +56,47 @@ public class LBUtil { UDP udpFrame = (UDP)tpFrame; port = udpFrame.getSourcePort(); } - + lbuLogger.info("Found port {}",port); - + Client source = new Client(ip, protocol,port); - + lbuLogger.info("Client information : {}",source.toString()); - + return source; } - + /** * Extract the details of the destination machine where this packet 'inPkt' need * to be delivered * @param inPkt Packet that is received by controller for forwarding - * @return Details of the destination machine packet in VIP + * @return Details of the destination machine packet in VIP */ public VIP getVIPFromPacket(IPv4 inPkt){ - + lbuLogger.info("Find VIP information from packet : {}",inPkt.toString()); - + String ip = NetUtils.getInetAddress(inPkt.getDestinationAddress()).getHostAddress(); - + String protocol = IPProtocols.getProtocolName(inPkt.getProtocol()); - + Packet tpFrame= inPkt.getPayload(); - + short port = 0; - + if(protocol.equals(IPProtocols.TCP.toString())){ TCP tcpFrame = (TCP)tpFrame; port = tcpFrame.getDestinationPort(); }else{ - + UDP udpFrame = (UDP)tpFrame; port = udpFrame.getDestinationPort(); } - + VIP dest = new VIP(null,ip, protocol,port,null); - + lbuLogger.info("VIP information : {}",dest.toString()); - + return dest; } } \ No newline at end of file diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Client.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Client.java index a16582d532..4d7cf4928a 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Client.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Client.java @@ -17,73 +17,73 @@ package org.opendaylight.controller.samples.loadbalancer.entities; * e.g TCP traffic from two different ports from the same host to a given VIP will be considered * as two different clients by this service. Similarly, traffic using two different protocols * (TCP, UDP) from the same host will be considered as two different clients. - * + * */ public class Client { - + /* * IP address of the client (source address) */ private String ip; - + /* * Network protocol of the traffic sent by client */ private String protocol; - + /* * Port used to send network traffic (source port) */ private short port; - + public Client(String ip, String protocol, short port){ this.ip = ip; this.protocol = protocol; this.port = port; } - + /** * @return the client IP */ public String getIp() { return ip; } - + /** * @param ip the IP to set */ public void setIp(String ip) { this.ip = ip; } - + /** * @return the client network protocol */ public String getProtocol() { return protocol; } - + /** * @param protocol the protocol to set */ public void setProtocol(String protocol) { this.protocol = protocol; } - + /** * @return the client port */ public short getPort() { return port; } - + /** * @param port the port to set */ public void setPort(short port) { this.port = port; } - + /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @@ -96,7 +96,7 @@ public class Client { result = prime * result+ ((protocol == null) ? 0 : protocol.hashCode()); return result; } - + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @@ -131,7 +131,7 @@ public class Client { } return true; } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java index ae48a3a451..bbf31162aa 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java @@ -16,12 +16,12 @@ import javax.xml.bind.annotation.XmlRootElement; /** * This class represents the pool of hosts among which incoming traffic - * will be load balanced. Each pool will load balance the traffic among its pool members - * based on the loadbalancing policy set for the pool. + * will be load balanced. Each pool will load balance the traffic among its pool members + * based on the loadbalancing policy set for the pool. * Currently, the pool supports two load balancing policies: * 1. Round Robin Policy{@link org.opendaylight.controller.samples.loadbalancer.policies.RoundRobinLBPolicy} * 2. Random Policy {@link org.opendaylight.controller.samples.loadbalancer.policies.RandomLBPolicy} - * + * * NOTE: After creation of the pool, user can't update (change) its load balancing policy. * NOTE: Each Pool should have a unique name. */ @@ -29,124 +29,124 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name="pool") @XmlAccessorType(XmlAccessType.NONE) public class Pool { - + /* * Unique name of the pool */ @XmlElement private String name; - + /* * Associated load balancing policy */ @XmlElement(name="lbmethod") private String lbMethod; - + /* * Status of the pool (active/inactive) */ @XmlElement private String status; - + /* * List of all the VIPs using this pool for load balancing their traffic - more than * one VIP can be mapped to each pool. */ @XmlElement private ArrayList vips = new ArrayList(); - + /* * List of all the pool members used for load balancing the traffic */ @XmlElement private ArrayList members = new ArrayList(); - + /* * Private constructor used for JAXB mapping */ @SuppressWarnings("unused") private Pool() {} - + /** * Getter/ Setter methods */ - + public Pool(String name, String lbMethod) { this.name = name; this.lbMethod = lbMethod; } - + /** * @return the name */ public String getName() { return name; } - + /** * @param name the name to set */ public void setName(String name) { this.name = name; } - + /** * @return the lbMethod */ public String getLbMethod() { return lbMethod; } - + /** * @param lbMethod the lbMethod to set */ public void setLbMethod(String lbMethod) { this.lbMethod = lbMethod; } - + /** * @return the status */ public String getStatus() { return status; } - + /** * @param status the status to set */ public void setStatus(String status) { this.status = status; } - + /** * @return the vip */ public ArrayList getAllVip() { return vips; } - + /** * @param vip the vip to set */ public void setVips(ArrayList vips) { this.vips = vips; } - + /** * @return the members */ public ArrayList getAllMembers() { return members; } - + /** * @param members the members to set */ public void setMembers(ArrayList members) { this.members = members; } - + /** * Add new VIP to the VIP list * @param vip new VIP to add @@ -154,11 +154,11 @@ public class Pool { public void addVIP(VIP vip){ this.vips.add(vip); } - + /** * Remove VIP with given name from the VIP list of the pool * @param name Name of the VIP - * @return true If VIP was using this pool and removed + * @return true If VIP was using this pool and removed * false IF VIP is not using this pool */ public boolean removeVIP(String name){ @@ -170,25 +170,25 @@ public class Pool { } return false; } - + /** * Check if the given pool member is part of this pool * @param pm Search for this pool member - * @return true If pool member is attached to this pool + * @return true If pool member is attached to this pool * false else */ public boolean poolMemberExists(PoolMember pm){ return this.members.contains(pm); } - + /** * Returns the pool member with the given name * @param name Search for this pool member - * @return PoolMember If pool member is attached to this pool + * @return PoolMember If pool member is attached to this pool * null else */ public PoolMember getMember(String name){ - + for(PoolMember pm: this.members){ if(pm.getName().equals(name)){ return pm; @@ -196,7 +196,7 @@ public class Pool { } return null; } - + /** * Add new pool member to the pool * @param pm Add this new pool @@ -204,12 +204,12 @@ public class Pool { public void addMember(PoolMember pm){ this.members.add(pm); } - + /** * Remove pool member from the pool list * @param name Remove this pool member - * @return true If pool member was attached to this pool and successfully removed - * false If pool member is not attached to this pool + * @return true If pool member was attached to this pool and successfully removed + * false If pool member is not attached to this pool */ public boolean removeMember(String name){ for(PoolMember pm: this.members){ @@ -220,7 +220,7 @@ public class Pool { } return false; } - + /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @@ -232,7 +232,7 @@ public class Pool { result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } - + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @@ -264,7 +264,7 @@ public class Pool { } return true; } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/PoolMember.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/PoolMember.java index 31949b43d4..31297ebcce 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/PoolMember.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/PoolMember.java @@ -17,111 +17,111 @@ import javax.xml.bind.annotation.XmlRootElement; * This class represents the host where load balancing service will * redirect VIP traffic for load balancing. All these hosts have to * register with a pool to be a part of traffic load balancing. - * This entity is referred to as a 'PoolMember'. - * Load balancer service differentiates each pool member based on its + * This entity is referred to as a 'PoolMember'. + * Load balancer service differentiates each pool member based on its * two properties { ip address, attached pool }. * A host (IP) can be attached to two different pools through creation of two * different pool member objects. - * + * * NOTE: Each pool member should have a unique name. * */ @XmlRootElement(name="poolmember") @XmlAccessorType(XmlAccessType.NONE) public class PoolMember { - + /* * Unique name of the pool member */ @XmlElement private String name; - + /* * IP address of the pool member */ @XmlElement private String ip; - + /* * Name of the pool this member is attached to. */ @XmlElement(name="poolname") private String poolName; - + /* * Status (active/inactive) */ @XmlElement private String status; - + /** * Private constructor used for JAXB mapping */ @SuppressWarnings("unused") private PoolMember() {} - + public PoolMember(String name, String memberIP, String poolName){ this.name = name; this.ip = memberIP; this.poolName = poolName; } - + /** * @return the name */ public String getName() { return name; } - + /** * @param name the name to set */ public void setName(String name) { this.name = name; } - + /** * @return the ip */ public String getIp() { return ip; } - + /** * @param ip the ip to set */ public void setIp(String ip) { this.ip = ip; } - + /** * @return the poolName */ public String getPoolName() { return poolName; } - + /** * @param poolName the poolName to set */ public void setPoolName(String poolName) { this.poolName = poolName; } - + /** * @return the status */ public String getStatus() { return status; } - + /** * @param status the status to set */ public void setStatus(String status) { this.status = status; } - + /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @@ -134,7 +134,7 @@ public class PoolMember { + ((poolName == null) ? 0 : poolName.hashCode()); return result; } - + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/VIP.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/VIP.java index 22a7109f59..6f866fe23f 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/VIP.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/VIP.java @@ -18,47 +18,47 @@ import javax.xml.bind.annotation.XmlRootElement; * 1. IP address of the VIP exposed by the application * 2. Protocol of the network traffic (TCP/UDP) * 3. Port to which incoming traffic is destined - * - * User is allowed to create mutliple VIPs with the same IP, but all such VIPs (with the same IP) + * + * User is allowed to create mutliple VIPs with the same IP, but all such VIPs (with the same IP) * should differ at least in the protocol or port or both. - * + * * NOTE: Each VIP should have a unique name. */ @XmlRootElement(name="vip") @XmlAccessorType(XmlAccessType.NONE) public class VIP { - + /* * Unique name of the VIP */ @XmlElement private String name; - + /* - * Virtual IP address of the VIP + * Virtual IP address of the VIP */ @XmlElement private String ip; - + /* - * Network traffic protocol + * Network traffic protocol */ @XmlElement private String protocol; - + /* * Port where network traffic is destined (destination port) */ @XmlElement private short port; - + /* * Name of the pool attached to the VIP for load balancing its traffic */ @XmlElement(name="poolname") private String poolName; - + /* * Status (Active/inactive) */ @@ -70,7 +70,7 @@ public class VIP { */ @SuppressWarnings("unused") private VIP() {} - + public VIP(String name, String ip, String protocol, @@ -82,61 +82,61 @@ public class VIP { this.port = port; this.poolName = poolName; } - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } - + public String getIp() { return ip; } - + public void setIp(String ip) { this.ip = ip; } - + public String getProtocol() { return protocol; } - + public void setProtocol(String protocol) { this.protocol = protocol; } - + public short getPort() { return port; } - + public void setPort(short port) { this.port = port; } - + public String getPoolName() { return poolName; } - + public void setPoolName(String poolName) { this.poolName = poolName; } - + /** * @return the status */ public String getStatus() { return status; } - + /** * @param status the status to set */ public void setStatus(String status) { this.status = status; } - + /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @@ -150,7 +150,7 @@ public class VIP { + ((protocol == null) ? 0 : protocol.hashCode()); return result; } - + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @@ -158,7 +158,7 @@ public class VIP { public boolean equals(Object obj) { if (this == obj) { return true; - + } if (obj == null) { return false; @@ -166,7 +166,7 @@ public class VIP { if (!(obj instanceof VIP)) { return false; } - + VIP other = (VIP) obj; if (ip == null) { if (other.ip != null) { @@ -187,7 +187,7 @@ public class VIP { } return true; } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/Activator.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/Activator.java index fc78a72eaf..0568fced6e 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/Activator.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/Activator.java @@ -23,13 +23,13 @@ import org.opendaylight.controller.sal.routing.IRouting; import org.opendaylight.controller.samples.loadbalancer.IConfigManager; /** - * Main application activator class for registering the dependencies and + * Main application activator class for registering the dependencies and * initialising the load balancer application. * */ public class Activator extends ComponentActivatorAbstractBase { - + /* * Logger instance */ @@ -86,13 +86,13 @@ public class Activator extends ComponentActivatorAbstractBase { props.put("salListenerName", "loadbalancer"); c.setInterface(new String[] { IListenDataPacket.class.getName(), - IConfigManager.class.getName()}, props); + IConfigManager.class.getName()}, props); c.add(createContainerServiceDependency(containerName).setService( IDataPacketService.class).setCallbacks( "setDataPacketService", "unsetDataPacketService") .setRequired(true)); - + c.add(createContainerServiceDependency(containerName).setService( IRouting.class).setCallbacks("setRouting", "unsetRouting") .setRequired(false)); diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerService.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerService.java index 7eaa8b4ec0..ddfde38931 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerService.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerService.java @@ -56,78 +56,78 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * This class is the main class that represents the load balancer service. - * This is a sample load balancer application that balances traffic to backend servers - * based on the source address and source port on each incoming packet. The service + * This class is the main class that represents the load balancer service. + * This is a sample load balancer application that balances traffic to backend servers + * based on the source address and source port on each incoming packet. The service * reactively installs OpenFlow rules to direct all packets with a specific source address - * and source port to one of the appropriate backend servers. The servers may be chosen - * using a round robin policy or a random policy. This service can be configured via a + * and source port to one of the appropriate backend servers. The servers may be chosen + * using a round robin policy or a random policy. This service can be configured via a * REST APIs which are similar to the OpenStack Quantum LBaaS (Load-balancer-as-a-Service) * v1.0 API proposal (http://wiki.openstack.org/Quantum/LBaaS) - * + * * To use this service, a virtual IP (or VIP) should be exposed to the clients of this service * and used as the destination address. A VIP is a entity that comprises of a virtual IP, port * and protocol (TCP or UDP). * Assumptions: * 1. One or more VIPs may be mapped to the same server pool. All VIPs that share the same * pool must also share the same load balancing policy (random or round robin). - * + * * 2. Only one server pool can be be assigned to a VIP. - * + * * 3. All flow rules are installed with an idle timeout of 5 seconds. - * + * * 4. Packets to a VIP must leave the OpenFlow cluster from the same switch from where * it entered it. - * + * * 5. When you delete a VIP or a server pool or a server from a pool, the service does not * delete the flow rules it has already installed. The flow rules should automatically - * time out after the idle timeout of 5 seconds. + * time out after the idle timeout of 5 seconds. * */ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ - + /* * Logger instance */ private static Logger lbsLogger = LoggerFactory.getLogger(LoadBalancerService.class); - + /* * Single instance of the configuration manager. Application passes this reference to all * the new policies implemented for load balancing. */ private static ConfigManager configManager = new ConfigManager(); - + /* * Round robing policy instance. Need to implement factory patterns to get * policy instance. */ private static RoundRobinLBPolicy rrLBMethod= new RoundRobinLBPolicy(configManager); - + /* * Random policy instance. */ private static RandomLBPolicy ranLBMethod= new RandomLBPolicy(configManager); - + /* * Reference to the data packet service */ private IDataPacketService dataPacketService = null; - + /* * Reference to the host tracker service */ private IfIptoHost hostTracker; - + /* * Reference to the forwarding manager */ private IForwardingRulesManager ruleManager; - + /* * Reference to the routing service */ private IRouting routing; - + /* * Load balancer application installs all flows with priority 2. */ @@ -139,7 +139,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ private String containerName = null; /* - * Set/unset methods for the service instance that load balancer + * Set/unset methods for the service instance that load balancer * service requires */ public String getContainerName() { @@ -147,7 +147,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ return GlobalConstants.DEFAULT.toString(); return containerName; } - + void setDataPacketService(IDataPacketService s) { this.dataPacketService = s; } @@ -157,7 +157,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ this.dataPacketService = null; } } - + public void setRouting(IRouting routing) { this.routing = routing; } @@ -169,7 +169,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ } public void setHostTracker(IfIptoHost hostTracker) { - lbsLogger.debug("Setting HostTracker"); + lbsLogger.debug("Setting HostTracker"); this.hostTracker = hostTracker; } @@ -181,7 +181,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ public void setForwardingRulesManager( IForwardingRulesManager forwardingRulesManager) { - lbsLogger.debug("Setting ForwardingRulesManager"); + lbsLogger.debug("Setting ForwardingRulesManager"); this.ruleManager = forwardingRulesManager; } @@ -194,68 +194,68 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ /** * This method receives first packet of flows for which there is no - * matching flow rule installed on the switch. IP addresses used for VIPs + * matching flow rule installed on the switch. IP addresses used for VIPs * are not supposed to be used by any real/virtual host in the network. * Hence, any forwarding/routing service will not install any flows rules matching * these VIPs. This ensures that all the flows destined for VIPs will not find a match * in the switch and will be forwarded to the load balancing service. - * Service will decide where to route this traffic based on the load balancing - * policy of the VIP's attached pool and will install appropriate flow rules - * in a reactive manner. + * Service will decide where to route this traffic based on the load balancing + * policy of the VIP's attached pool and will install appropriate flow rules + * in a reactive manner. */ @Override public PacketResult receiveDataPacket(RawPacket inPkt){ - + if (inPkt == null) { return PacketResult.IGNORED; } - + Packet formattedPak = this.dataPacketService.decodeDataPacket(inPkt); - + if (formattedPak instanceof Ethernet) { byte[] vipMacAddr = ((Ethernet) formattedPak).getDestinationMACAddress(); Object ipPkt = formattedPak.getPayload(); - + if (ipPkt instanceof IPv4) { - + lbsLogger.debug("Packet recieved from switch : {}",inPkt.getIncomingNodeConnector().getNode().toString()); IPv4 ipv4Pkt = (IPv4)ipPkt; if(IPProtocols.getProtocolName(ipv4Pkt.getProtocol()).equals(IPProtocols.TCP.toString()) || IPProtocols.getProtocolName(ipv4Pkt.getProtocol()).equals(IPProtocols.UDP.toString())){ - + lbsLogger.debug("Packet protocol : {}",IPProtocols.getProtocolName(ipv4Pkt.getProtocol())); Client client = new LBUtil().getClientFromPacket(ipv4Pkt); VIP vip = new LBUtil().getVIPFromPacket(ipv4Pkt); - + if(configManager.vipExists(vip)){ VIP vipWithPoolName = configManager.getVIPWithPoolName(vip); String poolMemberIp = null; if(configManager.getPool(vipWithPoolName.getPoolName()).getLbMethod().equalsIgnoreCase(LBConst.ROUND_ROBIN_LB_METHOD)){ - + poolMemberIp = rrLBMethod.getPoolMemberForClient(client,vipWithPoolName); } - + if(configManager.getPool(vipWithPoolName.getPoolName()).getLbMethod().equalsIgnoreCase(LBConst.RANDOM_LB_METHOD)){ poolMemberIp = ranLBMethod.getPoolMemberForClient(client,vipWithPoolName); } - + try { - + Node clientNode = inPkt.getIncomingNodeConnector().getNode(); HostNodeConnector hnConnector = this.hostTracker.hostFind(InetAddress.getByName(poolMemberIp)); - + Node destNode = hnConnector.getnodeconnectorNode(); - + lbsLogger.debug("Client is connected to switch : {}",clientNode.toString()); lbsLogger.debug("Destination pool machine is connected to switch : {}",destNode.toString()); - + //Get path between both the nodes Path route = this.routing.getRoute(clientNode, destNode); - + lbsLogger.info("Path between source (client) and destination switch nodes : {}",route.toString()); - + NodeConnector forwardPort = route.getEdges().get(0).getTailNodeConnector(); - + if(installLoadBalancerFlow(client, vip, clientNode, @@ -268,7 +268,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ }else{ lbsLogger.error("Not able to route traffic from client : {}",client ); } - + if(installLoadBalancerFlow(client, vip, clientNode, @@ -291,7 +291,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ } return PacketResult.IGNORED; } - + /* * This method installs the flow rule for routing the traffic between two hosts. * @param source Traffic is sent by this source @@ -301,21 +301,21 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ * @param destMachineMac MAC address of the pool member where traffic needs to be routed * @param outport Use this port to send out traffic * @param flowDirection FORWARD_DIRECTION_LB_FLOW or REVERSE_DIRECTION_LB_FLOW - * @return true If flow installation was successful - * false else + * @return true If flow installation was successful + * false else * @throws UnknownHostException */ private boolean installLoadBalancerFlow(Client source, VIP dest, Node sourceSwitch, String destMachineIp, - byte[] destMachineMac, + byte[] destMachineMac, NodeConnector outport, int flowDirection) throws UnknownHostException{ - + Match match = new Match(); List actions = new ArrayList(); - + if(flowDirection == LBConst.FORWARD_DIRECTION_LB_FLOW){ match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue()); match.setField(MatchType.NW_SRC, InetAddress.getByName(source.getIp())); @@ -323,11 +323,11 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ match.setField(MatchType.NW_PROTO, IPProtocols.getProtocolNumberByte(dest.getProtocol())); match.setField(MatchType.TP_SRC, source.getPort()); match.setField(MatchType.TP_DST, dest.getPort()); - + actions.add(new SetNwDst(InetAddress.getByName(destMachineIp))); actions.add(new SetDlDst(destMachineMac)); } - + if(flowDirection == LBConst.REVERSE_DIRECTION_LB_FLOW){ match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue()); match.setField(MatchType.NW_SRC, InetAddress.getByName(destMachineIp)); @@ -335,37 +335,37 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ match.setField(MatchType.NW_PROTO, IPProtocols.getProtocolNumberByte(source.getProtocol())); match.setField(MatchType.TP_SRC, dest.getPort()); match.setField(MatchType.TP_DST,source.getPort()); - + actions.add(new SetNwSrc(InetAddress.getByName(dest.getIp()))); actions.add(new SetDlSrc(destMachineMac)); } - + actions.add(new Output(outport)); - + // Make sure the priority for IP switch entries is // set to a level just above default drop entries - + Flow flow = new Flow(match, actions); flow.setIdleTimeout((short) 5); flow.setHardTimeout((short) 0); flow.setPriority(LB_IPSWITCH_PRIORITY); - + String policyName = source.getIp()+":"+source.getProtocol()+":"+source.getPort(); String flowName =null; - + if(flowDirection == LBConst.FORWARD_DIRECTION_LB_FLOW){ flowName = "["+policyName+":"+source.getIp() + ":"+dest.getIp()+"]"; } - + if(flowDirection == LBConst.REVERSE_DIRECTION_LB_FLOW){ - + flowName = "["+policyName+":"+dest.getIp() + ":"+source.getIp()+"]"; } - + FlowEntry fEntry = new FlowEntry(policyName, flowName, flow, sourceSwitch); - + lbsLogger.info("Install flow entry {} on node {}",fEntry.toString(),sourceSwitch.toString()); - + if(!this.ruleManager.checkFlowEntryConflict(fEntry)){ if(this.ruleManager.installFlowEntry(fEntry).isSuccess()){ return true; @@ -377,7 +377,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ } return false; } - + /** * Function called by the dependency manager when all the required * dependencies are satisfied @@ -387,16 +387,16 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ Dictionary props = c.getServiceProperties(); if (props != null) { this.containerName = (String) props.get("containerName"); - + lbsLogger.info("Running container name:" + this.containerName); }else { - + // In the Global instance case the containerName is empty this.containerName = ""; } lbsLogger.info(configManager.toString()); } - + /** * Function called by the dependency manager when at least one * dependency become unsatisfied or when the component is shutting @@ -426,106 +426,106 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager{ /* * All the methods below are just proxy methods to direct the REST API requests to configuration - * manager. We need this redirection as currently, opendaylight supports only one - * implementation of the service. + * manager. We need this redirection as currently, opendaylight supports only one + * implementation of the service. */ @Override public Set getAllVIPs() { return configManager.getAllVIPs(); } - + @Override public boolean vipExists(String name, String ip, String protocol, short protocolPort, String poolName) { return configManager.vipExists(name, ip, protocol, protocolPort, poolName); } - + @Override public boolean vipExists(VIP vip) { return configManager.vipExists(vip); } - + @Override public VIP createVIP(String name, String ip, String protocol, short protocolPort, String poolName) { return configManager.createVIP(name, ip, protocol, protocolPort, poolName); } - + @Override public VIP updateVIP(String name, String poolName) { return configManager.updateVIP(name, poolName); } - + @Override public VIP deleteVIP(String name) { return configManager.deleteVIP(name); } - + @Override public boolean memberExists(String name, String memberIP, String poolName) { return configManager.memberExists(name, memberIP, poolName); } - + @Override public Set getAllPoolMembers(String poolName) { - + return configManager.getAllPoolMembers(poolName); } - + @Override - public PoolMember addPoolMember(String name, + public PoolMember addPoolMember(String name, String memberIP, String poolName) { return configManager.addPoolMember(name, memberIP, poolName); } - + @Override public PoolMember removePoolMember(String name, String poolName) { - + return configManager.removePoolMember(name, poolName); } - + @Override public Set getAllPools() { - + return configManager.getAllPools(); } - + @Override public Pool getPool(String poolName) { return configManager.getPool(poolName); } - + @Override public boolean poolExists(String name, String lbMethod) { return configManager.poolExists(name, lbMethod); } - + @Override public Pool createPool(String name, String lbMethod) { return configManager.createPool(name, lbMethod); } - + @Override public Pool deletePool(String poolName) { return configManager.deletePool(poolName); } - + @Override public boolean vipExists(String name) { return configManager.vipExists(name); } - + @Override public boolean memberExists(String name, String poolName) { return configManager.memberExists(name, poolName); } - + @Override public boolean poolExists(String name) { return configManager.poolExists(name); } - + @Override public String getVIPAttachedPool(String name) { return configManager.getVIPAttachedPool(name); diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/ILoadBalancingPolicy.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/ILoadBalancingPolicy.java index f9562d6c52..d69c63c200 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/ILoadBalancingPolicy.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/ILoadBalancingPolicy.java @@ -14,16 +14,16 @@ import org.opendaylight.controller.samples.loadbalancer.entities.VIP; * All new load balancer policies must implement this interface. */ public interface ILoadBalancingPolicy { - + /** * Returns IP address of the next pool member from the pool * to which the load balancer service can direct incoming packets. * @param source source on the packet * @param dest virtual IP (VIP) that is used as destination on the packet - * @return IP address of the next pool member which will serve + * @return IP address of the next pool member which will serve * all incoming traffic destined for the given VIP and with the given source * information */ public String getPoolMemberForClient(Client source, VIP dest); - + } \ No newline at end of file diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RandomLBPolicy.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RandomLBPolicy.java index ba5d5babb6..b4b616f3a8 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RandomLBPolicy.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RandomLBPolicy.java @@ -24,31 +24,31 @@ import org.slf4j.LoggerFactory; * */ public class RandomLBPolicy implements ILoadBalancingPolicy { - + /* * Instance logger */ private static final Logger rLogger = LoggerFactory.getLogger(RandomLBPolicy.class); - + /* - * Reference to the configuration manager. This reference is passed from load balancer + * Reference to the configuration manager. This reference is passed from load balancer * class. */ private ConfigManager cmgr; - + /* * Mapping between the client and the pool member that serves all traffic for that client. */ private HashMap clientMemberMap; - + /* * Random generator */ Random randomGenerator = null; - + @SuppressWarnings("unused") private RandomLBPolicy(){} - + public RandomLBPolicy(ConfigManager cmgr){ this.cmgr = cmgr; this.clientMemberMap = new HashMap(); @@ -56,13 +56,13 @@ public class RandomLBPolicy implements ILoadBalancingPolicy { } @Override public String getPoolMemberForClient(Client source, VIP dest){ - + rLogger.info("Received traffic from client : {} for VIP : {} ",source, dest); - + syncWithLoadBalancerData(); - + PoolMember pm= null; - + if(this.clientMemberMap.containsKey(source)){ pm= this.clientMemberMap.get(source); rLogger.info("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm); @@ -76,7 +76,7 @@ public class RandomLBPolicy implements ILoadBalancingPolicy { } return pm.getIp(); } - + /* * This method does the clean up. Whenever a new client packet arrives with a given VIP, * this method checks the current configuration to see if any pool members have been deleted and @@ -84,25 +84,25 @@ public class RandomLBPolicy implements ILoadBalancingPolicy { */ private void syncWithLoadBalancerData(){ rLogger.debug("[Client - PoolMember] table before cleanup : {}",this.clientMemberMap.toString()); - + ArrayList removeClient = new ArrayList(); - + if(this.clientMemberMap.size() != 0){ for(Client client : this.clientMemberMap.keySet()){ - + if(!this.cmgr.memberExists(this.clientMemberMap.get(client).getName(), this.clientMemberMap.get(client).getPoolName())){ removeClient.add(client); } } } - + for(Client client : removeClient){ this.clientMemberMap.remove(client); - + rLogger.debug("Removed client : {} ",client); } rLogger.debug("[Client - PoolMember] table after cleanup : {}",this.clientMemberMap.toString()); } - + } diff --git a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RoundRobinLBPolicy.java b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RoundRobinLBPolicy.java index c8687883e7..f1011dddc5 100644 --- a/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RoundRobinLBPolicy.java +++ b/opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RoundRobinLBPolicy.java @@ -23,23 +23,23 @@ import org.slf4j.LoggerFactory; * */ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{ - + /* * Logger instance */ private static final Logger rrLogger = LoggerFactory.getLogger(RoundRobinLBPolicy.class); - + /* - * Reference to the configuration manager. This reference is passed from load balancer + * Reference to the configuration manager. This reference is passed from load balancer * class. */ private ConfigManager cmgr; - + /* * Mapping between the client and the pool member that serves all traffic for that client. */ private HashMap clientMemberMap; - + /* * Maintains the next pool member counter for the VIPs. * More than one VIP can be attached to one pool, so each VIP @@ -47,34 +47,34 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{ * the same pool. */ private HashMap nextItemFromPool; - + @SuppressWarnings("unused") private RoundRobinLBPolicy(){} - + public RoundRobinLBPolicy(ConfigManager cmgr){ this.cmgr = cmgr; this.clientMemberMap = new HashMap(); this.nextItemFromPool = new HashMap(); } - + @Override public String getPoolMemberForClient(Client source, VIP dest){ - + rrLogger.info("Received traffic from client : {} for VIP : {} ",source, dest); - + syncWithLoadBalancerData(); - + PoolMember pm= null; - + if(this.clientMemberMap.containsKey(source)){ - + pm= this.clientMemberMap.get(source); rrLogger.info("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm); }else{ - + Pool pool = null; if(nextItemFromPool.containsKey(dest)){ - + int memberNum = nextItemFromPool.get(dest).intValue(); rrLogger.debug("Packet is from new client for VIP {}",dest); pool = this.cmgr.getPool(dest.getPoolName()); @@ -82,19 +82,19 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{ this.clientMemberMap.put(source, pm ); rrLogger.info("New client's packet will be directed to pool member {}",pm); memberNum++; - + if(memberNum > pool.getAllMembers().size()-1){ memberNum = 0; } rrLogger.debug("Next pool member for new client of VIP is set to {}",pool.getAllMembers().get(memberNum)); - + this.nextItemFromPool.put(dest, new Integer(memberNum)); }else{ rrLogger.debug("Network traffic for VIP : {} has appeared first time from client {}",dest,source); pool = this.cmgr.getPool(dest.getPoolName()); pm = pool.getAllMembers().get(0); this.clientMemberMap.put(source, pm); - + rrLogger.info("Network traffic from client {} will be directed to pool member {}",pm); this.nextItemFromPool.put(dest, new Integer(1)); rrLogger.debug("Next pool member for new client of VIP is set to {}",pool.getAllMembers().get(1)); @@ -102,7 +102,7 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{ } return pm.getIp(); } - + /* * This method does the clean up. Whenever a new client packet arrives with a given VIP, * this method checks the current configuration to see if any pool members have been deleted and @@ -111,43 +111,43 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{ private void syncWithLoadBalancerData(){ rrLogger.debug("[Client - PoolMember] table before cleanup : {}",this.clientMemberMap.toString()); ArrayList removeClient = new ArrayList(); - + if(this.clientMemberMap.size() != 0){ for(Client client : this.clientMemberMap.keySet()){ if(!this.cmgr.memberExists(this.clientMemberMap.get(client).getName(), this.clientMemberMap.get(client).getPoolName())){ - + removeClient.add(client); } } } - + for(Client client : removeClient){ this.clientMemberMap.remove(client); - + rrLogger.debug("Removed client : {} ",client); } rrLogger.debug("[Client - PoolMember] table after cleanup : {}",this.clientMemberMap.toString()); - + rrLogger.debug("[VIP- NextMember] table before cleanup : {}",this.nextItemFromPool.toString()); - + ArrayList resetVIPPoolMemberCount= new ArrayList(); - + if(this.nextItemFromPool.size() != 0){ - + for(VIP vip:this.nextItemFromPool.keySet()){ if(this.nextItemFromPool.get(vip).intValue() > this.cmgr.getPool(vip.getPoolName()).getAllMembers().size()-1){ - + resetVIPPoolMemberCount.add(vip); } } } - + for(VIP vip:resetVIPPoolMemberCount){ rrLogger.debug("VIP next pool member counter reset to 0"); this.nextItemFromPool.put(vip, new Integer(0)); } - + rrLogger.debug("[VIP- NextMember] table after cleanup : {}",this.nextItemFromPool.toString()); } } diff --git a/opendaylight/samples/loadbalancer/src/test/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerTest.java b/opendaylight/samples/loadbalancer/src/test/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerTest.java index 45d041c3e1..f8633b9ef8 100644 --- a/opendaylight/samples/loadbalancer/src/test/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerTest.java +++ b/opendaylight/samples/loadbalancer/src/test/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerTest.java @@ -20,7 +20,7 @@ import org.opendaylight.controller.samples.loadbalancer.policies.RoundRobinLBPol import junit.framework.TestCase; /** - * + * * Class to unit test the load balancing policies. * */ @@ -30,7 +30,7 @@ public class LoadBalancerTest extends TestCase { ConfigManager cm = null; cm = new ConfigManager(); Assert.assertFalse(cm== null); - + Pool pool = cm.createPool("TestPool","roundrobin"); VIP vip = cm.createVIP("TestVIP","10.0.0.9","TCP",(short)5550,"TestPool"); PoolMember host1 = new PoolMember("host1","10.0.0.1","TestPool"); @@ -40,7 +40,7 @@ public class LoadBalancerTest extends TestCase { PoolMember host5 = new PoolMember("host5","10.0.0.5","TestPool"); PoolMember host6 = new PoolMember("host6","10.0.0.6","TestPool"); PoolMember host7 = new PoolMember("host7","10.0.0.7","TestPool"); - + pool.addMember(host1); pool.addMember(host2); pool.addMember(host3); @@ -49,20 +49,20 @@ public class LoadBalancerTest extends TestCase { pool.addMember(host6); pool.addMember(host7); pool.addVIP(vip); - + Assert.assertTrue(cm.getAllPoolMembers("TestPool").size() == pool.getAllMembers().size()); - + RoundRobinLBPolicy rrp = new RoundRobinLBPolicy(cm); - + Client c1 = new Client("10.0.0.1","TCP",(short)5000); Assert.assertTrue(rrp.getPoolMemberForClient(c1, vip).equals(host1.getIp())); - + c1 = new Client("10.0.0.1","TCP",(short)5001); Assert.assertTrue(rrp.getPoolMemberForClient(c1, vip).equals(host2.getIp())); - + c1 = new Client("10.0.0.1","TCP",(short)5002); Assert.assertTrue(rrp.getPoolMemberForClient(c1, vip).equals(host3.getIp())); - + c1 = new Client("10.0.0.1","TCP",(short)5003); Assert.assertTrue(rrp.getPoolMemberForClient(c1, vip).equals(host4.getIp())); } diff --git a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/LoadBalancerNorthbound.java b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/LoadBalancerNorthbound.java index 8ea0d78360..4ec567c95b 100644 --- a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/LoadBalancerNorthbound.java +++ b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/LoadBalancerNorthbound.java @@ -41,38 +41,38 @@ import org.opendaylight.controller.samples.loadbalancer.IConfigManager; /** * This class exposes North bound REST APIs for the Load Balancer Service. * Following APIs are exposed by the Load Balancer Service: - * + * * Data retrieval REST APIs:: - * 1. Get details of all existing pools - * Type : GET - * URI : /one/nb/v2/lb/{container-name}/ - * NOTE: Current implementation of the opendaylight usage 'default' as a container-name - * e.g : http://localhost:8080/one/nb/v2/lb/default will give you list of all the pools - * - * 2. Get details of all the existing VIPs - * Type : GET - * URI: /one/nb/v2/lb/{container-name}/vips - * + * 1. Get details of all existing pools + * Type : GET + * URI : /one/nb/v2/lb/{container-name}/ + * NOTE: Current implementation of the opendaylight usage 'default' as a container-name + * e.g : http://localhost:8080/one/nb/v2/lb/default will give you list of all the pools + * + * 2. Get details of all the existing VIPs + * Type : GET + * URI: /one/nb/v2/lb/{container-name}/vips + * * Pool related REST APIs:: - * 1. Create Pool : - * Type : POST - * URI : /one/nb/v2/lb/{container-name}/create/pool - * Request body : + * 1. Create Pool : + * Type : POST + * URI : /one/nb/v2/lb/{container-name}/create/pool + * Request body : * { * "name":"", * "lbmethod":"" * } - * Currently, two load balancing policies are allowed {"roundrobin" and "random" } - * - * 2. Delete Pool : - * Type : DELETE - * URI : /one/nb/v2/lb/{container-name}/delete/pool/{pool-name} - * + * Currently, two load balancing policies are allowed {"roundrobin" and "random" } + * + * 2. Delete Pool : + * Type : DELETE + * URI : /one/nb/v2/lb/{container-name}/delete/pool/{pool-name} + * * VIP related REST APIs:: - * 1. Create VIP: - * Type : POST - * URI : /one/nb/v2/lb/{container-name}/create/vip - * Request body : + * 1. Create VIP: + * Type : POST + * URI : /one/nb/v2/lb/{container-name}/create/vip + * Request body : * { * "name":"", * "ip":"ip in (xxx.xxx.xxx.xxx) format", @@ -80,12 +80,12 @@ import org.opendaylight.controller.samples.loadbalancer.IConfigManager; * "port":"any valid port number", * "poolname":"" (optional) * } - * The pool name is optional and can be set up at a later stage (using the REST API given below). - * - * 2. Update VIP: Update pool name of the VIP - * Type : PUT - * URI : /one/nb/v2/lb/{container-name}/update/vip - * Request body : + * The pool name is optional and can be set up at a later stage (using the REST API given below). + * + * 2. Update VIP: Update pool name of the VIP + * Type : PUT + * URI : /one/nb/v2/lb/{container-name}/update/vip + * Request body : * { * "name":"", * "poolname":"" @@ -94,34 +94,34 @@ import org.opendaylight.controller.samples.loadbalancer.IConfigManager; * and not of the VIP name itself. * The specified pool name must already exist. If the specified VIP is already attached to a pool, the update * will fail. - * - * 3. Delete VIP : - * Type : DELETE - * URI : /one/nb/v2/lb/{container-name}/delete/vip/{vip-name} - * + * + * 3. Delete VIP : + * Type : DELETE + * URI : /one/nb/v2/lb/{container-name}/delete/vip/{vip-name} + * * Pool member related REST APIs:: - * 1. Create pool member: - * Type : POST - * URI : /one/nb/v2/lb/default/create/poolmember - * Request body : + * 1. Create pool member: + * Type : POST + * URI : /one/nb/v2/lb/default/create/poolmember + * Request body : * { * "name":"", * "ip":"ip in (xxx.xxx.xxx.xxx) format", * "poolname":"existing pool name" * } - * - * 2. Delete pool member: - * Type : DELETE - * URI : /one/nb/v2/lb/{container-name}/delete/poolmember/{pool-member-name}/{pool-name} - * - * NOTE: Property "name" of each individual entity must be unique. - * All the above REST APIs throw appropriate response codes in case of error/success. - * Please consult the respective methods to get details of various response codes. + * + * 2. Delete pool member: + * Type : DELETE + * URI : /one/nb/v2/lb/{container-name}/delete/poolmember/{pool-member-name}/{pool-name} + * + * NOTE: Property "name" of each individual entity must be unique. + * All the above REST APIs throw appropriate response codes in case of error/success. + * Please consult the respective methods to get details of various response codes. */ @Path("/") public class LoadBalancerNorthbound { - + /* * Method returns the Load balancer service instance running within * 'default' container. @@ -148,7 +148,7 @@ public class LoadBalancerNorthbound { } IConfigManager configManager = (IConfigManager) ServiceHelper.getInstance( - IConfigManager.class, containerName, this); + IConfigManager.class, containerName, this); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer" @@ -168,13 +168,13 @@ public class LoadBalancerNorthbound { @ResponseCode(code = 503, condition = "Load balancer service is unavailable") }) public Pools getAllPools( @PathParam("containerName") String containerName) { - + IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer " + RestMessages.SERVICEUNAVAILABLE.toString()); } - + return new Pools(configManager.getAllPools()); } @@ -188,7 +188,7 @@ public class LoadBalancerNorthbound { @ResponseCode(code = 503, condition = "Load balancer service is unavailable") }) public VIPs getAllVIPs( @PathParam("containerName") String containerName) { - + IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer " @@ -209,7 +209,7 @@ public class LoadBalancerNorthbound { @ResponseCode(code = 415, condition = "Invalid input data")}) public Response addVIP(@PathParam("containerName") String containerName, @TypeHint(VIP.class) JAXBElement inVIP){ - + VIP vipInput = inVIP.getValue(); String name = vipInput.getName(); String ip = vipInput.getIp(); @@ -222,16 +222,16 @@ public class LoadBalancerNorthbound { protocolPort < 0 ){ throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); } - + IConfigManager configManager = getConfigManagerService(containerName); - + if (configManager == null) { throw new ServiceUnavailableException("Load Balancer " + RestMessages.SERVICEUNAVAILABLE.toString()); } - + if(!configManager.vipExists(name, ip, protocol, protocolPort, poolName)){ - + VIP vip = configManager.createVIP(name, ip, protocol, protocolPort, poolName); if ( vip != null){ return Response.status(Response.Status.CREATED).build(); @@ -254,7 +254,7 @@ public class LoadBalancerNorthbound { @ResponseCode(code = 415, condition = "Invalid input name")}) public Response updateVIP(@PathParam("containerName") String containerName, @TypeHint(VIP.class) JAXBElement inVIP) { - + VIP vipInput = inVIP.getValue(); String name = vipInput.getName(); String poolName = vipInput.getPoolName(); @@ -262,25 +262,25 @@ public class LoadBalancerNorthbound { poolName.isEmpty()){ throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); } - + IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer " + RestMessages.SERVICEUNAVAILABLE.toString()); } - + if(!configManager.poolExists(poolName)) throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND); - + if(configManager.getVIPAttachedPool(name)!=null) throw new MethodNotAllowedException(NBConst.RES_VIP_POOL_EXIST); - + if(configManager.updateVIP(name, poolName)!= null) return Response.status(Response.Status.ACCEPTED).build(); - + throw new InternalServerErrorException(NBConst.RES_VIP_UPDATE_FAILED); } - + @Path("/{containerName}/delete/vip/{vipName}") @DELETE @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @@ -293,19 +293,19 @@ public class LoadBalancerNorthbound { public Response deleteVIP( @PathParam(value = "containerName") String containerName, @PathParam(value = "vipName") String vipName) { - + if(vipName.isEmpty()) throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); - + IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer" + RestMessages.SERVICEUNAVAILABLE.toString()); } - + if(!configManager.vipExists(vipName)) throw new ResourceNotFoundException(NBConst.RES_VIP_NOT_FOUND); - + for(VIP vip : configManager.getAllVIPs()){ if(vip.getName().equals(vipName)){ configManager.deleteVIP(vipName); @@ -326,7 +326,7 @@ public class LoadBalancerNorthbound { @ResponseCode(code = 415, condition = "Invalid input data")}) public Response addPool(@PathParam("containerName") String containerName, @TypeHint(Pool.class) JAXBElement inPool) { - + Pool poolInput = inPool.getValue(); String name = poolInput.getName(); String lbMethod =poolInput.getLbMethod(); @@ -334,15 +334,15 @@ public class LoadBalancerNorthbound { lbMethod.isEmpty()){ throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); } - + IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer " + RestMessages.SERVICEUNAVAILABLE.toString()); } - + if(!configManager.poolExists(name)){ - + Pool pool = configManager.createPool(name, lbMethod); if ( pool != null){ return Response.status(Response.Status.CREATED).build(); @@ -365,19 +365,19 @@ public class LoadBalancerNorthbound { public Response deletePool( @PathParam(value = "containerName") String containerName, @PathParam(value = "poolName") String poolName) { - + if(poolName.isEmpty()) throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); - + IConfigManager configManager = getConfigManagerService(containerName); if (configManager == null) { throw new ServiceUnavailableException("Load Balancer" + RestMessages.SERVICEUNAVAILABLE.toString()); } - + if(!configManager.poolExists(poolName)) throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND); - + for(Pool pool:configManager.getAllPools()){ if(pool.getName().equals(poolName)){ configManager.deletePool(poolName); @@ -399,37 +399,37 @@ public class LoadBalancerNorthbound { @ResponseCode(code = 415, condition = "Invalid input data")}) public Response addPoolMember(@PathParam("containerName") String containerName, @TypeHint(PoolMember.class) JAXBElement inPoolMember){ - + PoolMember pmInput = inPoolMember.getValue(); - String name = pmInput.getName(); - String memberIP = pmInput.getIp(); - String poolName = pmInput.getPoolName(); - - if(name.isEmpty() || - memberIP.isEmpty()|| - poolName.isEmpty()){ - throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); - } - - IConfigManager configManager = getConfigManagerService(containerName); - if (configManager == null) { - throw new ServiceUnavailableException("Load Balancer " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - if(!configManager.poolExists(poolName)) - throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND); - - if(!configManager.memberExists(name, memberIP, poolName)){ - - PoolMember poolMember = configManager.addPoolMember(name, memberIP, poolName); - if ( poolMember != null){ - return Response.status(Response.Status.CREATED).build(); - } - }else{ - throw new ResourceConflictException(NBConst.RES_POOLMEMBER_ALREADY_EXIST); - } - throw new InternalServerErrorException(NBConst.RES_POOLMEMBER_CREATION_FAILED); + String name = pmInput.getName(); + String memberIP = pmInput.getIp(); + String poolName = pmInput.getPoolName(); + + if(name.isEmpty() || + memberIP.isEmpty()|| + poolName.isEmpty()){ + throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); + } + + IConfigManager configManager = getConfigManagerService(containerName); + if (configManager == null) { + throw new ServiceUnavailableException("Load Balancer " + + RestMessages.SERVICEUNAVAILABLE.toString()); + } + + if(!configManager.poolExists(poolName)) + throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND); + + if(!configManager.memberExists(name, memberIP, poolName)){ + + PoolMember poolMember = configManager.addPoolMember(name, memberIP, poolName); + if ( poolMember != null){ + return Response.status(Response.Status.CREATED).build(); + } + }else{ + throw new ResourceConflictException(NBConst.RES_POOLMEMBER_ALREADY_EXIST); + } + throw new InternalServerErrorException(NBConst.RES_POOLMEMBER_CREATION_FAILED); } @Path("/{containerName}/delete/poolmember/{poolMemberName}/{poolName}") @@ -445,25 +445,25 @@ public class LoadBalancerNorthbound { @PathParam(value = "containerName") String containerName, @PathParam(value = "poolMemberName") String poolMemberName, @PathParam(value = "poolName") String poolName) { - + if(poolMemberName.isEmpty()|| poolName.isEmpty()) throw new UnsupportedMediaTypeException(RestMessages.INVALIDDATA.toString()); - + IConfigManager configManager = getConfigManagerService(containerName); - + if (configManager == null) { throw new ServiceUnavailableException("Load Balancer" + RestMessages.SERVICEUNAVAILABLE.toString()); } - + if(!configManager.poolExists(poolName)) throw new ResourceNotFoundException(NBConst.RES_POOL_NOT_FOUND); - + if(configManager.memberExists(poolMemberName, poolName)){ - + configManager.removePoolMember(poolMemberName, poolName); - + return Response.ok().build(); } throw new ResourceNotFoundException(NBConst.RES_POOLMEMBER_NOT_FOUND); diff --git a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/NBConst.java b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/NBConst.java index a5d2091470..4aa4705a53 100644 --- a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/NBConst.java +++ b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/NBConst.java @@ -12,32 +12,32 @@ package org.opendaylight.controller.samples.loadbalancer.northbound; * */ public class NBConst { - + public static final String RES_VIP_ALREADY_EXIST= " VIP already exists"; - + public static final String RES_VIP_NOT_FOUND= " VIP not found"; - + public static final String RES_VIP_CREATION_FAILED = " Creation of VIP failed"; - + public static final String RES_VIP_DELETION_FAILED = " Deletion of VIP failed"; - + public static final String RES_VIP_UPDATE_FAILED = " Update of VIP failed"; - + public static final String RES_POOL_ALREADY_EXIST= " Pool already exists"; - + public static final String RES_POOL_NOT_FOUND= " Pool not found"; - + public static final String RES_POOL_CREATION_FAILED = " Creation of pool failed"; - + public static final String RES_POOL_DELETION_FAILED = " Deletion of pool failed"; - + public static final String RES_POOLMEMBER_ALREADY_EXIST= " Pool member already exists"; - + public static final String RES_POOLMEMBER_NOT_FOUND= " Pool member not found"; - + public static final String RES_POOLMEMBER_CREATION_FAILED = " Creation of pool member failed"; - + public static final String RES_POOLMEMBER_DELETION_FAILED = " Deletion of pool member failed"; - + public static final String RES_VIP_POOL_EXIST = "Pool already attached to a VIP"; } diff --git a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/Pools.java b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/Pools.java index 74be568018..abb5495cbf 100644 --- a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/Pools.java +++ b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/Pools.java @@ -19,29 +19,29 @@ import org.opendaylight.controller.samples.loadbalancer.entities.Pool; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) /** - * JAX-RS resource for handling details of all the available pools + * JAX-RS resource for handling details of all the available pools * in response to respective REST API requests. */ public class Pools { - + @XmlElement (name="pool") Set loadBalancerPools; - + public Pools() { } - + public Pools (Set loadBalancerPools) { this.loadBalancerPools = loadBalancerPools; } - + /** * @return the loadBalancerPools */ public Set getLoadBalancerPools() { return loadBalancerPools; } - + /** * @param loadBalancerPools the loadBalancerPools to set */ diff --git a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/VIPs.java b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/VIPs.java index 66a20338ab..f0af929b39 100644 --- a/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/VIPs.java +++ b/opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/VIPs.java @@ -25,28 +25,28 @@ import org.opendaylight.controller.samples.loadbalancer.entities.VIP; @XmlAccessorType(XmlAccessType.NONE) public class VIPs { - + @XmlElement (name="vip") Set loadBalancerVIPs; - + public VIPs() {} - - + + public VIPs (Set loadBalancerVIPs) { this.loadBalancerVIPs = loadBalancerVIPs; } - + /** * @return the loadBalancerVIPs */ public Set getLoadBalancerVIPs() { return loadBalancerVIPs; } - + /** * @param loadBalancerVIPs the loadBalancerVIPs to set */ - + public void setLoadBalancerVIPs(Set loadBalancerVIPs) { this.loadBalancerVIPs = loadBalancerVIPs; } diff --git a/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java b/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java index 11056478db..c2fee970ac 100644 --- a/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java +++ b/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java @@ -147,7 +147,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify, } @SuppressWarnings("deprecation") - private void allocateCaches() { + private void allocateCaches() { if (this.clusterContainerService == null) { log.info("un-initialized clusterContainerService, can't create cache"); return; @@ -178,7 +178,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify, } @SuppressWarnings("deprecation") - private void destroyCaches() { + private void destroyCaches() { if (this.clusterContainerService == null) { log.info("un-initialized clusterContainerService, can't destroy cache"); return; @@ -367,7 +367,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify, } } else { - log.debug("Adding policyMatch(DIP = {}) Action(outPort= {}) " + + log.debug("Adding policyMatch(DIP = {}) Action(outPort= {}) " + "to node {}", new Object[] { host.getNetworkAddress().getHostAddress(), outPort, currNode}); @@ -482,7 +482,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify, updatePerHostRuleInSW(host, rootNode, rootNode, null, new HostNodePair( host, rootNode), ports); - // log.debug("Getting out at the end!"); + // log.debug("Getting out at the end!"); return switchesToProgram; } @@ -575,10 +575,10 @@ public class SimpleForwardingImpl implements IfNewHostNotify, // rest of the world // switchesToProgram.add(rootNode); //updatePerHostRuleInSW(host, rootNode, - // rootNode, null, - // new HostNodePair(host, rootNode),ports); + // rootNode, null, + // new HostNodePair(host, rootNode),ports); - // log.debug("Getting out at the end!"); + // log.debug("Getting out at the end!"); return switchesToProgram; } @@ -617,7 +617,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify, Status poStatus = this.frm.installFlowEntry(po); if (!poStatus.isSuccess()) { log.error("Failed to install policy: " - + po.getGroupName() + " (" + + po.getGroupName() + " (" + poStatus.getDescription() + ")"); retCode = RulesProgrammingReturnCode.FAILED_FEW_SWITCHES; @@ -632,8 +632,8 @@ public class SimpleForwardingImpl implements IfNewHostNotify, swId, host); /* // Now dump every single rule */ /* for (HostNodePair dumpkey : this.rulesDB.keySet()) { */ - /* po = this.rulesDB.get(dumpkey); */ - /* log.debug("Dumping entry H{" + dumpkey.getHost() + "} S{" + dumpkey.getSwitchId() + "} = {" + (po == null ? "null policy" : po)); */ + /* po = this.rulesDB.get(dumpkey); */ + /* log.debug("Dumping entry H{" + dumpkey.getHost() + "} S{" + dumpkey.getSwitchId() + "} = {" + (po == null ? "null policy" : po)); */ /* } */ } } diff --git a/opendaylight/statisticsmanager/api/src/main/java/org/opendaylight/controller/statisticsmanager/IStatisticsManager.java b/opendaylight/statisticsmanager/api/src/main/java/org/opendaylight/controller/statisticsmanager/IStatisticsManager.java index a2ab07ac7b..98977f6e91 100644 --- a/opendaylight/statisticsmanager/api/src/main/java/org/opendaylight/controller/statisticsmanager/IStatisticsManager.java +++ b/opendaylight/statisticsmanager/api/src/main/java/org/opendaylight/controller/statisticsmanager/IStatisticsManager.java @@ -31,7 +31,7 @@ public interface IStatisticsManager { * If the context is the default container, the returned statistics are for all the flows installed on the node, * regardless of the container they belong to * - * @param node the network node + * @param node the network node * @return the list of flows installed on the network node */ List getFlows(Node node); @@ -40,7 +40,7 @@ public interface IStatisticsManager { * Returns the statistics for the flows specified in the list * * @param flows - * @return the list of flows installed on the network node + * @return the list of flows installed on the network node */ Map> getFlowStatisticsForFlowList( List flows); diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/IInventoryListener.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/IInventoryListener.java index 29d0a42f85..e7b8c59dff 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/IInventoryListener.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/IInventoryListener.java @@ -23,11 +23,11 @@ public interface IInventoryListener { /** * This method is called when some properties of a node are added/deleted/changed. * - * @param node {@link org.opendaylight.controller.sal.core.Node} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param propMap map of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.Tier} etc. + * @param node {@link org.opendaylight.controller.sal.core.Node} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param propMap map of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.Tier} etc. */ public void notifyNode(Node node, UpdateType type, Map propMap); @@ -35,11 +35,11 @@ public interface IInventoryListener { /** * This method is called when some properties of a node connector are added/deleted/changed. * - * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated - * @param type {@link org.opendaylight.controller.sal.core.UpdateType} - * @param propMap map of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.State} etc. + * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} being updated + * @param type {@link org.opendaylight.controller.sal.core.UpdateType} + * @param propMap map of {@link org.opendaylight.controller.sal.core.Property} such as + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.State} etc. */ public void notifyNodeConnector(NodeConnector nodeConnector, UpdateType type, Map propMap); diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISpanAware.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISpanAware.java index 1e4a79fcc0..af1ab1cc7b 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISpanAware.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISpanAware.java @@ -22,9 +22,9 @@ public interface ISpanAware { /** * This method is called when list of ports in a node are added/deleted as span ports. * - * @param node {@link org.opendaylight.controller.sal.core.Node} being updated - * @param portList list of span {@link org.opendaylight.controller.sal.core.NodeConnector} - * @param add true if add; false if delete. + * @param node {@link org.opendaylight.controller.sal.core.Node} being updated + * @param portList list of span {@link org.opendaylight.controller.sal.core.NodeConnector} + * @param add true if add; false if delete. */ public void spanUpdate(Node node, List portList, boolean add); } \ No newline at end of file diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManager.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManager.java index 48f5aa48f6..ddc5f8ffee 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManager.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManager.java @@ -44,7 +44,7 @@ public interface ISwitchManager { /** * Remove a subnet configuration * - * @param configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig} + * @param configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig} * @return "Success" or failure reason */ public Status removeSubnet(SubnetConfig configObject); @@ -53,14 +53,14 @@ public interface ISwitchManager { * Remove a subnet configuration given the name * * @param name subnet name - * @return "Success" or failure reason + * @return "Success" or failure reason */ public Status removeSubnet(String name); /** * Return a list of all known devices in the system * - * @return returns a list of {@link org.opendaylight.controller.switchmanager.Switch} + * @return returns a list of {@link org.opendaylight.controller.switchmanager.Switch} */ public List getNetworkDevices(); @@ -82,8 +82,8 @@ public interface ISwitchManager { /** * Return a subnet configuration given the network address * - * @param networkAddress the ip address in long format - * @return the {@link org.opendaylight.controller.switchmanager.Subnet} + * @param networkAddress the ip address in long format + * @return the {@link org.opendaylight.controller.switchmanager.Subnet} */ public Subnet getSubnetByNetworkAddress(InetAddress networkAddress); @@ -98,7 +98,7 @@ public interface ISwitchManager { * Add a span port configuration * * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig} - * @return status code + * @return status code */ public Status addSpanConfig(SpanConfig configObject); @@ -106,7 +106,7 @@ public interface ISwitchManager { * Remove a span port configuration * * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig} - * @return status code + * @return status code */ public Status removeSpanConfig(SpanConfig cfgObject); @@ -152,8 +152,8 @@ public interface ISwitchManager { /** * Remove node connectors from a subnet * - * @param name the subnet config name - * @param nodeConnectors nodePorts string specified by {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig} + * @param name the subnet config name + * @param nodeConnectors nodePorts string specified by {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig} * @return "Success" or failure reason */ public Status removePortsFromSubnet(String name, String nodeConnectors); @@ -170,16 +170,16 @@ public interface ISwitchManager { * * @param node {@link org.opendaylight.controller.sal.core.Node} * @return map of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.Tier} etc. + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.Tier} etc. */ public Map getNodeProps(Node node); /** * Return a specific property of a node given the property name * - * @param node {@link org.opendaylight.controller.sal.core.Node} - * @param propName the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes + * @param node {@link org.opendaylight.controller.sal.core.Node} + * @param propName the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes * @return {@link org.opendaylight.controller.sal.core.Property} */ public Property getNodeProp(Node node, String propName); @@ -187,23 +187,23 @@ public interface ISwitchManager { /** * Set a specific property of a node * - * @param node {@link org.opendaylight.controller.sal.core.Node} - * @param prop {@link org.opendaylight.controller.sal.core.Property} + * @param node {@link org.opendaylight.controller.sal.core.Node} + * @param prop {@link org.opendaylight.controller.sal.core.Property} */ public void setNodeProp(Node node, Property prop); /** * Remove a property of a node - * - * @param nc {@link org.opendaylight.controller.sal.core.Node} - * @param propName the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes + * + * @param nc {@link org.opendaylight.controller.sal.core.Node} + * @param propName the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes * @return success or failed reason */ public Status removeNodeProp(Node node, String propName); /** * Remove all the properties of a node - * + * * @param node {@link org.opendaylight.controller.sal.core.Node} * @return success or failed reason */ @@ -238,8 +238,8 @@ public interface ISwitchManager { * * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} * @return map of {@link org.opendaylight.controller.sal.core.Property} such as - * {@link org.opendaylight.controller.sal.core.Description} and/or - * {@link org.opendaylight.controller.sal.core.State} etc. + * {@link org.opendaylight.controller.sal.core.Description} and/or + * {@link org.opendaylight.controller.sal.core.State} etc. */ public Map getNodeConnectorProps( NodeConnector nodeConnector); @@ -266,7 +266,7 @@ public interface ISwitchManager { /** * Remove a property of a node connector - * + * * @param nc {@link org.opendaylight.controller.sal.core.NodeConnector} * @param propName property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes * @return success or failed reason @@ -275,7 +275,7 @@ public interface ISwitchManager { /** * Remove all the properties of a node connector - * + * * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector} * @return success or failed reason */ @@ -284,7 +284,7 @@ public interface ISwitchManager { /** * Return the node connector given its name * - * @param node {@link org.opendaylight.controller.sal.core.Node} + * @param node {@link org.opendaylight.controller.sal.core.Node} * @param nodeConnectorName node connector identifier specified by {@link org.opendaylight.controller.sal.core.NodeConnector} * @return {@link org.opendaylight.controller.sal.core.NodeConnector} */ @@ -309,7 +309,7 @@ public interface ISwitchManager { /** * Return controller MAC address - * + * * @return MAC address in byte array */ public byte[] getControllerMAC(); @@ -317,7 +317,7 @@ public interface ISwitchManager { /** * Return MAC address for a given node * - * @param node {@link org.opendaylight.controller.sal.core.Node} + * @param node {@link org.opendaylight.controller.sal.core.Node} * @return MAC address in byte array */ public byte[] getNodeMAC(Node node); @@ -338,22 +338,22 @@ public interface ISwitchManager { */ public int getHostRetryCount(); - /** - * Create a Name/Tier/Bandwidth Property object based on given property - * name and value. Other property types are not supported yet. - * + /** + * Create a Name/Tier/Bandwidth Property object based on given property + * name and value. Other property types are not supported yet. + * * @param propName Name of the Property specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes * @param propValue Value of the Property specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes - * @return {@link org.opendaylight.controller.sal.core.Property} - */ + * @return {@link org.opendaylight.controller.sal.core.Property} + */ public Property createProperty(String propName, String propValue); - + /** - * Returns the description for the specified node. It is either the one + * Returns the description for the specified node. It is either the one * configured by user or the description advertised by the node. - * + * * @param node the network node identifier - * @return the description of the specified node. If no description is + * @return the description of the specified node. If no description is * configured and the network node does not provide its description, * an empty string is returned. */ diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java index 253096edc3..778310e07f 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java @@ -47,9 +47,9 @@ public class SwitchConfig implements Serializable { } public boolean isProactive() { - return Integer.parseInt(mode) != 0; + return Integer.parseInt(mode) != 0; } - + public static long getSerialversionuid() { return serialVersionUID; } diff --git a/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SwitchTest.java b/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SwitchTest.java index 18b3195372..1499f9e2ef 100644 --- a/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SwitchTest.java +++ b/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SwitchTest.java @@ -119,23 +119,23 @@ public class SwitchTest { Assert.assertTrue(sw.getSpanPorts().isEmpty()); } - + @Test public void testSwitchConfig(){ SwitchConfig sc = new SwitchConfig(null, null, null, null); SwitchConfig sc2 = new SwitchConfig(null, null, null, null); Assert.assertTrue(sc.equals(sc2)); - + Assert.assertNull(sc.getMode()); Assert.assertNull(sc.getNodeId()); Assert.assertNull(sc.getTier()); Assert.assertNull(sc.getNodeDescription()); - + SwitchConfig sc3 = new SwitchConfig("123", "name", "tier", "mode"); SwitchConfig sc4 = new SwitchConfig("123", "name", "tier", "mode"); Assert.assertFalse(sc.equals(sc3)); Assert.assertTrue(sc3.equals(sc4)); - + Assert.assertTrue(sc3.getNodeId().equals("123")); Assert.assertTrue(sc3.getNodeDescription().equals("name")); Assert.assertTrue(sc3.getTier().equals("tier")); diff --git a/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java b/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java index b58ae28610..d5b499c42b 100644 --- a/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java +++ b/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java @@ -94,10 +94,10 @@ public class TopologyUserLinkConfig implements Serializable { status = STATUS.LINKDOWN.toString(); } - public TopologyUserLinkConfig(String name, String srcNodeIDType, - String srcSwitchId, String srcNodeConnectorIDType, String srcPort, - String dstNodeIDType, String dstSwitchId, - String dstNodeConnectorIDType, String dstPort) { + public TopologyUserLinkConfig(String name, String srcNodeIDType, + String srcSwitchId, String srcNodeConnectorIDType, String srcPort, + String dstNodeIDType, String dstSwitchId, + String dstNodeConnectorIDType, String dstPort) { super(); this.name = name; this.srcNodeIDType = srcNodeIDType; @@ -111,38 +111,38 @@ public class TopologyUserLinkConfig implements Serializable { } public String getSrcNodeIDType() { - return srcNodeIDType; - } + return srcNodeIDType; + } - public void setSrcNodeIDType(String srcNodeIDType) { - this.srcNodeIDType = srcNodeIDType; - } + public void setSrcNodeIDType(String srcNodeIDType) { + this.srcNodeIDType = srcNodeIDType; + } - public String getSrcNodeConnectorIDType() { - return srcNodeConnectorIDType; - } + public String getSrcNodeConnectorIDType() { + return srcNodeConnectorIDType; + } - public void setSrcNodeConnectorIDType(String srcNodeConnectorIDType) { - this.srcNodeConnectorIDType = srcNodeConnectorIDType; - } + public void setSrcNodeConnectorIDType(String srcNodeConnectorIDType) { + this.srcNodeConnectorIDType = srcNodeConnectorIDType; + } - public String getDstNodeIDType() { - return dstNodeIDType; - } + public String getDstNodeIDType() { + return dstNodeIDType; + } - public void setDstNodeIDType(String dstNodeIDType) { - this.dstNodeIDType = dstNodeIDType; - } + public void setDstNodeIDType(String dstNodeIDType) { + this.dstNodeIDType = dstNodeIDType; + } - public String getDstNodeConnectorIDType() { - return dstNodeConnectorIDType; - } + public String getDstNodeConnectorIDType() { + return dstNodeConnectorIDType; + } - public void setDstNodeConnectorIDType(String dstNodeConnectorIDType) { - this.dstNodeConnectorIDType = dstNodeConnectorIDType; - } + public void setDstNodeConnectorIDType(String dstNodeConnectorIDType) { + this.dstNodeConnectorIDType = dstNodeConnectorIDType; + } - public String getName() { + public String getName() { return name; } @@ -206,24 +206,24 @@ public class TopologyUserLinkConfig implements Serializable { private boolean isValidSwitchId(String switchId, String typeStr) { if (typeStr.equals(NodeIDType.OPENFLOW)) { return isValidSwitchId(switchId); - } else if (typeStr.equals(NodeIDType.ONEPK) || - typeStr.equals(NodeIDType.PCEP) || - typeStr.equals(NodeIDType.PRODUCTION)) { + } else if (typeStr.equals(NodeIDType.ONEPK) || + typeStr.equals(NodeIDType.PCEP) || + typeStr.equals(NodeIDType.PRODUCTION)) { return true; } else { - logger.warn("Invalid node id type {}", typeStr); - return false; + logger.warn("Invalid node id type {}", typeStr); + return false; } } private boolean isValidPortId(String portId, String nodeConnectorType) { - if (NodeConnectorIDType.getClassType(nodeConnectorType) == null) { - logger.warn("Invalid node connector id type {}", nodeConnectorType); - return false; - } - - return true; - } + if (NodeConnectorIDType.getClassType(nodeConnectorType) == null) { + logger.warn("Invalid node connector id type {}", nodeConnectorType); + return false; + } + + return true; + } private long getSwitchIDLong(String switchId) { int radix = 16; @@ -245,26 +245,26 @@ public class TopologyUserLinkConfig implements Serializable { } public boolean isValid() { - if (name == null || srcSwitchId == null || dstSwitchId == null - || srcPort == null || dstPort == null || srcNodeIDType == null - || dstNodeIDType == null || srcNodeConnectorIDType == null - || dstNodeConnectorIDType == null) { + if (name == null || srcSwitchId == null || dstSwitchId == null + || srcPort == null || dstPort == null || srcNodeIDType == null + || dstNodeIDType == null || srcNodeConnectorIDType == null + || dstNodeConnectorIDType == null) { return false; - } - - if (!isValidSwitchId(srcSwitchId, srcNodeIDType) || - !isValidSwitchId(dstSwitchId, dstNodeIDType)) { - logger.warn("Invalid switch id"); - return false; - } - - if (!isValidPortId(srcPort, srcNodeConnectorIDType) || - !isValidPortId(dstPort, dstNodeConnectorIDType)) { - logger.warn("Invalid port id"); - return false; - } - - return true; + } + + if (!isValidSwitchId(srcSwitchId, srcNodeIDType) || + !isValidSwitchId(dstSwitchId, dstNodeIDType)) { + logger.warn("Invalid switch id"); + return false; + } + + if (!isValidPortId(srcPort, srcNodeConnectorIDType) || + !isValidPortId(dstPort, dstNodeConnectorIDType)) { + logger.warn("Invalid port id"); + return false; + } + + return true; } public boolean isSrcPortByName() { @@ -295,13 +295,13 @@ public class TopologyUserLinkConfig implements Serializable { @Override public String toString() { - return "ITopologyUserLinkConfig [status=" + status + ", name=" + name - + ", srcNodeIDType=" + srcNodeIDType + ", srcSwitchId=" - + srcSwitchId + ", srcNodeConnectorIDType=" - + srcNodeConnectorIDType + ", srcPort=" + srcPort - + ", dstNodeIDType=" + dstNodeIDType + ", dstId=" - + dstSwitchId + ", dstNodeConnectorIDType=" - + dstNodeConnectorIDType + ", dstPort=" + dstPort + "]"; + return "ITopologyUserLinkConfig [status=" + status + ", name=" + name + + ", srcNodeIDType=" + srcNodeIDType + ", srcSwitchId=" + + srcSwitchId + ", srcNodeConnectorIDType=" + + srcNodeConnectorIDType + ", srcPort=" + srcPort + + ", dstNodeIDType=" + dstNodeIDType + ", dstId=" + + dstSwitchId + ", dstNodeConnectorIDType=" + + dstNodeConnectorIDType + ", dstPort=" + dstPort + "]"; } @Override diff --git a/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java b/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java index bcc13a9933..c176cb2cf3 100644 --- a/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java +++ b/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java @@ -45,9 +45,9 @@ public class TopologyManagerImplTest { * NodeConnectorId> : <1:1>--><11:11>; <1:2>--><11:12>; <3:3>--><13:13>; * <3:4>--><13:14>; <5:5>--><15:15>; <5:6>--><15:16>; Method used by two * tests: testGetNodeEdges and testGetEdges - * + * * @param topoManagerImpl - * + * * @throws ConstructionException */ public void setNodeEdges(TopologyManagerImpl topoManagerImpl) diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java index 36a2c06bf6..0fb26a1a62 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java @@ -18,7 +18,7 @@ public interface IAAAProvider { /** * Authenticate user with AAA server and return authentication and * authorization info using the Provider's mechanism - * + * * @param userName * the username * @param password @@ -35,7 +35,7 @@ public interface IAAAProvider { /** * Returns the Name of the Provider - * + * * @return Name of the AAA provider */ public String getName(); diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java index 372462eaae..8149d7a5a2 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java @@ -11,14 +11,14 @@ package org.opendaylight.controller.usermanager; import javax.servlet.http.HttpSessionListener; /** - * + * * This interface defines method(s) to invalidate a session. */ public interface ISessionManager extends HttpSessionListener { /** * Invalidates the session for a given user and a session Id - * + * * @param username * the username * @param sessionId diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java index ca6000a9f5..9766fd475a 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java @@ -13,8 +13,8 @@ import org.opendaylight.controller.sal.authorization.UserLevel; import org.springframework.security.core.GrantedAuthority; public class ODLUserLevel implements GrantedAuthority { - private static final long serialVersionUID = 1L; - UserLevel userLevel; + private static final long serialVersionUID = 1L; + UserLevel userLevel; public ODLUserLevel(UserLevel userLevel) { this.userLevel = userLevel; diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java index e1278e8aa4..2ad98aba68 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java @@ -27,11 +27,11 @@ public class ServerConfig implements Serializable { } public ServerConfig(String ip, String secret, String protocol) { - this.ip = ip; - this.secret = secret; - this.protocol = protocol; + this.ip = ip; + this.secret = secret; + this.protocol = protocol; } - + public String getAddress() { return ip; } diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java index c7ddd4a6ec..176af3a3e4 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java @@ -49,7 +49,7 @@ public class UserConfig implements Serializable { this.roles = (roles == null) ? new ArrayList() : new ArrayList(roles); } - + public String getUser() { return user; } @@ -161,24 +161,24 @@ public class UserConfig implements Serializable { return new Status(StatusCode.BADREQUEST, "Current password is incorrect"); } - + // Create a new object with the proposed modifications UserConfig proposed = new UserConfig(); proposed.user = this.user; proposed.password = (newPassword != null)? newPassword : this.password; proposed.roles = (newRoles != null)? newRoles : this.roles; - + // Validate it Status status = proposed.validate(); if (!status.isSuccess()) { return status; } - + // Accept the modifications this.user = proposed.user; this.password = proposed.password; this.roles = new ArrayList(proposed.roles); - + return status; } @@ -192,7 +192,7 @@ public class UserConfig implements Serializable { } return locResponse; } - + protected String getRolesString() { StringBuffer buffer = new StringBuffer(); if (!roles.isEmpty()) { diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java index 5201a6dc6d..21d0137849 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java @@ -83,7 +83,7 @@ public class SessionManager implements ISessionManager { while (sessIterator.hasNext()) { HttpSession session = sessIterator.next(); if (session != null && sessionId != null && session.getId() != null && !session.getId().equals(sessionId)) { - sessionsList.add(session); + sessionsList.add(session); sessIterator.remove(); } else { diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java index af68be6cef..cb4c75fecc 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java +++ b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java @@ -10,5 +10,5 @@ package org.opendaylight.controller.usermanager; public class AuthResponseTest{ - + } \ No newline at end of file diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java index f4810c978f..810500baa4 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java +++ b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java @@ -20,53 +20,53 @@ import org.springframework.security.core.GrantedAuthority; public class AuthenticatedUserTest { - static String[] roleArray; - static AuthenticatedUser user; - - @BeforeClass - public static void testSetup() { - roleArray = new String[] { UserLevel.NETWORKOPERATOR.toString(), - UserLevel.APPUSER.toString() }; - } - - @Test - public void testAuthenticatedUser() { - user = new AuthenticatedUser("auser"); - - Assert.assertFalse(user.getAccessDate().isEmpty()); - Assert.assertNull(user.getUserRoles()); - } - - @Test - public void testSetUserRoleList() { - List retrievedRoleList = null; - List roleList = Arrays.asList(roleArray); - - // list arg - user = new AuthenticatedUser("auser"); - user.setRoleList(roleList); - retrievedRoleList = user.getUserRoles(); - Assert.assertTrue(roleList.equals(retrievedRoleList)); - - // array arg - user = new AuthenticatedUser("auser"); - user.setRoleList(roleArray); - retrievedRoleList = user.getUserRoles(); - for (int i = 0; i < roleArray.length; i++) - Assert.assertTrue(roleArray[i].equals(retrievedRoleList.get(i))); - - // test addUserRole - user.addUserRole("AnotherRole"); - Assert.assertTrue(user.getUserRoles().lastIndexOf("AnotherRole") != -1); - - } - - @Test - public void testGetGrantedAuthorities() { - List gaList = user - .getGrantedAuthorities(UserLevel.NETWORKOPERATOR); - Assert.assertTrue(gaList.get(0).getAuthority() - .equals("ROLE_NETWORK-OPERATOR")); - } + static String[] roleArray; + static AuthenticatedUser user; + + @BeforeClass + public static void testSetup() { + roleArray = new String[] { UserLevel.NETWORKOPERATOR.toString(), + UserLevel.APPUSER.toString() }; + } + + @Test + public void testAuthenticatedUser() { + user = new AuthenticatedUser("auser"); + + Assert.assertFalse(user.getAccessDate().isEmpty()); + Assert.assertNull(user.getUserRoles()); + } + + @Test + public void testSetUserRoleList() { + List retrievedRoleList = null; + List roleList = Arrays.asList(roleArray); + + // list arg + user = new AuthenticatedUser("auser"); + user.setRoleList(roleList); + retrievedRoleList = user.getUserRoles(); + Assert.assertTrue(roleList.equals(retrievedRoleList)); + + // array arg + user = new AuthenticatedUser("auser"); + user.setRoleList(roleArray); + retrievedRoleList = user.getUserRoles(); + for (int i = 0; i < roleArray.length; i++) + Assert.assertTrue(roleArray[i].equals(retrievedRoleList.get(i))); + + // test addUserRole + user.addUserRole("AnotherRole"); + Assert.assertTrue(user.getUserRoles().lastIndexOf("AnotherRole") != -1); + + } + + @Test + public void testGetGrantedAuthorities() { + List gaList = user + .getGrantedAuthorities(UserLevel.NETWORKOPERATOR); + Assert.assertTrue(gaList.get(0).getAuthority() + .equals("ROLE_NETWORK-OPERATOR")); + } } diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java index c7261d5ec2..7d28d23075 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java +++ b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java @@ -65,13 +65,13 @@ public class AuthorizationUserConfigTest { roles.clear(); roles.add(UserLevel.NETWORKADMIN.toString()); assertTrue(userConfig.update("ciscocisco", null, roles).isSuccess()); - + // Role change and same new password roles.clear(); roles.add(UserLevel.NETWORKOPERATOR.toString()); assertTrue(userConfig.update("ciscocisco", "ciscocisco", roles) .isSuccess()); - + // New Password = null, No change in password assertTrue(userConfig.getPassword().equals("ciscocisco")); diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java index d60d101cfb..33c11de0ba 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java +++ b/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013 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, diff --git a/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java b/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java index e1cfcc5708..7cb2b3a054 100644 --- a/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java +++ b/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java @@ -76,7 +76,7 @@ public class Flows implements IDaylightWeb { @ResponseBody public Set> getFlows(HttpServletRequest request, @RequestParam(required = false) String container) { String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); - + // fetch frm IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper .getInstance(IForwardingRulesManager.class, containerName, this); @@ -113,7 +113,7 @@ public class Flows implements IDaylightWeb { @ResponseBody public Map getNodePorts(HttpServletRequest request, @RequestParam(required = false) String container) { String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); - + ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); if (switchManager == null) { @@ -160,7 +160,7 @@ public class Flows implements IDaylightWeb { @ResponseBody public Map getNodeFlows(HttpServletRequest request, @RequestParam(required = false) String container) { String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); - + ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); if (switchManager == null) { @@ -201,7 +201,7 @@ public class Flows implements IDaylightWeb { if (!isUserAuthorized(UserLevel.NETWORKADMIN, request)) { return "Operation not authorized"; } - + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper @@ -232,7 +232,7 @@ public class Flows implements IDaylightWeb { if (!isUserAuthorized(UserLevel.NETWORKADMIN, request)) { return "Operation not authorized"; } - + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper @@ -261,7 +261,7 @@ public class Flows implements IDaylightWeb { /** * Returns whether the current user's level is same or above the required * authorization level. - * + * * @param requiredLevel * the authorization level required */ diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java index c748171685..46b8d4e0fe 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java @@ -95,7 +95,7 @@ public class DaylightWebAdmin { return userManager.removeLocalUser(userName).getDescription(); } - + @RequestMapping(value = "/users/password/{username}", method = RequestMethod.POST) @ResponseBody public Status changePassword(@PathVariable("username") String username, HttpServletRequest request, @@ -105,23 +105,23 @@ public class DaylightWebAdmin { if (userManager == null) { return new Status(StatusCode.GONE, "User Manager not found"); } - + if (!authorize(userManager, UserLevel.NETWORKADMIN, request)) { return new Status(StatusCode.FORBIDDEN, "Operation not permitted"); } - + if (newPassword.isEmpty()) { return new Status(StatusCode.BADREQUEST, "Empty passwords not allowed"); } - + Status status = userManager.changeLocalUserPassword(username, currentPassword, newPassword); - + return status; } /** * Is the operation permitted for the given level - * + * * @param level */ private boolean authorize(IUserManager userManager, UserLevel level, diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java index a7f7133cb2..ee8284e883 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java @@ -11,11 +11,11 @@ import org.opendaylight.controller.sal.utils.ServiceHelper; public class DaylightWebUtil { private static String defaultName = GlobalConstants.DEFAULT.toString(); - + /** * Returns the container that this user is authorized to access. If the user is not authorized to the requested * container, then this method will return the default container. - * + * * @param request - HttpServletRequest object to retrieve username * @param container - requested container * @param bundle - respective bundle @@ -25,7 +25,7 @@ public class DaylightWebUtil { if (container == null) { return defaultName; } - + String username = request.getUserPrincipal().getName(); IContainerAuthorization containerAuthorization = (IContainerAuthorization) ServiceHelper.getGlobalInstance(IContainerAuthorization.class, bundle); diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/IDaylightWeb.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/IDaylightWeb.java index 7421759d98..55e3ee5110 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/IDaylightWeb.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/IDaylightWeb.java @@ -14,31 +14,31 @@ public interface IDaylightWeb { /** * Returns the name of the bundle. In the GUI, this name will be displayed * on the tab. - * + * * @return Name assigned to the bundle. */ public String getWebName(); /** * Returns the Id assigned to the web bundle. - * + * * @return Id assigned to the web bundle. */ public String getWebId(); /** * Returns the position where the bundle tab will be placed in the GUI. - * + * * @return Position number for the bundle tab. */ public short getWebOrder(); /** * This method checks if the user is authorized to access the bundle. - * + * * @param userLevel * user role level in the controller space. - * + * * @return true, if user is authorized to access the bundle, else false. */ public boolean isAuthorized(UserLevel userLevel); diff --git a/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java b/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java index 62b64a5184..b4695defdb 100644 --- a/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java +++ b/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java @@ -70,77 +70,77 @@ public class Topology implements IObjectReader, IConfigurationAware { protected Map>> metaCache = new HashMap>>(); protected Map> stagedNodes; protected Map> newNodes; - + protected Map metaNodeHash = new HashMap(); protected Map metaHostHash = new HashMap(); protected Map metaNodeSingleHash = new HashMap(); protected Map metaNodeConfigurationHash = new HashMap(); - + public Topology() { - ServiceHelper.registerGlobalService(IConfigurationAware.class, this, null); - topologyWebFileName = ROOT + "topologyCache.sav"; - loadConfiguration(); + ServiceHelper.registerGlobalService(IConfigurationAware.class, this, null); + topologyWebFileName = ROOT + "topologyCache.sav"; + loadConfiguration(); } - + /** * Topology of nodes and hosts in the network in JSON format. - * + * * Mainly intended for consumption by the visual topology. - * + * * @return - JSON output for visual topology */ @RequestMapping(value = "/visual.json", method = RequestMethod.GET) @ResponseBody public Collection> getLinkData(@RequestParam(required = false) String container, HttpServletRequest request) { - String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); - + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); + ITopologyManager topologyManager = (ITopologyManager) ServiceHelper .getInstance(ITopologyManager.class, containerName, this); if (topologyManager == null) { - return null; + return null; } ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); if (switchManager == null) { - return null; + return null; } - + Map> nodeEdges = topologyManager.getNodeEdges(); Map> hostEdges = topologyManager .getNodesWithNodeConnectorHost(); List nodes = switchManager.getNetworkDevices(); - + List switchConfigurations = new ArrayList(); for(Switch sw : nodes) { - Node n = sw.getNode(); - SwitchConfig config = switchManager.getSwitchConfig(n.toString()); - switchConfigurations.add(config); + Node n = sw.getNode(); + SwitchConfig config = switchManager.getSwitchConfig(n.toString()); + switchConfigurations.add(config); } - + // initialize cache if needed if (!metaCache.containsKey(containerName)) { - metaCache.put(containerName, new HashMap>()); - // initialize hashes - metaNodeHash.put(containerName, null); - metaHostHash.put(containerName, null); - metaNodeSingleHash.put(containerName, null); - metaNodeConfigurationHash.put(containerName, null); + metaCache.put(containerName, new HashMap>()); + // initialize hashes + metaNodeHash.put(containerName, null); + metaHostHash.put(containerName, null); + metaNodeSingleHash.put(containerName, null); + metaNodeConfigurationHash.put(containerName, null); } - + // return cache if topology hasn't changed if ( - (metaNodeHash.get(containerName) != null && metaHostHash.get(containerName) != null && metaNodeSingleHash.get(containerName) != null && metaNodeConfigurationHash.get(containerName) != null) && - metaNodeHash.get(containerName).equals(nodeEdges.hashCode()) && metaHostHash.get(containerName).equals(hostEdges.hashCode()) && metaNodeSingleHash.get(containerName).equals(nodes.hashCode()) && metaNodeConfigurationHash.get(containerName).equals(switchConfigurations.hashCode()) + (metaNodeHash.get(containerName) != null && metaHostHash.get(containerName) != null && metaNodeSingleHash.get(containerName) != null && metaNodeConfigurationHash.get(containerName) != null) && + metaNodeHash.get(containerName).equals(nodeEdges.hashCode()) && metaHostHash.get(containerName).equals(hostEdges.hashCode()) && metaNodeSingleHash.get(containerName).equals(nodes.hashCode()) && metaNodeConfigurationHash.get(containerName).equals(switchConfigurations.hashCode()) ) { - return metaCache.get(containerName).values(); + return metaCache.get(containerName).values(); } - + // cache has changed, we must assign the new values metaNodeHash.put(containerName, nodeEdges.hashCode()); metaHostHash.put(containerName, hostEdges.hashCode()); metaNodeSingleHash.put(containerName, nodes.hashCode()); metaNodeConfigurationHash.put(containerName, switchConfigurations.hashCode()); - + stagedNodes = new HashMap>(); newNodes = new HashMap>(); @@ -149,12 +149,12 @@ public class Topology implements IObjectReader, IConfigurationAware { // single nodes addition addSingleNodes(nodes, switchManager, containerName); - + // hostNodes addition addHostNodes(hostEdges, topologyManager, containerName); - + repositionTopology(containerName); - + return metaCache.get(containerName).values(); } @@ -165,20 +165,20 @@ public class Topology implements IObjectReader, IConfigurationAware { * @param topology - the topology instance */ private void addNodes(Map> nodeEdges, - ITopologyManager topology, ISwitchManager switchManager, String containerName) { + ITopologyManager topology, ISwitchManager switchManager, String containerName) { Bandwidth bandwidth = new Bandwidth(0); Map> properties = topology.getEdges(); - + for (Map.Entry> e : nodeEdges.entrySet()) { Node n = e.getKey(); String description = switchManager.getNodeDescription(n); NodeBean node = createNodeBean(description, n); - + // skip production node if (nodeIgnore(n)) { continue; } - + List> adjacencies = new LinkedList>(); Set links = e.getValue(); for (Edge link : links) { @@ -187,53 +187,53 @@ public class Topology implements IObjectReader, IConfigurationAware { } for (Property p : properties.get(link)) { if (p instanceof Bandwidth) { - bandwidth = (Bandwidth) p; + bandwidth = (Bandwidth) p; break; } } EdgeBean edge = new EdgeBean(link, bandwidth); adjacencies.add(edge.out()); } - + node.setLinks(adjacencies); if (metaCache.get(containerName).containsKey(node.id())) { - // retrieve node from cache - Map nodeEntry = metaCache.get(containerName).get(node.id()); - - Map data = (Map) nodeEntry.get("data"); - data.put("$desc", description); - nodeEntry.put("data", data); - - // always update adjacencies - nodeEntry.put("adjacencies", adjacencies); - // stage this cached node (with position) - stagedNodes.put(node.id(), nodeEntry); + // retrieve node from cache + Map nodeEntry = metaCache.get(containerName).get(node.id()); + + Map data = (Map) nodeEntry.get("data"); + data.put("$desc", description); + nodeEntry.put("data", data); + + // always update adjacencies + nodeEntry.put("adjacencies", adjacencies); + // stage this cached node (with position) + stagedNodes.put(node.id(), nodeEntry); } else { - newNodes.put(node.id(), node.out()); + newNodes.put(node.id(), node.out()); } } } - + /** * Check if this node shouldn't appear in the visual topology - * + * * @param node * @return */ private boolean nodeIgnore(Node node) { String nodeType = node.getType(); - + // add other node types to ignore later if (nodeType.equals(NodeIDType.PRODUCTION)) { return true; } - + return false; } - + /** * Check if this edge shouldn't appear in the visual topology - * + * * @param edge * @return */ @@ -243,57 +243,57 @@ public class Topology implements IObjectReader, IConfigurationAware { if (nodeIgnore(headNode)) { return true; } - + NodeConnector tailNodeConnector = edge.getTailNodeConnector(); Node tailNode = tailNodeConnector.getNode(); if (nodeIgnore(tailNode)) { return true; } - + return false; } - + protected NodeBean createNodeBean(String description, Node node) { - String name = (description == null || - description.trim().isEmpty() || - description.equalsIgnoreCase("none"))? - node.toString() : description; - return new NodeBean(node.toString(), name, NodeType.NODE); + String name = (description == null || + description.trim().isEmpty() || + description.equalsIgnoreCase("none"))? + node.toString() : description; + return new NodeBean(node.toString(), name, NodeType.NODE); } - + @SuppressWarnings("unchecked") - private void addSingleNodes(List nodes, ISwitchManager switchManager, String containerName) { - if (nodes == null) { - return; - } - for (Switch sw : nodes) { - Node n = sw.getNode(); - - // skip production node - if (nodeIgnore(n)) { - continue; - } - - String description = switchManager.getNodeDescription(n); - - if ((stagedNodes.containsKey(n.toString()) && metaCache.get(containerName).containsKey(n.toString())) || newNodes.containsKey(n.toString())) { - continue; - } - NodeBean node = createNodeBean(description, n); - - // FIXME still doesn't display standalone node when last remaining link is removed - if (metaCache.get(containerName).containsKey(node.id()) && !stagedNodes.containsKey(node.id())) { - Map nodeEntry = metaCache.get(containerName).get(node.id()); - Map data = (Map) nodeEntry.get("data"); - data.put("$desc", description); - nodeEntry.put("data", data); - // clear adjacencies since this is now a single node - nodeEntry.put("adjacencies", new LinkedList>()); - stagedNodes.put(node.id(), nodeEntry); + private void addSingleNodes(List nodes, ISwitchManager switchManager, String containerName) { + if (nodes == null) { + return; + } + for (Switch sw : nodes) { + Node n = sw.getNode(); + + // skip production node + if (nodeIgnore(n)) { + continue; + } + + String description = switchManager.getNodeDescription(n); + + if ((stagedNodes.containsKey(n.toString()) && metaCache.get(containerName).containsKey(n.toString())) || newNodes.containsKey(n.toString())) { + continue; + } + NodeBean node = createNodeBean(description, n); + + // FIXME still doesn't display standalone node when last remaining link is removed + if (metaCache.get(containerName).containsKey(node.id()) && !stagedNodes.containsKey(node.id())) { + Map nodeEntry = metaCache.get(containerName).get(node.id()); + Map data = (Map) nodeEntry.get("data"); + data.put("$desc", description); + nodeEntry.put("data", data); + // clear adjacencies since this is now a single node + nodeEntry.put("adjacencies", new LinkedList>()); + stagedNodes.put(node.id(), nodeEntry); } else { - newNodes.put(node.id(), node.out()); + newNodes.put(node.id(), node.out()); } - } + } } /** @@ -313,22 +313,22 @@ public class Topology implements IObjectReader, IConfigurationAware { addressByteBuffer.putShort((short) 0); addressByteBuffer.put(dmac.getValue()); addressByteBuffer.rewind(); - + long hid = addressByteBuffer.getLong(); String hostId = String.valueOf(hid); - + NodeBean hostBean = new NodeBean(hostId, host.getNetworkAddressAsString(), NodeType.HOST); List> adjacencies = new LinkedList>(); EdgeBean edge = new EdgeBean(connector, hid); adjacencies.add(edge.out()); hostBean.setLinks(adjacencies); - + if (metaCache.get(containerName).containsKey(hostId)) { - Map hostEntry = metaCache.get(containerName).get(hostId); - hostEntry.put("adjacencies", adjacencies); - stagedNodes.put(hostId, hostEntry); + Map hostEntry = metaCache.get(containerName).get(hostId); + hostEntry.put("adjacencies", adjacencies); + stagedNodes.put(hostId, hostEntry); } else { - newNodes.put(String.valueOf(hid), hostBean.out()); + newNodes.put(String.valueOf(hid), hostBean.out()); } } } @@ -339,24 +339,24 @@ public class Topology implements IObjectReader, IConfigurationAware { */ private void repositionTopology(String containerName) { Graph graph = new SparseMultigraph(); - + metaCache.get(containerName).clear(); metaCache.get(containerName).putAll(stagedNodes); metaCache.get(containerName).putAll(newNodes); - + for (Map on : metaCache.get(containerName).values()) { graph.addVertex(on.toString()); List> adjacencies = (List>) on.get("adjacencies"); - + for (Map adj : adjacencies) { graph.addEdge( - adj.toString(), adj.get("nodeFrom").toString(), - adj.get("nodeTo").toString() + adj.toString(), adj.get("nodeFrom").toString(), + adj.get("nodeTo").toString() ); } } - + CircleLayout layout = new CircleLayout(graph); layout.setSize(new Dimension(1200, 365)); for (Map.Entry> v : newNodes.entrySet()) { @@ -373,7 +373,7 @@ public class Topology implements IObjectReader, IConfigurationAware { /** * Update node position - * + * * This method is mainly used by the visual topology * * @param nodeId - The node to update @@ -382,16 +382,16 @@ public class Topology implements IObjectReader, IConfigurationAware { @RequestMapping(value = "/node/{nodeId}", method = RequestMethod.POST) @ResponseBody public Map post(@PathVariable String nodeId, @RequestParam(required = true) String x, - @RequestParam(required = true) String y, @RequestParam(required = false) String container, - HttpServletRequest request) { - if (!authorize(UserLevel.NETWORKADMIN, request)) { - return new HashMap(); // silently disregard new node position - } - - String containerName = getAuthorizedContainer(request, container); - + @RequestParam(required = true) String y, @RequestParam(required = false) String container, + HttpServletRequest request) { + if (!authorize(UserLevel.NETWORKADMIN, request)) { + return new HashMap(); // silently disregard new node position + } + + String containerName = getAuthorizedContainer(request, container); + String id = new String(nodeId); - + if (!metaCache.get(containerName).containsKey(id)) { return null; } @@ -403,123 +403,123 @@ public class Topology implements IObjectReader, IConfigurationAware { data.put("$y", y); node.put("data", data); - + return node; } - + /** * Node object for visual topology */ protected class NodeBean { - protected String id; - protected String name; - protected Map data; - protected List> links; - - public NodeBean() { - data = new HashMap(); - links = new ArrayList>(); - } - - public NodeBean(String id, String name, String type) { - this(); - this.id = id; - this.name = name; - data.put("$desc", name); - data.put("$type", type); - } - - public void setLinks(List> links) { - this.links = links; - } - - public Map out() { - Map node = new HashMap(); - node.put("id", this.id); - node.put("name", this.name); - node.put("data", this.data); - node.put("adjacencies", this.links); - - return node; - } - - public String name() { - return this.name; - } - - public String id() { - return this.id; - } + protected String id; + protected String name; + protected Map data; + protected List> links; + + public NodeBean() { + data = new HashMap(); + links = new ArrayList>(); + } + + public NodeBean(String id, String name, String type) { + this(); + this.id = id; + this.name = name; + data.put("$desc", name); + data.put("$type", type); + } + + public void setLinks(List> links) { + this.links = links; + } + + public Map out() { + Map node = new HashMap(); + node.put("id", this.id); + node.put("name", this.name); + node.put("data", this.data); + node.put("adjacencies", this.links); + + return node; + } + + public String name() { + return this.name; + } + + public String id() { + return this.id; + } } - + /** * Edge object for visual topology */ protected class EdgeBean { - protected NodeConnector source; - protected NodeConnector destination; - protected Map data; - protected Long hostId; - - public EdgeBean() { - data = new HashMap(); - } - - public EdgeBean(Edge link, Bandwidth bandwidth) { - this(); - this.source = link.getHeadNodeConnector(); - this.destination = link.getTailNodeConnector(); - - // data - data.put("$bandwidth", bandwidth.toString()); - data.put("$color", bandwidthColor(bandwidth)); - data.put("$nodeToPort", destination.getID().toString()); - data.put("$nodeFromPort", source.getID().toString()); - data.put("$descFrom", source.getNode().toString()); - data.put("$descTo", destination.getNode().toString()); - data.put("$nodeFromPortName", source.toString()); - data.put("$nodeToPortName", destination.toString()); - } - - public EdgeBean(NodeConnector connector, Long hostId) { - this(); - this.source = null; - this.destination = connector; - this.hostId = hostId; - - data.put("$bandwidth", "N/A"); - data.put("$color", bandwidthColor(new Bandwidth(0))); - data.put("$nodeToPort", connector.getNodeConnectorIDString()); - data.put("$nodeFromPort", connector.getNodeConnectorIDString()); - data.put("$descTo", ""); - data.put("$descFrom", ""); - data.put("$nodeToPortName", ""); - data.put("$nodeFromPortName", ""); - } - - public Map out() { - Map edge = new HashMap(); - - edge.put("data", data); - if (source == null) { - edge.put("nodeFrom", String.valueOf(this.hostId)); - } else { - edge.put("nodeFrom", source.getNode().toString()); - } - edge.put("nodeTo", destination.getNode().toString()); - - - return edge; - } - - private String bandwidthColor(Bandwidth bandwidth) { - String color = null; - long bandwidthValue = bandwidth.getValue(); - - if (bandwidthValue == 0) { + protected NodeConnector source; + protected NodeConnector destination; + protected Map data; + protected Long hostId; + + public EdgeBean() { + data = new HashMap(); + } + + public EdgeBean(Edge link, Bandwidth bandwidth) { + this(); + this.source = link.getHeadNodeConnector(); + this.destination = link.getTailNodeConnector(); + + // data + data.put("$bandwidth", bandwidth.toString()); + data.put("$color", bandwidthColor(bandwidth)); + data.put("$nodeToPort", destination.getID().toString()); + data.put("$nodeFromPort", source.getID().toString()); + data.put("$descFrom", source.getNode().toString()); + data.put("$descTo", destination.getNode().toString()); + data.put("$nodeFromPortName", source.toString()); + data.put("$nodeToPortName", destination.toString()); + } + + public EdgeBean(NodeConnector connector, Long hostId) { + this(); + this.source = null; + this.destination = connector; + this.hostId = hostId; + + data.put("$bandwidth", "N/A"); + data.put("$color", bandwidthColor(new Bandwidth(0))); + data.put("$nodeToPort", connector.getNodeConnectorIDString()); + data.put("$nodeFromPort", connector.getNodeConnectorIDString()); + data.put("$descTo", ""); + data.put("$descFrom", ""); + data.put("$nodeToPortName", ""); + data.put("$nodeFromPortName", ""); + } + + public Map out() { + Map edge = new HashMap(); + + edge.put("data", data); + if (source == null) { + edge.put("nodeFrom", String.valueOf(this.hostId)); + } else { + edge.put("nodeFrom", source.getNode().toString()); + } + edge.put("nodeTo", destination.getNode().toString()); + + + return edge; + } + + private String bandwidthColor(Bandwidth bandwidth) { + String color = null; + long bandwidthValue = bandwidth.getValue(); + + if (bandwidthValue == 0) { color = "#000"; } else if (bandwidthValue < Bandwidth.BW1Kbps) { - color = "#148AC6"; + color = "#148AC6"; } else if (bandwidthValue < Bandwidth.BW1Mbps) { color = "#2858A0"; } else if (bandwidthValue < Bandwidth.BW1Gbps) { @@ -529,58 +529,58 @@ public class Topology implements IObjectReader, IConfigurationAware { } else if (bandwidthValue < Bandwidth.BW1Pbps) { color = "#F9F464"; } - - return color; + + return color; } } - + protected class NodeType { - public static final String NODE = "swtch"; - public static final String HOST = "host"; + public static final String NODE = "swtch"; + public static final String HOST = "host"; } - + private boolean authorize(UserLevel level, HttpServletRequest request) { - IUserManager userManager = (IUserManager) ServiceHelper + IUserManager userManager = (IUserManager) ServiceHelper .getGlobalInstance(IUserManager.class, this); if (userManager == null) { - return false; + return false; } - + String username = request.getUserPrincipal().getName(); UserLevel userLevel = userManager.getUserLevel(username); if (userLevel.toNumber() <= level.toNumber()) { - return true; + return true; } return false; } - + private String getAuthorizedContainer(HttpServletRequest request, String container) { - String username = request.getUserPrincipal().getName(); - IContainerAuthorization containerAuthorization = (IContainerAuthorization) ServiceHelper. - getGlobalInstance(IContainerAuthorization.class, this); - if (containerAuthorization != null) { - Set resources = containerAuthorization.getAllResourcesforUser(username); - if (authorizeContainer(container, resources)) { - return container; - } - } - - return GlobalConstants.DEFAULT.toString(); + String username = request.getUserPrincipal().getName(); + IContainerAuthorization containerAuthorization = (IContainerAuthorization) ServiceHelper. + getGlobalInstance(IContainerAuthorization.class, this); + if (containerAuthorization != null) { + Set resources = containerAuthorization.getAllResourcesforUser(username); + if (authorizeContainer(container, resources)) { + return container; + } + } + + return GlobalConstants.DEFAULT.toString(); } - + private boolean authorizeContainer(String container, Set resources) { - for(Resource resource : resources) { - String containerName = (String) resource.getResource(); - if (containerName.equals(container)) { - return true; - } - } - - return false; + for(Resource resource : resources) { + String containerName = (String) resource.getResource(); + if (containerName.equals(container)) { + return true; + } + } + + return false; } @SuppressWarnings("unchecked") - private void loadConfiguration() { + private void loadConfiguration() { ObjectReader objReader = new ObjectReader(); metaCache = (Map>>) objReader.read(this, topologyWebFileName); if (metaCache == null) metaCache = new HashMap>>(); diff --git a/opendaylight/web/topology/src/test/java/org/opendaylight/controller/topology/web/TopologyTest.java b/opendaylight/web/topology/src/test/java/org/opendaylight/controller/topology/web/TopologyTest.java index e33af082b6..e26e7c666b 100644 --- a/opendaylight/web/topology/src/test/java/org/opendaylight/controller/topology/web/TopologyTest.java +++ b/opendaylight/web/topology/src/test/java/org/opendaylight/controller/topology/web/TopologyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013 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, @@ -16,32 +16,32 @@ import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.utils.NodeCreator; import org.opendaylight.controller.switchmanager.SwitchConfig; import org.opendaylight.controller.topology.web.Topology.NodeBean; - + public class TopologyTest { - @Test - public void testCreateNodeBean() { - Topology topology = new Topology(); - Node node = NodeCreator.createOFNode(new Long(3)); - String description = "foo"; - - NodeBean bean = topology.createNodeBean(description, node); - - assertNotNull(bean); - assertEquals(bean.id, node.toString()); - assertEquals(bean.name, "foo"); - - bean = topology.createNodeBean(null, node); - - assertNotNull(bean); - assertEquals(bean.id, node.toString()); - assertEquals(bean.name, bean.id); - - bean = topology.createNodeBean(" ", node); - - assertNotNull(bean); - assertEquals(bean.id, node.toString()); - assertEquals(bean.name, bean.id); - } + @Test + public void testCreateNodeBean() { + Topology topology = new Topology(); + Node node = NodeCreator.createOFNode(new Long(3)); + String description = "foo"; + + NodeBean bean = topology.createNodeBean(description, node); + + assertNotNull(bean); + assertEquals(bean.id, node.toString()); + assertEquals(bean.name, "foo"); + + bean = topology.createNodeBean(null, node); + + assertNotNull(bean); + assertEquals(bean.id, node.toString()); + assertEquals(bean.name, bean.id); + + bean = topology.createNodeBean(" ", node); + + assertNotNull(bean); + assertEquals(bean.id, node.toString()); + assertEquals(bean.name, bean.id); + } } diff --git a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java index bde4152f5b..f145c568b5 100644 --- a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java +++ b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java @@ -231,10 +231,10 @@ public class Troubleshoot implements IDaylightWeb { Match match = flow.getMatch(); ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); - String desc = (switchManager == null)? - "" : switchManager.getNodeDescription(node); - desc = (desc.isEmpty() || desc.equalsIgnoreCase("none"))? - node.toString(): desc; + String desc = (switchManager == null)? + "" : switchManager.getNodeDescription(node); + desc = (desc.isEmpty() || desc.equalsIgnoreCase("none"))? + node.toString(): desc; row.put("nodeName", desc); if (match.isPresent(MatchType.IN_PORT)) { row.put(MatchType.IN_PORT.id(), ((NodeConnector) flow.getMatch() @@ -300,7 +300,7 @@ public class Troubleshoot implements IDaylightWeb { Short tpSrc = (Short) (flow.getMatch().getField(MatchType.TP_SRC) .getValue()); row.put(MatchType.TP_SRC.id(), - String.valueOf(NetUtils.getUnsignedShort(tpSrc))); + String.valueOf(NetUtils.getUnsignedShort(tpSrc))); } else { row.put(MatchType.TP_SRC.id(), "*"); } @@ -308,7 +308,7 @@ public class Troubleshoot implements IDaylightWeb { Short tpDst = (Short) (flow.getMatch().getField(MatchType.TP_DST) .getValue()); row.put(MatchType.TP_DST.id(), - String.valueOf(NetUtils.getUnsignedShort(tpDst))); + String.valueOf(NetUtils.getUnsignedShort(tpDst))); } else { row.put(MatchType.TP_DST.id(), "*"); }