.project
.settings
MANIFEST.MF
+opendaylight/northbound/integrationtest/logs/*
import org.junit.Test;\r
\r
public class ArphandlerTest extends TestCase {\r
- \r
- @Test\r
- public void testArphandlerCreation() {\r
- \r
- ArpHandler ah = null;\r
- ah = new ArpHandler();\r
- Assert.assertTrue(ah != null);\r
- \r
- }\r
+\r
+ @Test\r
+ public void testArphandlerCreation() {\r
+\r
+ ArpHandler ah = null;\r
+ ah = new ArpHandler();\r
+ Assert.assertTrue(ah != null);\r
+\r
+ }\r
\r
}\r
<configuration scan="true">
-
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
\r
public class TestClusteringTest extends TestCase {\r
\r
- @Test\r
- public void testComplexClass() {\r
- ComplexClass cc = new ComplexClass("cplxc1");\r
- Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc1"));\r
- cc.IAm("cplxc2");\r
- Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc2"));\r
- }\r
- \r
- @Test\r
- public void testComplexClass1() {\r
- ComplexClass1 cc1 = new ComplexClass1("cplxc1a");\r
- Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1a"));\r
- cc1.IAm("cplxc1b");\r
- Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1b"));\r
- }\r
- \r
- \r
- @Test\r
- public void testComplexContainer() {\r
- ComplexContainer cplxcontnr1 = new ComplexContainer("cct1", 5);\r
- Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct1]-[ComplexClass1_cct1]"));\r
- Assert.assertTrue(cplxcontnr1.getState() == 5);\r
- \r
- cplxcontnr1.setIdentity("cct2");\r
- Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct2]-[ComplexClass1_cct2]"));\r
- \r
- Assert.assertTrue(cplxcontnr1.toString().equals(\r
- "{ID:[ComplexClass_cct2]-[ComplexClass1_cct2],STATE:5}"));\r
- }\r
- \r
- @Test\r
- public void testStringContainer() {\r
- StringContainer strcontainer1 = new StringContainer();\r
- Assert.assertTrue(strcontainer1.getMystring() == null);\r
- Assert.assertTrue(strcontainer1.hashCode() == 0);\r
- \r
- StringContainer strcontainer2 = new StringContainer("foo");\r
- Assert.assertTrue(strcontainer2.getMystring() != null);\r
- Assert.assertTrue(strcontainer2.hashCode() != 0);\r
- \r
- strcontainer1.setMystring("foo");\r
- Assert.assertTrue(strcontainer2.equals(strcontainer1));\r
- \r
- Assert.assertTrue(strcontainer2.toString().equals("{foo}"));\r
- }\r
- \r
+ @Test\r
+ public void testComplexClass() {\r
+ ComplexClass cc = new ComplexClass("cplxc1");\r
+ Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc1"));\r
+ cc.IAm("cplxc2");\r
+ Assert.assertTrue(cc.whoAmI().equals("ComplexClass_cplxc2"));\r
+ }\r
+\r
+ @Test\r
+ public void testComplexClass1() {\r
+ ComplexClass1 cc1 = new ComplexClass1("cplxc1a");\r
+ Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1a"));\r
+ cc1.IAm("cplxc1b");\r
+ Assert.assertTrue(cc1.whoAmI().equals("ComplexClass1_cplxc1b"));\r
+ }\r
+\r
+\r
+ @Test\r
+ public void testComplexContainer() {\r
+ ComplexContainer cplxcontnr1 = new ComplexContainer("cct1", 5);\r
+ Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct1]-[ComplexClass1_cct1]"));\r
+ Assert.assertTrue(cplxcontnr1.getState() == 5);\r
+\r
+ cplxcontnr1.setIdentity("cct2");\r
+ Assert.assertTrue(cplxcontnr1.getIdentity().equals("[ComplexClass_cct2]-[ComplexClass1_cct2]"));\r
+\r
+ Assert.assertTrue(cplxcontnr1.toString().equals(\r
+ "{ID:[ComplexClass_cct2]-[ComplexClass1_cct2],STATE:5}"));\r
+ }\r
+\r
+ @Test\r
+ public void testStringContainer() {\r
+ StringContainer strcontainer1 = new StringContainer();\r
+ Assert.assertTrue(strcontainer1.getMystring() == null);\r
+ Assert.assertTrue(strcontainer1.hashCode() == 0);\r
+\r
+ StringContainer strcontainer2 = new StringContainer("foo");\r
+ Assert.assertTrue(strcontainer2.getMystring() != null);\r
+ Assert.assertTrue(strcontainer2.hashCode() != 0);\r
+\r
+ strcontainer1.setMystring("foo");\r
+ Assert.assertTrue(strcontainer2.equals(strcontainer1));\r
+\r
+ Assert.assertTrue(strcontainer2.toString().equals("{foo}"));\r
+ }\r
+\r
\r
}\r
<manifestLocation>${project.basedir}/META-INF</manifestLocation>\r
</configuration>\r
</plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-checkstyle-plugin</artifactId>\r
+ <version>${checkstyle.version}</version>\r
+ <configuration>\r
+ <failsOnError>true</failsOnError>\r
+ <configLocation>${project.parent.parent.basedir}/space_and_tabs_checks.xml</configLocation>\r
+ </configuration>\r
+ </plugin>\r
</plugins>\r
</build>\r
<dependencies>\r
public interface Acceptor<I> {\r
\r
/**\r
- * \r
+ *\r
* @param input\r
* @return true if input is accepted.\r
*/\r
\r
import java.util.Collection;\r
/**\r
- * \r
+ *\r
* @author Tony Tkacik\r
*\r
* @param <I>\r
/**\r
* Transformer which aggregates multiple implementations of\r
* {@link InputClassBasedTransformer}.\r
- * \r
+ *\r
* The transformation process is driven by {@link Class} of input. The selection\r
* of used {@link InputClassBasedTransformer} is done by using the {@link Class}\r
* of input as a key to select the transformer.\r
- * \r
+ *\r
* This approach provides quick resolution of transformer, but does not support\r
* registering a super type of input to provide transformation support for all\r
* subclasses, one must register a new instance of transformer for each valid\r
* input class.\r
- * \r
+ *\r
* If you need more flexible selection of transformation consider using\r
* {@link CompositeConditionalTransformer} which is slower but most flexible or\r
* {@link RuleBasedTransformer} which provides declarative approach for\r
* transformation.\r
- * \r
+ *\r
* See {@link #transform(Object)} for more information about tranformation\r
* process.\r
- * \r
+ *\r
* @author Tony Tkacik <ttkacik@cisco.com>\r
- * \r
+ *\r
* @param <I>\r
* Input super-type\r
* @param <P>\r
\r
/**\r
* Transforms an input into instance of Product class.\r
- * \r
+ *\r
* The final registered transformer is the one which match following\r
* condition:\r
- * \r
+ *\r
* <code>input.getClass() == transformer.getInputClass()</code>\r
- * \r
+ *\r
* This means that transformers are not resolved by class hierarchy, only\r
* selected based on final class of the input. If you need more flexible\r
* selection of transformation consider using\r
* {@link CompositeConditionalTransformer} which is slower but more\r
* flexible.\r
- * \r
+ *\r
*/\r
@Override\r
public P transform(I input) {\r
\r
/**\r
* Registers a new transformer.\r
- * \r
+ *\r
* The transformer is registered for class returned by\r
* {@link InputClassBasedTransformer#getInputClass()}. Only one transformer\r
* can be registered for particular input class.\r
- * \r
+ *\r
*/\r
public void addTransformer(\r
InputClassBasedTransformer<I, ? extends I, P> transformer)\r
\r
/**\r
* Removes an registered transformer.\r
- * \r
+ *\r
* Note: Removal is currently unsupported.\r
- * \r
+ *\r
* @param transformer\r
* Tranformer to be removed.\r
* @throws IllegalArgumentException\r
throws IllegalArgumentException {\r
throw new UnsupportedOperationException("Not implemented yet");\r
}\r
- \r
+\r
@Override\r
public Collection<P> transformAll(Collection<? extends I> inputs) {\r
Collection<P> ret = new ArrayList<P>();\r
\r
/**\r
* Input class based transformer\r
- * \r
+ *\r
* {@link Transformer} which accepts / transforms only specific classes of\r
* input, and is useful if the selection of transformer should be based on the\r
* class of the input and there is one-to-one mapping between input class and\r
* transformer.\r
- * \r
- * \r
+ *\r
+ *\r
* @author Tony Tkacik\r
- * \r
+ *\r
* @param <S>\r
* Common supertype of input\r
* @param <I>\r
\r
/**\r
* Returns an {@link Class} of input which is acceptable for transformation.\r
- * \r
+ *\r
* @return {@link Class} of input which is acceptable for transformation.\r
*/\r
Class<? extends S> getInputClass();\r
\r
/**\r
* Transformer with set of acceptance rules\r
- * \r
+ *\r
* The transformer provides a set of {@link Acceptor}s, which could be used to\r
* verify if the input will produce result using the transformer.\r
- * \r
+ *\r
* The transormer is able to produce result if ANY of associated\r
* {@link Acceptor}s accepted result.\r
- * \r
+ *\r
* @author Tony Tkacik\r
- * \r
+ *\r
* @param <I>\r
* Input class for transformation\r
* @param <P>\r
/**\r
* Set of {@link Acceptor}, which could be used to verify if the input is\r
* usable by transformer.\r
- * \r
+ *\r
* The transformer is able to produce result if ANY of associated\r
* {@link Acceptor}s accepted result.\r
- * \r
+ *\r
* @return Set of input acceptance rules associated to this transformer.\r
*/\r
Set<Acceptor<I>> getRules();\r
\r
/**\r
* Simple condition-based transformer\r
- * \r
+ *\r
* The transformer provides {@link #isAcceptable(Object)} method,\r
* which could be used to query transformer if the input will produce\r
* result.\r
- * \r
+ *\r
* This interface is simplified version of {@link RuleBasedTransformer} - does not\r
* provide decoupling of Acceptance rule from transformer, and should be used only\r
* for simple use-cases.\r
- * \r
+ *\r
* @author Tony Tkacik\r
*\r
* @param <I> Input class for transformation\r
\r
\r
/**\r
- * Checks if the input is acceptable \r
+ * Checks if the input is acceptable\r
* for processing by the transformer.\r
- * \r
+ *\r
* @return true it the input is acceptable for processing by transformer.\r
*/\r
@Override\r
\r
/**\r
* Factory which produces product based on input object\r
- * \r
+ *\r
* @author Tony Tkacik\r
*\r
* @param <I> Input\r
public interface Transformer<I,P> {\r
/**\r
* Transforms input into instance of product.\r
- * \r
+ *\r
* @param input Input which drives transformation\r
* @return Instance of product which was created from supplied input.\r
*/\r
<plugin>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>maven-paxexam-plugin</artifactId>
+ <version>1.2.4</version>
<executions>
<execution>
<id>generate-config</id>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${checkstyle.version}</version>
+ <configuration>
+ <failsOnError>true</failsOnError>
+ <configLocation>${project.parent.parent.basedir}/space_and_tabs_checks.xml</configLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <version>${propertymavenplugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>set-system-properties</goal>
+ </goals>
+ <configuration>
+ <properties>
+ <property>
+ <name>logback.configurationFile</name>
+ <value>${project.parent.parent.basedir}/logback.xml</value>
+ </property>
+ </properties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
<artifactId>commons.opendaylight</artifactId>
<version>1.4.0-SNAPSHOT</version>
<packaging>pom</packaging>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>commons.parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
<properties>
+ <propertymavenplugin.version>1.0-alpha-2</propertymavenplugin.version>
<sonar.host.url>https://sonar.opendaylight.org/</sonar.host.url>
- <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
<sitedeploy>dav:http://nexus.opendaylight.org/content/sites/site</sitedeploy>
<siteplugin>3.2</siteplugin>
<projectinfo>2.6</projectinfo>
<jersey.version>1.17</jersey.version>
<virgo.version>3.6.0.RELEASE</virgo.version>
<geminiweb.version>2.2.0.RELEASE</geminiweb.version>
+ <checkstyle.version>2.10</checkstyle.version>
</properties>
<pluginRepositories>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.10</version>
+ <version>${checkstyle.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
- <version>1.0-alpha-2</version>
+ <version>${propertymavenplugin.version}</version>
<executions>
<execution>
<goals>
<properties>
<property>
<name>logback.configurationFile</name>
- <value>${project.parent.relativePath}/logback.xml</value>
+ <value>${project.parent.basedir}/logback.xml</value>
</property>
</properties>
</configuration>
<compilerSource>1.6</compilerSource>
<compilerCompliance>1.6</compilerCompliance>
<compilerTargetPlatform>1.6</compilerTargetPlatform>
- <configFile>${project.parent.relativePath}/sun_coding_style.xml</configFile>
+ <configFile>${project.parent.basedir}/sun_coding_style.xml</configFile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${checkstyle.version}</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <failsOnError>true</failsOnError>
+ <configLocation>${project.parent.basedir}/space_and_tabs_checks.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
<plugin>
</action>
</pluginExecution>
<pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <versionRange>[1.2.4,)</versionRange>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
+ <pluginExecutionFilter>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>maven-paxexam-plugin</artifactId>
+ <versionRange>[1.2.4,)</versionRange>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <versionRange>[2.0,)</versionRange>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE module PUBLIC\r
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"\r
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">\r
+\r
+<module name="Checker">\r
+ <module name="FileTabCharacter">\r
+ <property name="eachLine" value="true"/>\r
+ </module>\r
+\r
+ <module name="RegexpSingleline">\r
+ <!-- \s matches whitespace character, $ matches end of line. -->\r
+ <property name="format" value="\s+$"/>\r
+ <property name="message" value="Line has trailing spaces."/>\r
+ </module>\r
+\r
+</module>\r
--- /dev/null
+This contains a dummy parent project. The use case of this is for
+example the maven-checkstyle plugin call in commons/opendaylight in
+there the plugin references the spaces_tabs_checks.xml from the
+parent, it works well for all the childs of commons/opendaylight
+artifact but when trying to deploy that one itself it breaks because
+the plugin section will still refer to the parent when there is no
+parent.
+This fake parents allow to still set a parent for the
+commons/opendaylight even if pretty much empty or limited to the bare
+minimum and yet allow the commons/opendaylight to reference a parent.
--- /dev/null
+<configuration scan="true">
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="error">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>commons.parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+ </properties>
+ <distributionManagement>
+ <!-- OpenDayLight Released artifact -->
+ <repository>
+ <id>opendaylight-release</id>
+ <url>${nexusproxy}/repositories/opendaylight.release/</url>
+ </repository>
+ <!-- OpenDayLight Snapshot artifact -->
+ <snapshotRepository>
+ <id>opendaylight-snapshot</id>
+ <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+ </snapshotRepository>
+ <!-- Site deployment -->
+ <site>
+ <id>website</id>
+ <url>${sitedeploy}</url>
+ </site>
+ </distributionManagement>
+</project>
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE module PUBLIC\r
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"\r
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">\r
+\r
+<module name="Checker">\r
+ <module name="FileTabCharacter">\r
+ <property name="eachLine" value="true"/>\r
+ </module>\r
+\r
+ <module name="RegexpSingleline">\r
+ <!-- \s matches whitespace character, $ matches end of line. -->\r
+ <property name="format" value="\s+$"/>\r
+ <property name="message" value="Line has trailing spaces."/>\r
+ </module>\r
+\r
+</module>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="12">
+<profile kind="CodeFormatterProfile" name="SunCodingStyle" version="12">
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="8"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+</profile>
+</profiles>
}
public int getConfigurationAwareListSize() {
- return this.configurationAwareList.size();
+ return this.configurationAwareList.size();
}
-
+
public void removeConfigurationContainerAware(
IConfigurationContainerAware configurationAware) {
this.configurationAwareList.remove(configurationAware);
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");
}
}
private Set<IConfigurationAware> configurationAwareList = (Set<IConfigurationAware>) Collections
.synchronizedSet(new HashSet<IConfigurationAware>());
-
+
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);
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");
}
}
public class ConfigurationAwareTest implements
IConfigurationAware {
-
- @Override
- public Status saveConfiguration() {
- return null;
- }
+
+ @Override
+ public Status saveConfiguration() {
+ return null;
+ }
}
public class ConfigurationContainerAwareTest implements
IConfigurationContainerAware {
-
-
-
- @Override
- public Status saveConfiguration() {
- return null;
- }
-
-
+
+
+
+ @Override
+ public Status saveConfiguration() {
+ return null;
+ }
+
+
}
-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());
+
+
+ }
+
+}
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());
+
+ }
+
+}
/**
* 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<String> getContainerNames();
* 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();
}
\r
public class ContainerImplTest {\r
\r
- @Test\r
- public void test() {\r
- \r
- ContainerImpl container1 = new ContainerImpl();\r
- \r
- //Create Component for init\r
- ComponentImpl component1 = new ComponentImpl(null, null, null);\r
- component1.setInterface("serviceTestName", null);\r
-\r
- //container1 does not have name yet\r
- container1.init(component1);\r
- assertNull(container1.getName());\r
- \r
- //Sets container1 name to TestName\r
- Hashtable<String, String> properties = new Hashtable<String, String>();\r
- properties.put("dummyKey", "dummyValue");\r
- properties.put("containerName", "TestName");\r
- component1.setInterface("serviceTestName", properties);\r
-\r
- container1.init(component1);\r
- assertEquals("TestName", container1.getName());\r
- \r
- //getContainerFlows always returns null for now\r
- assertNull(container1.getContainerFlows());\r
- \r
- //getTag always returns 0 for now\r
- Node n = NodeCreator.createOFNode(1L);\r
- assertEquals(0, container1.getTag(n));\r
- \r
- //getNodeConnectors always returns null for now\r
- assertNull(container1.getNodeConnectors());\r
- \r
- //getNodes always returns null for now\r
- assertNull(container1.getNodes());\r
- \r
- }\r
+ @Test\r
+ public void test() {\r
+\r
+ ContainerImpl container1 = new ContainerImpl();\r
+\r
+ //Create Component for init\r
+ ComponentImpl component1 = new ComponentImpl(null, null, null);\r
+ component1.setInterface("serviceTestName", null);\r
+\r
+ //container1 does not have name yet\r
+ container1.init(component1);\r
+ assertNull(container1.getName());\r
+\r
+ //Sets container1 name to TestName\r
+ Hashtable<String, String> properties = new Hashtable<String, String>();\r
+ properties.put("dummyKey", "dummyValue");\r
+ properties.put("containerName", "TestName");\r
+ component1.setInterface("serviceTestName", properties);\r
+\r
+ container1.init(component1);\r
+ assertEquals("TestName", container1.getName());\r
+\r
+ //getContainerFlows always returns null for now\r
+ assertNull(container1.getContainerFlows());\r
+\r
+ //getTag always returns 0 for now\r
+ Node n = NodeCreator.createOFNode(1L);\r
+ assertEquals(0, container1.getTag(n));\r
+\r
+ //getNodeConnectors always returns null for now\r
+ assertNull(container1.getNodeConnectors());\r
+\r
+ //getNodes always returns null for now\r
+ assertNull(container1.getNodes());\r
+\r
+ }\r
\r
}\r
\r
public class ContainerManagerTest {\r
\r
- @Test\r
- public void test() {\r
- ContainerManager cm = new ContainerManager();\r
- \r
- cm.init();\r
- \r
- ArrayList<String> names = (ArrayList<String>) cm.getContainerNames();\r
- assertEquals(1, names.size());\r
- assertEquals(GlobalConstants.DEFAULT.toString(), names.get(0));\r
- \r
- assertFalse(cm.hasNonDefaultContainer());\r
- assertNull(cm.saveContainerConfig());\r
- \r
- cm.destroy();\r
-\r
- }\r
+ @Test\r
+ public void test() {\r
+ ContainerManager cm = new ContainerManager();\r
+\r
+ cm.init();\r
+\r
+ ArrayList<String> names = (ArrayList<String>) cm.getContainerNames();\r
+ assertEquals(1, names.size());\r
+ assertEquals(GlobalConstants.DEFAULT.toString(), names.get(0));\r
+\r
+ assertFalse(cm.hasNonDefaultContainer());\r
+ assertNull(cm.saveContainerConfig());\r
+\r
+ cm.destroy();\r
+\r
+ }\r
\r
}\r
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
*
*/
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);
}
}
-
+
private Status saveConfig() {
// Publish the save config event to the cluster nodes
configSaveEvent.put(new Date().getTime(), SAVE);
}
@SuppressWarnings("deprecation")
- private void allocateCaches() {
+ private void allocateCaches() {
if (this.clusterContainerService == null) {
log
.info("un-initialized clusterContainerService, can't create cache");
}
@SuppressWarnings("deprecation")
- private void destroyCaches() {
+ private void destroyCaches() {
if (this.clusterContainerService == null) {
log
.info("un-initialized clusterContainerService, can't destroy cache");
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");
}
}
StaticRoute sRoute = new StaticRoute(config);
staticRoutes.put(config.getName(), sRoute);
checkAndUpdateListeners(sRoute, true);
- return status;
+ return status;
}
public Status removeStaticRoute(String name) {
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) {
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);
+ }
+}
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 {
}
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");
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());
+ }
}
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"));
+ }
+}
/**
* Return the actual Flow contained in this entry
- *
+ *
* @return the flow
*/
public Flow getFlow() {
/**
* 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
*/
* 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;
public void setRequestId(long rid) {
this.requestId = rid;
}
-
+
public long getRequestId() {
return requestId;
}
/**
* Interface that describes methods for installing or removing forwarding rules
* and to access to the flows database.
- *
+ *
*/
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.
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
/**
* Check whether the passed flow entry conflicts with the Container flows
- *
+ *
* @param flow
* the flow entry to test
* @return true if conflicts, false otherwise
/**
* 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
/**
* 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
/**
* 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
/**
* Replace the current output port in the specified flow with the specified
* one
- *
+ *
* @param node
* the network node
* @param groupName
/**
* Returns the output port configured on the specified flow
- *
+ *
* @param node
* the network node
* @param flowName
* 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<String, Object> getTSPolicyData();
/**
* Set the troubleshooting information for the policy
- *
+ *
* @param policyname
* the flow group name
* @param o
/**
* Returns the troubleshooting information that was set for the specified
* policy
- *
+ *
* @param groupName
* the flows group name
* @return the troubleshooting info object
/**
* 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<FlowConfig> getStaticFlows();
/**
* 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
/**
* Returns the specification of the flow configured for the given network
* node on the current container
- *
+ *
* @param name
* the flow name
* @param n
/**
* 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
/**
* Returns the list of Node(s) for which a static flow has been configured
- *
+ *
* @return the list of network nodes
*/
public List<Node> getListNodeWithConfiguredFlows();
/**
* Save the flow configured so far to file
- *
+ *
* @return the {@code Status} object indicating the result of this action.
*/
public Status saveConfig();
/**
* 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
/**
* 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
* 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
/**
* Remove the flow specified by name on the passed network node
- *
+ *
* @param name
* for the static flow
* @param node
* 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
* 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
/**
* 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
* 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
/**
* 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;
/**
* PortGroup Constructor using Switch and Ports.
- *
+ *
* @param matrixSwitchId
* Switch Id that represents an openflow Switch
* @param ports
/**
* PortGroup Constructor using Switch.
- *
+ *
* @param matrixSwitchId
* Switch-Id that represents an openflow Switch
*/
/**
* Returns the switchId representing the Switch that makes this PortGroup.
- *
+ *
* @return long switchId
*/
public long getMatrixSwitchId() {
/**
* Assigns a Switch to this PortGroup
- *
+ *
* @param matrixSwitchId
* Switch-Id that represents an openflow Switch
*/
/**
* Returns the Set of Ports that makes this PortGroup.
- *
+ *
* @return Set of short values representing openflow port-ids.
*/
public Set<Short> getPorts() {
/**
* Assigns a set of openflow ports to this PortGroup
- *
+ *
* @param ports
* Set of short values representing openflow port-ids.
*/
/**
* Adds a port to this PortGroup
- *
+ *
* @param port
* Short value of a openflow port.
*/
/**
* 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
/**
* 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;
/**
* 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
/**
* Returns the user configured PortGroup Configuration name.
- *
+ *
* @return Configuration Name
*/
public String getName() {
/**
* Assigns a name to the configuration
- *
+ *
* @param name
* configuration name
*/
/**
* Returns the Opaque string
- *
+ *
* @return
*/
public String getMatchString() {
/**
* Assigns an opaque String to the Configuration.
- *
+ *
* @param matchString
* Opaque string handled by PortGroupProvider
*/
/**
* 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<String> getFieldsNames() {
* 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.
*/
* 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.
/**
* 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.
* 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
* 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
/**
* 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.
* 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();
/**
* Returns the name of the Custom Application that implements
* PortGroupProvider interface.
- *
+ *
* @return Provider Name
*/
public String getProviderName();
/**
* 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.
/**
* Function called when the activator starts just after some initializations
* are done by the ComponentActivatorAbstractBase.
- *
+ *
*/
public void init() {
/**
* Function called when the activator stops just before the cleanup done by
* ComponentActivatorAbstractBase
- *
+ *
*/
public void destroy() {
/**
* 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
/**
* 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
* 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
* 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";
* 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: {}",
* 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
/**
* 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
* 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
*/
* (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.
* 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
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()) :
/**
* 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
* 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
.getInstall().getFlow()) :
programmer.removeFlow(entry.getNode(), entry
.getInstall().getFlow());
-
+
if (!status.isSuccess()) {
log.warn(
* 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
* 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
}
return status;
}
-
+
@Override
public Status modifyFlowEntry(FlowEntry currentFlowEntry,
FlowEntry newFlowEntry) {
}
}
-
+
/**
* 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
* 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...
/**
* Remove from the databases all the flows installed on the node
- *
+ *
* @param node
*/
private synchronized void cleanDatabaseForNode(Node node) {
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
- *
+ *
*/
void init() {
frmAware = Collections
* 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();
/**
* 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() {
/*
* 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() {
}
/*
* 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<FlowEntryInstall> entries = nodeFlows.get(node);
this.updateLocalDatabase(target, false);
}
}
-
+
// Notify listeners
if (frmAware != null) {
synchronized (frmAware) {
}
}
}
-
+
@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;
}
}
* 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);
}
* 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);
* 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);
* 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<HostNodeConnector> discoverHost(InetAddress networkAddress);
* 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<List<String>> getHostNetworkHierarchy(InetAddress hostAddress);
* 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<HostNodeConnector> getAllHosts();
* 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<HostNodeConnector> getActiveStaticHosts();
* 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<HostNodeConnector> getInactiveStaticHosts();
* 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);
* 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);
}
/**
* 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.
*
*/
/**
* 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);
* 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);
}
* 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);
* 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);
}
\r
public class HostNodeConnectorTest extends TestCase {\r
\r
- @Test\r
- public void testHostNodeConnector() throws UnknownHostException {\r
- HostNodeConnector hostnodeconnector_1, hostnodeconnector_2, hostnodeconnector_3;\r
- InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8");\r
- InetAddress hostIP_2 = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0");\r
- InetAddress hostIP_3 = InetAddress.getByName("192.168.0.28");\r
- byte[] hostMAC_2 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x22,(byte)0x22,(byte)0x22};\r
- byte[] hostMAC_3 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x33,(byte)0x33,(byte)0x33};\r
- \r
- Node node = NodeCreator.createOFNode(1L);\r
- NodeConnector nc1 = NodeConnectorCreator.createOFNodeConnector((short) 2, node);\r
- NodeConnector nc2 = NodeConnectorCreator.createOFNodeConnector((short) 1, node);\r
- \r
- try {\r
- hostnodeconnector_1 = new HostNodeConnector(hostIP_1);\r
- Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1));\r
- Assert.assertTrue(hostnodeconnector_1.isV4Host());\r
- Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1));\r
- } catch (ConstructionException e) {\r
- Assert.assertTrue(false);\r
- }\r
- \r
- try {\r
- hostnodeconnector_2 = new HostNodeConnector(\r
- hostMAC_2, hostIP_2, nc1, (short)2);\r
- Assert.assertTrue(hostnodeconnector_2.isV6Host());\r
- Assert.assertTrue(hostnodeconnector_2.getnodeConnector().equals(nc1));\r
- Assert.assertTrue(hostnodeconnector_2.getnodeconnectorNode().equals(node));\r
+ @Test\r
+ public void testHostNodeConnector() throws UnknownHostException {\r
+ HostNodeConnector hostnodeconnector_1, hostnodeconnector_2, hostnodeconnector_3;\r
+ InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8");\r
+ InetAddress hostIP_2 = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0");\r
+ InetAddress hostIP_3 = InetAddress.getByName("192.168.0.28");\r
+ byte[] hostMAC_2 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x22,(byte)0x22,(byte)0x22};\r
+ byte[] hostMAC_3 = new byte[]{(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x33,(byte)0x33,(byte)0x33};\r
+\r
+ Node node = NodeCreator.createOFNode(1L);\r
+ NodeConnector nc1 = NodeConnectorCreator.createOFNodeConnector((short) 2, node);\r
+ NodeConnector nc2 = NodeConnectorCreator.createOFNodeConnector((short) 1, node);\r
+\r
+ try {\r
+ hostnodeconnector_1 = new HostNodeConnector(hostIP_1);\r
+ Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1));\r
+ Assert.assertTrue(hostnodeconnector_1.isV4Host());\r
+ Assert.assertTrue(hostnodeconnector_1.equalsByIP(hostIP_1));\r
+ } catch (ConstructionException e) {\r
+ Assert.assertTrue(false);\r
+ }\r
+\r
+ try {\r
+ hostnodeconnector_2 = new HostNodeConnector(\r
+ hostMAC_2, hostIP_2, nc1, (short)2);\r
+ Assert.assertTrue(hostnodeconnector_2.isV6Host());\r
+ Assert.assertTrue(hostnodeconnector_2.getnodeConnector().equals(nc1));\r
+ Assert.assertTrue(hostnodeconnector_2.getnodeconnectorNode().equals(node));\r
Assert.assertTrue(node.equals(hostnodeconnector_2.getnodeconnectorNode()));\r
- } catch (ConstructionException e) {\r
- Assert.assertTrue(false);\r
- }\r
- \r
- try {\r
- hostnodeconnector_3 = new HostNodeConnector(\r
- new EthernetAddress(hostMAC_3), hostIP_3, nc2, (short)3);\r
- byte[] hostMAC_3_rb = hostnodeconnector_3.getDataLayerAddressBytes();\r
- HostNodeConnector hostnodeconnector_3rb = new HostNodeConnector(\r
- new EthernetAddress(hostMAC_3_rb), hostIP_3, nc2, (short)3);\r
- Assert.assertTrue(hostnodeconnector_3.equals(hostnodeconnector_3rb));\r
- \r
- Assert.assertTrue(hostnodeconnector_3.getVlan() == (short)3);\r
- \r
- hostnodeconnector_3.setStaticHost(true);\r
- Assert.assertTrue(hostnodeconnector_3.isStaticHost());\r
- \r
- Assert.assertTrue(hostnodeconnector_3.isRewriteEnabled());\r
- \r
- hostnodeconnector_3.initArpSendCountDown().setArpSendCountDown((short) 10);\r
- Assert.assertTrue(hostnodeconnector_3.getArpSendCountDown() == (short)10);\r
- \r
- } catch (ConstructionException e) {\r
- Assert.assertTrue(false);\r
- }\r
- \r
- }\r
+ } catch (ConstructionException e) {\r
+ Assert.assertTrue(false);\r
+ }\r
+\r
+ try {\r
+ hostnodeconnector_3 = new HostNodeConnector(\r
+ new EthernetAddress(hostMAC_3), hostIP_3, nc2, (short)3);\r
+ byte[] hostMAC_3_rb = hostnodeconnector_3.getDataLayerAddressBytes();\r
+ HostNodeConnector hostnodeconnector_3rb = new HostNodeConnector(\r
+ new EthernetAddress(hostMAC_3_rb), hostIP_3, nc2, (short)3);\r
+ Assert.assertTrue(hostnodeconnector_3.equals(hostnodeconnector_3rb));\r
+\r
+ Assert.assertTrue(hostnodeconnector_3.getVlan() == (short)3);\r
+\r
+ hostnodeconnector_3.setStaticHost(true);\r
+ Assert.assertTrue(hostnodeconnector_3.isStaticHost());\r
+\r
+ Assert.assertTrue(hostnodeconnector_3.isRewriteEnabled());\r
+\r
+ hostnodeconnector_3.initArpSendCountDown().setArpSendCountDown((short) 10);\r
+ Assert.assertTrue(hostnodeconnector_3.getArpSendCountDown() == (short)10);\r
+\r
+ } catch (ConstructionException e) {\r
+ Assert.assertTrue(false);\r
+ }\r
+\r
+ }\r
\r
}\r
/**
* 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;
\r
public class HostTrackerTest extends TestCase {\r
\r
- @Test\r
- public void testHostTrackerCallable() throws UnknownHostException {\r
- \r
- HostTracker hostTracker = null;\r
- hostTracker = new HostTracker();\r
- Assert.assertFalse(hostTracker== null);\r
- \r
- InetAddress hostIP = InetAddress.getByName("192.168.0.8");\r
- \r
- HostTrackerCallable htCallable = new HostTrackerCallable (hostTracker, hostIP);\r
- Assert.assertTrue(htCallable.trackedHost.equals(hostIP));\r
- Assert.assertTrue(htCallable.hostTracker.equals(hostTracker));\r
-\r
- long count = htCallable.latch.getCount();\r
- htCallable.wakeup();\r
- Assert.assertTrue(htCallable.latch.getCount() == --count );\r
- } \r
- \r
- \r
- \r
- @Test\r
- public void testHostTracker() throws UnknownHostException {\r
- HostTracker hostTracker = null;\r
- hostTracker = new HostTracker();\r
- Assert.assertFalse(hostTracker== null);\r
- \r
- InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8");\r
- InetAddress hostIP_2 = InetAddress.getByName("192.168.0.18");\r
- Future<HostNodeConnector> dschost = hostTracker.discoverHost(hostIP_1);\r
- dschost = hostTracker.discoverHost(hostIP_2);\r
- hostTracker.nonClusterObjectCreate();\r
- }\r
- \r
+ @Test\r
+ public void testHostTrackerCallable() throws UnknownHostException {\r
+\r
+ HostTracker hostTracker = null;\r
+ hostTracker = new HostTracker();\r
+ Assert.assertFalse(hostTracker== null);\r
+\r
+ InetAddress hostIP = InetAddress.getByName("192.168.0.8");\r
+\r
+ HostTrackerCallable htCallable = new HostTrackerCallable (hostTracker, hostIP);\r
+ Assert.assertTrue(htCallable.trackedHost.equals(hostIP));\r
+ Assert.assertTrue(htCallable.hostTracker.equals(hostTracker));\r
+\r
+ long count = htCallable.latch.getCount();\r
+ htCallable.wakeup();\r
+ Assert.assertTrue(htCallable.latch.getCount() == --count );\r
+ }\r
+\r
+\r
+\r
+ @Test\r
+ public void testHostTracker() throws UnknownHostException {\r
+ HostTracker hostTracker = null;\r
+ hostTracker = new HostTracker();\r
+ Assert.assertFalse(hostTracker== null);\r
+\r
+ InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8");\r
+ InetAddress hostIP_2 = InetAddress.getByName("192.168.0.18");\r
+ Future<HostNodeConnector> dschost = hostTracker.discoverHost(hostIP_1);\r
+ dschost = hostTracker.discoverHost(hostIP_2);\r
+ hostTracker.nonClusterObjectCreate();\r
+ }\r
+\r
\r
}\r
this.listener.logged(entry);
}
}
-
+
/*
* Install the default exception handler so that the uncaught
* exceptions are handled by our customized handler. This new
*/
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 "
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();
} catch (BundleException e) {
log.debug("Bundle couldn't be stopped");
}
- }
+ }
}
}
*
*/
package org.opendaylight.controller.northbound.commons.exception;
-
public class NorthboundUtils {
-
+
/**
* Returns whether the current user has the required privilege on the
* specified container
- *
+ *
* @param userName
* The user name
* @param containerName
* @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;
}
}
return true;
}
-
+
}
@XmlAccessorType(XmlAccessType.NONE)
public class FlowConfigs {
- @XmlElement
- List<FlowConfig> flowConfig;
- //To satisfy JAXB
- private FlowConfigs() {
-
- }
-
- public FlowConfigs(List<FlowConfig> flowConfig) {
- this.flowConfig = flowConfig;
- }
-
- public List<FlowConfig> getFlowConfig() {
- return flowConfig;
- }
-
- public void setFlowConfig(List<FlowConfig> flowConfig) {
- this.flowConfig = flowConfig;
- }
+ @XmlElement
+ List<FlowConfig> flowConfig;
+ //To satisfy JAXB
+ private FlowConfigs() {
+
+ }
+
+ public FlowConfigs(List<FlowConfig> flowConfig) {
+ this.flowConfig = flowConfig;
+ }
+
+ public List<FlowConfig> getFlowConfig() {
+ return flowConfig;
+ }
+
+ public void setFlowConfig(List<FlowConfig> flowConfig) {
+ this.flowConfig = flowConfig;
+ }
}
/**
* Flow Configuration Northbound API
- *
+ *
* <br>
* <br>
* Authentication scheme : <b>HTTP Basic</b><br>
* trusted authority.<br>
* More info :
* http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
- *
+ *
*/
@Path("/")
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".
/**
* 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".
/**
* 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".
/**
* Add a flow configuration
- *
+ *
* @param containerName
* Name of the Container. The Container name for the base
* controller is "default".
/**
* 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".
/**
* Toggle a Flow configuration
- *
+ *
* @param containerName
* Name of the Container. The Container name for the base
* controller is "default".
* 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.
- *
+ *
* <br>
* <br>
* Authentication scheme : <b>HTTP Basic</b><br>
* trusted authority.<br>
* More info :
* http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
- *
+ *
*/
@Path("/")
/**
* 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".
@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(
/**
* 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".
/**
* 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".
/**
* Add a Static Host configuration
- *
+ *
* @param containerName
* Name of the Container. The Container name for the base
* controller is "default".
/**
* Delete a Static Host configuration
- *
+ *
* @param containerName
* Name of the Container. The Container name for the base
* controller is "default".
public Response deleteFlow(
@PathParam(value = "containerName") String containerName,
@PathParam(value = "networkAddress") String networkAddress) {
-
+
if (!NorthboundUtils.isAuthorized(
getUserName(), containerName, Privilege.WRITE, this)) {
throw new UnauthorizedException(
@XmlAccessorType(XmlAccessType.NONE)
public class Hosts {
- @XmlElement (name="host")
- Set<HostNodeConnector> hostNodeConnector;
-
- public Hosts() {
- }
- public Hosts (Set<HostNodeConnector> hostNodeConnector) {
- this.hostNodeConnector = hostNodeConnector;
- }
- public Set<HostNodeConnector> getHostNodeConnector() {
- return hostNodeConnector;
- }
- public void setHostNodeConnector(Set<HostNodeConnector> hostNodeConnector) {
- this.hostNodeConnector = hostNodeConnector;
- }
+ @XmlElement (name="host")
+ Set<HostNodeConnector> hostNodeConnector;
+
+ public Hosts() {
+ }
+ public Hosts (Set<HostNodeConnector> hostNodeConnector) {
+ this.hostNodeConnector = hostNodeConnector;
+ }
+ public Set<HostNodeConnector> getHostNodeConnector() {
+ return hostNodeConnector;
+ }
+ public void setHostNodeConnector(Set<HostNodeConnector> hostNodeConnector) {
+ this.hostNodeConnector = hostNodeConnector;
+ }
}
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);
@XmlAccessorType(XmlAccessType.NONE)
public class StaticRoutes {
- @XmlElement
- List<StaticRoute> staticRoute;
- //To satisfy JAXB
- private StaticRoutes() {
-
- }
-
- public StaticRoutes(List<StaticRoute> staticRoute) {
- this.staticRoute = staticRoute;
- }
-
- public List<StaticRoute> getFlowConfig() {
- return staticRoute;
- }
-
- public void setFlowConfig(List<StaticRoute> staticRoute) {
- this.staticRoute = staticRoute;
- }
+ @XmlElement
+ List<StaticRoute> staticRoute;
+ //To satisfy JAXB
+ private StaticRoutes() {
+
+ }
+
+ public StaticRoutes(List<StaticRoute> staticRoute) {
+ this.staticRoute = staticRoute;
+ }
+
+ public List<StaticRoute> getFlowConfig() {
+ return staticRoute;
+ }
+
+ public void setFlowConfig(List<StaticRoute> staticRoute) {
+ this.staticRoute = staticRoute;
+ }
}
* Authentication realm : <b>opendaylight</b><br>
* Transport : <b>HTTP and HTTPS</b><br>
* <br>
- * 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.<br>
* More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
*/
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<StaticRoute> getStaticRoutesInternal(String containerName) {
IForwardingStaticRouting staticRouting = (IForwardingStaticRouting) ServiceHelper
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);
}
@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);
}
@PathParam(value = "name") String name,
@TypeHint(StaticRoute.class) JAXBElement<StaticRoute> 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);
}
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);
}
@XmlAccessorType(XmlAccessType.NONE)
public class AllFlowStatistics {
- @XmlElement
- List<FlowStatistics> flowStatistics;
- //To satisfy JAXB
- private AllFlowStatistics() {
- }
-
- public AllFlowStatistics(List<FlowStatistics> flowStatistics) {
- this.flowStatistics = flowStatistics;
- }
-
- public List<FlowStatistics> getFlowStatistics() {
- return flowStatistics;
- }
-
- public void setFlowStatistics(List<FlowStatistics> flowStatistics) {
- this.flowStatistics = flowStatistics;
- }
+ @XmlElement
+ List<FlowStatistics> flowStatistics;
+ //To satisfy JAXB
+ private AllFlowStatistics() {
+ }
+
+ public AllFlowStatistics(List<FlowStatistics> flowStatistics) {
+ this.flowStatistics = flowStatistics;
+ }
+
+ public List<FlowStatistics> getFlowStatistics() {
+ return flowStatistics;
+ }
+
+ public void setFlowStatistics(List<FlowStatistics> flowStatistics) {
+ this.flowStatistics = flowStatistics;
+ }
}
@XmlAccessorType(XmlAccessType.NONE)
public class AllPortStatistics {
- @XmlElement
- List<PortStatistics> portStatistics;
- //To satisfy JAXB
- private AllPortStatistics() {
- }
-
- public AllPortStatistics(List<PortStatistics> portStatistics) {
- this.portStatistics = portStatistics;
- }
-
- public List<PortStatistics> getPortStatistics() {
- return portStatistics;
- }
-
- public void setPortStatistics(List<PortStatistics> portStatistics) {
- this.portStatistics = portStatistics;
- }
+ @XmlElement
+ List<PortStatistics> portStatistics;
+ //To satisfy JAXB
+ private AllPortStatistics() {
+ }
+
+ public AllPortStatistics(List<PortStatistics> portStatistics) {
+ this.portStatistics = portStatistics;
+ }
+
+ public List<PortStatistics> getPortStatistics() {
+ return portStatistics;
+ }
+
+ public void setPortStatistics(List<PortStatistics> portStatistics) {
+ this.portStatistics = portStatistics;
+ }
}
// To satisfy JAXB
@SuppressWarnings("unused")
- private FlowStatistics() {
+ private FlowStatistics() {
}
public FlowStatistics(Node node, List<FlowOnNode> flowStat) {
// To satisfy JAXB
@SuppressWarnings("unused")
- private PortStatistics() {
+ private PortStatistics() {
}
public PortStatistics(Node node, List<NodeConnectorStatistics> portStats) {
/**
* Northbound APIs that returns various Statistics exposed by the Southbound
* plugins such as Openflow.
- *
+ *
* <br>
* <br>
* Authentication scheme : <b>HTTP Basic</b><br>
* trusted authority.<br>
* More info :
* http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
- *
+ *
*/
@Path("/")
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".
/**
* 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".
/**
* 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".
/**
* 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".
@XmlAccessorType(XmlAccessType.NONE)
public class SubnetConfigs {
- @XmlElement
- List<SubnetConfig> subnetConfig;
- //To satisfy JAXB
- private SubnetConfigs() {
-
- }
-
- public SubnetConfigs(List<SubnetConfig> subnetConfig) {
- this.subnetConfig = subnetConfig;
- }
-
- public List<SubnetConfig> getSubnetConfig() {
- return subnetConfig;
- }
-
- public void setSubnetConfig(List<SubnetConfig> subnetConfig) {
- this.subnetConfig = subnetConfig;
- }
+ @XmlElement
+ List<SubnetConfig> subnetConfig;
+ //To satisfy JAXB
+ private SubnetConfigs() {
+
+ }
+
+ public SubnetConfigs(List<SubnetConfig> subnetConfig) {
+ this.subnetConfig = subnetConfig;
+ }
+
+ public List<SubnetConfig> getSubnetConfig() {
+ return subnetConfig;
+ }
+
+ public void setSubnetConfig(List<SubnetConfig> subnetConfig) {
+ this.subnetConfig = subnetConfig;
+ }
}
/**
* 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}")
/**
* 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}")
/**
* Add/Update a subnet to a container
- *
+ *
* @param containerName
* container in which we want to add/update the subnet
* @param subnetName
* @param subnet
* pair default gateway IP/mask that identify the subnet being
* added modified
- *
+ *
*/
@Path("/{containerName}/{subnetName}")
@POST