From: Giovanni Meo Date: Sat, 15 Jun 2013 09:14:15 +0000 (+0000) Subject: Merge "Add IfNewHostNotify to DeviceManager" X-Git-Tag: releasepom-0.1.0~351 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=8f13b5e59fc066808cc73879f8defcb9cf3dc82a;hp=feeb64e96e1bfbb4d5492ddabcf70e7f43ad4082 Merge "Add IfNewHostNotify to DeviceManager" --- diff --git a/opendaylight/clustering/integrationtest/pom.xml b/opendaylight/clustering/integrationtest/pom.xml index 460b09e9da..52c568203b 100644 --- a/opendaylight/clustering/integrationtest/pom.xml +++ b/opendaylight/clustering/integrationtest/pom.xml @@ -32,7 +32,7 @@ sal.implementation 0.4.0-SNAPSHOT - + org.opendaylight.controller clustering.services-implementation 0.4.0-SNAPSHOT diff --git a/opendaylight/clustering/services_implementation/src/main/resources/config/infinispan-config.xml b/opendaylight/clustering/services_implementation/src/main/resources/config/infinispan-config.xml index 03a9b4d93e..2aa3fdb849 100644 --- a/opendaylight/clustering/services_implementation/src/main/resources/config/infinispan-config.xml +++ b/opendaylight/clustering/services_implementation/src/main/resources/config/infinispan-config.xml @@ -19,7 +19,7 @@ - + diff --git a/opendaylight/commons/integrationtest/pom.xml b/opendaylight/commons/integrationtest/pom.xml index 1f4b442ea4..4cd8582749 100644 --- a/opendaylight/commons/integrationtest/pom.xml +++ b/opendaylight/commons/integrationtest/pom.xml @@ -49,9 +49,17 @@ 0.8.0.v201110170705 - + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + true + + org.ops4j.pax.exam maven-paxexam-plugin diff --git a/opendaylight/commons/opendaylight/logback.xml b/opendaylight/commons/opendaylight/logback.xml index 043ceef329..05e607573e 100644 --- a/opendaylight/commons/opendaylight/logback.xml +++ b/opendaylight/commons/opendaylight/logback.xml @@ -1,11 +1,11 @@ - + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n - + diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 4062e1839b..c3c9a5cd1e 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -24,7 +24,8 @@ 2.6 UTF-8 2.3.2 - 2.13 + 2.15 + 2.15 3.0.0 1.5.0 1.26.2 @@ -303,21 +304,27 @@ ${project.parent.basedir}/space_and_tabs_checks.xml true true + ${project.basedir} + **\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat org.apache.maven.plugins maven-failsafe-plugin - 2.14.1 + ${failsafe.version} integration-test - verify + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + diff --git a/opendaylight/commons/opendaylight/sun_coding_style.xml b/opendaylight/commons/opendaylight/sun_coding_style.xml index f4516b913d..cb2c2c8b20 100644 --- a/opendaylight/commons/opendaylight/sun_coding_style.xml +++ b/opendaylight/commons/opendaylight/sun_coding_style.xml @@ -74,7 +74,7 @@ - + diff --git a/opendaylight/commons/parent/logback.xml b/opendaylight/commons/parent/logback.xml index 043ceef329..05e607573e 100644 --- a/opendaylight/commons/parent/logback.xml +++ b/opendaylight/commons/parent/logback.xml @@ -1,11 +1,11 @@ - + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n - + diff --git a/opendaylight/configuration/integrationtest/.gitignore b/opendaylight/configuration/integrationtest/.gitignore new file mode 100644 index 0000000000..f92f36385a --- /dev/null +++ b/opendaylight/configuration/integrationtest/.gitignore @@ -0,0 +1 @@ +configuration diff --git a/opendaylight/configuration/integrationtest/pom.xml b/opendaylight/configuration/integrationtest/pom.xml new file mode 100644 index 0000000000..037b43515a --- /dev/null +++ b/opendaylight/configuration/integrationtest/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + org.opendaylight.controller + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest + + configuration.integrationtest + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + protocol_plugins.stub + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + sal + 0.5.0-SNAPSHOT + + + org.opendaylight.controller + sal.implementation + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + forwardingrulesmanager + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + clustering.services + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + clustering.services-implementation + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + clustering.stub + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + containermanager + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + containermanager.implementation + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + switchmanager + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + switchmanager.implementation + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + configuration + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + configuration.implementation + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + hosttracker + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + topologymanager + 0.4.0-SNAPSHOT + + + diff --git a/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java b/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java new file mode 100644 index 0000000000..8e1f34e612 --- /dev/null +++ b/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java @@ -0,0 +1,212 @@ +package org.opendaylight.controller.configuration.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.systemPackages; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + +import java.io.File; + +import javax.inject.Inject; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.opendaylight.controller.clustering.services.IClusterServices; +import org.opendaylight.controller.configuration.IConfigurationService; +import org.opendaylight.controller.sal.utils.GlobalConstants; +import org.opendaylight.controller.sal.utils.Status; +import org.opendaylight.controller.sal.utils.StatusCode; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.util.PathUtils; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@RunWith(PaxExam.class) +public class ConfigurationIT { + private Logger logger = LoggerFactory + .getLogger(ConfigurationIT.class); + // get the OSGI bundle context + @Inject + private BundleContext bc; + private IClusterServices clusterService = null; + private IConfigurationService configService = null; + + // Configure the OSGi container + @Configuration + public Option[] config() { + return options( + systemProperty("logback.configurationFile").value( + "file:" + PathUtils.getBaseDir() + + "/src/test/resources/logback.xml"), + // To start OSGi console for inspection remotely + systemProperty("osgi.console").value("2401"), + // Set the systemPackages (used by clustering) + systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), + // List framework bundles + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", + "1.0.0.v20120522-1841"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", + "1.0.400.v20120522-2049"), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", + "3.3.100.v20120522-1822"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", + "1.4.0.v20120522-1841"), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", + "0.8.0.v201108120515"), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", + "0.8.0.v201108120515"), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", + "0.8.0.v201110170705"), + // List logger bundles + mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), + mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), + mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), + mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), + mavenBundle("org.apache.commons", "commons-lang3", "3.1"), + mavenBundle("org.jboss.spec.javax.transaction", + "jboss-transaction-api_1.1_spec", "1.0.1.Final"), + mavenBundle("org.apache.felix", + "org.apache.felix.dependencymanager", "3.1.0"), + // List all the bundles on which the test case depends + mavenBundle("org.opendaylight.controller", "sal", + "0.5.0-SNAPSHOT"), // SAL connects the protocols + // plug-ins to other stuff + mavenBundle("org.opendaylight.controller", + "sal.implementation", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", + "protocol_plugins.stub", "0.4.0-SNAPSHOT"), + // needed bundles by switchmanager + mavenBundle("org.opendaylight.controller", "containermanager", + "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", + "containermanager.implementation", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "switchmanager", + "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", + "switchmanager.implementation", "0.4.0-SNAPSHOT"), + // needed bundles by configuration + mavenBundle("org.opendaylight.controller", + "clustering.services", "0.4.0-SNAPSHOT"), // what are + // the + // clustering + // services + // for + mavenBundle("org.opendaylight.controller", "clustering.stub", + "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", + "clustering.services-implementation", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "configuration", + "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", + "configuration.implementation", "0.4.0-SNAPSHOT"), + junitBundles()); + } + + private String stateToString(int state) { + switch (state) { + case Bundle.ACTIVE: + return "ACTIVE"; + case Bundle.INSTALLED: + return "INSTALLED"; + case Bundle.RESOLVED: + return "RESOLVED"; + case Bundle.UNINSTALLED: + return "UNINSTALLED"; + default: + return "Not CONVERTED"; + } + } + + @Before + public void areWeReadyForClustering() { + assertNotNull(bc); + boolean debugit = false; + Bundle b[] = bc.getBundles(); + for (int i = 0; i < b.length; i++) { + int state = b[i].getState(); + if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) { + logger.debug("Bundle:" + b[i].getSymbolicName() + " state:" + + stateToString(state)); + debugit = true; + } + } + if (debugit) { + logger.debug("Do some debugging because some bundle is unresolved"); + } + + // Assert if true, if false we are good to go! + assertFalse(debugit); + ServiceReference r = bc.getServiceReference(IClusterServices.class + .getName()); + if (r != null) { + this.clusterService = (IClusterServices) bc.getService(r); + } + // If StatisticsManager is null, cannot run tests. + assertNotNull(this.clusterService); + + } + + @Before + public void areWeReadyForConfiguration() { + assertNotNull(bc); + boolean debugit = false; + Bundle b[] = bc.getBundles(); + for (int i = 0; i < b.length; i++) { + int state = b[i].getState(); + if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) { + logger.debug("Bundle:" + b[i].getSymbolicName() + " state:" + + stateToString(state)); + debugit = true; + } + } + if (debugit) { + logger.debug("Do some debugging because some bundle is unresolved"); + } + + // Assert if true, if false we are good to go! + assertFalse(debugit); + ServiceReference r = bc.getServiceReference(IConfigurationService.class + .getName()); + if (r != null) { + this.configService = (IConfigurationService) bc.getService(r); + } + // If StatisticsManager is null, cannot run tests. + assertNotNull(this.configService); + + } + + @Test + public void saveConfiguration() { + File f = new File(GlobalConstants.STARTUPHOME.toString()); + boolean success = f.exists(); + if (!success) { + success = f.mkdirs(); + } + if(success){ + Status status = new Status(StatusCode.SUCCESS, null); + if (this.configService != null) { + status = this.configService.saveConfigurations(); + } + if (status.getCode().equals(StatusCode.SUCCESS)) { + Assert.assertTrue("Successfully saved config for " + + configService.getClass().getSimpleName(), status + .getCode().equals(StatusCode.SUCCESS)); + } else { + Assert.assertFalse("Failed to save config for " + + configService.getClass().getSimpleName(), status + .getCode().equals(StatusCode.INTERNALERROR)); + } + } + } + +} diff --git a/opendaylight/configuration/integrationtest/src/test/resources/logback.xml b/opendaylight/configuration/integrationtest/src/test/resources/logback.xml new file mode 100644 index 0000000000..2d63ce5744 --- /dev/null +++ b/opendaylight/configuration/integrationtest/src/test/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + diff --git a/opendaylight/containermanager/implementation/pom.xml b/opendaylight/containermanager/implementation/pom.xml index 42ff3387f7..a324fca0d9 100644 --- a/opendaylight/containermanager/implementation/pom.xml +++ b/opendaylight/containermanager/implementation/pom.xml @@ -59,10 +59,10 @@ containermanager 0.4.0-SNAPSHOT - + org.opendaylight.controller sal 0.5.0-SNAPSHOT - + diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index 765dea5337..50b34faac8 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -38,6 +38,7 @@ ../../clustering/test ../../configuration/api ../../configuration/implementation + ../../configuration/integrationtest ../../routing/dijkstra_implementation ../../arphandler ../../forwardingrulesmanager/api @@ -57,7 +58,8 @@ ../../statisticsmanager/implementation ../../statisticsmanager/integrationtest ../../topologymanager - ../../usermanager + ../../usermanager/api + ../../usermanager/implementation ../../security @@ -101,7 +103,7 @@ ../../samples/northbound/loadbalancer ../../commons/concepts ../../commons/integrationtest - + diff --git a/opendaylight/distribution/opendaylight/src/assemble/bin.xml b/opendaylight/distribution/opendaylight/src/assemble/bin.xml index 8be21f6450..67a4735813 100644 --- a/opendaylight/distribution/opendaylight/src/assemble/bin.xml +++ b/opendaylight/distribution/opendaylight/src/assemble/bin.xml @@ -1,6 +1,6 @@ - + osgipackage dir @@ -12,9 +12,9 @@ org.opendaylight.controller.thirdparty:org.openflow.openflowj org.opendaylight.controller:clustering.stub - org.opendaylight.controller:logging.bridge - org.opendaylight.controller:protocol_plugins.stub - org.opendaylight.controller:*.integrationtest + org.opendaylight.controller:logging.bridge + org.opendaylight.controller:protocol_plugins.stub + org.opendaylight.controller:*.integrationtest org.opendaylight.controller:hosttracker_new org.opendaylight.controller:hosttracker_new.implementation @@ -27,19 +27,19 @@ false - - - org.opendaylight.controller:logging.bridge - - - opendaylight/lib - - ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} - - false - false - - + + + org.opendaylight.controller:logging.bridge + + + opendaylight/lib + + ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} + + false + false + + @@ -54,15 +54,15 @@ virgomirror:org.eclipse.jdt.core.compiler.batch org.apache.felix:org.apache.felix.fileinstall geminiweb:org.eclipse.virgo.kernel.equinox.extensions - org.slf4j:slf4j-api - ch.qos.logback:logback-core - ch.qos.logback:logback-classic - com.sun.jersey:jersey-core - com.sun.jersey:jersey-json - com.sun.jersey:jersey-server + org.slf4j:slf4j-api + ch.qos.logback:logback-core + ch.qos.logback:logback-classic + com.sun.jersey:jersey-core + com.sun.jersey:jersey-json + com.sun.jersey:jersey-server - ${artifact.groupId}.${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} + ${artifact.groupId}.${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} false runtime @@ -80,16 +80,16 @@ virgomirror:org.eclipse.jdt.core.compiler.batch org.apache.felix:org.apache.felix.fileinstall geminiweb:org.eclipse.virgo.kernel.equinox.extensions - org.slf4j:slf4j-api - ch.qos.logback:logback-core - ch.qos.logback:logback-classic - com.sun.jersey:jersey-core - com.sun.jersey:jersey-json - com.sun.jersey:jersey-server + org.slf4j:slf4j-api + ch.qos.logback:logback-core + ch.qos.logback:logback-classic + com.sun.jersey:jersey-core + com.sun.jersey:jersey-json + com.sun.jersey:jersey-server false - ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} + ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} false runtime diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini index a8d7beb49b..460145ee87 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini @@ -1,13 +1,13 @@ osgi.bundles=\ - reference\:file\:../lib/org.apache.felix.fileinstall-3.1.6.jar@1:start,\ - reference\:file\:../lib/org.eclipse.jdt.core.compiler.batch-3.8.0.I20120518-2145.jar@1:start,\ - reference\:file\:../lib/org.eclipse.equinox.ds-1.4.0.v20120522-1841.jar@2:start,\ - reference\:file\:../lib/org.eclipse.equinox.util-1.0.400.v20120522-2049.jar@2:start,\ - reference\:file\:../lib/org.eclipse.osgi.services-3.3.100.v20120522-1822@2:start,\ - reference\:file\:../lib/org.eclipse.equinox.console-1.0.0.v20120522-1841.jar@start,\ - reference\:file\:../lib/slf4j-api-1.7.2.jar@1:start,\ - reference\:file\:../lib/logback-classic-1.0.9.jar@1:start,\ - reference\:file\:../lib/logback-core-1.0.9.jar@1:start,\ + reference\:file\:../lib/org.apache.felix.fileinstall-3.1.6.jar@1:start,\ + reference\:file\:../lib/org.eclipse.jdt.core.compiler.batch-3.8.0.I20120518-2145.jar@1:start,\ + reference\:file\:../lib/org.eclipse.equinox.ds-1.4.0.v20120522-1841.jar@2:start,\ + reference\:file\:../lib/org.eclipse.equinox.util-1.0.400.v20120522-2049.jar@2:start,\ + reference\:file\:../lib/org.eclipse.osgi.services-3.3.100.v20120522-1822@2:start,\ + reference\:file\:../lib/org.eclipse.equinox.console-1.0.0.v20120522-1841.jar@start,\ + reference\:file\:../lib/slf4j-api-1.7.2.jar@1:start,\ + reference\:file\:../lib/logback-classic-1.0.9.jar@1:start,\ + reference\:file\:../lib/logback-core-1.0.9.jar@1:start,\ reference\:file\:../lib/logging.bridge-0.4.0-SNAPSHOT@1:start,\ reference\:file\:../lib/jersey-core-1.17.jar@2:start,\ reference\:file\:../lib/jersey-json-1.17.jar@2:start,\ @@ -19,7 +19,7 @@ osgi.bundles.defaultStartLevel=4 org.osgi.framework.system.packages.extra=sun.reflect,sun.reflect.misc,sun.misc # This is not Eclipse App eclipse.ignoreApp=true -# Don't shutdown equinox if the eclipse App has ended, +# Don't shutdown equinox if the eclipse App has ended, # which is our case because we are not running any eclipse application osgi.noShutdown=true # Clean any cached data on restart of the framework @@ -33,7 +33,7 @@ felix.fileinstall.dir=./plugins felix.fileinstall.noInitialDelay=true # Auto start the bundles at level 4 felix.fileinstall.start.level=4 -# Avoid to auto-install following bundles, that means those need +# Avoid to auto-install following bundles, that means those need # to be started manually or in other way like osgi.bundles felix.fileinstall.filter=^(?!org.apache.felix.fileinstall).* @@ -69,7 +69,7 @@ org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml # TLS configuration # To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. -# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate +# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate # entries, including switches' Certification Authority (CA) certificates. For example, # secureChannelEnabled=true # controllerKeyStore=./configuration/ctlKeyStore diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/logback.xml b/opendaylight/distribution/opendaylight/src/main/resources/configuration/logback.xml index a99d17d37c..de70a52a31 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/logback.xml +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/logback.xml @@ -54,5 +54,5 @@ - + diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/tomcat-server.xml b/opendaylight/distribution/opendaylight/src/main/resources/configuration/tomcat-server.xml index 4be075451e..56d469b599 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/tomcat-server.xml +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/tomcat-server.xml @@ -30,13 +30,13 @@ connectionTimeout="20000" redirectPort="8443" /> - - - ../../northbound/commons - + diff --git a/opendaylight/distribution/sdk/src/assemble/bin.xml b/opendaylight/distribution/sdk/src/assemble/bin.xml index bb3c6734f6..b2f45c38c9 100644 --- a/opendaylight/distribution/sdk/src/assemble/bin.xml +++ b/opendaylight/distribution/sdk/src/assemble/bin.xml @@ -1,4 +1,4 @@ - package diff --git a/opendaylight/forwarding/staticrouting/pom.xml b/opendaylight/forwarding/staticrouting/pom.xml index 80eea57b8f..ea22c4f1ca 100644 --- a/opendaylight/forwarding/staticrouting/pom.xml +++ b/opendaylight/forwarding/staticrouting/pom.xml @@ -70,7 +70,7 @@ org.opendaylight.controller configuration 0.4.0-SNAPSHOT - + junit junit diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java index 5d9a5e1803..8345b5adbc 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java @@ -18,7 +18,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.opendaylight.controller.sal.core.ConstructionException; import org.opendaylight.controller.sal.core.Host; import org.opendaylight.controller.sal.core.Node; @@ -172,15 +171,10 @@ public class HostNodeConnector extends Host { return !Arrays.equals(emptyArray, macaddr); } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { - return "HostNodeConnector[" + ReflectionToStringBuilder.toString(this) - + "]"; + return "HostNodeConnector [nodeConnector=" + nodeConnector + ", vlan=" + + vlan + ", staticHost=" + staticHost + "]"; } public boolean isV4Host() { diff --git a/opendaylight/northbound/commons/pom.xml b/opendaylight/northbound/commons/pom.xml index 7c0835a903..56da363d3e 100644 --- a/opendaylight/northbound/commons/pom.xml +++ b/opendaylight/northbound/commons/pom.xml @@ -33,7 +33,7 @@ org.opendaylight.controller.sal.authorization, org.opendaylight.controller.containermanager, org.opendaylight.controller.usermanager, - javax.servlet.http, + javax.servlet.http, org.slf4j diff --git a/opendaylight/northbound/flowprogrammer/enunciate.xml b/opendaylight/northbound/flowprogrammer/enunciate.xml index a49d9f8265..90bf6de1d6 100644 --- a/opendaylight/northbound/flowprogrammer/enunciate.xml +++ b/opendaylight/northbound/flowprogrammer/enunciate.xml @@ -1,7 +1,7 @@ - + diff --git a/opendaylight/northbound/flowprogrammer/pom.xml b/opendaylight/northbound/flowprogrammer/pom.xml index 0a873ca065..c7e9a771c1 100644 --- a/opendaylight/northbound/flowprogrammer/pom.xml +++ b/opendaylight/northbound/flowprogrammer/pom.xml @@ -24,7 +24,7 @@ 0.5.0-SNAPSHOT - + org.apache.felix maven-bundle-plugin @@ -43,7 +43,7 @@ org.opendaylight.controller.northbound.commons.utils, org.opendaylight.controller.sal.authorization, org.opendaylight.controller.usermanager, - com.sun.jersey.spi.container.servlet, + com.sun.jersey.spi.container.servlet, javax.ws.rs, javax.ws.rs.core, javax.xml.bind.annotation, @@ -70,7 +70,7 @@ org.opendaylight.controller switchmanager 0.4.0-SNAPSHOT - + org.opendaylight.controller forwardingrulesmanager @@ -87,10 +87,10 @@ ${enunciate.version} - org.opendaylight.controller - commons.northbound - 0.4.0-SNAPSHOT - + org.opendaylight.controller + commons.northbound + 0.4.0-SNAPSHOT + org.opendaylight.controller.thirdparty com.sun.jersey.jersey-servlet diff --git a/opendaylight/northbound/flowprogrammer/src/main/resources/WEB-INF/web.xml b/opendaylight/northbound/flowprogrammer/src/main/resources/WEB-INF/web.xml index 83f7e4b35d..4cedf2df89 100644 --- a/opendaylight/northbound/flowprogrammer/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/northbound/flowprogrammer/src/main/resources/WEB-INF/web.xml @@ -1,51 +1,51 @@ - - - JAXRSFlowProgrammer - com.sun.jersey.spi.container.servlet.ServletContainer - - javax.ws.rs.Application - org.opendaylight.controller.flowprogrammer.northbound.FlowProgrammerNorthboundRSApplication - - 1 - - - - JAXRSFlowProgrammer - /* - + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + + + JAXRSFlowProgrammer + com.sun.jersey.spi.container.servlet.ServletContainer + + javax.ws.rs.Application + org.opendaylight.controller.flowprogrammer.northbound.FlowProgrammerNorthboundRSApplication + + 1 + + + + JAXRSFlowProgrammer + /* + + + + + NB api + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + - - - NB api - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - - - - BASIC - opendaylight - + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + + + + BASIC + opendaylight + \ No newline at end of file diff --git a/opendaylight/northbound/hosttracker/enunciate.xml b/opendaylight/northbound/hosttracker/enunciate.xml index 8f0d7e6ab8..e0c7dcd2ac 100644 --- a/opendaylight/northbound/hosttracker/enunciate.xml +++ b/opendaylight/northbound/hosttracker/enunciate.xml @@ -1,7 +1,7 @@ - + diff --git a/opendaylight/northbound/hosttracker/pom.xml b/opendaylight/northbound/hosttracker/pom.xml index 853c54ec2c..f0caa52d63 100644 --- a/opendaylight/northbound/hosttracker/pom.xml +++ b/opendaylight/northbound/hosttracker/pom.xml @@ -24,7 +24,7 @@ 0.5.0-SNAPSHOT - + org.apache.felix maven-bundle-plugin diff --git a/opendaylight/northbound/hosttracker/src/main/resources/WEB-INF/web.xml b/opendaylight/northbound/hosttracker/src/main/resources/WEB-INF/web.xml index 7eb940875a..0fa8b95dd0 100644 --- a/opendaylight/northbound/hosttracker/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/northbound/hosttracker/src/main/resources/WEB-INF/web.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> JAXRSHostTracker com.sun.jersey.spi.container.servlet.ServletContainer @@ -17,34 +17,34 @@ /* - - - NB api - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - + + + NB api + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - BASIC - opendaylight - + + BASIC + opendaylight + \ No newline at end of file diff --git a/opendaylight/northbound/integrationtest/pom.xml b/opendaylight/northbound/integrationtest/pom.xml index aa4469e452..90acc8c59f 100644 --- a/opendaylight/northbound/integrationtest/pom.xml +++ b/opendaylight/northbound/integrationtest/pom.xml @@ -607,7 +607,7 @@ jersey-core ${jersey.version} - com.sun.jersey @@ -627,4 +627,3 @@ - diff --git a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java index 112725976f..103a515607 100644 --- a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java +++ b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java @@ -41,11 +41,9 @@ import org.opendaylight.controller.sal.core.UpdateType; import org.opendaylight.controller.switchmanager.IInventoryListener; import org.opendaylight.controller.usermanager.IUserManager; - @RunWith(PaxExam.class) public class NorthboundIT { - private Logger log = LoggerFactory - .getLogger(NorthboundIT.class); + private Logger log = LoggerFactory.getLogger(NorthboundIT.class); // get the OSGI bundle context @Inject private BundleContext bc; @@ -257,7 +255,157 @@ public class NorthboundIT { } @Test - public void testSwitchManager() { + public void testSubnetsNorthbound() throws JSONException { + String baseURL = "http://127.0.0.1:8080/controller/nb/v2/subnet/"; + + String name1 = "testSubnet1"; + String subnet1 = "1.1.1.1/24"; + String name2 = "testSubnet2"; + String subnet2 = "2.2.2.2/24"; + + // Test GET subnets in default container + String result = getJsonResult(baseURL + "default"); + JSONTokener jt = new JSONTokener(result); + JSONObject json = new JSONObject(jt); + Assert.assertEquals("{}", result); + + // Test GET subnet1 expecting 404 + result = getJsonResult(baseURL + "default/" + name1); + Assert.assertEquals(404, httpResponseCode.intValue()); + + // Test POST subnet1 + String queryParameter = new QueryParameter("subnetName", name1).add( + "subnet", subnet1).getString(); + result = getJsonResult(baseURL + "default/" + name1 + queryParameter, + "POST"); + Assert.assertEquals(201, httpResponseCode.intValue()); + + // Test GET subnet1 + result = getJsonResult(baseURL + "default/" + name1); + jt = new JSONTokener(result); + json = new JSONObject(jt); + Assert.assertEquals(200, httpResponseCode.intValue()); + Assert.assertEquals(name1, json.getString("@name")); + Assert.assertEquals(subnet1, json.getString("@subnet")); + + // Test POST subnet2 + queryParameter = new QueryParameter("subnetName", name2).add("subnet", + subnet2).getString(); + result = getJsonResult(baseURL + "default/" + name2 + queryParameter, + "POST"); + Assert.assertEquals(201, httpResponseCode.intValue()); + + // Test GET all subnets in default container + result = getJsonResult(baseURL + "default"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + JSONArray subnetConfigArray = json.getJSONArray("subnetConfig"); + JSONObject subnetConfig; + Assert.assertEquals(2, subnetConfigArray.length()); + for (int i = 0; i < subnetConfigArray.length(); i++) { + subnetConfig = subnetConfigArray.getJSONObject(i); + if (subnetConfig.getString("@name").equals(name1)) { + Assert.assertEquals(subnet1, subnetConfig.getString("@subnet")); + } else if (subnetConfig.getString("@name").equals(name2)) { + Assert.assertEquals(subnet2, subnetConfig.getString("@subnet")); + } else { + // Unexpected config name + Assert.assertTrue(false); + } + } + + // Test DELETE subnet1 + result = getJsonResult(baseURL + "default/" + name1, "DELETE"); + Assert.assertEquals(200, httpResponseCode.intValue()); + + // Test GET deleted subnet1 + result = getJsonResult(baseURL + "default/" + name1); + Assert.assertEquals(404, httpResponseCode.intValue()); + + } + + @Test + public void testStaticRoutingNorthbound() throws JSONException { + String baseURL = "http://127.0.0.1:8080/controller/nb/v2/staticroute/"; + + String name1 = "testRoute1"; + String prefix1 = "192.168.1.1/24"; + String nextHop1 = "0.0.0.0"; + String name2 = "testRoute2"; + String prefix2 = "192.168.1.1/16"; + String nextHop2 = "1.1.1.1"; + + // Test GET static routes in default container, expecting no results + String result = getJsonResult(baseURL + "default"); + JSONTokener jt = new JSONTokener(result); + JSONObject json = new JSONObject(jt); + Assert.assertEquals("{}", result); + + // Test insert static route + String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\"" + + prefix1 + "\", \"nextHop\":\"" + nextHop1 + "\"}"; + result = getJsonResult(baseURL + "default/" + name1, "POST", + requestBody); + Assert.assertEquals(201, httpResponseCode.intValue()); + + requestBody = "{\"name\":\"" + name2 + "\", \"prefix\":\"" + prefix2 + + "\", \"nextHop\":\"" + nextHop2 + "\"}"; + result = getJsonResult(baseURL + "default/" + name2, "POST", + requestBody); + Assert.assertEquals(201, httpResponseCode.intValue()); + + // Test Get all static routes + result = getJsonResult(baseURL + "default"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + JSONArray staticRoutes = json.getJSONArray("staticRoute"); + Assert.assertEquals(2, staticRoutes.length()); + JSONObject route; + for (int i = 0; i < staticRoutes.length(); i++) { + route = staticRoutes.getJSONObject(i); + if (route.getString("name").equals(name1)) { + Assert.assertEquals(prefix1, route.getString("prefix")); + Assert.assertEquals(nextHop1, route.getString("nextHop")); + } else if (route.getString("name").equals(name2)) { + Assert.assertEquals(prefix2, route.getString("prefix")); + Assert.assertEquals(nextHop2, route.getString("nextHop")); + } else { + // static route has unknown name + Assert.assertTrue(false); + } + } + + // Test get specific static route + result = getJsonResult(baseURL + "default/" + name1); + jt = new JSONTokener(result); + json = new JSONObject(jt); + + Assert.assertEquals(name1, json.getString("name")); + Assert.assertEquals(prefix1, json.getString("prefix")); + Assert.assertEquals(nextHop1, json.getString("nextHop")); + + result = getJsonResult(baseURL + "default/" + name2); + jt = new JSONTokener(result); + json = new JSONObject(jt); + + Assert.assertEquals(name2, json.getString("name")); + Assert.assertEquals(prefix2, json.getString("prefix")); + Assert.assertEquals(nextHop2, json.getString("nextHop")); + + // Test delete static route + result = getJsonResult(baseURL + "default/" + name1, "DELETE"); + Assert.assertEquals(200, httpResponseCode.intValue()); + + result = getJsonResult(baseURL + "default"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + JSONObject singleStaticRoute = json.getJSONObject("staticRoute"); + Assert.assertEquals(name2, singleStaticRoute.getString("name")); + + } + + @Test + public void testSwitchManager() throws JSONException { String baseURL = "http://127.0.0.1:8080/controller/nb/v2/switch/default/"; // define Node/NodeConnector attributes for test @@ -280,203 +428,166 @@ public class NorthboundIT { int ncBandwidth = 1000000000; // Test GET all nodes - try { - String result = getJsonResult(baseURL + "nodes"); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - - // Test for first node - JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1); - Assert.assertNotNull(node); - testNodeProperties(node, nodeId_1, nodeType, timestamp_1, - timestampName_1, actionsValue_1, capabilitiesValue_1, - tablesValue_1, buffersValue_1); - - // Test 2nd node, properties of 2nd node same as first node - node = getJsonInstance(json, "nodeProperties", nodeId_2); - Assert.assertNotNull(node); - testNodeProperties(node, nodeId_2, nodeType, timestamp_1, - timestampName_1, actionsValue_1, capabilitiesValue_1, - tablesValue_1, buffersValue_1); - - // Test 3rd node, properties of 3rd node same as first node - node = getJsonInstance(json, "nodeProperties", nodeId_3); - Assert.assertNotNull(node); - testNodeProperties(node, nodeId_3, nodeType, timestamp_1, - timestampName_1, actionsValue_1, capabilitiesValue_1, - tablesValue_1, buffersValue_1); - } catch (Exception e) { - Assert.assertTrue(false); - } + String result = getJsonResult(baseURL + "nodes"); + JSONTokener jt = new JSONTokener(result); + JSONObject json = new JSONObject(jt); + + // Test for first node + JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1); + Assert.assertNotNull(node); + testNodeProperties(node, nodeId_1, nodeType, timestamp_1, + timestampName_1, actionsValue_1, capabilitiesValue_1, + tablesValue_1, buffersValue_1); + + // Test 2nd node, properties of 2nd node same as first node + node = getJsonInstance(json, "nodeProperties", nodeId_2); + Assert.assertNotNull(node); + testNodeProperties(node, nodeId_2, nodeType, timestamp_1, + timestampName_1, actionsValue_1, capabilitiesValue_1, + tablesValue_1, buffersValue_1); + + // Test 3rd node, properties of 3rd node same as first node + node = getJsonInstance(json, "nodeProperties", nodeId_3); + Assert.assertNotNull(node); + testNodeProperties(node, nodeId_3, nodeType, timestamp_1, + timestampName_1, actionsValue_1, capabilitiesValue_1, + tablesValue_1, buffersValue_1); // Test GET nodeConnectors of a node - try { - //Test first node - String result = getJsonResult(baseURL + "node/STUB/" + nodeId_1); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - JSONObject nodeConnectorProperties = json - .getJSONObject("nodeConnectorProperties"); - - testNodeConnectorProperties(nodeConnectorProperties, - nodeConnectorId_1, ncType, nodeId_1, nodeType, ncState, - ncCapabilities, ncBandwidth); - - //Test second node - result = getJsonResult(baseURL + "node/STUB/" + nodeId_2); - jt = new JSONTokener(result); - json = new JSONObject(jt); - nodeConnectorProperties = json - .getJSONObject("nodeConnectorProperties"); - - testNodeConnectorProperties(nodeConnectorProperties, - nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState, - ncCapabilities, ncBandwidth); - - //Test third node - result = getJsonResult(baseURL + "node/STUB/" + nodeId_3); - jt = new JSONTokener(result); - json = new JSONObject(jt); - - nodeConnectorProperties = json - .getJSONObject("nodeConnectorProperties"); - testNodeConnectorProperties(nodeConnectorProperties, - nodeConnectorId_3, ncType, nodeId_3, nodeType, ncState, - ncCapabilities, ncBandwidth); - - } catch (Exception e) { - Assert.assertTrue(false); - } + // Test first node + result = getJsonResult(baseURL + "node/STUB/" + nodeId_1); + jt = new JSONTokener(result); + json = new JSONObject(jt); + JSONObject nodeConnectorProperties = json + .getJSONObject("nodeConnectorProperties"); + + testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, + ncType, nodeId_1, nodeType, ncState, ncCapabilities, + ncBandwidth); + + // Test second node + result = getJsonResult(baseURL + "node/STUB/" + nodeId_2); + jt = new JSONTokener(result); + json = new JSONObject(jt); + nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties"); + + testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, + ncType, nodeId_2, nodeType, ncState, ncCapabilities, + ncBandwidth); + + // Test third node + result = getJsonResult(baseURL + "node/STUB/" + nodeId_3); + jt = new JSONTokener(result); + json = new JSONObject(jt); + + nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties"); + testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3, + ncType, nodeId_3, nodeType, ncState, ncCapabilities, + ncBandwidth); // Test delete node property - try { - // Delete timestamp property from node1 - String result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 - + "/property/timeStamp", "DELETE"); - Assert.assertEquals(200, httpResponseCode.intValue()); - - // Check node1 - result = getJsonResult(baseURL + "nodes"); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1); - Assert.assertNotNull(node); - testNodeProperties(node, nodeId_1, nodeType, null, null, - actionsValue_1, capabilitiesValue_1, tablesValue_1, - buffersValue_1); - - // Delete actions property from node2 - result = getJsonResult(baseURL + "node/STUB/" + nodeId_2 - + "/property/actions", "DELETE"); - Assert.assertEquals(200, httpResponseCode.intValue()); - - // Check node2 - result = getJsonResult(baseURL + "nodes"); - jt = new JSONTokener(result); - json = new JSONObject(jt); - node = getJsonInstance(json, "nodeProperties", nodeId_2); - Assert.assertNotNull(node); - testNodeProperties(node, nodeId_2, nodeType, timestamp_1, - timestampName_1, null, capabilitiesValue_1, tablesValue_1, - buffersValue_1); - - } catch (Exception e) { - Assert.assertTrue(false); - } + // Delete timestamp property from node1 + result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + + "/property/timeStamp", "DELETE"); + Assert.assertEquals(200, httpResponseCode.intValue()); + + // Check node1 + result = getJsonResult(baseURL + "nodes"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + node = getJsonInstance(json, "nodeProperties", nodeId_1); + Assert.assertNotNull(node); + testNodeProperties(node, nodeId_1, nodeType, null, null, + actionsValue_1, capabilitiesValue_1, tablesValue_1, + buffersValue_1); + + // Delete actions property from node2 + result = getJsonResult(baseURL + "node/STUB/" + nodeId_2 + + "/property/actions", "DELETE"); + Assert.assertEquals(200, httpResponseCode.intValue()); + + // Check node2 + result = getJsonResult(baseURL + "nodes"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + node = getJsonInstance(json, "nodeProperties", nodeId_2); + Assert.assertNotNull(node); + testNodeProperties(node, nodeId_2, nodeType, timestamp_1, + timestampName_1, null, capabilitiesValue_1, tablesValue_1, + buffersValue_1); // Test add property to node - try { - // Add Tier and Bandwidth property to node1 - String result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 - + "/property/tier/1001", "PUT"); - Assert.assertEquals(201, httpResponseCode.intValue()); - result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 - + "/property/bandwidth/1002", "PUT"); - Assert.assertEquals(201, httpResponseCode.intValue()); - - // Test for first node - result = getJsonResult(baseURL + "nodes"); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1); - Assert.assertNotNull(node); - Assert.assertEquals(1001, node.getJSONObject("properties") - .getJSONObject("tier").getInt("tierValue")); - Assert.assertEquals(1002, node.getJSONObject("properties") - .getJSONObject("bandwidth").getInt("bandwidthValue")); - - } catch (Exception e) { - Assert.assertTrue(false); - } + // Add Tier and Bandwidth property to node1 + result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + + "/property/tier/1001", "PUT"); + Assert.assertEquals(201, httpResponseCode.intValue()); + result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + + "/property/bandwidth/1002", "PUT"); + Assert.assertEquals(201, httpResponseCode.intValue()); + + // Test for first node + result = getJsonResult(baseURL + "nodes"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + node = getJsonInstance(json, "nodeProperties", nodeId_1); + Assert.assertNotNull(node); + Assert.assertEquals(1001, node.getJSONObject("properties") + .getJSONObject("tier").getInt("tierValue")); + Assert.assertEquals(1002, node.getJSONObject("properties") + .getJSONObject("bandwidth").getInt("bandwidthValue")); // Test delete nodeConnector property - try { - // Delete state property of nodeconnector1 - String result = getJsonResult(baseURL + "nodeconnector/STUB/" - + nodeId_1 + "/STUB/" + nodeConnectorId_1 - + "/property/state", "DELETE"); - Assert.assertEquals(200, httpResponseCode.intValue()); - - result = getJsonResult(baseURL + "node/STUB/" + nodeId_1); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - JSONObject nodeConnectorProperties = json - .getJSONObject("nodeConnectorProperties"); - - testNodeConnectorProperties(nodeConnectorProperties, - nodeConnectorId_1, ncType, nodeId_1, nodeType, null, - ncCapabilities, ncBandwidth); - - // Delete capabilities property of nodeconnector2 - result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2 - + "/STUB/" + nodeConnectorId_2 + "/property/capabilities", - "DELETE"); - Assert.assertEquals(200, httpResponseCode.intValue()); - - result = getJsonResult(baseURL + "node/STUB/" + nodeId_2); - jt = new JSONTokener(result); - json = new JSONObject(jt); - nodeConnectorProperties = json - .getJSONObject("nodeConnectorProperties"); - - testNodeConnectorProperties(nodeConnectorProperties, - nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState, - null, ncBandwidth); + // Delete state property of nodeconnector1 + result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1 + + "/STUB/" + nodeConnectorId_1 + "/property/state", "DELETE"); + Assert.assertEquals(200, httpResponseCode.intValue()); - } catch (Exception e) { - Assert.assertTrue(false); - } + result = getJsonResult(baseURL + "node/STUB/" + nodeId_1); + jt = new JSONTokener(result); + json = new JSONObject(jt); + nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties"); + + testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, + ncType, nodeId_1, nodeType, null, ncCapabilities, ncBandwidth); + + // Delete capabilities property of nodeconnector2 + result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2 + + "/STUB/" + nodeConnectorId_2 + "/property/capabilities", + "DELETE"); + Assert.assertEquals(200, httpResponseCode.intValue()); + + result = getJsonResult(baseURL + "node/STUB/" + nodeId_2); + jt = new JSONTokener(result); + json = new JSONObject(jt); + nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties"); + + testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, + ncType, nodeId_2, nodeType, ncState, null, ncBandwidth); // Test PUT nodeConnector property - try { - int newBandwidth = 1001; - - // Add Name/Bandwidth property to nodeConnector1 - String result = getJsonResult(baseURL + "nodeconnector/STUB/" - + nodeId_1 + "/STUB/" + nodeConnectorId_1 - + "/property/bandwidth/" + newBandwidth, "PUT"); - Assert.assertEquals(201, httpResponseCode.intValue()); - - result = getJsonResult(baseURL + "node/STUB/" + nodeId_1); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - JSONObject nodeConnectorProperties = json - .getJSONObject("nodeConnectorProperties"); - - // Check for new bandwidth value, state value removed from previous - // test - testNodeConnectorProperties(nodeConnectorProperties, - nodeConnectorId_1, ncType, nodeId_1, nodeType, null, - ncCapabilities, newBandwidth); + int newBandwidth = 1001; + + // Add Name/Bandwidth property to nodeConnector1 + result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1 + + "/STUB/" + nodeConnectorId_1 + "/property/bandwidth/" + + newBandwidth, "PUT"); + Assert.assertEquals(201, httpResponseCode.intValue()); + + result = getJsonResult(baseURL + "node/STUB/" + nodeId_1); + jt = new JSONTokener(result); + json = new JSONObject(jt); + nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties"); + + // Check for new bandwidth value, state value removed from previous + // test + testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, + ncType, nodeId_1, nodeType, null, ncCapabilities, newBandwidth); - } catch (Exception e) { - Assert.assertTrue(false); - } } @Test - public void testStatistics() { + public void testStatistics() throws JSONException { String actionTypes[] = { "drop", "loopback", "flood", "floodAll", "controller", "swPath", "hwPath", "output", "setDlSrc", "setDlDst", "setDlType", "setVlanId", "setVlanPcp", @@ -485,262 +596,247 @@ public class NorthboundIT { System.out.println("Starting Statistics JAXB client."); String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/"; - try { - String result = getJsonResult(baseURL + "flowstats"); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - JSONObject flowStatistics = getJsonInstance(json, "flowStatistics", - 0xCAFE); - JSONObject node = flowStatistics.getJSONObject("node"); - // test that node was returned properly - Assert.assertTrue(node.getInt("@id") == 0xCAFE); - Assert.assertTrue(node.getString("@type").equals("STUB")); - - // test that flow statistics results are correct - JSONArray flowStats = flowStatistics.getJSONArray("flowStat"); - for (int i = 0; i < flowStats.length(); i++) { - - JSONObject flowStat = flowStats.getJSONObject(i); - testFlowStat(flowStat, actionTypes[i]); - } + String result = getJsonResult(baseURL + "flowstats"); + JSONTokener jt = new JSONTokener(result); + JSONObject json = new JSONObject(jt); + JSONObject flowStatistics = getJsonInstance(json, "flowStatistics", + 0xCAFE); + JSONObject node = flowStatistics.getJSONObject("node"); + // test that node was returned properly + Assert.assertTrue(node.getInt("@id") == 0xCAFE); + Assert.assertTrue(node.getString("@type").equals("STUB")); - // for /controller/nb/v2/statistics/default/portstats - result = getJsonResult(baseURL + "portstats"); - jt = new JSONTokener(result); - json = new JSONObject(jt); - JSONObject portStatistics = getJsonInstance(json, "portStatistics", - 0xCAFE); - JSONObject node2 = portStatistics.getJSONObject("node"); - // test that node was returned properly - Assert.assertTrue(node2.getInt("@id") == 0xCAFE); - Assert.assertTrue(node2.getString("@type").equals("STUB")); - - // test that port statistic results are correct - JSONObject portStat = portStatistics.getJSONObject("portStat"); - Assert.assertTrue(portStat.getInt("receivePackets") == 250); - Assert.assertTrue(portStat.getInt("transmitPackets") == 500); - Assert.assertTrue(portStat.getInt("receiveBytes") == 1000); - Assert.assertTrue(portStat.getInt("transmitBytes") == 5000); - Assert.assertTrue(portStat.getInt("receiveDrops") == 2); - Assert.assertTrue(portStat.getInt("transmitDrops") == 50); - Assert.assertTrue(portStat.getInt("receiveErrors") == 3); - Assert.assertTrue(portStat.getInt("transmitErrors") == 10); - Assert.assertTrue(portStat.getInt("receiveFrameError") == 5); - Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6); - Assert.assertTrue(portStat.getInt("receiveCrcError") == 1); - Assert.assertTrue(portStat.getInt("collisionCount") == 4); - - // test for getting one specific node's stats - result = getJsonResult(baseURL + "flowstats/STUB/51966"); - jt = new JSONTokener(result); - json = new JSONObject(jt); - node = json.getJSONObject("node"); - // test that node was returned properly - Assert.assertTrue(node.getInt("@id") == 0xCAFE); - Assert.assertTrue(node.getString("@type").equals("STUB")); - - // test that flow statistics results are correct - flowStats = json.getJSONArray("flowStat"); - for (int i = 0; i < flowStats.length(); i++) { - JSONObject flowStat = flowStats.getJSONObject(i); - testFlowStat(flowStat, actionTypes[i]); - } + // test that flow statistics results are correct + JSONArray flowStats = flowStatistics.getJSONArray("flowStat"); + for (int i = 0; i < flowStats.length(); i++) { - result = getJsonResult(baseURL + "portstats/STUB/51966"); - jt = new JSONTokener(result); - json = new JSONObject(jt); - node2 = json.getJSONObject("node"); - // test that node was returned properly - Assert.assertTrue(node2.getInt("@id") == 0xCAFE); - Assert.assertTrue(node2.getString("@type").equals("STUB")); - - // test that port statistic results are correct - portStat = json.getJSONObject("portStat"); - Assert.assertTrue(portStat.getInt("receivePackets") == 250); - Assert.assertTrue(portStat.getInt("transmitPackets") == 500); - Assert.assertTrue(portStat.getInt("receiveBytes") == 1000); - Assert.assertTrue(portStat.getInt("transmitBytes") == 5000); - Assert.assertTrue(portStat.getInt("receiveDrops") == 2); - Assert.assertTrue(portStat.getInt("transmitDrops") == 50); - Assert.assertTrue(portStat.getInt("receiveErrors") == 3); - Assert.assertTrue(portStat.getInt("transmitErrors") == 10); - Assert.assertTrue(portStat.getInt("receiveFrameError") == 5); - Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6); - Assert.assertTrue(portStat.getInt("receiveCrcError") == 1); - Assert.assertTrue(portStat.getInt("collisionCount") == 4); + JSONObject flowStat = flowStats.getJSONObject(i); + testFlowStat(flowStat, actionTypes[i]); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); + } + // for /controller/nb/v2/statistics/default/portstats + result = getJsonResult(baseURL + "portstats"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + JSONObject portStatistics = getJsonInstance(json, "portStatistics", + 0xCAFE); + JSONObject node2 = portStatistics.getJSONObject("node"); + // test that node was returned properly + Assert.assertTrue(node2.getInt("@id") == 0xCAFE); + Assert.assertTrue(node2.getString("@type").equals("STUB")); + + // test that port statistic results are correct + JSONObject portStat = portStatistics.getJSONObject("portStat"); + Assert.assertTrue(portStat.getInt("receivePackets") == 250); + Assert.assertTrue(portStat.getInt("transmitPackets") == 500); + Assert.assertTrue(portStat.getInt("receiveBytes") == 1000); + Assert.assertTrue(portStat.getInt("transmitBytes") == 5000); + Assert.assertTrue(portStat.getInt("receiveDrops") == 2); + Assert.assertTrue(portStat.getInt("transmitDrops") == 50); + Assert.assertTrue(portStat.getInt("receiveErrors") == 3); + Assert.assertTrue(portStat.getInt("transmitErrors") == 10); + Assert.assertTrue(portStat.getInt("receiveFrameError") == 5); + Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6); + Assert.assertTrue(portStat.getInt("receiveCrcError") == 1); + Assert.assertTrue(portStat.getInt("collisionCount") == 4); + + // test for getting one specific node's stats + result = getJsonResult(baseURL + "flowstats/STUB/51966"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + node = json.getJSONObject("node"); + // test that node was returned properly + Assert.assertTrue(node.getInt("@id") == 0xCAFE); + Assert.assertTrue(node.getString("@type").equals("STUB")); + + // test that flow statistics results are correct + flowStats = json.getJSONArray("flowStat"); + for (int i = 0; i < flowStats.length(); i++) { + JSONObject flowStat = flowStats.getJSONObject(i); + testFlowStat(flowStat, actionTypes[i]); } + + result = getJsonResult(baseURL + "portstats/STUB/51966"); + jt = new JSONTokener(result); + json = new JSONObject(jt); + node2 = json.getJSONObject("node"); + // test that node was returned properly + Assert.assertTrue(node2.getInt("@id") == 0xCAFE); + Assert.assertTrue(node2.getString("@type").equals("STUB")); + + // test that port statistic results are correct + portStat = json.getJSONObject("portStat"); + Assert.assertTrue(portStat.getInt("receivePackets") == 250); + Assert.assertTrue(portStat.getInt("transmitPackets") == 500); + Assert.assertTrue(portStat.getInt("receiveBytes") == 1000); + Assert.assertTrue(portStat.getInt("transmitBytes") == 5000); + Assert.assertTrue(portStat.getInt("receiveDrops") == 2); + Assert.assertTrue(portStat.getInt("transmitDrops") == 50); + Assert.assertTrue(portStat.getInt("receiveErrors") == 3); + Assert.assertTrue(portStat.getInt("transmitErrors") == 10); + Assert.assertTrue(portStat.getInt("receiveFrameError") == 5); + Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6); + Assert.assertTrue(portStat.getInt("receiveCrcError") == 1); + Assert.assertTrue(portStat.getInt("collisionCount") == 4); } - private void testFlowStat(JSONObject flowStat, String actionType) { - try { - Assert.assertTrue(flowStat.getInt("tableId") == 1); - Assert.assertTrue(flowStat.getInt("durationSeconds") == 40); - Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400); - Assert.assertTrue(flowStat.getInt("packetCount") == 200); - Assert.assertTrue(flowStat.getInt("byteCount") == 100); - - // test that flow information is correct - JSONObject flow = flowStat.getJSONObject("flow"); - Assert.assertTrue(flow.getInt("priority") == 3500); - Assert.assertTrue(flow.getInt("idleTimeout") == 1000); - Assert.assertTrue(flow.getInt("hardTimeout") == 2000); - Assert.assertTrue(flow.getInt("id") == 12345); - - JSONObject match = (flow.getJSONObject("match") - .getJSONObject("matchField")); - Assert.assertTrue(match.getString("type").equals("NW_DST")); - Assert.assertTrue(match.getString("value").equals("1.1.1.1")); - - JSONObject act = flow.getJSONObject("actions"); - Assert.assertTrue(act.getString("@type").equals(actionType)); - - if (act.getString("@type").equals("output")) { - JSONObject port = act.getJSONObject("port"); - JSONObject port_node = port.getJSONObject("node"); - Assert.assertTrue(port.getInt("@id") == 51966); - Assert.assertTrue(port.getString("@type").equals("STUB")); - Assert.assertTrue(port_node.getInt("@id") == 51966); - Assert.assertTrue(port_node.getString("@type").equals("STUB")); - } + private void testFlowStat(JSONObject flowStat, String actionType) + throws JSONException { + Assert.assertTrue(flowStat.getInt("tableId") == 1); + Assert.assertTrue(flowStat.getInt("durationSeconds") == 40); + Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400); + Assert.assertTrue(flowStat.getInt("packetCount") == 200); + Assert.assertTrue(flowStat.getInt("byteCount") == 100); + + // test that flow information is correct + JSONObject flow = flowStat.getJSONObject("flow"); + Assert.assertTrue(flow.getInt("priority") == 3500); + Assert.assertTrue(flow.getInt("idleTimeout") == 1000); + Assert.assertTrue(flow.getInt("hardTimeout") == 2000); + Assert.assertTrue(flow.getInt("id") == 12345); + + JSONObject match = (flow.getJSONObject("match") + .getJSONObject("matchField")); + Assert.assertTrue(match.getString("type").equals("NW_DST")); + Assert.assertTrue(match.getString("value").equals("1.1.1.1")); + + JSONObject act = flow.getJSONObject("actions"); + Assert.assertTrue(act.getString("@type").equals(actionType)); + + if (act.getString("@type").equals("output")) { + JSONObject port = act.getJSONObject("port"); + JSONObject port_node = port.getJSONObject("node"); + Assert.assertTrue(port.getInt("@id") == 51966); + Assert.assertTrue(port.getString("@type").equals("STUB")); + Assert.assertTrue(port_node.getInt("@id") == 51966); + Assert.assertTrue(port_node.getString("@type").equals("STUB")); + } - if (act.getString("@type").equals("setDlSrc")) { - byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, - (byte) 1 }; - String src = act.getString("address"); - byte srcBytes[] = new byte[5]; - srcBytes[0] = Byte.parseByte(src.substring(0, 2)); - srcBytes[1] = Byte.parseByte(src.substring(2, 4)); - srcBytes[2] = Byte.parseByte(src.substring(4, 6)); - srcBytes[3] = Byte.parseByte(src.substring(6, 8)); - srcBytes[4] = Byte.parseByte(src.substring(8, 10)); - Assert.assertTrue(Arrays.equals(srcBytes, srcMatch)); - } + if (act.getString("@type").equals("setDlSrc")) { + byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, + (byte) 1 }; + String src = act.getString("address"); + byte srcBytes[] = new byte[5]; + srcBytes[0] = Byte.parseByte(src.substring(0, 2)); + srcBytes[1] = Byte.parseByte(src.substring(2, 4)); + srcBytes[2] = Byte.parseByte(src.substring(4, 6)); + srcBytes[3] = Byte.parseByte(src.substring(6, 8)); + srcBytes[4] = Byte.parseByte(src.substring(8, 10)); + Assert.assertTrue(Arrays.equals(srcBytes, srcMatch)); + } - if (act.getString("@type").equals("setDlDst")) { - byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, - (byte) 5 }; - String dst = act.getString("address"); - byte dstBytes[] = new byte[5]; - dstBytes[0] = Byte.parseByte(dst.substring(0, 2)); - dstBytes[1] = Byte.parseByte(dst.substring(2, 4)); - dstBytes[2] = Byte.parseByte(dst.substring(4, 6)); - dstBytes[3] = Byte.parseByte(dst.substring(6, 8)); - dstBytes[4] = Byte.parseByte(dst.substring(8, 10)); - Assert.assertTrue(Arrays.equals(dstBytes, dstMatch)); - } - if (act.getString("@type").equals("setDlType")) - Assert.assertTrue(act.getInt("dlType") == 10); - if (act.getString("@type").equals("setVlanId")) - Assert.assertTrue(act.getInt("vlanId") == 2); - if (act.getString("@type").equals("setVlanPcp")) - Assert.assertTrue(act.getInt("pcp") == 3); - if (act.getString("@type").equals("setVlanCfi")) - Assert.assertTrue(act.getInt("cfi") == 1); - - if (act.getString("@type").equals("setNwSrc")) - Assert.assertTrue(act.getString("address").equals("2.2.2.2")); - if (act.getString("@type").equals("setNwDst")) - Assert.assertTrue(act.getString("address").equals("1.1.1.1")); - - if (act.getString("@type").equals("pushVlan")) { - int head = act.getInt("VlanHeader"); - // parsing vlan header - int id = head & 0xfff; - int cfi = (head >> 12) & 0x1; - int pcp = (head >> 13) & 0x7; - int tag = (head >> 16) & 0xffff; - Assert.assertTrue(id == 1234); - Assert.assertTrue(cfi == 1); - Assert.assertTrue(pcp == 1); - Assert.assertTrue(tag == 0x8100); - } - if (act.getString("@type").equals("setNwTos")) - Assert.assertTrue(act.getInt("tos") == 16); - if (act.getString("@type").equals("setTpSrc")) - Assert.assertTrue(act.getInt("port") == 4201); - if (act.getString("@type").equals("setTpDst")) - Assert.assertTrue(act.getInt("port") == 8080); - } catch (Exception e) { - Assert.assertTrue(false); + if (act.getString("@type").equals("setDlDst")) { + byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, + (byte) 5 }; + String dst = act.getString("address"); + byte dstBytes[] = new byte[5]; + dstBytes[0] = Byte.parseByte(dst.substring(0, 2)); + dstBytes[1] = Byte.parseByte(dst.substring(2, 4)); + dstBytes[2] = Byte.parseByte(dst.substring(4, 6)); + dstBytes[3] = Byte.parseByte(dst.substring(6, 8)); + dstBytes[4] = Byte.parseByte(dst.substring(8, 10)); + Assert.assertTrue(Arrays.equals(dstBytes, dstMatch)); + } + if (act.getString("@type").equals("setDlType")) + Assert.assertTrue(act.getInt("dlType") == 10); + if (act.getString("@type").equals("setVlanId")) + Assert.assertTrue(act.getInt("vlanId") == 2); + if (act.getString("@type").equals("setVlanPcp")) + Assert.assertTrue(act.getInt("pcp") == 3); + if (act.getString("@type").equals("setVlanCfi")) + Assert.assertTrue(act.getInt("cfi") == 1); + + if (act.getString("@type").equals("setNwSrc")) + Assert.assertTrue(act.getString("address").equals("2.2.2.2")); + if (act.getString("@type").equals("setNwDst")) + Assert.assertTrue(act.getString("address").equals("1.1.1.1")); + + if (act.getString("@type").equals("pushVlan")) { + int head = act.getInt("VlanHeader"); + // parsing vlan header + int id = head & 0xfff; + int cfi = (head >> 12) & 0x1; + int pcp = (head >> 13) & 0x7; + int tag = (head >> 16) & 0xffff; + Assert.assertTrue(id == 1234); + Assert.assertTrue(cfi == 1); + Assert.assertTrue(pcp == 1); + Assert.assertTrue(tag == 0x8100); } + if (act.getString("@type").equals("setNwTos")) + Assert.assertTrue(act.getInt("tos") == 16); + if (act.getString("@type").equals("setTpSrc")) + Assert.assertTrue(act.getInt("port") == 4201); + if (act.getString("@type").equals("setTpDst")) + Assert.assertTrue(act.getInt("port") == 8080); } @Test - public void testFlowProgrammer() { - try { - String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flow/default/"; - // Attempt to get a flow that doesn't exit. Should return 404 - // status. - String result = getJsonResult(baseURL + "STUB/51966/test1", "GET"); - Assert.assertTrue(result.equals("404")); - - // test add flow1 - String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; - result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc); - Assert.assertTrue(httpResponseCode == 201); - - // test get returns flow that was added. - result = getJsonResult(baseURL + "STUB/51966/test1", "GET"); - // check that result came out fine. - Assert.assertTrue(httpResponseCode == 200); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - Assert.assertTrue(json.getString("name").equals("test1")); - Assert.assertTrue(json.getString("actions").equals("DROP")); - Assert.assertTrue(json.getString("installInHw").equals("true")); - JSONObject node = json.getJSONObject("node"); - Assert.assertTrue(node.getString("@type").equals("STUB")); - Assert.assertTrue(node.getString("@id").equals("51966")); - // test adding same flow again fails due to repeat name..return 409 - // code - result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc); - Assert.assertTrue(result.equals("409")); - - fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; - result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc); - // test should return 500 for error due to same flow being added. - Assert.assertTrue(result.equals("500")); - - // add second flow that's different - 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); - json = new JSONObject(jt); - Assert.assertTrue(json.get("flowConfig") instanceof JSONArray); - JSONArray ja = json.getJSONArray("flowConfig"); - Integer count = ja.length(); - Assert.assertTrue(count == 2); - - // check that request returns both flows given just container. - result = getJsonResult(baseURL); - jt = new JSONTokener(result); - json = new JSONObject(jt); - Assert.assertTrue(json.get("flowConfig") instanceof JSONArray); - ja = json.getJSONArray("flowConfig"); - count = ja.length(); - Assert.assertTrue(count == 2); - - // delete a flow, check that it's no longer in list. - result = getJsonResult(baseURL + "STUB/51966/test2", "DELETE"); - Assert.assertTrue(httpResponseCode == 200); - - result = getJsonResult(baseURL + "STUB/51966/test2", "GET"); - Assert.assertTrue(result.equals("404")); - - } catch (Exception e) { - Assert.assertTrue(false); - } - + public void testFlowProgrammer() throws JSONException { + String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flow/default/"; + // Attempt to get a flow that doesn't exit. Should return 404 + // status. + String result = getJsonResult(baseURL + "STUB/51966/test1", "GET"); + Assert.assertTrue(result.equals("404")); + + // test add flow1 + String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; + result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc); + Assert.assertTrue(httpResponseCode == 201); + + // test get returns flow that was added. + result = getJsonResult(baseURL + "STUB/51966/test1", "GET"); + // check that result came out fine. + Assert.assertTrue(httpResponseCode == 200); + JSONTokener jt = new JSONTokener(result); + JSONObject json = new JSONObject(jt); + Assert.assertTrue(json.getString("name").equals("test1")); + Assert.assertTrue(json.getString("actions").equals("DROP")); + Assert.assertTrue(json.getString("installInHw").equals("true")); + JSONObject node = json.getJSONObject("node"); + Assert.assertTrue(node.getString("@type").equals("STUB")); + Assert.assertTrue(node.getString("@id").equals("51966")); + // test adding same flow again fails due to repeat name..return 409 + // code + result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc); + Assert.assertTrue(result.equals("409")); + + fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; + result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc); + // test should return 500 for error due to same flow being added. + Assert.assertTrue(result.equals("500")); + + // add second flow that's different + 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); + json = new JSONObject(jt); + Assert.assertTrue(json.get("flowConfig") instanceof JSONArray); + JSONArray ja = json.getJSONArray("flowConfig"); + Integer count = ja.length(); + Assert.assertTrue(count == 2); + + // check that request returns both flows given just container. + result = getJsonResult(baseURL); + jt = new JSONTokener(result); + json = new JSONObject(jt); + Assert.assertTrue(json.get("flowConfig") instanceof JSONArray); + ja = json.getJSONArray("flowConfig"); + count = ja.length(); + Assert.assertTrue(count == 2); + + // delete a flow, check that it's no longer in list. + result = getJsonResult(baseURL + "STUB/51966/test2", "DELETE"); + Assert.assertTrue(httpResponseCode == 200); + + result = getJsonResult(baseURL + "STUB/51966/test2", "GET"); + Assert.assertTrue(result.equals("404")); } // method to extract a JSONObject with specified node ID from a JSONObject @@ -792,7 +888,7 @@ public class NorthboundIT { } @Test - public void testHostTracker() { + public void testHostTracker() throws JSONException { System.out.println("Starting HostTracker JAXB client."); @@ -818,34 +914,29 @@ public class NorthboundIT { String baseURL = "http://127.0.0.1:8080/controller/nb/v2/host/default"; // test POST method: addHost() - try { - String queryParameter = new QueryParameter("dataLayerAddress", - dataLayerAddress_1).add("nodeType", nodeType_1) - .add("nodeId", nodeId_1.toString()) - .add("nodeConnectorType", nodeConnectorType_1) - .add("nodeConnectorId", nodeConnectorId_1.toString()) - .add("vlan", vlan_1).getString(); - - String result = getJsonResult(baseURL + "/" + networkAddress_1 - + queryParameter, "POST"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201); - - // vlan is not passed through query parameter but should be - // defaulted to "0" - queryParameter = new QueryParameter("dataLayerAddress", - dataLayerAddress_2).add("nodeType", nodeType_2) - .add("nodeId", nodeId_2.toString()) - .add("nodeConnectorType", nodeConnectorType_2) - .add("nodeConnectorId", nodeConnectorId_2.toString()) - .getString(); - - result = getJsonResult(baseURL + "/" + networkAddress_2 - + queryParameter, "POST"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); - } + String queryParameter = new QueryParameter("dataLayerAddress", + dataLayerAddress_1).add("nodeType", nodeType_1) + .add("nodeId", nodeId_1.toString()) + .add("nodeConnectorType", nodeConnectorType_1) + .add("nodeConnectorId", nodeConnectorId_1.toString()) + .add("vlan", vlan_1).getString(); + + String result = getJsonResult(baseURL + "/" + networkAddress_1 + + queryParameter, "POST"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201); + + // vlan is not passed through query parameter but should be + // defaulted to "0" + queryParameter = new QueryParameter("dataLayerAddress", + dataLayerAddress_2).add("nodeType", nodeType_2) + .add("nodeId", nodeId_2.toString()) + .add("nodeConnectorType", nodeConnectorType_2) + .add("nodeConnectorId", nodeConnectorId_2.toString()) + .getString(); + + result = getJsonResult(baseURL + "/" + networkAddress_2 + + queryParameter, "POST"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201); // define variables for decoding returned strings String networkAddress; @@ -853,69 +944,59 @@ public class NorthboundIT { // the two hosts should be in inactive host DB // test GET method: getInactiveHosts() - try { - String result = getJsonResult(baseURL + "/inactive", "GET"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); + result = getJsonResult(baseURL + "/inactive", "GET"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); + + JSONTokener jt = new JSONTokener(result); + JSONObject json = new JSONObject(jt); + // there should be at least two hosts in the DB + Assert.assertTrue(json.get("host") instanceof JSONArray); + JSONArray ja = json.getJSONArray("host"); + Integer count = ja.length(); + Assert.assertTrue(count == 2); + + for (int i = 0; i < count; i++) { + host_jo = ja.getJSONObject(i); + dl_jo = host_jo.getJSONObject("dataLayerAddress"); + nc_jo = host_jo.getJSONObject("nodeConnector"); + node_jo = nc_jo.getJSONObject("node"); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - // there should be at least two hosts in the DB - Assert.assertTrue(json.get("host") instanceof JSONArray); - JSONArray ja = json.getJSONArray("host"); - Integer count = ja.length(); - Assert.assertTrue(count == 2); - - for (int i = 0; i < count; i++) { - host_jo = ja.getJSONObject(i); - dl_jo = host_jo.getJSONObject("dataLayerAddress"); - nc_jo = host_jo.getJSONObject("nodeConnector"); - node_jo = nc_jo.getJSONObject("node"); - - networkAddress = host_jo.getString("networkAddress"); - if (networkAddress.equalsIgnoreCase(networkAddress_1)) { - Assert.assertTrue(dl_jo.getString("macAddress") - .equalsIgnoreCase(dataLayerAddress_1)); - Assert.assertTrue(nc_jo.getString("@type") - .equalsIgnoreCase(nodeConnectorType_1)); - Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1); - Assert.assertTrue(node_jo.getString("@type") - .equalsIgnoreCase(nodeType_1)); - Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1); - Assert.assertTrue(host_jo.getString("vlan") - .equalsIgnoreCase(vlan_1)); - } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) { - Assert.assertTrue(dl_jo.getString("macAddress") - .equalsIgnoreCase(dataLayerAddress_2)); - Assert.assertTrue(nc_jo.getString("@type") - .equalsIgnoreCase(nodeConnectorType_2)); - Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_2); - Assert.assertTrue(node_jo.getString("@type") - .equalsIgnoreCase(nodeType_2)); - Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_2); - Assert.assertTrue(host_jo.getString("vlan") - .equalsIgnoreCase(vlan_2)); - } else { - Assert.assertTrue(false); - } + networkAddress = host_jo.getString("networkAddress"); + if (networkAddress.equalsIgnoreCase(networkAddress_1)) { + Assert.assertTrue(dl_jo.getString("macAddress") + .equalsIgnoreCase(dataLayerAddress_1)); + Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase( + nodeConnectorType_1)); + Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1); + Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase( + nodeType_1)); + Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1); + Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase( + vlan_1)); + } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) { + Assert.assertTrue(dl_jo.getString("macAddress") + .equalsIgnoreCase(dataLayerAddress_2)); + Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase( + nodeConnectorType_2)); + Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_2); + Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase( + nodeType_2)); + Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_2); + Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase( + vlan_2)); + } else { + Assert.assertTrue(false); } - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); } // test GET method: getActiveHosts() - no host expected - try { - String result = getJsonResult(baseURL, "GET"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); + result = getJsonResult(baseURL, "GET"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); - Assert.assertFalse(hostInJson(json, networkAddress_1)); - Assert.assertFalse(hostInJson(json, networkAddress_2)); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); - } + jt = new JSONTokener(result); + json = new JSONObject(jt); + Assert.assertFalse(hostInJson(json, networkAddress_1)); + Assert.assertFalse(hostInJson(json, networkAddress_2)); // put the 1st host into active host DB Node nd; @@ -931,75 +1012,57 @@ public class NorthboundIT { } // verify the host shows up in active host DB - try { - String result = getJsonResult(baseURL, "GET"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); + result = getJsonResult(baseURL, "GET"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - Assert.assertTrue(hostInJson(json, networkAddress_1)); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); - } + jt = new JSONTokener(result); + json = new JSONObject(jt); + + Assert.assertTrue(hostInJson(json, networkAddress_1)); // test GET method for getHostDetails() - try { - String result = getJsonResult(baseURL + "/" + networkAddress_1, - "GET"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); + result = getJsonResult(baseURL + "/" + networkAddress_1, "GET"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - Assert.assertFalse(json.length() == 0); + jt = new JSONTokener(result); + json = new JSONObject(jt); - dl_jo = json.getJSONObject("dataLayerAddress"); - nc_jo = json.getJSONObject("nodeConnector"); - node_jo = nc_jo.getJSONObject("node"); + Assert.assertFalse(json.length() == 0); - Assert.assertTrue(json.getString("networkAddress") - .equalsIgnoreCase(networkAddress_1)); - Assert.assertTrue(dl_jo.getString("macAddress").equalsIgnoreCase( - dataLayerAddress_1)); - Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase( - nodeConnectorType_1)); - Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1); - Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase( - nodeType_1)); - Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1); - Assert.assertTrue(json.getString("vlan").equalsIgnoreCase(vlan_1)); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); - } + dl_jo = json.getJSONObject("dataLayerAddress"); + nc_jo = json.getJSONObject("nodeConnector"); + node_jo = nc_jo.getJSONObject("node"); + + Assert.assertTrue(json.getString("networkAddress").equalsIgnoreCase( + networkAddress_1)); + Assert.assertTrue(dl_jo.getString("macAddress").equalsIgnoreCase( + dataLayerAddress_1)); + Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase( + nodeConnectorType_1)); + Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1); + Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase( + nodeType_1)); + Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1); + Assert.assertTrue(json.getString("vlan").equalsIgnoreCase(vlan_1)); // test DELETE method for deleteFlow() - try { - String result = getJsonResult(baseURL + "/" + networkAddress_1, - "DELETE"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); - } + result = getJsonResult(baseURL + "/" + networkAddress_1, "DELETE"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); // verify host_1 removed from active host DB // test GET method: getActiveHosts() - no host expected - try { - String result = getJsonResult(baseURL, "GET"); - Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); - JSONTokener jt = new JSONTokener(result); - JSONObject json = new JSONObject(jt); + result = getJsonResult(baseURL, "GET"); + Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200); + + jt = new JSONTokener(result); + json = new JSONObject(jt); + + Assert.assertFalse(hostInJson(json, networkAddress_1)); - Assert.assertFalse(hostInJson(json, networkAddress_1)); - } catch (Exception e) { - // Got an unexpected exception - Assert.assertTrue(false); - } } private Boolean hostInJson(JSONObject json, String hostIp) @@ -1104,6 +1167,8 @@ public class NorthboundIT { mavenBundle("org.opendaylight.controller", "usermanager", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", + "usermanager.implementation", "0.4.0-SNAPSHOT"), mavenBundle("org.opendaylight.controller", "logging.bridge", "0.4.0-SNAPSHOT"), mavenBundle("org.opendaylight.controller", "clustering.test", @@ -1290,4 +1355,4 @@ public class NorthboundIT { mavenBundle("com.sun.jersey", "jersey-json", "1.17") .startLevel(2), junitBundles()); } -} \ No newline at end of file +} diff --git a/opendaylight/northbound/integrationtest/src/test/resources/tomcat-server.xml b/opendaylight/northbound/integrationtest/src/test/resources/tomcat-server.xml index 4be075451e..56d469b599 100644 --- a/opendaylight/northbound/integrationtest/src/test/resources/tomcat-server.xml +++ b/opendaylight/northbound/integrationtest/src/test/resources/tomcat-server.xml @@ -30,13 +30,13 @@ connectionTimeout="20000" redirectPort="8443" /> - - - - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT diff --git a/opendaylight/sal/yang-prototype/code-generator/samples/modeling-sample/pom.xml b/opendaylight/sal/yang-prototype/code-generator/samples/modeling-sample/pom.xml new file mode 100644 index 0000000000..260303ef9e --- /dev/null +++ b/opendaylight/sal/yang-prototype/code-generator/samples/modeling-sample/pom.xml @@ -0,0 +1,116 @@ + + 4.0.0 + + binding-generator + org.opendaylight.controller + 0.5.1-SNAPSHOT + + modeling-sample + + + + + org.opendaylight.controller + yang-maven-plugin + 0.5.1-SNAPSHOT + + + + generate-sources + + + src/main/yang + + + + org.opendaylight.controller.maven.sal.api.gen.plugin.CodeGeneratorImpl + + + target/generated-sources/sal + + + + false + + + + + + + org.opendaylight.controller + maven-sal-api-gen-plugin + 0.5.1-SNAPSHOT + jar + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + generate-sources + + add-source + + + + target/generated-sources/sal + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.opendaylight.controller + + + yang-maven-plugin + + + [0.5,) + + + + generate-sources + + + + + + + + + + + + + + + + + org.opendaylight.controller + yang-binding + + + org.opendaylight.controller + yang-common + + + \ No newline at end of file diff --git a/opendaylight/sal/yang-prototype/code-generator/samples/modeling-sample/src/main/yang/sample.yang b/opendaylight/sal/yang-prototype/code-generator/samples/modeling-sample/src/main/yang/sample.yang new file mode 100644 index 0000000000..3ecdc0a3ce --- /dev/null +++ b/opendaylight/sal/yang-prototype/code-generator/samples/modeling-sample/src/main/yang/sample.yang @@ -0,0 +1,62 @@ +module sample { + yang-version 1; + namespace "sample"; + prefix "s"; + + revision 2013-06-13 { + description "Initial demo"; + } + + + + // Simple Type definition + + typedef foo-name { + type string; + } + + // Storage / data structure + + container topologies { + list topology { + leaf foo-name { + type string; + } + } + } + + + // Notification / Event + + notification packet-in { + leaf node { + type string; + } + leaf port { + type uint16; + } + leaf content { + type binary; + } + } + + // RPC + + rpc packet-out { + input { + leaf node { + type string; + } + leaf port { + type uint16; + } + leaf content { + type binary; + } + } + output { + + } + } + +} \ No newline at end of file diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-api/pom.xml b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-api/pom.xml index 547d83adc8..53ca931406 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-api/pom.xml +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-api/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../yang/pom.xml yang-model-parser-api diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/pom.xml b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/pom.xml index 16a746905e..b83d63f9b0 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/pom.xml +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../yang/pom.xml yang-model-parser-impl diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/DataNodeContainerBuilder.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/DataNodeContainerBuilder.java index 32c7a6d3f1..e64bb02c6d 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/DataNodeContainerBuilder.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/DataNodeContainerBuilder.java @@ -24,6 +24,8 @@ public interface DataNodeContainerBuilder extends Builder { void addChildNode(DataSchemaNodeBuilder childNode); + Set getGroupings(); + void addGrouping(GroupingBuilder groupingBuilder); void addUsesNode(UsesNodeBuilder usesBuilder); diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/UsesNodeBuilder.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/UsesNodeBuilder.java index 1c4a4acde4..c295c0eafd 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/UsesNodeBuilder.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/UsesNodeBuilder.java @@ -19,9 +19,13 @@ import org.opendaylight.controller.yang.parser.util.RefineHolder; */ public interface UsesNodeBuilder extends Builder { - String getGroupingPathString(); + String getGroupingName(); - SchemaPath getGroupingPath(); + void setGroupingPath(SchemaPath groupingPath); + + SchemaPath getPath(); + + void setPath(SchemaPath path); Set getAugmentations(); diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java index e5ba8b17cc..775751a166 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java @@ -68,6 +68,11 @@ public final class AugmentationSchemaBuilderImpl implements AugmentationSchemaBu return childNodes; } + @Override + public Set getGroupings() { + return groupings; + } + @Override public void addGrouping(GroupingBuilder grouping) { groupings.add(grouping); diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/LeafSchemaNodeBuilder.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/LeafSchemaNodeBuilder.java index ba9609b4db..ec9c35c1bd 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/LeafSchemaNodeBuilder.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/LeafSchemaNodeBuilder.java @@ -290,6 +290,7 @@ public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder } } + @Override public String getDefault() { return defaultStr; } @@ -298,6 +299,7 @@ public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder this.defaultStr = defaultStr; } + @Override public String getUnits() { return unitsStr; } diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ModuleBuilder.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ModuleBuilder.java index 67e4c6fb72..fa307972d4 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ModuleBuilder.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ModuleBuilder.java @@ -240,6 +240,17 @@ public class ModuleBuilder implements Builder { return typedefs; } + public Set getModuleGroupings() { + final Set groupings = new HashSet(); + for (Map.Entry, GroupingBuilder> entry : addedGroupings + .entrySet()) { + if (entry.getKey().size() == 2) { + groupings.add(entry.getValue()); + } + } + return groupings; + } + public String getName() { return name; } diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/RpcDefinitionBuilder.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/RpcDefinitionBuilder.java index 5b9638eb63..6cbcec1054 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/RpcDefinitionBuilder.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/RpcDefinitionBuilder.java @@ -103,6 +103,10 @@ public final class RpcDefinitionBuilder implements SchemaNodeBuilder, addedTypedefs.add(type); } + public Set getGroupings() { + return addedGroupings; + } + public void addGrouping(GroupingBuilder grouping) { addedGroupings.add(grouping); } diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/UsesNodeBuilderImpl.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/UsesNodeBuilderImpl.java index dba747db1d..850938161b 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/UsesNodeBuilderImpl.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/UsesNodeBuilderImpl.java @@ -15,7 +15,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.opendaylight.controller.yang.common.QName; import org.opendaylight.controller.yang.model.api.AugmentationSchema; import org.opendaylight.controller.yang.model.api.SchemaNode; import org.opendaylight.controller.yang.model.api.SchemaPath; @@ -27,25 +26,25 @@ import org.opendaylight.controller.yang.parser.util.RefineHolder; public final class UsesNodeBuilderImpl implements UsesNodeBuilder { private boolean isBuilt; - private final UsesNodeImpl instance; + private UsesNodeImpl instance; private final int line; - private final String groupingPathStr; - private final SchemaPath groupingPath; + private SchemaPath schemaPath; + private final String groupingName; + private SchemaPath groupingPath; private boolean augmenting; private final Set addedAugments = new HashSet(); private List refineBuilders = new ArrayList(); private List refines = new ArrayList(); - public UsesNodeBuilderImpl(final String groupingPathStr, final int line) { - this.groupingPathStr = groupingPathStr; - this.groupingPath = parseUsesPath(groupingPathStr); + public UsesNodeBuilderImpl(final String groupingName, final int line) { + this.groupingName = groupingName; this.line = line; - instance = new UsesNodeImpl(groupingPath); } @Override public UsesNode build() { if (!isBuilt) { + instance = new UsesNodeImpl(groupingPath); instance.setAugmenting(augmenting); // AUGMENTATIONS @@ -74,13 +73,23 @@ public final class UsesNodeBuilderImpl implements UsesNodeBuilder { } @Override - public String getGroupingPathString() { - return groupingPathStr; + public void setGroupingPath(SchemaPath groupingPath) { + this.groupingPath = groupingPath; } @Override - public SchemaPath getGroupingPath() { - return groupingPath; + public SchemaPath getPath() { + return schemaPath; + } + + @Override + public void setPath(SchemaPath path) { + this.schemaPath = path; + } + + @Override + public String getGroupingName() { + return groupingName; } @Override @@ -123,23 +132,6 @@ public final class UsesNodeBuilderImpl implements UsesNodeBuilder { refines.add(refine); } - private SchemaPath parseUsesPath(final String groupingPathStr) { - final String[] splittedPath = groupingPathStr.split("/"); - final List path = new ArrayList(); - QName name; - for (String pathElement : splittedPath) { - final String[] splittedElement = pathElement.split(":"); - if (splittedElement.length == 1) { - name = new QName(null, null, null, splittedElement[0]); - } else { - name = new QName(null, null, splittedElement[0], - splittedElement[1]); - } - path.add(name); - } - final boolean absolute = groupingPathStr.startsWith("/"); - return new SchemaPath(path, absolute); - } private final class UsesNodeImpl implements UsesNode { private final SchemaPath groupingPath; diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserImpl.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserImpl.java index 4520405bbe..94437170f4 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserImpl.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserImpl.java @@ -761,15 +761,15 @@ public final class YangParserImpl implements YangModelParser { .getUsesNodes(); for (Map.Entry, UsesNodeBuilder> entry : moduleUses .entrySet()) { - final List key = entry.getKey(); final UsesNodeBuilder usesNode = entry.getValue(); final int line = usesNode.getLine(); - final String groupingName = key.get(key.size() - 1); + GroupingBuilder targetGrouping = getTargetGrouping(usesNode, modules, module); + usesNode.setGroupingPath(targetGrouping.getPath()); for (RefineHolder refine : usesNode.getRefines()) { SchemaNodeBuilder refineTarget = getRefineNodeBuilderCopy( - groupingName, refine, modules, module); + targetGrouping, refine, modules, module); ParserUtils.checkRefine(refineTarget, refine); ParserUtils.refineDefault(refineTarget, refine, line); if (refineTarget instanceof LeafSchemaNodeBuilder) { @@ -805,6 +805,82 @@ public final class YangParserImpl implements YangModelParser { } } + private GroupingBuilder getTargetGrouping( + final UsesNodeBuilder usesBuilder, + final Map> modules, + final ModuleBuilder module) { + final int line = usesBuilder.getLine(); + String groupingString = usesBuilder.getGroupingName(); + String groupingPrefix; + String groupingName; + + if(groupingString.contains(":")) { + String[] splitted = groupingString.split(":"); + if(splitted.length != 2 || groupingString.contains("/")) { + throw new YangParseException(module.getName(), line, "Invalid name of target grouping"); + } + groupingPrefix = splitted[0]; + groupingName = splitted[1]; + } else { + groupingPrefix = module.getPrefix(); + groupingName = groupingString; + } + + ModuleBuilder dependentModule = null; + if(groupingPrefix.equals(module.getPrefix())) { + dependentModule = module; + } else { + dependentModule = findDependentModule(modules, module, groupingPrefix, line); + } + + + List path = usesBuilder.getPath().getPath(); + GroupingBuilder result = null; + Set groupings = dependentModule.getModuleGroupings(); + result = findGrouping(groupings, groupingName); + + if (result == null) { + Builder currentNode = null; + final List currentPath = new ArrayList(); + currentPath.add(dependentModule.getName()); + + for (int i = 0; i < path.size(); i++) { + QName qname = path.get(i); + currentPath.add(qname.getLocalName()); + currentNode = dependentModule.getModuleNode(currentPath); + + if (currentNode instanceof RpcDefinitionBuilder) { + groupings = ((RpcDefinitionBuilder) currentNode).getGroupings(); + } else if (currentNode instanceof DataNodeContainerBuilder) { + groupings = ((DataNodeContainerBuilder) currentNode).getGroupings(); + } else { + groupings = Collections.emptySet(); + } + + result = findGrouping(groupings, groupingName); + if (result != null) { + break; + } + } + } + + if (result != null) { + return result; + } + throw new YangParseException(module.getName(), line, + "Referenced grouping '" + groupingName + "' not found."); + } + + private GroupingBuilder findGrouping(Set groupings, + String name) { + for (GroupingBuilder grouping : groupings) { + if (grouping.getQName().getLocalName().equals(name)) { + return grouping; + } + } + return null; + } + /** * Find original builder of node to refine and return copy of this builder. *

@@ -825,11 +901,11 @@ public final class YangParserImpl implements YangModelParser { * otherwise */ private SchemaNodeBuilder getRefineNodeBuilderCopy( - final String groupingPath, final RefineHolder refine, + final GroupingBuilder targetGrouping, final RefineHolder refine, final Map> modules, final ModuleBuilder module) { Builder result = null; - final Builder lookedUpBuilder = findRefineTargetBuilder(groupingPath, + final Builder lookedUpBuilder = findRefineTargetBuilder(targetGrouping, refine, modules, module); if (lookedUpBuilder instanceof LeafSchemaNodeBuilder) { result = ParserUtils @@ -876,28 +952,11 @@ public final class YangParserImpl implements YangModelParser { * @return Builder object of refine node if it is present in grouping, null * otherwise */ - private Builder findRefineTargetBuilder(final String groupingPath, + private Builder findRefineTargetBuilder(final GroupingBuilder builder, final RefineHolder refine, final Map> modules, final ModuleBuilder module) { final String refineNodeName = refine.getName(); - final SchemaPath path = ParserUtils.parseUsesPath(groupingPath); - final List builderPath = new ArrayList(); - String prefix = null; - for (QName qname : path.getPath()) { - builderPath.add(qname.getLocalName()); - prefix = qname.getPrefix(); - } - if (prefix == null) { - prefix = module.getPrefix(); - } - - final ModuleBuilder dependentModule = findDependentModule(modules, - module, prefix, refine.getLine()); - builderPath.add(0, dependentModule.getName()); - final GroupingBuilder builder = dependentModule - .getGrouping(builderPath); - Builder result = builder.getChildNode(refineNodeName); if (result == null) { Set grps = builder.getGroupings(); diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserListenerImpl.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserListenerImpl.java index 40a3289745..1c01cd4a82 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserListenerImpl.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserListenerImpl.java @@ -410,15 +410,15 @@ public final class YangParserListenerImpl extends YangParserBaseListener { GroupingBuilder builder = moduleBuilder.addGrouping(groupQName, actualPath, ctx.getStart().getLine()); moduleBuilder.enterNode(builder); - updatePath("grouping"); updatePath(groupName); + builder.setPath(createActualSchemaPath(actualPath, namespace, revision, + yangModelPrefix)); parseSchemaNodeArgs(ctx, builder); } @Override public void exitGrouping_stmt(YangParser.Grouping_stmtContext ctx) { String actContainer = actualPath.pop(); - actContainer += "-" + actualPath.pop(); logger.debug("exiting " + actContainer); moduleBuilder.exitNode(); } @@ -495,8 +495,11 @@ public final class YangParserListenerImpl extends YangParserBaseListener { final String groupingPathStr = stringFromNode(ctx); UsesNodeBuilder builder = moduleBuilder.addUsesNode(groupingPathStr, actualPath, ctx.getStart().getLine()); + moduleBuilder.enterNode(builder); updatePath(groupingPathStr); + builder.setPath(createActualSchemaPath(actualPath, namespace, revision, + yangModelPrefix)); } @Override diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserUtils.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserUtils.java index 8361d47156..d38bc5e7ad 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserUtils.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserUtils.java @@ -907,7 +907,7 @@ public final class ParserUtils { public static UsesNodeBuilder copyUsesNodeBuilder(UsesNodeBuilder old) { final UsesNodeBuilder copy = new UsesNodeBuilderImpl( - old.getGroupingPathString(), old.getLine()); + old.getGroupingName(), old.getLine()); for (AugmentationSchemaBuilder augment : old.getAugmentations()) { copy.addAugment(augment); } diff --git a/opendaylight/sal/yang-prototype/yang/pom.xml b/opendaylight/sal/yang-prototype/yang/pom.xml index e79e70028b..4e15f8d47c 100644 --- a/opendaylight/sal/yang-prototype/yang/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/pom.xml @@ -6,7 +6,7 @@ yang-prototype 0.5-SNAPSHOT - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang pom diff --git a/opendaylight/sal/yang-prototype/yang/yang-binding/pom.xml b/opendaylight/sal/yang-prototype/yang/yang-binding/pom.xml index f7df24f53f..6362eb9acc 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-binding/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/yang-binding/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang-binding \ No newline at end of file diff --git a/opendaylight/sal/yang-prototype/yang/yang-binding/src/main/java/org/opendaylight/controller/yang/binding/BaseIdentity.java b/opendaylight/sal/yang-prototype/yang/yang-binding/src/main/java/org/opendaylight/controller/yang/binding/BaseIdentity.java new file mode 100644 index 0000000000..004287aebc --- /dev/null +++ b/opendaylight/sal/yang-prototype/yang/yang-binding/src/main/java/org/opendaylight/controller/yang/binding/BaseIdentity.java @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.yang.binding; + +public abstract class BaseIdentity { + + protected BaseIdentity() { + } + +} diff --git a/opendaylight/sal/yang-prototype/yang/yang-common/pom.xml b/opendaylight/sal/yang-prototype/yang/yang-common/pom.xml index 987b9b11a1..7f55386925 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-common/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/yang-common/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang-common diff --git a/opendaylight/sal/yang-prototype/yang/yang-data-api/pom.xml b/opendaylight/sal/yang-prototype/yang/yang-data-api/pom.xml index 749c9c66f4..02562172e8 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-data-api/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/yang-data-api/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang-data-api diff --git a/opendaylight/sal/yang-prototype/yang/yang-data-util/pom.xml b/opendaylight/sal/yang-prototype/yang/yang-data-util/pom.xml index 15b391f5b8..bce9e91346 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-data-util/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/yang-data-util/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang-data-util diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-api/pom.xml b/opendaylight/sal/yang-prototype/yang/yang-model-api/pom.xml index 3eabd7ff9f..fc601e32b4 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-api/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/yang-model-api/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang-model-api diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/pom.xml b/opendaylight/sal/yang-prototype/yang/yang-model-util/pom.xml index 3390837be9..d95b23957b 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/pom.xml +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller yang - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT yang-model-util diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/DataNodeIterator.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/DataNodeIterator.java index df111acf08..7c26531f37 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/DataNodeIterator.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/DataNodeIterator.java @@ -8,29 +8,30 @@ import java.util.Set; import org.opendaylight.controller.yang.model.api.ContainerSchemaNode; import org.opendaylight.controller.yang.model.api.DataNodeContainer; import org.opendaylight.controller.yang.model.api.DataSchemaNode; +import org.opendaylight.controller.yang.model.api.GroupingDefinition; import org.opendaylight.controller.yang.model.api.LeafListSchemaNode; import org.opendaylight.controller.yang.model.api.LeafSchemaNode; import org.opendaylight.controller.yang.model.api.ListSchemaNode; public class DataNodeIterator implements Iterator { - + private final DataNodeContainer container; private List allLists; private List allContainers; private List allLeafs; private List allLeafLists; private List allChilds; - + public DataNodeIterator(final DataNodeContainer container) { if (container == null) { throw new IllegalArgumentException("Data Node Container MUST be specified and cannot be NULL!"); } - + init(); this.container = container; traverse(this.container); } - + private void init() { this.allContainers = new ArrayList(); this.allLists = new ArrayList(); @@ -38,28 +39,28 @@ public class DataNodeIterator implements Iterator { this.allLeafLists = new ArrayList(); this.allChilds = new ArrayList(); } - + public List allContainers() { return allContainers; } - + public List allLists() { return allLists; } - + public List allLeafs() { return allLeafs; } - + public List allLeafLists() { return allLeafLists; } - + private void traverse(final DataNodeContainer dataNode) { if (dataNode == null) { return; } - + final Set childs = dataNode.getChildNodes(); if (childs != null) { for (DataSchemaNode childNode : childs) { @@ -83,15 +84,21 @@ public class DataNodeIterator implements Iterator { allLeafLists.add(leafList); } } - return; + } + + final Set groupings = dataNode.getGroupings(); + if(groupings != null) { + for(GroupingDefinition grouping : groupings) { + traverse(grouping); + } } } - + @Override public boolean hasNext() { if (container.getChildNodes() != null) { Set childs = container.getChildNodes(); - + if ((childs != null) && !childs.isEmpty()) { return childs.iterator().hasNext(); } diff --git a/opendaylight/samples/northbound/loadbalancer/enunciate.xml b/opendaylight/samples/northbound/loadbalancer/enunciate.xml index e666af7e51..13ec7ca5ec 100644 --- a/opendaylight/samples/northbound/loadbalancer/enunciate.xml +++ b/opendaylight/samples/northbound/loadbalancer/enunciate.xml @@ -1,7 +1,7 @@ - + diff --git a/opendaylight/samples/northbound/loadbalancer/src/main/resources/WEB-INF/web.xml b/opendaylight/samples/northbound/loadbalancer/src/main/resources/WEB-INF/web.xml index 365e4b22d6..aac4647de6 100644 --- a/opendaylight/samples/northbound/loadbalancer/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/samples/northbound/loadbalancer/src/main/resources/WEB-INF/web.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> JAXRSLoadBalancer com.sun.jersey.spi.container.servlet.ServletContainer @@ -17,34 +17,34 @@ /* - - - NB api - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - + + + NB api + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - BASIC - opendaylight - + + BASIC + opendaylight + diff --git a/opendaylight/statisticsmanager/api/pom.xml b/opendaylight/statisticsmanager/api/pom.xml index 7ee475ed2b..1bf1c7ca74 100644 --- a/opendaylight/statisticsmanager/api/pom.xml +++ b/opendaylight/statisticsmanager/api/pom.xml @@ -29,7 +29,7 @@ org.apache.felix.dm - org.opendaylight.controller.statisticsmanager + org.opendaylight.controller.statisticsmanager ${project.basedir}/META-INF diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java index eae01a6487..a665096e8b 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java @@ -16,9 +16,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.core.NodeConnector; +import org.opendaylight.controller.sal.utils.HexEncode; /** * The class describes switch related information including L2 address, ports, @@ -164,6 +164,8 @@ public class Switch implements Serializable { @Override public String toString() { - return "Switch[" + ReflectionToStringBuilder.toString(this) + "]"; + return "Switch [dataLayerAddress=" + HexEncode.bytesToHexStringFormat(dataLayerAddress) + + ", nodeConnectors=" + nodeConnectors + ", spanPorts=" + + spanPorts + ", node=" + node + "]"; } } diff --git a/opendaylight/switchmanager/integrationtest/pom.xml b/opendaylight/switchmanager/integrationtest/pom.xml index 44ad73c496..e774dae115 100644 --- a/opendaylight/switchmanager/integrationtest/pom.xml +++ b/opendaylight/switchmanager/integrationtest/pom.xml @@ -21,7 +21,7 @@ org.opendaylight.controller switchmanager.implementation - 0.4.0-SNAPSHOT + 0.4.0-SNAPSHOT org.opendaylight.controller diff --git a/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java b/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java index 850563fe95..65487a614a 100644 --- a/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java +++ b/opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java @@ -73,16 +73,16 @@ public class TopologyManagerImplTest { NodeConnector tailnc1 = NodeConnectorCreator .createOFNodeConnector((short) (i + 10), NodeCreator.createOFNode((long) (i + 10))); - Edge e1 = new Edge(headnc1, tailnc1); + Edge e1 = new Edge(tailnc1, headnc1); TopoEdgeUpdate teu1 = new TopoEdgeUpdate(e1, props, UpdateType.ADDED); topoedgeupdateList.add(teu1); - NodeConnector headnc2 = NodeConnectorCreator.createOFNodeConnector( - (short) (i + 1), headnc1.getNode()); NodeConnector tailnc2 = NodeConnectorCreator.createOFNodeConnector( + (short) (i + 1), headnc1.getNode()); + NodeConnector headnc2 = NodeConnectorCreator.createOFNodeConnector( (short) (i + 11), tailnc1.getNode()); - Edge e2 = new Edge(headnc2, tailnc2); + Edge e2 = new Edge(tailnc2, headnc2); TopoEdgeUpdate teu2 = new TopoEdgeUpdate(e2, props, UpdateType.ADDED); topoedgeupdateList.add(teu2); @@ -111,25 +111,12 @@ public class TopologyManagerImplTest { .longValue(); Long tailNcId = ((Short) edge.getTailNodeConnector().getID()) .longValue(); - if (nodeId == 1 || nodeId == 3 || nodeId == 5) { - Assert.assertTrue((headNcId.equals(nodeId) && tailNcId - .equals(nodeId + 10)) - || (headNcId.equals(nodeId + 10) && tailNcId - .equals(nodeId)) - || (headNcId.equals(nodeId + 1) && tailNcId - .equals(nodeId + 11)) - || (headNcId.equals(nodeId + 11) && tailNcId - .equals(nodeId + 1))); - } else if (nodeId == 11 || nodeId == 13 || nodeId == 15) { - Assert.assertTrue((headNcId.equals(nodeId) && tailNcId - .equals(nodeId - 10)) - || (headNcId.equals(nodeId) && tailNcId - .equals(nodeId - 10)) - || (headNcId.equals(nodeId - 9) && tailNcId - .equals(nodeId + 1)) - || (headNcId.equals(nodeId + 1) && tailNcId - .equals(nodeId - 9))); - } + Assert.assertTrue( + (headNcId.equals(nodeId) && tailNcId.equals(nodeId + 10)) + || (headNcId.equals(nodeId + 11) && tailNcId.equals(nodeId + 1)) + || (headNcId.equals(nodeId + 1) && tailNcId.equals(nodeId - 9)) + || (headNcId.equals(nodeId - 10) && tailNcId.equals(nodeId)) + ); } i.remove(); } diff --git a/opendaylight/usermanager/pom.xml b/opendaylight/usermanager/api/pom.xml similarity index 95% rename from opendaylight/usermanager/pom.xml rename to opendaylight/usermanager/api/pom.xml index 1859e8ed4c..877461daaa 100644 --- a/opendaylight/usermanager/pom.xml +++ b/opendaylight/usermanager/api/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller commons.opendaylight 1.4.0-SNAPSHOT - ../commons/opendaylight + ../../commons/opendaylight usermanager @@ -48,11 +48,15 @@ org.opendaylight.controller.usermanager, + + + + ${project.basedir}/META-INF diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/AuthResponse.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthResponse.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/AuthResponse.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthResponse.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthorizationConfig.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthorizationConfig.java similarity index 89% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthorizationConfig.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthorizationConfig.java index 038ccca2fc..bad8fa511f 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthorizationConfig.java +++ b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthorizationConfig.java @@ -6,9 +6,10 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.usermanager.internal; +package org.opendaylight.controller.usermanager; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import org.opendaylight.controller.sal.utils.Status; @@ -44,4 +45,9 @@ public class AuthorizationConfig extends UserConfig { public String toString() { return "AuthorizationConfig=[user: " + user + ", roles: " + roles + "]"; } + + public String getRolesString() { + return super.getRolesString(); + } + } diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java similarity index 97% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java index 85a97f0b85..cd86ed73fe 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java +++ b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java @@ -15,9 +15,9 @@ import java.util.Set; import org.opendaylight.controller.sal.authorization.AuthResultEnum; import org.opendaylight.controller.sal.authorization.UserLevel; import org.opendaylight.controller.sal.utils.Status; -import org.opendaylight.controller.usermanager.internal.AuthorizationConfig; -import org.opendaylight.controller.usermanager.internal.ServerConfig; -import org.opendaylight.controller.usermanager.internal.UserConfig; +import org.opendaylight.controller.usermanager.AuthorizationConfig; +import org.opendaylight.controller.usermanager.ServerConfig; +import org.opendaylight.controller.usermanager.UserConfig; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.web.context.SecurityContextRepository; diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ServerConfig.java similarity index 97% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ServerConfig.java index e1278e8aa4..f50f9e71c9 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java +++ b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ServerConfig.java @@ -7,7 +7,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.usermanager.internal; +package org.opendaylight.controller.usermanager; import java.io.Serializable; diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/UserConfig.java similarity index 99% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java rename to opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/UserConfig.java index c7ddd4a6ec..0e6a48ab52 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java +++ b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/UserConfig.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.usermanager.internal; +package org.opendaylight.controller.usermanager; import java.io.Serializable; import java.util.ArrayList; diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java similarity index 100% rename from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java rename to opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthorizationUserConfigTest.java similarity index 96% rename from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java rename to opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthorizationUserConfigTest.java index c7261d5ec2..cccbe24734 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java +++ b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthorizationUserConfigTest.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.usermanager.internal; +package org.opendaylight.controller.usermanager; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -18,6 +18,8 @@ import org.junit.Test; import org.opendaylight.controller.sal.authorization.AuthResultEnum; import org.opendaylight.controller.sal.authorization.UserLevel; import org.opendaylight.controller.usermanager.AuthResponse; +import org.opendaylight.controller.usermanager.AuthorizationConfig; +import org.opendaylight.controller.usermanager.UserConfig; /* * This test case includes tests for UserConfig and the extending class AuthorizationConfig diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/ServerConfigTest.java similarity index 85% rename from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java rename to opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/ServerConfigTest.java index d60d101cfb..eaeca73003 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java +++ b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/ServerConfigTest.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.usermanager.internal; +package org.opendaylight.controller.usermanager; public class ServerConfigTest { } diff --git a/opendaylight/usermanager/implementation/pom.xml b/opendaylight/usermanager/implementation/pom.xml new file mode 100644 index 0000000000..a558fa2048 --- /dev/null +++ b/opendaylight/usermanager/implementation/pom.xml @@ -0,0 +1,97 @@ + + 4.0.0 + + org.opendaylight.controller + commons.opendaylight + 1.4.0-SNAPSHOT + ../../commons/opendaylight + + + usermanager.implementation + 0.4.0-SNAPSHOT + bundle + + + + org.apache.felix + maven-bundle-plugin + 2.3.6 + true + + + + org.opendaylight.controller.clustering.services, + org.opendaylight.controller.configuration, + org.opendaylight.controller.sal.authorization, + org.opendaylight.controller.sal.core, + org.opendaylight.controller.sal.packet, + org.opendaylight.controller.sal.utils, + org.opendaylight.controller.switchmanager, + org.opendaylight.controller.containermanager, + org.slf4j, + org.eclipse.osgi.framework.console, + org.osgi.framework, + org.apache.felix.dm, + org.apache.commons.lang3.builder, + org.apache.commons.logging, + javax.servlet, + javax.servlet.http, + org.springframework.security.web.context, + org.springframework.security.core, + org.springframework.security.core.context, + org.apache.commons.lang3, + org.springframework.security.authentication, + org.springframework.security.core.authority, + org.springframework.security.core.userdetails, + org.opendaylight.controller.usermanager + + + + + + org.opendaylight.controller.usermanager.internal.Activator + + + ${project.basedir}/META-INF + + + + + + + org.opendaylight.controller + usermanager + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + switchmanager + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + containermanager + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + clustering.services + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + configuration + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + sal + 0.5.0-SNAPSHOT + + + diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/Activator.java b/opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/Activator.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/Activator.java rename to opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/Activator.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUser.java b/opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUser.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUser.java rename to opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUser.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java b/opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java similarity index 99% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java rename to opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java index e835887606..faa6e3b96f 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java +++ b/opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java @@ -43,11 +43,16 @@ import org.opendaylight.controller.sal.utils.ObjectReader; import org.opendaylight.controller.sal.utils.ObjectWriter; import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.controller.usermanager.AuthResponse; +import org.opendaylight.controller.usermanager.AuthorizationConfig; import org.opendaylight.controller.usermanager.IAAAProvider; import org.opendaylight.controller.usermanager.ISessionManager; import org.opendaylight.controller.usermanager.IUserManager; +import org.opendaylight.controller.usermanager.ServerConfig; +import org.opendaylight.controller.usermanager.UserConfig; import org.opendaylight.controller.usermanager.security.SessionManager; import org.opendaylight.controller.usermanager.security.UserSecurityContextRepository; +import org.opendaylight.controller.usermanager.internal.AuthenticatedUser; + import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.slf4j.Logger; diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java b/opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java rename to opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/UserSecurityContextRepository.java b/opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/security/UserSecurityContextRepository.java similarity index 100% rename from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/UserSecurityContextRepository.java rename to opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/security/UserSecurityContextRepository.java diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java b/opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java similarity index 100% rename from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java rename to opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java diff --git a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java b/opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java similarity index 97% rename from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java rename to opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java index df421e4fe6..e8748d8200 100644 --- a/opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java +++ b/opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java @@ -25,6 +25,9 @@ import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.usermanager.AuthResponse; import org.opendaylight.controller.usermanager.IAAAProvider; import org.opendaylight.controller.usermanager.IUserManager; +import org.opendaylight.controller.usermanager.ServerConfig; +import org.opendaylight.controller.usermanager.UserConfig; +import org.opendaylight.controller.usermanager.AuthorizationConfig; /** * Unit Tests for UserManagerImpl @@ -157,7 +160,7 @@ public class UserManagerImplTest { /** * Test method for - * {@link org.opendaylight.controller.usermanager.internal.UserManagerImpl#addRemoveLocalUser(org.opendaylight.controller.usermanager.internal.UserConfig, boolean)} + * {@link org.opendaylight.controller.usermanager.internal.UserManagerImpl#addRemoveLocalUser(org.opendaylight.controller.usermanager.org.opendaylight.controller.usermanager.internal.UserConfig, boolean)} * . */ @Test diff --git a/opendaylight/web/devices/src/main/resources/WEB-INF/Devices-servlet.xml b/opendaylight/web/devices/src/main/resources/WEB-INF/Devices-servlet.xml index 6b0a731b99..af5cd8d456 100644 --- a/opendaylight/web/devices/src/main/resources/WEB-INF/Devices-servlet.xml +++ b/opendaylight/web/devices/src/main/resources/WEB-INF/Devices-servlet.xml @@ -3,19 +3,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + - - + + diff --git a/opendaylight/web/devices/src/main/resources/WEB-INF/web.xml b/opendaylight/web/devices/src/main/resources/WEB-INF/web.xml index 0c7edce249..6294a9fb5b 100644 --- a/opendaylight/web/devices/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/web/devices/src/main/resources/WEB-INF/web.xml @@ -1,75 +1,75 @@ - - - free access - /js/* - /images/* - /css/* - /favicon.ico - - + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + + + free access + /js/* + /images/* + /css/* + /favicon.ico + + - - DevicesApp - - DevicesGUI - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - + + DevicesApp + + DevicesGUI + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - FORM - - /WEB-INF/jsp/login.jsp - /WEB-INF/jsp/error.jsp - - + + FORM + + /WEB-INF/jsp/login.jsp + /WEB-INF/jsp/error.jsp + + 403 /WEB-INF/jsp/autherror.jsp - - Devices - org.springframework.web.servlet.DispatcherServlet - 1 - + + Devices + org.springframework.web.servlet.DispatcherServlet + 1 + - - Devices - / - + + Devices + / + - - org.opendaylight.controller.web.ControllerUISessionManager - - - - / - - + + org.opendaylight.controller.web.ControllerUISessionManager + + + + / + + diff --git a/opendaylight/web/flows/src/main/resources/WEB-INF/Flows-servlet.xml b/opendaylight/web/flows/src/main/resources/WEB-INF/Flows-servlet.xml index fbe69795c2..293fa77ef1 100644 --- a/opendaylight/web/flows/src/main/resources/WEB-INF/Flows-servlet.xml +++ b/opendaylight/web/flows/src/main/resources/WEB-INF/Flows-servlet.xml @@ -3,19 +3,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + - - + + diff --git a/opendaylight/web/flows/src/main/resources/WEB-INF/web.xml b/opendaylight/web/flows/src/main/resources/WEB-INF/web.xml index 5660a37a14..c5d2479f6b 100644 --- a/opendaylight/web/flows/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/web/flows/src/main/resources/WEB-INF/web.xml @@ -1,79 +1,79 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> - - Flows - org.springframework.web.servlet.DispatcherServlet - 1 - + + Flows + org.springframework.web.servlet.DispatcherServlet + 1 + - - Flows - / - + + Flows + / + - - - free access - /js/* - /images/* - /css/* - /favicon.ico - - + + + free access + /js/* + /images/* + /css/* + /favicon.ico + + - - FlowApp - - FlowMgrGUI - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + FlowApp + + FlowMgrGUI + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - FORM - - /WEB-INF/jsp/login.jsp - /WEB-INF/jsp/error.jsp - - + + FORM + + /WEB-INF/jsp/login.jsp + /WEB-INF/jsp/error.jsp + + 403 /WEB-INF/jsp/autherror.jsp - - org.opendaylight.controller.web.ControllerUISessionManager - + + org.opendaylight.controller.web.ControllerUISessionManager + - - - / - - + + + / + + diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java index c748171685..ba2075ddb6 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java @@ -17,7 +17,7 @@ import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.controller.sal.utils.StatusCode; import org.opendaylight.controller.usermanager.IUserManager; -import org.opendaylight.controller.usermanager.internal.UserConfig; +import org.opendaylight.controller.usermanager.UserConfig; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/opendaylight/web/root/src/main/resources/WEB-INF/RootGUI-servlet.xml b/opendaylight/web/root/src/main/resources/WEB-INF/RootGUI-servlet.xml index a818c8e6c9..a8cb864367 100644 --- a/opendaylight/web/root/src/main/resources/WEB-INF/RootGUI-servlet.xml +++ b/opendaylight/web/root/src/main/resources/WEB-INF/RootGUI-servlet.xml @@ -3,19 +3,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + - - + + \ No newline at end of file diff --git a/opendaylight/web/root/src/main/resources/WEB-INF/spring/servlet/security.xml b/opendaylight/web/root/src/main/resources/WEB-INF/spring/servlet/security.xml index 18ac6e7ecb..1e373fb56c 100644 --- a/opendaylight/web/root/src/main/resources/WEB-INF/spring/servlet/security.xml +++ b/opendaylight/web/root/src/main/resources/WEB-INF/spring/servlet/security.xml @@ -1,82 +1,82 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /> + + @@ -88,33 +88,33 @@ - - + + + + + + + + - - - - - + + + + + + + - - - - - - - + - + + + - - - - diff --git a/opendaylight/web/root/src/main/resources/WEB-INF/web.xml b/opendaylight/web/root/src/main/resources/WEB-INF/web.xml index d96fb6eba2..557b9c74f5 100644 --- a/opendaylight/web/root/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/web/root/src/main/resources/WEB-INF/web.xml @@ -1,84 +1,84 @@ - + + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> - - - free access - /js/* - /images/* - /css/* - /favicon.ico - - + + + free access + /js/* + /images/* + /css/* + /favicon.ico + + - - RootApp - - RootGUI - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - + + RootApp + + RootGUI + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - FORM - - /WEB-INF/jsp/login.jsp - /WEB-INF/jsp/error.jsp - - + + FORM + + /WEB-INF/jsp/login.jsp + /WEB-INF/jsp/error.jsp + + 403 /WEB-INF/jsp/autherror.jsp - - RootGUI - org.springframework.web.servlet.DispatcherServlet - 1 - + + RootGUI + org.springframework.web.servlet.DispatcherServlet + 1 + - - RootGUI - / - + + RootGUI + / + - OpenDaylight Controller - OpenDaylight Controller + OpenDaylight Controller + OpenDaylight Controller - - org.opendaylight.controller.web.ControllerUISessionManager - + + org.opendaylight.controller.web.ControllerUISessionManager + - - - / - - + + + / + + diff --git a/opendaylight/web/topology/src/main/resources/WEB-INF/Topology-servlet.xml b/opendaylight/web/topology/src/main/resources/WEB-INF/Topology-servlet.xml index 1c05bbcd7e..cb6f2b6973 100644 --- a/opendaylight/web/topology/src/main/resources/WEB-INF/Topology-servlet.xml +++ b/opendaylight/web/topology/src/main/resources/WEB-INF/Topology-servlet.xml @@ -3,19 +3,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + - - + + diff --git a/opendaylight/web/topology/src/main/resources/WEB-INF/web.xml b/opendaylight/web/topology/src/main/resources/WEB-INF/web.xml index 274908caec..c37fffe500 100644 --- a/opendaylight/web/topology/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/web/topology/src/main/resources/WEB-INF/web.xml @@ -1,78 +1,78 @@ - - - free access - /js/* - /images/* - /css/* - /favicon.ico - - + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + + + free access + /js/* + /images/* + /css/* + /favicon.ico + + - - TopologyApp - - TopoGUI - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + TopologyApp + + TopoGUI + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - FORM - - /WEB-INF/jsp/login.jsp - /WEB-INF/jsp/error.jsp - - + + FORM + + /WEB-INF/jsp/login.jsp + /WEB-INF/jsp/error.jsp + + 403 /WEB-INF/jsp/autherror.jsp - - Topology - org.springframework.web.servlet.DispatcherServlet - 1 - + + Topology + org.springframework.web.servlet.DispatcherServlet + 1 + - - Topology - / - + + Topology + / + - - org.opendaylight.controller.web.ControllerUISessionManager - + + org.opendaylight.controller.web.ControllerUISessionManager + - - - / - - + + + / + + diff --git a/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/Troubleshoot-servlet.xml b/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/Troubleshoot-servlet.xml index 877617a975..91e22f6dad 100644 --- a/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/Troubleshoot-servlet.xml +++ b/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/Troubleshoot-servlet.xml @@ -3,19 +3,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - + - + - - + + diff --git a/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/web.xml b/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/web.xml index 47d38f9a53..2d89e9d975 100644 --- a/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/web/troubleshoot/src/main/resources/WEB-INF/web.xml @@ -1,81 +1,81 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> - - Troubleshoot - org.springframework.web.servlet.DispatcherServlet - 1 - + + Troubleshoot + org.springframework.web.servlet.DispatcherServlet + 1 + - - Troubleshoot - / - + + Troubleshoot + / + - - - free access - /js/* - /images/* - /css/* - /favicon.ico - - + + + free access + /js/* + /images/* + /css/* + /favicon.ico + + - - TroubleShootApp - - TroubleShootGUI - /* - - - System-Admin - Network-Admin - Network-Operator - Container-User - - + + TroubleShootApp + + TroubleShootGUI + /* + + + System-Admin + Network-Admin + Network-Operator + Container-User + + - - System-Admin - - - Network-Admin - - - Network-Operator - - - Container-User - + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + - - FORM - - /WEB-INF/jsp/login.jsp - /WEB-INF/jsp/error.jsp - - + + FORM + + /WEB-INF/jsp/login.jsp + /WEB-INF/jsp/error.jsp + + 403 /WEB-INF/jsp/autherror.jsp - - org.opendaylight.controller.web.ControllerUISessionManager - + + org.opendaylight.controller.web.ControllerUISessionManager + - - - / - - + + + / + +