From: Ed Warnicke Date: Fri, 7 Feb 2014 06:35:34 +0000 (+0000) Subject: Merge "Increase timeout for waiting for broker service in sal-binding-it." X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~514 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=6fd408a04fe4a3611843e2246ece6d7c34b76903;hp=80a8676ea2863377e5edac55b6e0a37b8b2bfecd Merge "Increase timeout for waiting for broker service in sal-binding-it." --- diff --git a/opendaylight/appauth/pom.xml b/opendaylight/appauth/pom.xml index dab75f2c8d..30879c6565 100644 --- a/opendaylight/appauth/pom.xml +++ b/opendaylight/appauth/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../commons/opendaylight @@ -14,7 +14,7 @@ HEAD appauth - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle @@ -27,6 +27,7 @@ + org.opendaylight.controller.configuration, org.opendaylight.controller.containermanager, org.opendaylight.controller.sal.authorization, org.opendaylight.controller.sal.utils, @@ -47,6 +48,10 @@ + + org.opendaylight.controller + configuration + org.opendaylight.controller sal diff --git a/opendaylight/appauth/src/main/java/org/opendaylight/controller/appauth/authorization/Authorization.java b/opendaylight/appauth/src/main/java/org/opendaylight/controller/appauth/authorization/Authorization.java index 1992f59711..b70a79b4ae 100644 --- a/opendaylight/appauth/src/main/java/org/opendaylight/controller/appauth/authorization/Authorization.java +++ b/opendaylight/appauth/src/main/java/org/opendaylight/controller/appauth/authorization/Authorization.java @@ -16,6 +16,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentMap; +import org.opendaylight.controller.configuration.ConfigurationObject; import org.opendaylight.controller.containermanager.IContainerAuthorization; import org.opendaylight.controller.sal.authorization.AppRoleLevel; import org.opendaylight.controller.sal.authorization.IResourceAuthorization; @@ -36,7 +37,7 @@ import org.slf4j.LoggerFactory; */ public abstract class Authorization implements IResourceAuthorization { private static final Logger logger = LoggerFactory.getLogger(Authorization.class); - private static final String namesRegex = "^[a-zA-Z0-9]+[{\\.|\\_|\\-}[a-zA-Z0-9]]*$"; + private static final String namesRegex = ConfigurationObject.getRegularExpression(); /* * The configured resource groups */ diff --git a/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml b/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml index 1dc40f25ba..ebb9302b78 100644 --- a/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml +++ b/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml @@ -9,8 +9,8 @@ UTF-8 http://nexus.opendaylight.org/content - 0.6.0-SNAPSHOT - 0.6.0-SNAPSHOT + 0.6.2-SNAPSHOT + 0.6.2-SNAPSHOT 2.3.7 diff --git a/opendaylight/arphandler/pom.xml b/opendaylight/arphandler/pom.xml index deb2172b95..d7d185e725 100644 --- a/opendaylight/arphandler/pom.xml +++ b/opendaylight/arphandler/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../commons/opendaylight @@ -14,7 +14,7 @@ HEAD arphandler - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/clustering/integrationtest/pom.xml b/opendaylight/clustering/integrationtest/pom.xml index e0f03739bb..069f197ada 100644 --- a/opendaylight/clustering/integrationtest/pom.xml +++ b/opendaylight/clustering/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -15,7 +15,7 @@ clustering.services.integrationtest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT diff --git a/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java b/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java index 9c9831f4f5..166dec4b48 100644 --- a/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java +++ b/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.clustering.services_implementation.internal; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/clustering/services/pom.xml b/opendaylight/clustering/services/pom.xml index ebaffc29df..fedb8d4dbe 100644 --- a/opendaylight/clustering/services/pom.xml +++ b/opendaylight/clustering/services/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ clustering.services - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle diff --git a/opendaylight/clustering/services_implementation/pom.xml b/opendaylight/clustering/services_implementation/pom.xml index 2d48934cfd..d7a3db3841 100644 --- a/opendaylight/clustering/services_implementation/pom.xml +++ b/opendaylight/clustering/services_implementation/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ clustering.services-implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCLI.java b/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCLI.java index e7927dba98..402b853088 100644 --- a/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCLI.java +++ b/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCLI.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.clustering.services_implementation.internal; import java.util.Dictionary; diff --git a/opendaylight/clustering/services_implementation/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerTest.java b/opendaylight/clustering/services_implementation/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerTest.java index df9036467f..3d234d32c5 100644 --- a/opendaylight/clustering/services_implementation/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerTest.java +++ b/opendaylight/clustering/services_implementation/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.clustering.services_implementation.internal; import static org.junit.Assert.assertFalse; diff --git a/opendaylight/clustering/stub/pom.xml b/opendaylight/clustering/stub/pom.xml index 31577fc32e..2f0ac1d9a0 100644 --- a/opendaylight/clustering/stub/pom.xml +++ b/opendaylight/clustering/stub/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ clustering.stub - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/clustering/test/pom.xml b/opendaylight/clustering/test/pom.xml index 6d4fb57a38..ca0fc83bea 100644 --- a/opendaylight/clustering/test/pom.xml +++ b/opendaylight/clustering/test/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ clustering.test - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/commons/checkstyle/pom.xml b/opendaylight/commons/checkstyle/pom.xml index d0180397b8..9f2bf9040e 100644 --- a/opendaylight/commons/checkstyle/pom.xml +++ b/opendaylight/commons/checkstyle/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.opendaylight.controller checkstyle - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/commons/concepts/pom.xml b/opendaylight/commons/concepts/pom.xml index c3c668fec8..6113fcce47 100644 --- a/opendaylight/commons/concepts/pom.xml +++ b/opendaylight/commons/concepts/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ concepts - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle @@ -42,7 +42,7 @@ org.opendaylight.controller checkstyle - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT diff --git a/opendaylight/commons/httpclient/pom.xml b/opendaylight/commons/httpclient/pom.xml index 7dee9ac92c..c078884ccf 100644 --- a/opendaylight/commons/httpclient/pom.xml +++ b/opendaylight/commons/httpclient/pom.xml @@ -1,93 +1,93 @@ - - - 4.0.0 - - org.opendaylight.controller - commons.opendaylight - 1.4.1-SNAPSHOT - ../../commons/opendaylight - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main - HEAD - - - commons.httpclient - 0.1.1-SNAPSHOT - bundle - - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - - javax.crypto, - javax.crypto.spec, - javax.net, - javax.net.ssl, - javax.security.auth.x500, - javax.servlet, - org.apache.log4j, - org.ietf.jgss, - !org.apache.commons.codec.*, - !org.apache.log, - !org.apache.avalon.framework.* - - - org.opendaylight.controller.commons.httpclient - - - httpclient,httpcore,commons-logging - - false - - ${project.basedir}/META-INF - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle.version} - - - org.opendaylight.controller - checkstyle - 0.0.2-SNAPSHOT - - - - true - controller/checkstyle.xml - - - - - - - junit - junit - - - org.apache.httpcomponents - httpclient - 4.3 - - - org.apache.httpcomponents - httpcore - 4.3 - - - commons-logging - commons-logging - 1.1.3 - - - + + + 4.0.0 + + org.opendaylight.controller + commons.opendaylight + 1.4.2-SNAPSHOT + ../../commons/opendaylight + + + scm:git:ssh://git.opendaylight.org:29418/controller.git + scm:git:ssh://git.opendaylight.org:29418/controller.git + https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main + HEAD + + + commons.httpclient + 0.1.2-SNAPSHOT + bundle + + + + + org.apache.felix + maven-bundle-plugin + ${bundle.plugin.version} + true + + + + javax.crypto, + javax.crypto.spec, + javax.net, + javax.net.ssl, + javax.security.auth.x500, + javax.servlet, + org.apache.log4j, + org.ietf.jgss, + !org.apache.commons.codec.*, + !org.apache.log, + !org.apache.avalon.framework.* + + + org.opendaylight.controller.commons.httpclient + + + httpclient,httpcore,commons-logging + + false + + ${project.basedir}/META-INF + + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.version} + + + org.opendaylight.controller + checkstyle + 0.0.3-SNAPSHOT + + + + true + controller/checkstyle.xml + + + + + + + junit + junit + + + org.apache.httpcomponents + httpclient + 4.3 + + + org.apache.httpcomponents + httpcore + 4.3 + + + commons-logging + commons-logging + 1.1.3 + + + diff --git a/opendaylight/commons/httpclient/src/main/java/org/opendaylight/controller/commons/httpclient/HTTPClient.java b/opendaylight/commons/httpclient/src/main/java/org/opendaylight/controller/commons/httpclient/HTTPClient.java index ca6d68380e..87664f08a5 100644 --- a/opendaylight/commons/httpclient/src/main/java/org/opendaylight/controller/commons/httpclient/HTTPClient.java +++ b/opendaylight/commons/httpclient/src/main/java/org/opendaylight/controller/commons/httpclient/HTTPClient.java @@ -1,3 +1,10 @@ +/* + * Copyright IBM Corporation, 2013. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the 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.commons.httpclient; import java.util.ArrayList; diff --git a/opendaylight/commons/integrationtest/pom.xml b/opendaylight/commons/integrationtest/pom.xml index 42da74b8f4..5dec7757b2 100644 --- a/opendaylight/commons/integrationtest/pom.xml +++ b/opendaylight/commons/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom @@ -112,7 +112,7 @@ org.opendaylight.controller checkstyle - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT diff --git a/opendaylight/commons/logback_settings/pom.xml b/opendaylight/commons/logback_settings/pom.xml index c1ce36edae..3ea13d0122 100644 --- a/opendaylight/commons/logback_settings/pom.xml +++ b/opendaylight/commons/logback_settings/pom.xml @@ -1,7 +1,7 @@ 4.0.0 commons.logback_settings - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git @@ -11,7 +11,7 @@ org.opendaylight.controller commons.parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT ../parent diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 00e4d4c6fb..d2e9048027 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -1,18 +1,17 @@ - + 4.0.0 3.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT pom org.opendaylight.controller commons.parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT ../parent @@ -58,11 +57,11 @@ -Xmx1024m -XX:MaxPermSize=256m 14.0.1 5.0.0 - 2010.09.24.2-SNAPSHOT - 2010.09.24.2-SNAPSHOT - 2013.10.21.0-SNAPSHOT - 2013.08.27.2-SNAPSHOT - 2013.09.07.2-SNAPSHOT + 2010.09.24.3 + 2010.09.24.3 + 2013.10.21.1 + 2013.08.27.3 + 2013.09.07.3 3.17.1-GA 2.3.2 3.1 @@ -70,40 +69,40 @@ 1.3.1 2.3.7 4.8.1 - 0.6.0-SNAPSHOT + 0.6.2-SNAPSHOT - 0.4.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.4.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.2.3-SNAPSHOT - 0.2.3-SNAPSHOT - 1.0-SNAPSHOT - 0.5.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.7.0-SNAPSHOT - 0.1.1-SNAPSHOT - 0.7.0-SNAPSHOT - 0.0.2-SNAPSHOT - 0.1.1-SNAPSHOT - 0.0.2-SNAPSHOT - 0.1.1-SNAPSHOT - 0.5.1-SNAPSHOT - 0.4.0-SNAPSHOT + 0.4.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.2.4-SNAPSHOT + 0.2.4-SNAPSHOT + 1.1-SNAPSHOT + 0.5.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.7.1-SNAPSHOT + 0.1.2-SNAPSHOT + 0.7.1-SNAPSHOT + 0.0.3-SNAPSHOT + 0.1.2-SNAPSHOT + 0.0.3-SNAPSHOT + 0.1.2-SNAPSHOT + 0.5.2-SNAPSHOT + 0.4.1-SNAPSHOT 4.0.10.Final 2.4 - 0.4.1-SNAPSHOT - 0.4.1-SNAPSHOT - 0.5.0-SNAPSHOT - 0.5.0-SNAPSHOT - 0.5.0-SNAPSHOT - 0.4.1-SNAPSHOT - 0.4.1-SNAPSHOT - 0.4.1-SNAPSHOT - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.5.1-SNAPSHOT + 0.5.1-SNAPSHOT + 0.5.1-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 1.17 7.0.42 @@ -646,7 +645,7 @@ org.opendaylight.controller.thirdparty ganymed - 1.0-SNAPSHOT + 1.1-SNAPSHOT com.google.code.findbugs @@ -723,6 +722,11 @@ netty-common ${netty.version} + + io.netty + netty-codec-http + ${netty.version} + @@ -954,7 +958,7 @@ org.opendaylight.controller osgi-brandfragment.web - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT @@ -1038,12 +1042,12 @@ org.opendaylight.controller httpservice-bridge - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT org.opendaylight.controller jolokia-bridge - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT org.opendaylight.controller @@ -1053,12 +1057,12 @@ org.opendaylight.controller usermanager.northbound - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT org.opendaylight.controller controllermanager.northbound - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT @@ -1135,7 +1139,7 @@ org.opendaylight.controller commons.logback_settings - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT test @@ -1662,7 +1666,7 @@ org.opendaylight.controller checkstyle - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT @@ -1841,7 +1845,7 @@ - + @@ -1854,7 +1858,7 @@ - + @@ -1879,7 +1883,7 @@ org.opendaylight.controller commons.logback_settings - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT diff --git a/opendaylight/commons/parent/pom.xml b/opendaylight/commons/parent/pom.xml index e4d8cac80d..085096d206 100644 --- a/opendaylight/commons/parent/pom.xml +++ b/opendaylight/commons/parent/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller commons.parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT pom scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/commons/protocol-framework/pom.xml b/opendaylight/commons/protocol-framework/pom.xml index 0ea865fa6a..b162b9c400 100644 --- a/opendaylight/commons/protocol-framework/pom.xml +++ b/opendaylight/commons/protocol-framework/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -18,7 +17,7 @@ protocol-framework - ${protocol-framework.version} + 0.4.1-SNAPSHOT Common protocol framework bundle ${project.artifactId} diff --git a/opendaylight/config/config-api/pom.xml b/opendaylight/config/config-api/pom.xml index 10c9fad07e..425e4b4406 100644 --- a/opendaylight/config/config-api/pom.xml +++ b/opendaylight/config/config-api/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT config-api diff --git a/opendaylight/config/config-manager/pom.xml b/opendaylight/config/config-manager/pom.xml index 2fd9f08cfd..f50f7693ad 100644 --- a/opendaylight/config/config-manager/pom.xml +++ b/opendaylight/config/config-manager/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-manager diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BindingIndependentMappingServiceTracker.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BindingIndependentMappingServiceTracker.java index 06a5826086..16a0605cd4 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BindingIndependentMappingServiceTracker.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BindingIndependentMappingServiceTracker.java @@ -15,11 +15,6 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * Every time factory is added or removed, blank transaction is triggered to handle - * {@link org.opendaylight.controller.config.spi.ModuleFactory#getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory, org.osgi.framework.BundleContext)} - * functionality. - */ public class BindingIndependentMappingServiceTracker implements ServiceTrackerCustomizer { private static final Logger logger = LoggerFactory.getLogger(BindingIndependentMappingServiceTracker.class); @@ -48,7 +43,7 @@ public class BindingIndependentMappingServiceTracker implements ServiceTrackerCu BindingIndependentMappingService service = ctx.getService(moduleFactoryServiceReference); this.service = service; CodecRegistry codecRegistry = service.getCodecRegistry(); - logger.warn("Codec registry acquired {}", codecRegistry); + logger.debug("Codec registry acquired {}", codecRegistry); activator.initConfigManager(ctx, codecRegistry); return service; } @@ -59,7 +54,7 @@ public class BindingIndependentMappingServiceTracker implements ServiceTrackerCu } @Override - public void removedService(ServiceReference moduleFactoryServiceReference, BindingIndependentMappingService o) { + public void removedService(ServiceReference moduleFactoryServiceReference, BindingIndependentMappingService o) { // TODO crash } } diff --git a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java index d9bbeb4a2c..001af7525b 100644 --- a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java +++ b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java @@ -213,7 +213,6 @@ public abstract class AbstractConfigTest extends return mock(CodecRegistry.class); } - public static interface BundleContextServiceRegistrationHandler { void handleServiceRegistration(Object serviceInstance); diff --git a/opendaylight/config/config-module-archetype/pom.xml b/opendaylight/config/config-module-archetype/pom.xml new file mode 100644 index 0000000000..42c9105c05 --- /dev/null +++ b/opendaylight/config/config-module-archetype/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.opendaylight.controller + config-subsystem + 0.2.4-SNAPSHOT + + + config-module-archetype + config-module-archetype + Archetype for new module managed by configuration subsystem + + diff --git a/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 0000000000..fc30b4d2c3 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,46 @@ + + config-module-archetype + + true + + + + + + + + impl + + + 2013-04-05 + + + 0.2.4-SNAPSHOT + + + 0.6.2-SNAPSHOT + + + 2014-01-31 + + + java.lang.AutoCloseable + + + 2.4.0 + + + urn:opendaylight:params:xml:ns:yang:controller + + + org.opendaylight.controller.config.yang + + + + + + + src/main/yang + + + diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000000..d1c371d618 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,104 @@ + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + bundle + + + ${project.build.directory}/generated-sources/config + ${config-api-version} + ${maven-bundle-plugin-version} + + + + + org.opendaylight.controller + config-api + ${config.version} + + + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${yang-maven-plugin-version} + + + config + + generate-sources + + + + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + + ${jmxGeneratorPath} + + + ${yang-namespace-mapping-from}==${yang-namespace-mapping-to} + + + + + true + + + + + + org.opendaylight.controller + yang-jmx-generator-plugin + ${config.version} + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + ${jmxGeneratorPath} + + + + + + + + org.apache.felix + maven-bundle-plugin + ${maven.bundle.version} + true + + + ${project.groupId}.${project.artifactId} + + ${yang-namespace-mapping-to}.${module-name}, + + + * + + + + + + + + + diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang new file mode 100644 index 0000000000..8c1dab1495 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang @@ -0,0 +1,54 @@ +// vi: set smarttab et sw=4 tabstop=4: +module ${module-name}-${module-implementation-name} { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${module-name}:${module-implementation-name}"; + prefix "${module-name}-${module-implementation-name}"; + + import config { prefix config; revision-date ${config-api-yang-revision}; } + import ${module-name} { prefix ${module-name}; revision-date ${revision}; } + + description + "This module contains the base YANG definitions for + ${module-name} ${module-implementation-name} implementation."; + + revision "${revision}" { + description + "Initial revision."; + } + + // This is the definition of a service implementation + identity ${module-name}-${module-implementation-name} { + base config:module-type; + config:provided-service ${module-name}:${module-name}; + config:java-name-prefix ${module-name-java-prefix}; + } + + augment "/config:modules/config:module/config:configuration" { + case ${module-name}-${module-implementation-name} { + when "/config:modules/config:module/config:type = '${module-name}-${module-implementation-name}'"; + + leaf simple-attribute { + type uint32; + } + + container dto-attribute { + leaf inner-attribute { + type string; + } + } + + // Dependency attribute demonstration, the config:required-identity points to a service type + // In this case it is the same service type as this implementation provides: ${module-name} + container dependency-attribute { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity ${module-name}:${module-name}; + } + } + } + + } + } +} \ No newline at end of file diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang new file mode 100644 index 0000000000..2afc91e8e3 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang @@ -0,0 +1,27 @@ +// vi: set smarttab et sw=4 tabstop=4: +module ${module-name} { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${module-name}"; + prefix "${module-name}"; + + import config { prefix config; revision-date ${config-api-yang-revision}; } + + description + "This module contains the base YANG definitions for + ${module-name} services."; + + revision "${revision}" { + description + "Initial revision."; + } + + // This is the definition of a service + identity ${module-name} { + + base "config:service-type"; + + // TODO modify the java class + config:java-class " ${service-java-class}"; + } +} \ No newline at end of file diff --git a/opendaylight/config/config-persister-api/pom.xml b/opendaylight/config/config-persister-api/pom.xml index f622992bb5..403ee82b8e 100644 --- a/opendaylight/config/config-persister-api/pom.xml +++ b/opendaylight/config/config-persister-api/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-persister-api diff --git a/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolder.java b/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolder.java index 37d29d746e..c00b26d9ce 100644 --- a/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolder.java +++ b/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolder.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.persist.api; import java.util.SortedSet; diff --git a/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolderImpl.java b/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolderImpl.java index a0586df840..d25e70d203 100644 --- a/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolderImpl.java +++ b/opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/ConfigSnapshotHolderImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.persist.api; import java.util.SortedSet; diff --git a/opendaylight/config/config-persister-directory-adapter/pom.xml b/opendaylight/config/config-persister-directory-adapter/pom.xml index 04c0b95294..919fd13fc2 100644 --- a/opendaylight/config/config-persister-directory-adapter/pom.xml +++ b/opendaylight/config/config-persister-directory-adapter/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-persister-directory-adapter diff --git a/opendaylight/config/config-persister-directory-autodetect-adapter/pom.xml b/opendaylight/config/config-persister-directory-autodetect-adapter/pom.xml index c94f63355c..301f00f768 100644 --- a/opendaylight/config/config-persister-directory-autodetect-adapter/pom.xml +++ b/opendaylight/config/config-persister-directory-autodetect-adapter/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-persister-directory-autodetect-adapter diff --git a/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/autodetect/AutodetectDirectoryPersisterTest.java b/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/autodetect/AutodetectDirectoryPersisterTest.java index f833460766..bcade93352 100644 --- a/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/autodetect/AutodetectDirectoryPersisterTest.java +++ b/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/autodetect/AutodetectDirectoryPersisterTest.java @@ -8,12 +8,15 @@ package org.opendaylight.controller.config.persist.storage.directory.autodetect; import java.io.File; +import java.io.IOException; import java.util.List; import junit.framework.Assert; import org.junit.Test; import org.junit.matchers.JUnitMatchers; import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder; import org.opendaylight.controller.config.persist.test.PropertiesProviderTest; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; public class AutodetectDirectoryPersisterTest { @@ -37,5 +40,52 @@ public class AutodetectDirectoryPersisterTest { String snapFromXml = configs.get(1).getConfigSnapshot(); org.junit.Assert.assertThat(snapFromXml, JUnitMatchers.containsString("xml")); - Assert.assertEquals(configs.get(0).getCapabilities(), configs.get(1).getCapabilities()); } + Assert.assertEquals(configs.get(0).getCapabilities(), configs.get(1).getCapabilities()); + } + + @Test + public void testInvalidXml() throws Exception { + File resourcePath = FileTypeTest.getResourceAsFile("/bad_controller.xml.config"); + File parentFile = resourcePath.getParentFile(); + + AutodetectDirectoryStorageAdapter adapter = new AutodetectDirectoryStorageAdapter(); + + PropertiesProviderTest pp = new PropertiesProviderTest(); + pp.addProperty("directoryStorage",parentFile.getPath()); + AutodetectDirectoryPersister persister = (AutodetectDirectoryPersister) adapter.instantiate(pp); + try { + List configs = persister.loadLastConfigs(); + fail("An exception of type " + IllegalStateException.class + " was expected"); + } catch (IllegalStateException ise){ + String message = ise.getMessage(); + assertThat(message, JUnitMatchers.containsString("Unable to restore configuration snapshot from ")); + } + + } + + @Test + public void testPersistConfig() throws Exception { + File resourcePath = FileTypeTest.getResourceAsFile("/combined/1controller.txt.config"); + File parentFile = resourcePath.getParentFile(); + + AutodetectDirectoryStorageAdapter adapter = new AutodetectDirectoryStorageAdapter(); + + PropertiesProviderTest pp = new PropertiesProviderTest(); + pp.addProperty("directoryStorage",parentFile.getPath()); + AutodetectDirectoryPersister persister = (AutodetectDirectoryPersister) adapter.instantiate(pp); + List configs = null; + try { + configs = persister.loadLastConfigs(); + } catch (IOException e) { + fail("An exception of type " + UnsupportedOperationException.class + " was expected"); + } + Assert.assertEquals(2, configs.size()); + try { + persister.persistConfig(configs.get(0)); + } catch (UnsupportedOperationException uoe){ + String message = uoe.getMessage(); + assertThat(message,JUnitMatchers.containsString("This adapter is read only. Please set readonly=true on class")); + } + } + } diff --git a/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/resources/bad_controller.xml.config b/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/resources/bad_controller.xml.config new file mode 100644 index 0000000000..3f6a3375d0 --- /dev/null +++ b/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/resources/bad_controller.xml.config @@ -0,0 +1,10 @@ + + + cap2 + capa a + + + xml + + \ No newline at end of file diff --git a/opendaylight/config/config-persister-directory-xml-adapter/pom.xml b/opendaylight/config/config-persister-directory-xml-adapter/pom.xml index 5ebb6154be..36fa530062 100644 --- a/opendaylight/config/config-persister-directory-xml-adapter/pom.xml +++ b/opendaylight/config/config-persister-directory-xml-adapter/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-persister-directory-xml-adapter diff --git a/opendaylight/config/config-persister-file-adapter/pom.xml b/opendaylight/config/config-persister-file-adapter/pom.xml index e892829ee0..4681b3b710 100644 --- a/opendaylight/config/config-persister-file-adapter/pom.xml +++ b/opendaylight/config/config-persister-file-adapter/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-persister-file-adapter diff --git a/opendaylight/config/config-persister-file-xml-adapter/pom.xml b/opendaylight/config/config-persister-file-xml-adapter/pom.xml index 29c21069a3..6fa496d92e 100644 --- a/opendaylight/config/config-persister-file-xml-adapter/pom.xml +++ b/opendaylight/config/config-persister-file-xml-adapter/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-persister-file-xml-adapter diff --git a/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/CapabilityHandler.java b/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/CapabilityHandler.java deleted file mode 100644 index d384df6989..0000000000 --- a/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/CapabilityHandler.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.config.persist.storage.file.xml.model; - -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.annotation.DomHandler; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.io.StringReader; -import java.io.StringWriter; - -class CapabilityHandler implements DomHandler { - - private static final String START_TAG = ""; - private static final String END_TAG = ""; - - private StringWriter xmlWriter = new StringWriter(); - - public StreamResult createUnmarshaller(ValidationEventHandler errorHandler) { - xmlWriter.getBuffer().setLength(0); - return new StreamResult(xmlWriter); - } - - public String getElement(StreamResult rt) { - String xml = rt.getWriter().toString(); - int beginIndex = xml.indexOf(START_TAG) + START_TAG.length(); - int endIndex = xml.indexOf(END_TAG); - return xml.substring(beginIndex, endIndex); - } - - public Source marshal(String n, ValidationEventHandler errorHandler) { - try { - String xml = START_TAG + n.trim() + END_TAG; - StringReader xmlReader = new StringReader(xml); - return new StreamSource(xmlReader); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - -} diff --git a/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java b/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java index 0e4cce544f..5322f6357a 100644 --- a/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java +++ b/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java @@ -10,6 +10,8 @@ package org.opendaylight.controller.config.persist.storage.file.xml; import com.google.common.base.Charsets; import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; import java.nio.file.Files; import java.util.List; import java.util.SortedSet; @@ -29,6 +31,8 @@ public class FileStorageAdapterTest { private static int i; private File file; + private static final String NON_EXISTENT_DIRECTORY = "./nonExistentDir/"; + private static final String NON_EXISTENT_FILE = "nonExistent.txt"; @Before public void setUp() throws Exception { @@ -39,6 +43,32 @@ public class FileStorageAdapterTest { i = 1; } + @Test + public void testNewFile() throws Exception { + XmlFileStorageAdapter storage = new XmlFileStorageAdapter(); + PropertiesProviderTest pp = new PropertiesProviderTest(); + pp.addProperty("fileStorage",NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE); + pp.addProperty("numberOfBackups",Integer.toString(Integer.MAX_VALUE)); + storage.instantiate(pp); + + final ConfigSnapshotHolder holder = new ConfigSnapshotHolder() { + @Override + public String getConfigSnapshot() { + return createConfig(); + } + + @Override + public SortedSet getCapabilities() { + return createCaps(); + } + }; + storage.persistConfig(holder); + + storage.persistConfig(holder); + + Assert.assertEquals(storage.toString().replace("\\","/"),"XmlFileStorageAdapter [storage="+NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE+"]"); + delete(new File(NON_EXISTENT_DIRECTORY)); + } @Test public void testFileAdapter() throws Exception { XmlFileStorageAdapter storage = new XmlFileStorageAdapter(); @@ -191,4 +221,12 @@ public class FileStorageAdapterTest { return "" + i++ + ""; } + private void delete(File f) throws IOException { + if (f.isDirectory()) { + for (File c : f.listFiles()) + delete(c); + } + if (!f.delete()) + throw new FileNotFoundException("Failed to delete file: " + f); + } } diff --git a/opendaylight/config/config-plugin-parent/pom.xml b/opendaylight/config/config-plugin-parent/pom.xml index b8f8d9822b..0bc1ef6e76 100644 --- a/opendaylight/config/config-plugin-parent/pom.xml +++ b/opendaylight/config/config-plugin-parent/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 config-plugin-parent @@ -16,7 +16,7 @@ ${project.build.directory}/generated-sources/config - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT diff --git a/opendaylight/config/config-util/pom.xml b/opendaylight/config/config-util/pom.xml index 23603ae626..6a50ee843a 100644 --- a/opendaylight/config/config-util/pom.xml +++ b/opendaylight/config/config-util/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. config-util diff --git a/opendaylight/config/logback-config/pom.xml b/opendaylight/config/logback-config/pom.xml index c9a94c13ae..4e0cfaada6 100644 --- a/opendaylight/config/logback-config/pom.xml +++ b/opendaylight/config/logback-config/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent logback-config diff --git a/opendaylight/config/netty-config-api/pom.xml b/opendaylight/config/netty-config-api/pom.xml index 19c926a2fb..fd099b3242 100644 --- a/opendaylight/config/netty-config-api/pom.xml +++ b/opendaylight/config/netty-config-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/netty-event-executor-config/pom.xml b/opendaylight/config/netty-event-executor-config/pom.xml index 30562a4570..c1e0ccae31 100644 --- a/opendaylight/config/netty-event-executor-config/pom.xml +++ b/opendaylight/config/netty-event-executor-config/pom.xml @@ -1,11 +1,10 @@ - + org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/netty-threadgroup-config/pom.xml b/opendaylight/config/netty-threadgroup-config/pom.xml index 06677ff670..2e7777f91b 100644 --- a/opendaylight/config/netty-threadgroup-config/pom.xml +++ b/opendaylight/config/netty-threadgroup-config/pom.xml @@ -1,12 +1,11 @@ - + org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent diff --git a/opendaylight/config/netty-timer-config/pom.xml b/opendaylight/config/netty-timer-config/pom.xml index ceb3cd9cc6..1e0c917032 100644 --- a/opendaylight/config/netty-timer-config/pom.xml +++ b/opendaylight/config/netty-timer-config/pom.xml @@ -1,11 +1,10 @@ - + org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/pom.xml b/opendaylight/config/pom.xml index 9eede7765b..80621a4d44 100644 --- a/opendaylight/config/pom.xml +++ b/opendaylight/config/pom.xml @@ -1,18 +1,16 @@ - - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../commons/opendaylight - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT config-subsystem pom ${project.artifactId} @@ -45,6 +43,7 @@ yang-test-plugin shutdown-api shutdown-impl + config-module-archetype @@ -69,7 +68,7 @@ 0.6.2.201302030002 1.7.2 ${project.build.directory}/generated-sources/sal - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT @@ -411,7 +410,7 @@ - + @@ -421,4 +420,4 @@ - + \ No newline at end of file diff --git a/opendaylight/config/shutdown-api/pom.xml b/opendaylight/config/shutdown-api/pom.xml index 625ac1425a..99a88fe209 100644 --- a/opendaylight/config/shutdown-api/pom.xml +++ b/opendaylight/config/shutdown-api/pom.xml @@ -1,11 +1,9 @@ - + config-plugin-parent org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/shutdown-impl/pom.xml b/opendaylight/config/shutdown-impl/pom.xml index 10e21e558e..fa661b4ab8 100644 --- a/opendaylight/config/shutdown-impl/pom.xml +++ b/opendaylight/config/shutdown-impl/pom.xml @@ -1,11 +1,9 @@ - + config-plugin-parent org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModule.java b/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModule.java index d58ebf2895..e3ae30db74 100644 --- a/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModule.java +++ b/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModule.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ /** * Generated file diff --git a/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModuleFactory.java b/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModuleFactory.java index 0517fafd56..4df9b036f1 100644 --- a/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModuleFactory.java +++ b/opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownModuleFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ /** * Generated file diff --git a/opendaylight/config/threadpool-config-api/pom.xml b/opendaylight/config/threadpool-config-api/pom.xml index 49e9f0da9a..2f5e35c26d 100644 --- a/opendaylight/config/threadpool-config-api/pom.xml +++ b/opendaylight/config/threadpool-config-api/pom.xml @@ -1,11 +1,10 @@ - + org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/threadpool-config-impl/pom.xml b/opendaylight/config/threadpool-config-impl/pom.xml index cb29796f73..49a01819d8 100644 --- a/opendaylight/config/threadpool-config-impl/pom.xml +++ b/opendaylight/config/threadpool-config-impl/pom.xml @@ -1,11 +1,10 @@ - + org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/yang-jmx-generator-it/pom.xml b/opendaylight/config/yang-jmx-generator-it/pom.xml index ce4700ce20..a0ef5c2735 100644 --- a/opendaylight/config/yang-jmx-generator-it/pom.xml +++ b/opendaylight/config/yang-jmx-generator-it/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT yang-jmx-generator-it diff --git a/opendaylight/config/yang-jmx-generator-plugin/pom.xml b/opendaylight/config/yang-jmx-generator-plugin/pom.xml index aa8a302e83..f6d1c88c83 100644 --- a/opendaylight/config/yang-jmx-generator-plugin/pom.xml +++ b/opendaylight/config/yang-jmx-generator-plugin/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. yang-jmx-generator-plugin diff --git a/opendaylight/config/yang-jmx-generator/pom.xml b/opendaylight/config/yang-jmx-generator/pom.xml index 9993c2f259..b6e89cb92e 100644 --- a/opendaylight/config/yang-jmx-generator/pom.xml +++ b/opendaylight/config/yang-jmx-generator/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT yang-jmx-generator diff --git a/opendaylight/config/yang-store-api/pom.xml b/opendaylight/config/yang-store-api/pom.xml index c97eade26c..b071025c1a 100644 --- a/opendaylight/config/yang-store-api/pom.xml +++ b/opendaylight/config/yang-store-api/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. yang-store-api diff --git a/opendaylight/config/yang-store-impl/pom.xml b/opendaylight/config/yang-store-impl/pom.xml index b0b88e6e59..c4ac830591 100644 --- a/opendaylight/config/yang-store-impl/pom.xml +++ b/opendaylight/config/yang-store-impl/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 config-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT .. yang-store-impl diff --git a/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreCache.java b/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreCache.java index 321ce3af72..48bce78378 100644 --- a/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreCache.java +++ b/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreCache.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.store.impl; import com.google.common.base.Optional; diff --git a/opendaylight/config/yang-test-plugin/pom.xml b/opendaylight/config/yang-test-plugin/pom.xml index 30ac8554fe..fe7358ee90 100644 --- a/opendaylight/config/yang-test-plugin/pom.xml +++ b/opendaylight/config/yang-test-plugin/pom.xml @@ -1,11 +1,9 @@ - + org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent 4.0.0 diff --git a/opendaylight/config/yang-test/pom.xml b/opendaylight/config/yang-test/pom.xml index 10d62edfc1..9c6e98e571 100644 --- a/opendaylight/config/yang-test/pom.xml +++ b/opendaylight/config/yang-test/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 org.opendaylight.controller config-plugin-parent - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../config-plugin-parent @@ -61,7 +59,49 @@ + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.opendaylight.controller + + + yang-test-plugin + + + [0.2.3,) + + + + delete-sources + + + process-sources + + + + + + + + + + + + + + org.opendaylight.yangtools diff --git a/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java b/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java index 5a4cfc1248..31b4c78fe3 100644 --- a/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java +++ b/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.test.impl; import com.google.common.collect.Lists; diff --git a/opendaylight/configuration/api/pom.xml b/opendaylight/configuration/api/pom.xml index 08dbd7c200..97b2d25fc1 100644 --- a/opendaylight/configuration/api/pom.xml +++ b/opendaylight/configuration/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ configuration - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationEvent.java b/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationEvent.java index 77333e2dc2..a7e936532b 100644 --- a/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationEvent.java +++ b/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationEvent.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.configuration; public enum ConfigurationEvent { diff --git a/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationObject.java b/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationObject.java index 34542de896..720dc7b234 100644 --- a/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationObject.java +++ b/opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationObject.java @@ -12,7 +12,7 @@ import java.io.Serializable; public abstract class ConfigurationObject implements Serializable { private static final long serialVersionUID = 1L; - private static final String DEFAULT_REGEX = "^[\\w-\\+\\*\\/\\.\\(\\)\\[\\]\\@]{1,256}$"; + private static final String DEFAULT_REGEX = "^[\\w-=\\+\\*\\/\\.\\(\\)\\[\\]\\@\\|\\:]{1,256}$"; private static final String REGEX_PROP_NAME = "resourceNameRegularExpression"; private static String regex; @@ -31,7 +31,7 @@ public abstract class ConfigurationObject implements Serializable { * resource name regular expression, false otherwise */ protected boolean isValidResourceName(String name) { - return (name != null) ? name.matches(regex) : false; + return name != null && name.matches(regex); } /** diff --git a/opendaylight/configuration/implementation/pom.xml b/opendaylight/configuration/implementation/pom.xml index 9eb2e16809..8259243fdc 100644 --- a/opendaylight/configuration/implementation/pom.xml +++ b/opendaylight/configuration/implementation/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ configuration.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java index 03acfa88eb..e4d55d11fb 100644 --- a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java +++ b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.configuration.internal; +import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; @@ -189,7 +190,12 @@ public class ConfigurationService implements IConfigurationService, ICacheUpdate } String source = String.format("%s%s", ROOT, fileName); Object obj = objReader.read(reader, source); - return (obj == null || !(obj instanceof List)) ? Collections. emptyList() - : (List) obj; + if (obj == null) { + return Collections. emptyList(); + } + if (obj instanceof ConcurrentMap) { + return new ArrayList(((ConcurrentMap)obj).values()); + } + return (List) obj; } } diff --git a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java index c33fdefd7b..9c1d391daa 100644 --- a/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java +++ b/opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.configuration.internal; import java.io.File; +import java.util.ArrayList; import java.util.Collections; import java.util.Dictionary; import java.util.EnumSet; @@ -219,7 +220,12 @@ public class ContainerConfigurationService implements IConfigurationContainerSer } String source = String.format("%s%s", root, fileName); Object obj = objReader.read(reader, source); - return (obj == null || !(obj instanceof List)) ? Collections. emptyList() - : (List) obj; + if (obj == null) { + return Collections. emptyList(); + } + if (obj instanceof ConcurrentMap) { + return new ArrayList(((ConcurrentMap)obj).values()); + } + return (List) obj; } } diff --git a/opendaylight/configuration/integrationtest/pom.xml b/opendaylight/configuration/integrationtest/pom.xml index aa3758142b..6f116e3576 100644 --- a/opendaylight/configuration/integrationtest/pom.xml +++ b/opendaylight/configuration/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -15,7 +15,7 @@ configuration.integrationtest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT org.opendaylight.controller 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 index 713592275d..eb9ce47507 100644 --- 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 @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.configuration.internal; import static org.junit.Assert.assertFalse; diff --git a/opendaylight/connectionmanager/api/pom.xml b/opendaylight/connectionmanager/api/pom.xml index 01799f996b..3a66ce3420 100644 --- a/opendaylight/connectionmanager/api/pom.xml +++ b/opendaylight/connectionmanager/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ connectionmanager - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT bundle diff --git a/opendaylight/connectionmanager/implementation/pom.xml b/opendaylight/connectionmanager/implementation/pom.xml index a3cbe51607..7de43962cf 100644 --- a/opendaylight/connectionmanager/implementation/pom.xml +++ b/opendaylight/connectionmanager/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ connectionmanager.implementation - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT bundle @@ -54,22 +54,22 @@ org.opendaylight.controller clustering.services - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT org.opendaylight.controller connectionmanager - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.opendaylight.controller sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT org.opendaylight.controller sal.connection - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT equinoxSDK381 diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEvent.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEvent.java index f07672d110..bb353ffa08 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEvent.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEvent.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.internal; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEventType.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEventType.java index 98399b0f2b..cefae55fc6 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEventType.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionMgmtEventType.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.internal; public enum ConnectionMgmtEventType { diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java index 718a3ff166..1d0e86ecd1 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; import java.net.InetAddress; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AnyControllerScheme.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AnyControllerScheme.java index 4db64a64d3..a4138c4160 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AnyControllerScheme.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AnyControllerScheme.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; import java.net.InetAddress; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/ControllerConfig.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/ControllerConfig.java index 4db80a52bb..e186d2b9a1 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/ControllerConfig.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/ControllerConfig.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; import java.net.InetAddress; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/LoadBalancedScheme.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/LoadBalancedScheme.java index a80494b62a..04b6e1bc30 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/LoadBalancedScheme.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/LoadBalancedScheme.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/RoundRobinScheme.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/RoundRobinScheme.java index 4a498dc515..eed120b7ec 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/RoundRobinScheme.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/RoundRobinScheme.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; import org.opendaylight.controller.clustering.services.IClusterGlobalServices; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SchemeFactory.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SchemeFactory.java index 7e137452b0..2a6a91fda3 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SchemeFactory.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SchemeFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; import org.opendaylight.controller.clustering.services.IClusterGlobalServices; diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SingleControllerScheme.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SingleControllerScheme.java index a84a11b336..292773a2ed 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SingleControllerScheme.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SingleControllerScheme.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.connectionmanager.scheme; import org.opendaylight.controller.clustering.services.IClusterGlobalServices; @@ -24,4 +31,4 @@ class SingleControllerScheme extends AbstractScheme { // Lets make it simple. The Cluster Coordinator is the master return clusterServices.amICoordinator(); } -} \ No newline at end of file +} diff --git a/opendaylight/containermanager/api/pom.xml b/opendaylight/containermanager/api/pom.xml index 3c053f441a..566691f7cb 100644 --- a/opendaylight/containermanager/api/pom.xml +++ b/opendaylight/containermanager/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ containermanager - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/containermanager/implementation/pom.xml b/opendaylight/containermanager/implementation/pom.xml index 13e847b575..4cc44cb580 100644 --- a/opendaylight/containermanager/implementation/pom.xml +++ b/opendaylight/containermanager/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ containermanager.implementation - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/containermanager/it.implementation/pom.xml b/opendaylight/containermanager/it.implementation/pom.xml index c6d8c5911c..5fff7024fb 100644 --- a/opendaylight/containermanager/it.implementation/pom.xml +++ b/opendaylight/containermanager/it.implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ containermanager.it.implementation - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index 1de9c4856c..5aba5ca5cb 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -13,7 +13,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -145,7 +145,7 @@ org.opendaylight.controller.model model-topology - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools.model @@ -154,7 +154,7 @@ org.opendaylight.controller sal-binding-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.md @@ -369,12 +369,12 @@ org.opendaylight.yangtools yang-binding - 0.6.0-SNAPSHOT + ${yangtools.version} org.opendaylight.yangtools binding-type-provider - 0.6.0-SNAPSHOT + ${yangtools.version} org.opendaylight.yangtools @@ -556,7 +556,7 @@ distribution.opendaylight - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT pom @@ -1248,6 +1248,10 @@ io.netty netty-common + + io.netty + netty-codec-http + diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini index 47563b94cf..1ddfe1c7f3 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini @@ -13,7 +13,7 @@ osgi.bundles=\ reference\:file\:../lib/jersey-server-1.17.jar@2:start # Netconf startup configuration -netconf.tcp.address=0.0.0.0 +netconf.tcp.address=127.0.0.1 netconf.tcp.port=8383 netconf.tcp.client.address=127.0.0.1 diff --git a/opendaylight/distribution/sanitytest/pom.xml b/opendaylight/distribution/sanitytest/pom.xml index 9d5ba5cc95..a8d083ea6b 100644 --- a/opendaylight/distribution/sanitytest/pom.xml +++ b/opendaylight/distribution/sanitytest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ sanitytest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/distribution/Sanity.java b/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/distribution/Sanity.java index 7fc25e2b81..9e6d43a06b 100644 --- a/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/distribution/Sanity.java +++ b/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/distribution/Sanity.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.distribution; import java.io.IOException; diff --git a/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java b/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java index 08f0700168..60db1b31e6 100644 --- a/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java +++ b/opendaylight/distribution/sanitytest/src/main/java/org/opendaylight/controller/sanitytest/internal/Activator.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sanitytest.internal; import java.util.Timer; diff --git a/opendaylight/forwarding/staticrouting/pom.xml b/opendaylight/forwarding/staticrouting/pom.xml index e02b6bb39e..2d6fc2ad6c 100644 --- a/opendaylight/forwarding/staticrouting/pom.xml +++ b/opendaylight/forwarding/staticrouting/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ forwarding.staticrouting - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/forwardingrulesmanager/api/pom.xml b/opendaylight/forwardingrulesmanager/api/pom.xml index 4687866c29..3bd1af3a10 100644 --- a/opendaylight/forwardingrulesmanager/api/pom.xml +++ b/opendaylight/forwardingrulesmanager/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ forwardingrulesmanager - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle diff --git a/opendaylight/forwardingrulesmanager/implementation/pom.xml b/opendaylight/forwardingrulesmanager/implementation/pom.xml index eaee390eec..8db8a0b8fd 100644 --- a/opendaylight/forwardingrulesmanager/implementation/pom.xml +++ b/opendaylight/forwardingrulesmanager/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ forwardingrulesmanager.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle @@ -72,12 +72,12 @@ org.opendaylight.controller configuration - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT org.opendaylight.controller clustering.services - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT org.opendaylight.controller @@ -86,17 +86,17 @@ org.opendaylight.controller sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT org.opendaylight.controller sal.connection - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.opendaylight.controller forwardingrulesmanager - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT equinoxSDK381 @@ -105,12 +105,12 @@ org.opendaylight.controller connectionmanager - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.opendaylight.controller containermanager - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT diff --git a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java index bce7dd30ba..b94103fb1c 100644 --- a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java +++ b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java @@ -331,7 +331,7 @@ public class ForwardingRulesManager implements for (FlowEntryInstall installEntry : toInstallSafe) { // Install and update database - Status ret = addEntriesInternal(installEntry, async); + Status ret = addEntryInternal(installEntry, async); if (ret.isSuccess()) { oneSucceded = true; @@ -494,7 +494,7 @@ public class ForwardingRulesManager implements } // Install new entries for (FlowEntryInstall newEntry : toInstallSafe) { - succeeded = this.addEntriesInternal(newEntry, async); + succeeded = this.addEntryInternal(newEntry, async); } } else { /* @@ -554,7 +554,9 @@ public class ForwardingRulesManager implements /** * This is the function that modifies the final container flows merged * entries on the network node and update the database. It expects that all - * the validity checks are passed + * the validity checks are passed. + * This function is supposed to be called only on the controller on which + * the IFRM call is executed. * * @param currentEntries * @param newEntries @@ -564,13 +566,13 @@ public class ForwardingRulesManager implements * contain the unique id assigned to this request */ private Status modifyEntryInternal(FlowEntryInstall currentEntries, FlowEntryInstall newEntries, boolean async) { + Status status = new Status(StatusCode.UNDEFINED); FlowEntryDistributionOrderFutureTask futureStatus = distributeWorkOrder(currentEntries, newEntries, UpdateType.CHANGED); if (futureStatus != null) { - Status retStatus = new Status(StatusCode.UNDEFINED); try { - retStatus = futureStatus.get(); - if (retStatus.getCode() + status = futureStatus.get(); + if (status.getCode() .equals(StatusCode.TIMEOUT)) { // A timeout happened, lets cleanup the workMonitor workMonitor.remove(futureStatus.getOrder()); @@ -580,30 +582,31 @@ public class ForwardingRulesManager implements } catch (ExecutionException e) { log.error("", e); } - return retStatus; } else { // Modify the flow on the network node - Status status = async ? programmer.modifyFlowAsync(currentEntries.getNode(), currentEntries.getInstall() - .getFlow(), newEntries.getInstall() - .getFlow()) : programmer.modifyFlow(currentEntries.getNode(), currentEntries.getInstall() - .getFlow(), newEntries.getInstall() - .getFlow()); + status = modifyEntryInHw(currentEntries, newEntries, async); + } - if (!status.isSuccess()) { - log.trace("SDN Plugin failed to program the flow: {}. The failure is: {}", newEntries.getInstall(), - status.getDescription()); - return status; - } + if (!status.isSuccess()) { + log.trace("{} SDN Plugin failed to program the flow: {}. The failure is: {}", + (futureStatus != null) ? "Remote" : "Local", newEntries.getInstall(), status.getDescription()); + return status; + } - log.trace("Modified {} => {}", currentEntries.getInstall(), newEntries.getInstall()); + log.trace("Modified {} => {}", currentEntries.getInstall(), newEntries.getInstall()); - // Update DB - newEntries.setRequestId(status.getRequestId()); - updateSwViews(currentEntries, false); - updateSwViews(newEntries, true); + // Update DB + newEntries.setRequestId(status.getRequestId()); + updateSwViews(currentEntries, false); + updateSwViews(newEntries, true); - return status; - } + return status; + } + + private Status modifyEntryInHw(FlowEntryInstall currentEntries, FlowEntryInstall newEntries, boolean async) { + return async ? programmer.modifyFlowAsync(currentEntries.getNode(), currentEntries.getInstall().getFlow(), + newEntries.getInstall().getFlow()) : programmer.modifyFlow(currentEntries.getNode(), currentEntries + .getInstall().getFlow(), newEntries.getInstall().getFlow()); } /** @@ -672,6 +675,8 @@ public class ForwardingRulesManager implements * This is the function that removes the final container flows merged entry * from the network node and update the database. It expects that all the * validity checks are passed + * This function is supposed to be called only on the controller on which + * the IFRM call is executed. * * @param entry * the flow entry to remove @@ -681,13 +686,12 @@ public class ForwardingRulesManager implements * contain the unique id assigned to this request */ private Status removeEntryInternal(FlowEntryInstall entry, boolean async) { + Status status = new Status(StatusCode.UNDEFINED); FlowEntryDistributionOrderFutureTask futureStatus = distributeWorkOrder(entry, null, UpdateType.REMOVED); if (futureStatus != null) { - Status retStatus = new Status(StatusCode.UNDEFINED); try { - retStatus = futureStatus.get(); - if (retStatus.getCode() - .equals(StatusCode.TIMEOUT)) { + status = futureStatus.get(); + if (status.getCode().equals(StatusCode.TIMEOUT)) { // A timeout happened, lets cleanup the workMonitor workMonitor.remove(futureStatus.getOrder()); } @@ -696,28 +700,31 @@ public class ForwardingRulesManager implements } catch (ExecutionException e) { log.error("", e); } - return retStatus; } else { // Mark the entry to be deleted (for CC just in case we fail) entry.toBeDeleted(); // Remove from node - Status status = async ? programmer.removeFlowAsync(entry.getNode(), entry.getInstall() - .getFlow()) : programmer.removeFlow(entry.getNode(), entry.getInstall() - .getFlow()); - - if (!status.isSuccess()) { - log.trace("SDN Plugin failed to remove the flow: {}. The failure is: {}", entry.getInstall(), - status.getDescription()); - return status; - } - log.trace("Removed {}", entry.getInstall()); - - // Update DB - updateSwViews(entry, false); + status = removeEntryInHw(entry, async); + } + if (!status.isSuccess()) { + log.trace("{} SDN Plugin failed to remove the flow: {}. The failure is: {}", + (futureStatus != null) ? "Remote" : "Local", entry.getInstall(), status.getDescription()); return status; } + + log.trace("Removed {}", entry.getInstall()); + + // Update DB + updateSwViews(entry, false); + + return status; + } + + private Status removeEntryInHw(FlowEntryInstall entry, boolean async) { + return async ? programmer.removeFlowAsync(entry.getNode(), entry.getInstall().getFlow()) : programmer + .removeFlow(entry.getNode(), entry.getInstall().getFlow()); } /** @@ -725,6 +732,8 @@ public class ForwardingRulesManager implements * on the network node and updates the database. It expects that all the * validity and conflict checks are passed. That means it does not check * whether this flow would conflict or overwrite an existing one. + * This function is supposed to be called only on the controller on which + * the IFRM call is executed. * * @param entry * the flow entry to install @@ -733,14 +742,13 @@ public class ForwardingRulesManager implements * @return the status of this request. In case of asynchronous call, it will * contain the unique id assigned to this request */ - private Status addEntriesInternal(FlowEntryInstall entry, boolean async) { + private Status addEntryInternal(FlowEntryInstall entry, boolean async) { + Status status = new Status(StatusCode.UNDEFINED); FlowEntryDistributionOrderFutureTask futureStatus = distributeWorkOrder(entry, null, UpdateType.ADDED); if (futureStatus != null) { - Status retStatus = new Status(StatusCode.UNDEFINED); try { - retStatus = futureStatus.get(); - if (retStatus.getCode() - .equals(StatusCode.TIMEOUT)) { + status = futureStatus.get(); + if (status.getCode().equals(StatusCode.TIMEOUT)) { // A timeout happened, lets cleanup the workMonitor workMonitor.remove(futureStatus.getOrder()); } @@ -749,27 +757,29 @@ public class ForwardingRulesManager implements } catch (ExecutionException e) { log.error("", e); } - return retStatus; } else { - // Install the flow on the network node - Status status = async ? programmer.addFlowAsync(entry.getNode(), entry.getInstall() - .getFlow()) : programmer.addFlow(entry.getNode(), entry.getInstall() - .getFlow()); + status = addEntryInHw(entry, async); + } - if (!status.isSuccess()) { - log.trace("SDN Plugin failed to program the flow: {}. The failure is: {}", entry.getInstall(), - status.getDescription()); - return status; - } + if (!status.isSuccess()) { + log.trace("{} SDN Plugin failed to program the flow: {}. The failure is: {}", + (futureStatus != null) ? "Remote" : "Local", entry.getInstall(), status.getDescription()); + return status; + } + + log.trace("Added {}", entry.getInstall()); - log.trace("Added {}", entry.getInstall()); + // Update DB + entry.setRequestId(status.getRequestId()); + updateSwViews(entry, true); - // Update DB - entry.setRequestId(status.getRequestId()); - updateSwViews(entry, true); + return status; + } - return status; - } + private Status addEntryInHw(FlowEntryInstall entry, boolean async) { + // Install the flow on the network node + return async ? programmer.addFlowAsync(entry.getNode(), entry.getInstall().getFlow()) : programmer.addFlow( + entry.getNode(), entry.getInstall().getFlow()); } /** @@ -2526,13 +2536,13 @@ public class ForwardingRulesManager implements FlowEntryInstall feiNew = workOrder.get(fe); switch (fe.getUpType()) { case ADDED: - gotStatus = addEntriesInternal(feiCurrent, false); + gotStatus = addEntryInHw(feiCurrent, false); break; case CHANGED: - gotStatus = modifyEntryInternal(feiCurrent, feiNew, false); + gotStatus = modifyEntryInHw(feiCurrent, feiNew, false); break; case REMOVED: - gotStatus = removeEntryInternal(feiCurrent, false); + gotStatus = removeEntryInHw(feiCurrent, false); break; } // Remove the Order diff --git a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerCLI.java b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerCLI.java index 3a99ed7ba0..320561b5de 100644 --- a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerCLI.java +++ b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerCLI.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.forwardingrulesmanager.internal; import java.util.Dictionary; diff --git a/opendaylight/forwardingrulesmanager/integrationtest/pom.xml b/opendaylight/forwardingrulesmanager/integrationtest/pom.xml index 6fc318cd3a..7ac45f47b6 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/pom.xml +++ b/opendaylight/forwardingrulesmanager/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -15,7 +15,7 @@ forwardingrulesmanager.integrationtest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT diff --git a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java index 6d8156f788..09618c2664 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java +++ b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.forwardingrulesmanager.internal; import static junit.framework.Assert.fail; diff --git a/opendaylight/hosttracker/api/pom.xml b/opendaylight/hosttracker/api/pom.xml index d84f96d84e..f4dfe6a099 100644 --- a/opendaylight/hosttracker/api/pom.xml +++ b/opendaylight/hosttracker/api/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +14,7 @@ HEAD hosttracker - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPHostId.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPHostId.java index 9e2123c6cd..b8b54b45ba 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPHostId.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPHostId.java @@ -61,4 +61,19 @@ public class IPHostId implements IHostId, Serializable { return new IPHostId(addr); } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("IP=["); + if (this.ipAddress != null) { + builder.append(this.ipAddress.getHostAddress()); + } + builder.append("]"); + return (builder.toString()); + } } diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPMacHostId.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPMacHostId.java index 4ab84eb653..e10c5d1a78 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPMacHostId.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IPMacHostId.java @@ -80,4 +80,24 @@ public class IPMacHostId implements IHostId, Serializable { return new IPMacHostId(ip, mac); } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("IP=["); + if (this.ipAddress != null) { + builder.append(this.ipAddress.getHostAddress()); + } + builder.append("]") + .append("MAC=["); + if (this.macAddr != null) { + builder.append(this.macAddr.toString()); + } + builder.append("]"); + return (builder.toString()); + } } diff --git a/opendaylight/hosttracker/implementation/pom.xml b/opendaylight/hosttracker/implementation/pom.xml index 625ababf7a..f19d4e83c4 100644 --- a/opendaylight/hosttracker/implementation/pom.xml +++ b/opendaylight/hosttracker/implementation/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight hosttracker.implementation - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java index e1a8ef806a..734a392bc1 100644 --- a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java +++ b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java @@ -480,7 +480,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw * Host replacement has failed, do the recovery */ hostsDB.put(id, newHost); - logger.error("Host replacement failed. Overwrite the host. Repalced Host: {}, New Host: {}", removedHost, + logger.error("Host replacement failed. Overwrite the host. Replaced Host: {}, New Host: {}", removedHost, newHost); } notifyHostLearnedOrRemoved(removedHost, false); @@ -948,6 +948,10 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw } } + /* + * This thread runs every 4 seconds + */ + class OutStandingARPHandler extends TimerTask { @Override public void run() { @@ -955,53 +959,55 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw return; } ARPPending arphost; - /* This routine runs every 4 seconds */ - logger.trace("Number of Entries in ARP Pending/Failed Lists: ARPPendingList = {}, failedARPReqList = {}", - ARPPendingList.size(), failedARPReqList.size()); - for (Entry entry : ARPPendingList.entrySet()) { - arphost = entry.getValue(); - - if (hostsDB.containsKey(arphost.getHostId())) { - // this host is already learned, shouldn't be in - // ARPPendingList - // Remove it and continue - logger.warn("Learned Host {} found in ARPPendingList", decodeIPFromId(arphost.getHostId())); - ARPPendingList.remove(entry.getKey()); - continue; - } - if (arphost.getSent_count() < hostRetryCount) { - /* - * No reply has been received of first ARP Req, send the - * next one. Before sending the ARP, check if ARPHandler is - * available or not - */ - if (hostFinder == null) { - logger.warn("ARPHandler Services are not available for Outstanding ARPs"); + try { + for (Entry entry : ARPPendingList.entrySet()) { + arphost = entry.getValue(); + + if (hostsDB.containsKey(arphost.getHostId())) { + // this host is already learned, shouldn't be in + // ARPPendingList + // Remove it and continue + logger.warn("Learned Host {} found in ARPPendingList", decodeIPFromId(arphost.getHostId())); + ARPPendingList.remove(entry.getKey()); continue; } - for (IHostFinder hf : hostFinder) { - hf.find(decodeIPFromId(arphost.getHostId())); - } - arphost.sent_count++; - logger.debug("ARP Sent from ARPPending List, IP: {}", decodeIPFromId(arphost.getHostId())); - } else if (arphost.getSent_count() >= hostRetryCount) { - /* - * ARP requests have been sent without receiving a reply, - * remove this from the pending list - */ - ARPPendingList.remove(entry.getKey()); - logger.debug("ARP reply not received after multiple attempts, removing from Pending List IP: {}", - decodeIPFromId(arphost.getHostId())); - /* - * Add this host to a different list which will be processed - * on link up events - */ - logger.debug("Adding the host to FailedARPReqList IP: {}", decodeIPFromId(arphost.getHostId())); - failedARPReqList.put(entry.getKey(), arphost); + if (arphost.getSent_count() < hostRetryCount) { + /* + * No reply has been received of first ARP Req, send the + * next one. Before sending the ARP, check if ARPHandler + * is available or not + */ + if (hostFinder == null) { + logger.warn("ARPHandler Services are not available for Outstanding ARPs"); + continue; + } + for (IHostFinder hf : hostFinder) { + hf.find(decodeIPFromId(arphost.getHostId())); + } + arphost.sent_count++; + logger.debug("ARP Sent from ARPPending List, IP: {}", decodeIPFromId(arphost.getHostId())); + } else if (arphost.getSent_count() >= hostRetryCount) { + /* + * ARP requests have been sent without receiving a + * reply, remove this from the pending list + */ + ARPPendingList.remove(entry.getKey()); + logger.debug( + "ARP reply not received after multiple attempts, removing from Pending List IP: {}", + decodeIPFromId(arphost.getHostId())); + /* + * Add this host to a different list which will be + * processed on link up events + */ + logger.debug("Adding the host to FailedARPReqList IP: {}", decodeIPFromId(arphost.getHostId())); + failedARPReqList.put(entry.getKey(), arphost); - } else { - logger.error("Inavlid arp_sent count for entry: {}", entry); + } else { + logger.error("Inavlid arp_sent count for entry: {}", entry); + } } + } catch (IllegalStateException e) { + logger.debug("IllegalStateException Received by OutStandingARPHandler from: {}", e.getMessage()); } } } @@ -1009,10 +1015,10 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw private class ARPRefreshHandler extends TimerTask { @Override public void run() { - if (stopping) { + if ((clusterContainerService != null) && !clusterContainerService.amICoordinator()) { return; } - if ((clusterContainerService != null) && !clusterContainerService.amICoordinator()) { + if (stopping) { return; } if (!hostRefresh) { @@ -1026,49 +1032,54 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw logger.error("ARPRefreshHandler(): hostsDB is not allocated yet:"); return; } - for (Entry entry : hostsDB.entrySet()) { - HostNodeConnector host = entry.getValue(); - if (host.isStaticHost()) { - /* this host was learned via API3, don't age it out */ - continue; - } - - short arp_cntdown = host.getArpSendCountDown(); - arp_cntdown--; - if (arp_cntdown > hostRetryCount) { - host.setArpSendCountDown(arp_cntdown); - } else if (arp_cntdown <= 0) { - /* - * No ARP Reply received in last 2 minutes, remove this host - * and inform applications - */ - removeKnownHost(entry.getKey()); - notifyHostLearnedOrRemoved(host, false); - } else if (arp_cntdown <= hostRetryCount) { - /* - * Use the services of arphandler to check if host is still - * there - */ - if (logger.isTraceEnabled()) { - logger.trace( - "ARP Probing ({}) for {}({})", - new Object[] { arp_cntdown, host.getNetworkAddress().getHostAddress(), - HexEncode.bytesToHexString(host.getDataLayerAddressBytes()) }); + try { + for (Entry entry : hostsDB.entrySet()) { + HostNodeConnector host = entry.getValue(); + if (host.isStaticHost()) { + /* this host was learned via API3, don't age it out */ + continue; } - host.setArpSendCountDown(arp_cntdown); - if (hostFinder == null) { + + short arp_cntdown = host.getArpSendCountDown(); + arp_cntdown--; + if (arp_cntdown > hostRetryCount) { + host.setArpSendCountDown(arp_cntdown); + } else if (arp_cntdown <= 0) { /* - * If hostfinder is not available, then can't send the - * probe. However, continue the age out the hosts since - * we don't know if the host is indeed out there or not. + * No ARP Reply received in last 2 minutes, remove this + * host and inform applications */ - logger.trace("ARPHandler is not avaialable, can't send the probe"); - continue; - } - for (IHostFinder hf : hostFinder) { - hf.probe(host); + removeKnownHost(entry.getKey()); + notifyHostLearnedOrRemoved(host, false); + } else if (arp_cntdown <= hostRetryCount) { + /* + * Use the services of arphandler to check if host is + * still there + */ + if (logger.isTraceEnabled()) { + logger.trace( + "ARP Probing ({}) for {}({})", + new Object[] { arp_cntdown, host.getNetworkAddress().getHostAddress(), + HexEncode.bytesToHexString(host.getDataLayerAddressBytes()) }); + } + host.setArpSendCountDown(arp_cntdown); + if (hostFinder == null) { + /* + * If hostfinder is not available, then can't send + * the probe. However, continue the age out the + * hosts since we don't know if the host is indeed + * out there or not. + */ + logger.trace("ARPHandler is not avaialable, can't send the probe"); + continue; + } + for (IHostFinder hf : hostFinder) { + hf.probe(host); + } } } + } catch (IllegalStateException e) { + logger.debug("IllegalStateException Received by ARPRefreshHandler from: {}", e.getMessage()); } } } diff --git a/opendaylight/hosttracker/integrationtest/pom.xml b/opendaylight/hosttracker/integrationtest/pom.xml index eb902528c1..17f43057d7 100644 --- a/opendaylight/hosttracker/integrationtest/pom.xml +++ b/opendaylight/hosttracker/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -15,7 +15,7 @@ hosttracker.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT diff --git a/opendaylight/hosttracker_new/api/pom.xml b/opendaylight/hosttracker_new/api/pom.xml index 495058ff86..b475efbf7a 100644 --- a/opendaylight/hosttracker_new/api/pom.xml +++ b/opendaylight/hosttracker_new/api/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight hosttracker_new - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/hosttracker_new/implementation/pom.xml b/opendaylight/hosttracker_new/implementation/pom.xml index c035be49ec..48e204bd4e 100644 --- a/opendaylight/hosttracker_new/implementation/pom.xml +++ b/opendaylight/hosttracker_new/implementation/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight hosttracker_new.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/logging/bridge/pom.xml b/opendaylight/logging/bridge/pom.xml index 3cdc01a409..3ceb5b1812 100644 --- a/opendaylight/logging/bridge/pom.xml +++ b/opendaylight/logging/bridge/pom.xml @@ -1,56 +1,71 @@ - 4.0.0 - - org.opendaylight.controller - commons.opendaylight - 1.4.1-SNAPSHOT - ../../commons/opendaylight - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main - HEAD - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.opendaylight.controller + commons.opendaylight + 1.4.2-SNAPSHOT + ../../commons/opendaylight + + + scm:git:ssh://git.opendaylight.org:29418/controller.git + scm:git:ssh://git.opendaylight.org:29418/controller.git + https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main + HEAD + - logging.bridge - 0.4.1-SNAPSHOT - bundle + logging.bridge + 0.4.2-SNAPSHOT + bundle - - - org.slf4j - slf4j-api - - - equinoxSDK381 - org.eclipse.osgi - - + + + org.slf4j + slf4j-api + + + equinoxSDK381 + org.eclipse.osgi + + + junit + junit + test + + + org.opendaylight.yangtools + mockito-configuration + test + + + ch.qos.logback + logback-classic + test + + - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - - org.slf4j, - org.osgi.framework, - org.osgi.service.log - - - org.opendaylight.controller.logging.bridge.internal.Activator - - - ${project.basedir}/META-INF - - - - + + + + org.apache.felix + maven-bundle-plugin + ${bundle.plugin.version} + true + + + + org.slf4j, + org.osgi.framework, + org.osgi.service.log + + + org.opendaylight.controller.logging.bridge.internal.Activator + + + ${project.basedir}/META-INF + + + + diff --git a/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImpl.java b/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImpl.java index 03719d567f..2f45c6f91b 100644 --- a/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImpl.java +++ b/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImpl.java @@ -26,19 +26,19 @@ public class LogListenerImpl implements LogListener { if (this.logger != null) { switch (entry.getLevel()) { case LogService.LOG_DEBUG: - this.logger.debug("Bundle:{} Message:{} Exception:{}", entry.getBundle() + this.logger.debug("Bundle:{} Message:{}", entry.getBundle() .getSymbolicName(), entry.getMessage(), entry.getException()); break; case LogService.LOG_INFO: - this.logger.info("Bundle:{} Message:{} Exception:{}", entry.getBundle() + this.logger.info("Bundle:{} Message:{}", entry.getBundle() .getSymbolicName(), entry.getMessage(), entry.getException()); break; case LogService.LOG_WARNING: - this.logger.warn("Bundle:{} Message:{} Exception:{}", entry.getBundle() + this.logger.warn("Bundle:{} Message:{}", entry.getBundle() .getSymbolicName(), entry.getMessage(), entry.getException()); break; case LogService.LOG_ERROR: - this.logger.error("Bundle:{} Message:{} Exception:{}", entry.getBundle() + this.logger.error("Bundle:{} Message:{}", entry.getBundle() .getSymbolicName(), entry.getMessage(), entry.getException()); break; } diff --git a/opendaylight/logging/bridge/src/test/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImplTest.java b/opendaylight/logging/bridge/src/test/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImplTest.java new file mode 100644 index 0000000000..2490c39171 --- /dev/null +++ b/opendaylight/logging/bridge/src/test/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImplTest.java @@ -0,0 +1,67 @@ +/* + * 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.logging.bridge.internal; + +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogEntry; +import org.osgi.service.log.LogService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +public class LogListenerImplTest { + private static final Logger logger = LoggerFactory.getLogger(LogListenerImplTest.class); + + @Test + public void test() { + LogListenerImpl tested = new LogListenerImpl(logger); + tested.logged(getEntry("m1", null)); + tested.logged(getEntry("m2", new RuntimeException())); + } + + private LogEntry getEntry(final String message, final Exception e) { + return new LogEntry() { + @Override + public Bundle getBundle() { + Bundle mock = mock(Bundle.class); + doReturn(null).when(mock).getSymbolicName(); + return mock; + } + + @Override + public ServiceReference getServiceReference() { + return null; + } + + @Override + public int getLevel() { + return LogService.LOG_INFO; + } + + @Override + public String getMessage() { + return message; + } + + @Override + public Throwable getException() { + return e; + } + + @Override + public long getTime() { + return 0; + } + }; + } + +} diff --git a/opendaylight/md-sal/clustered-data-store/implementation/pom.xml b/opendaylight/md-sal/clustered-data-store/implementation/pom.xml index 869a298d0f..e6cfee15e1 100644 --- a/opendaylight/md-sal/clustered-data-store/implementation/pom.xml +++ b/opendaylight/md-sal/clustered-data-store/implementation/pom.xml @@ -72,7 +72,7 @@ org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModule.java b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModule.java index 5038cae123..5fc2c015ed 100644 --- a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModule.java +++ b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModule.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ /** * Generated file diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModuleFactory.java b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModuleFactory.java index 8a926eb6b5..40c558726d 100644 --- a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModuleFactory.java +++ b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/cluster/store/ClusteredDataStoreImplModuleFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ /** * Generated file diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImplTest.java b/opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImplTest.java index 0323df6e2d..4c97b19bac 100644 --- a/opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImplTest.java +++ b/opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImplTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.datastore.internal; import org.junit.Before; diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml b/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml index fd31e35859..41db8af590 100644 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller compatibility-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT flow-management-compatibility bundle @@ -12,6 +11,7 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL + HEAD @@ -40,12 +40,12 @@ org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.slf4j @@ -72,17 +72,17 @@ org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller forwardingrulesmanager - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT org.opendaylight.controller sal-compatibility - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.xtend b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.xtend index bbad85b35f..b90c76378d 100644 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.xtend +++ b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.frm.compatibility import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.xtend b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.xtend index bafdf88553..e15b3c6c85 100644 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.xtend +++ b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.frm.compatibility import org.opendaylight.controller.forwardingrulesmanager.FlowConfig diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java index 61566d7aa3..017263e264 100644 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java +++ b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.frm.compatibility; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows; diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java index 2fbe0a0202..0b77ea7989 100644 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java +++ b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.frm.compatibility; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext; diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml index 1b510d0e0b..46f1c4f57b 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller compatibility-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT inventory-topology-compatibility bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -41,22 +41,22 @@ org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller switchmanager - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT org.opendaylight.controller topologymanager - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT org.slf4j @@ -83,27 +83,27 @@ org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-topology - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller forwardingrulesmanager - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT org.opendaylight.controller sal-compatibility - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend index 262e8486ee..9b71369593 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.inventory import org.opendaylight.controller.switchmanager.ISwitchManager diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend index 5d0e7e6fe7..72508416a6 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.switchmanager import org.opendaylight.controller.switchmanager.ISwitchManager diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend index 122aa32f12..faa4b8d5cd 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.switchmanager import org.opendaylight.controller.switchmanager.ISwitchManager diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend index 44c0c04d43..0889de17b6 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.topology import org.opendaylight.yangtools.yang.binding.InstanceIdentifier diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend index 6c0e50e3d2..37d4577e0a 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.topology import org.opendaylight.controller.switchmanager.ISwitchManager diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend index c8050b1526..905b838008 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.topologymanager import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend index 23924c864e..4fdea4b4c2 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.topologymanager import org.opendaylight.controller.topologymanager.ITopologyManager diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.xtend index da3bf66424..b5f6cecd34 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.xtend +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.compatibility.topologymanager import org.opendaylight.controller.topologymanager.ITopologyManager @@ -21,4 +28,4 @@ abstract class ConfigurableLinkManager implements ITopologyManager { throw new UnsupportedOperationException("TODO: auto-generated method stub") } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/compatibility/pom.xml b/opendaylight/md-sal/compatibility/pom.xml index 37d866dca5..606cf212e5 100644 --- a/opendaylight/md-sal/compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT compatibility-parent pom @@ -13,7 +12,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + sal-compatibility @@ -25,22 +25,22 @@ org.opendaylight.controller sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT com.google.guava diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml b/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml index 74193ea128..daef08949a 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller compatibility-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-compatibility MD-SAL to AD-SAL Adaptation @@ -12,28 +11,29 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL + HEAD org.opendaylight.controller.model model-flow-statistics - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-topology - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller clustering.services - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend index 4587cc59ed..a6fc4b0a23 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility import java.util.Arrays diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.xtend index f1c19b127f..8581d4a9da 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility import org.opendaylight.controller.sal.packet.IPluginOutDataPacketService diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend index f5b876f7c7..fac12ee10d 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility import java.util.Map diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java index eba4aa901b..53257f8c83 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility; import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend index 9b69d44144..60e43247c2 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility import java.util.ArrayList diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend index 5a91e919dd..fe545b0988 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility; import com.google.common.net.InetAddresses diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java index 5b4b16a39a..9aba23a308 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility; import org.opendaylight.controller.sal.core.ConstructionException; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java index e36ebd7245..dc834037f5 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility; import org.opendaylight.controller.sal.core.ConstructionException; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend index a3be5dd970..debcbac2eb 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility import org.opendaylight.controller.sal.core.Node diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ProtocolConstants.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ProtocolConstants.java index 92a1aa9476..531578261a 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ProtocolConstants.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ProtocolConstants.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility; public class ProtocolConstants { diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java index baf10efc67..cb72896858 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility; import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/DataPacketServiceAdapter.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/DataPacketServiceAdapter.java index edd3a27255..c4aaf64381 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/DataPacketServiceAdapter.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/DataPacketServiceAdapter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.adsal; import org.opendaylight.controller.sal.compatibility.NodeMapping; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java index c5ea267a01..40de6e5507 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.adsal; import java.math.BigInteger; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java index c7af60285a..4bc23fe33b 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.adsal; import java.math.BigInteger; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend index c4a1108e92..4ce57afe9e 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.topology import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader @@ -27,4 +34,4 @@ class TopologyAdapter implements IPluginInTopologyService { topologyPublisher.edgeUpdate(topology.toADEdgeUpdates(reader)) } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend index c02067a68a..fcf86f236a 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyCommitHandler.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.topology import com.google.common.collect.FluentIterable @@ -59,4 +66,4 @@ class TopologyCommitHandler implements DataCommitHandler { return true; } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/forwardingrules-manager/pom.xml b/opendaylight/md-sal/forwardingrules-manager/pom.xml index e2948fd54e..a949e45d67 100644 --- a/opendaylight/md-sal/forwardingrules-manager/pom.xml +++ b/opendaylight/md-sal/forwardingrules-manager/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.md forwardingrules-manager @@ -14,7 +13,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -46,22 +46,22 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller flow-management-compatibility - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools @@ -70,7 +70,7 @@ org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT provided diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend index 9f45a11d2d..cb1e90d6ba 100644 --- a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend +++ b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.frm import java.util.Collections @@ -96,4 +103,4 @@ abstract class AbstractTransaction implements DataCommitTransaction + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.md inventory-manager @@ -13,7 +12,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -23,17 +23,17 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-inventory - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.eclipse.xtend diff --git a/opendaylight/md-sal/model/model-flow-base/pom.xml b/opendaylight/md-sal/model/model-flow-base/pom.xml index ffa3194418..a7c74c573b 100644 --- a/opendaylight/md-sal/model/model-flow-base/pom.xml +++ b/opendaylight/md-sal/model/model-flow-base/pom.xml @@ -1,16 +1,16 @@ - + model-parent org.opendaylight.controller.model - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 model-flow-base @@ -19,7 +19,7 @@ org.opendaylight.yangtools.model opendaylight-l2-types - 2013.08.27.2-SNAPSHOT + 2013.08.27.3 ${project.groupId} diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-meter-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-meter-types.yang index 1686cad3de..6d1405019c 100644 --- a/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-meter-types.yang +++ b/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-meter-types.yang @@ -73,38 +73,46 @@ module opendaylight-meter-types { choice band-type { case drop { leaf drop-rate { + description "Rate for dropping packets"; type uint32; } leaf drop-burst-size { + description "Size of bursts"; type uint32; } } case dscp-remark { leaf dscp-remark-rate { + description "Rate for remarking packets"; type uint32; } leaf dscp-remark-burst-size { + description "Size of bursts"; type uint32; } leaf perc_level { + description "Number of drop precedence level to add"; type uint8; } } case experimenter { leaf experimenter-rate { + description "Rate for remarking packets"; type uint32; } leaf experimenter-burst-size { + description "Size of bursts"; type uint32; } leaf experimenter { + description "Experimenter id"; type uint32; } } @@ -118,22 +126,27 @@ module opendaylight-meter-types { grouping meter { leaf flags { + description "Meter configuration flags"; type meter-flags; } leaf meter-id { + description "Meter instance"; type meter-id; } leaf barrier { + description "If true, barrier message is sent"; type boolean; } leaf meter-name { + description "Name of meter instance"; type string; } leaf container-name { + description "Name of container"; type string; } @@ -141,20 +154,24 @@ module opendaylight-meter-types { list meter-band-header { key "band-id"; leaf band-id { + description "Meter band id"; type band-id; } container meter-band-types { leaf flags { + description "Meter band flags"; type meter-band-type; } } leaf band-rate { + description "Rate for this band"; type uint32; } leaf band-burst-size { + description "Size of bursts"; type uint32; } uses band-type; diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-table-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-table-types.yang index 118db1af06..e74b548342 100644 --- a/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-table-types.yang +++ b/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-table-types.yang @@ -191,6 +191,7 @@ module opendaylight-table-types { grouping set-field-match { list set-field-match { + key "match-type"; leaf match-type { type identityref { base match-field; diff --git a/opendaylight/md-sal/model/model-flow-management/pom.xml b/opendaylight/md-sal/model/model-flow-management/pom.xml index fe7b9f29f9..d81669532b 100644 --- a/opendaylight/md-sal/model/model-flow-management/pom.xml +++ b/opendaylight/md-sal/model/model-flow-management/pom.xml @@ -1,16 +1,16 @@ - + model-parent org.opendaylight.controller.model - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 model-flow-management @@ -29,7 +29,7 @@ org.opendaylight.yangtools.model opendaylight-l2-types - 2013.08.27.2-SNAPSHOT + 2013.08.27.3 bundle diff --git a/opendaylight/md-sal/model/model-flow-service/pom.xml b/opendaylight/md-sal/model/model-flow-service/pom.xml index fac7cfae28..55837564c3 100644 --- a/opendaylight/md-sal/model/model-flow-service/pom.xml +++ b/opendaylight/md-sal/model/model-flow-service/pom.xml @@ -1,16 +1,16 @@ - + model-parent org.opendaylight.controller.model - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 model-flow-service @@ -29,7 +29,7 @@ org.opendaylight.yangtools.model opendaylight-l2-types - 2013.08.27.2-SNAPSHOT + 2013.08.27.3 bundle diff --git a/opendaylight/md-sal/model/model-flow-service/src/main/yang/packet-processing.yang b/opendaylight/md-sal/model/model-flow-service/src/main/yang/packet-processing.yang index 00ecdbacf0..f3db3181f7 100644 --- a/opendaylight/md-sal/model/model-flow-service/src/main/yang/packet-processing.yang +++ b/opendaylight/md-sal/model/model-flow-service/src/main/yang/packet-processing.yang @@ -8,6 +8,8 @@ module packet-processing { import opendaylight-l2-types {prefix types;revision-date "2013-08-27";} import opendaylight-match-types {prefix match-type;revision-date "2013-10-26";} import opendaylight-table-types {prefix table-type;revision-date "2013-10-26";} + import opendaylight-action-types {prefix action-type;revision-date "2013-11-12";} + revision "2013-07-09" { description ""; @@ -88,7 +90,12 @@ module packet-processing { leaf egress { type inv:node-connector-ref; } + leaf buffer-id { + type uint32; + } + uses raw-packet; + uses action-type:action-list; } } } diff --git a/opendaylight/md-sal/model/model-flow-statistics/pom.xml b/opendaylight/md-sal/model/model-flow-statistics/pom.xml index e357f7d76f..13efc4c3ae 100644 --- a/opendaylight/md-sal/model/model-flow-statistics/pom.xml +++ b/opendaylight/md-sal/model/model-flow-statistics/pom.xml @@ -1,16 +1,16 @@ - + model-parent org.opendaylight.controller.model - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 model-flow-statistics @@ -29,7 +29,7 @@ org.opendaylight.yangtools.model opendaylight-l2-types - 2013.08.27.2-SNAPSHOT + 2013.08.27.3 bundle diff --git a/opendaylight/md-sal/model/model-inventory/pom.xml b/opendaylight/md-sal/model/model-inventory/pom.xml index 341caf5cc6..91400c261a 100644 --- a/opendaylight/md-sal/model/model-inventory/pom.xml +++ b/opendaylight/md-sal/model/model-inventory/pom.xml @@ -1,16 +1,16 @@ - + model-parent org.opendaylight.controller.model - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 model-inventory diff --git a/opendaylight/md-sal/model/model-topology/pom.xml b/opendaylight/md-sal/model/model-topology/pom.xml index 630dab7515..cd44bd2472 100644 --- a/opendaylight/md-sal/model/model-topology/pom.xml +++ b/opendaylight/md-sal/model/model-topology/pom.xml @@ -1,16 +1,16 @@ - + model-parent org.opendaylight.controller.model - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 model-topology @@ -20,7 +20,7 @@ org.opendaylight.controller.model model-inventory - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools.model diff --git a/opendaylight/md-sal/model/pom.xml b/opendaylight/md-sal/model/pom.xml index 5130548324..5092995eb0 100644 --- a/opendaylight/md-sal/model/pom.xml +++ b/opendaylight/md-sal/model/pom.xml @@ -1,16 +1,16 @@ - + org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 4.0.0 org.opendaylight.controller.model @@ -81,13 +81,13 @@ org.opendaylight.yangtools maven-sal-api-gen-plugin - ${yang.codegen.version} + ${yangtools.version} jar org.opendaylight.yangtools yang-binding - ${yang.codegen.version} + ${yangtools.version} jar diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index 50304ff41a..2f594148c9 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -1,23 +1,22 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../commons/opendaylight - org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT pom scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -102,7 +101,6 @@ - 0.6.0-SNAPSHOT UTF-8 http://nexus.opendaylight.org/content @@ -115,7 +113,6 @@ 1.7.2 - ${yangtools.version} 14.0.1 5.0.0 4.8.1 @@ -133,7 +130,7 @@ ${user.name}-private-view java 3.0.0 - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT @@ -464,23 +461,6 @@ maven-jar-plugin 2.4 - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8.1 - - maven - false - - - - - aggregate - - site - - - org.apache.maven.plugins diff --git a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/impl/ZeroMQRoutingTableTestIT.java b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/impl/ZeroMQRoutingTableTestIT.java index 0cf505c8cf..924921264f 100644 --- a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/impl/ZeroMQRoutingTableTestIT.java +++ b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/impl/ZeroMQRoutingTableTestIT.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.remoterpc.impl; import junit.framework.Assert; diff --git a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/RouteIdentifierImpl.java b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/RouteIdentifierImpl.java index 6b7ee26f14..eb5ecd798c 100644 --- a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/RouteIdentifierImpl.java +++ b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/RouteIdentifierImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.tests.zmqroutingtable.rest; import org.opendaylight.controller.sal.connector.api.RpcRouter; @@ -66,4 +73,4 @@ public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier, Serializa result = 31 * result + instance.hashCode(); return result; } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/Router.java b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/Router.java index c426927d52..9bf6e53424 100644 --- a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/Router.java +++ b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqroutingtable/rest/Router.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.tests.zmqroutingtable.rest; import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable; diff --git a/opendaylight/md-sal/sal-binding-api/pom.xml b/opendaylight/md-sal/sal-binding-api/pom.xml index cfbd4f7b71..86e14e4f56 100644 --- a/opendaylight/md-sal/sal-binding-api/pom.xml +++ b/opendaylight/md-sal/sal-binding-api/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-binding-api bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -26,7 +26,7 @@ org.opendaylight.controller sal-common - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBrokerAwareActivator.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBrokerAwareActivator.java index d1a3f85f94..4d008295a3 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBrokerAwareActivator.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBrokerAwareActivator.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api; import java.util.concurrent.ExecutorService; diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java index cb201c5fd1..c28b03eb65 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java @@ -7,14 +7,17 @@ */ package org.opendaylight.controller.sal.binding.api; +import java.util.EventListener; import java.util.concurrent.ExecutorService; import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishService; +import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.Notification; public interface NotificationProviderService extends NotificationService, NotificationPublishService { + /** * Deprecated. Use {@link #publish(Notification)}. * @@ -34,7 +37,8 @@ public interface NotificationProviderService extends NotificationService, Notifi /** * Publishes a notification. * - * @param Notification notification to publish. + * @param Notification + * notification to publish. * */ @Override @@ -46,4 +50,12 @@ public interface NotificationProviderService extends NotificationService, Notifi */ @Override void publish(Notification notification, ExecutorService service); + + ListenerRegistration registerInterestListener( + NotificationInterestListener interestListener); + + public interface NotificationInterestListener extends EventListener { + + void onNotificationSubscribtion(Class notificationType); + } } diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcAvailabilityListener.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcAvailabilityListener.java index e25b93918a..3cf6e8d209 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcAvailabilityListener.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcAvailabilityListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api; public interface RpcAvailabilityListener { diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java index 72c6b1d75d..33b384a94c 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api; import org.opendaylight.yangtools.yang.binding.RpcService; diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java index 0fa85d530e..fcf8ed5c9e 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher; diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/SynchronizedTransaction.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/SynchronizedTransaction.java new file mode 100644 index 0000000000..d7cb926775 --- /dev/null +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/SynchronizedTransaction.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.binding.api.data; + +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Future; + +import org.opendaylight.controller.md.sal.common.api.TransactionStatus; +import org.opendaylight.yangtools.concepts.Delegator; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; + +import com.google.common.base.Preconditions; + +/** + * Synchronized wrapper for DataModificationTransaction. + * + * To get instance of synchronized wrapper use {@link #from(DataModificationTransaction)} + * + */ +public final class SynchronizedTransaction implements DataModificationTransaction,Delegator { + + private final DataModificationTransaction delegate; + + private SynchronizedTransaction(DataModificationTransaction delegate) { + this.delegate = delegate; + } + + /** + * Returns synchronized wrapper on supplied transaction. + * + * @param transaction Transaction for which synchronized wrapper should be created. + * @return Synchronized wrapper over transaction. + */ + public static final SynchronizedTransaction from(DataModificationTransaction transaction) { + Preconditions.checkArgument(transaction != null, "Transaction must not be null."); + if (transaction instanceof SynchronizedTransaction) { + return (SynchronizedTransaction) transaction; + } + return new SynchronizedTransaction(transaction); + } + + @Override + public synchronized Map, DataObject> getCreatedOperationalData() { + return delegate.getCreatedOperationalData(); + } + + @Override + public synchronized Map, DataObject> getCreatedConfigurationData() { + return delegate.getCreatedConfigurationData(); + } + + @Override + public synchronized DataObject readOperationalData(InstanceIdentifier path) { + return delegate.readOperationalData(path); + } + + @Override + public synchronized TransactionStatus getStatus() { + return delegate.getStatus(); + } + + @Override + public synchronized Map, DataObject> getUpdatedOperationalData() { + return delegate.getUpdatedOperationalData(); + } + + @Deprecated + public synchronized void putRuntimeData(InstanceIdentifier path, DataObject data) { + delegate.putRuntimeData(path, data); + } + + @Override + public synchronized Object getIdentifier() { + return delegate.getIdentifier(); + } + + @Override + public synchronized DataObject readConfigurationData(InstanceIdentifier path) { + return delegate.readConfigurationData(path); + } + + @Override + public synchronized Future> commit() { + return delegate.commit(); + } + + @Override + public synchronized void putOperationalData(InstanceIdentifier path, DataObject data) { + delegate.putOperationalData(path, data); + } + + @Override + public synchronized void putConfigurationData(InstanceIdentifier path, DataObject data) { + delegate.putConfigurationData(path, data); + } + + @Override + public synchronized Map, DataObject> getUpdatedConfigurationData() { + return delegate.getUpdatedConfigurationData(); + } + + @Deprecated + public synchronized void removeRuntimeData(InstanceIdentifier path) { + delegate.removeRuntimeData(path); + } + + @Override + public synchronized void removeOperationalData(InstanceIdentifier path) { + delegate.removeOperationalData(path); + } + + @Override + public synchronized void removeConfigurationData(InstanceIdentifier path) { + delegate.removeConfigurationData(path); + } + + @Override + public synchronized Set> getRemovedConfigurationData() { + return delegate.getRemovedConfigurationData(); + } + + @Override + public synchronized Set> getRemovedOperationalData() { + return delegate.getRemovedOperationalData(); + } + + @Override + public synchronized Map, DataObject> getOriginalConfigurationData() { + return delegate.getOriginalConfigurationData(); + } + + @Override + public synchronized ListenerRegistration registerListener(DataTransactionListener listener) { + return delegate.registerListener(listener); + } + + @Override + public synchronized Map, DataObject> getOriginalOperationalData() { + return delegate.getOriginalOperationalData(); + } + + @Override + public synchronized DataModificationTransaction getDelegate() { + return delegate; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((delegate == null) ? 0 : delegate.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()){ + return false; + } + SynchronizedTransaction other = (SynchronizedTransaction) obj; + if (delegate == null) { + if (other.delegate != null) { + return false; + } + } else if (!delegate.equals(other.delegate)) { + return false; + } + return true; + } +} + diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java index 81a4a2431b..dec44f364f 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api.mount; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java index 194c431ec0..f7b584507a 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api.mount; import java.util.EventListener; diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcContextIdentifier.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcContextIdentifier.java index 8437c18f09..d6374fff90 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcContextIdentifier.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcContextIdentifier.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api.rpc; import org.opendaylight.yangtools.concepts.Immutable; diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingContext.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingContext.java index db93766c3c..a886692e8c 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingContext.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingContext.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.api.rpc; import org.opendaylight.yangtools.yang.binding.BaseIdentity; diff --git a/opendaylight/md-sal/sal-binding-broker/pom.xml b/opendaylight/md-sal/sal-binding-broker/pom.xml index 68358b3516..e5a74e42a1 100644 --- a/opendaylight/md-sal/sal-binding-broker/pom.xml +++ b/opendaylight/md-sal/sal-binding-broker/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-binding-broker-impl bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -51,12 +51,12 @@ org.opendaylight.controller yang-jmx-generator-plugin - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar @@ -156,22 +156,22 @@ org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-common-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.slf4j @@ -209,12 +209,12 @@ org.opendaylight.controller sal-core-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT compile @@ -234,7 +234,7 @@ org.opendaylight.controller sal-binding-config - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools @@ -253,28 +253,28 @@ org.opendaylight.yangtools.model ietf-inet-types - 2010.09.24.2-SNAPSHOT + 2010.09.24.3 org.opendaylight.yangtools.model ietf-topology-l3-unicast-igp - 2013.10.21.0-SNAPSHOT + 2013.10.21.1 test org.opendaylight.controller.model model-flow-base - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-statistics - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java index cd45f2c8b2..ffc8379228 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ /** * Generated file diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java index 1c03c3e7b0..df3b7ece5d 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ /** * Generated file diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java index 0ae4336571..286b0c378c 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java @@ -1,12 +1,10 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-data-broker - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 - * - * Do not modify this file unless it is present under src/main directory - */ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; import java.util.concurrent.ExecutorService; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java index 60c8156a56..9ce3ebf73f 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-data-broker - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java index 644860595e..0a503d5642 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-notification-broker - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModuleFactory.java index 31613a7433..5c5c062db6 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-notification-broker - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModule.java index b0d3f7a730..903475caea 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModule.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-rpc-broker - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModuleFactory.java index ed3371a5cc..b624087eb0 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-rpc-broker - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:33:01 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java index aadf2fcc8d..583591615c 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: runtime-generated-mapping - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 18:20:19 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; @@ -31,6 +29,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; +import com.google.common.base.Optional; import com.google.common.base.Preconditions; /** @@ -66,7 +65,7 @@ public final class RuntimeMappingModule extends @Override public java.lang.AutoCloseable createInstance() { - + RuntimeGeneratedMappingServiceProxy potential = tryToReuseGlobalInstance(); if(potential != null) { return potential; @@ -103,7 +102,7 @@ public final class RuntimeMappingModule extends BindingIndependentMappingService, // Delegator, // AutoCloseable { - + private BindingIndependentMappingService delegate; private ServiceReference reference; private BundleContext bundleContext; @@ -152,7 +151,12 @@ public final class RuntimeMappingModule extends public DataContainer dataObjectFromDataDom(Class inputClass, CompositeNode domInput) { return delegate.dataObjectFromDataDom(inputClass, domInput); } - + + @Override + public Optional> getRpcServiceClassFor(String namespace, String revision) { + return delegate.getRpcServiceClassFor(namespace, revision); + } + @Override public void close() throws Exception { if(delegate != null) { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModuleFactory.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModuleFactory.java index 6344ae981f..64e23e887c 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModuleFactory.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: runtime-generated-mapping - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 18:20:19 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.binding.impl; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java index 76318ae843..500b1b399e 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.codegen.impl; import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable; @@ -145,4 +152,4 @@ implements // listener = null; } } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java index 446a9caf8e..244e350343 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.codegen.impl; import java.util.concurrent.ExecutorService; @@ -31,9 +38,23 @@ public class SingletonHolder { return NOTIFICATION_EXECUTOR; } + /** + * @deprecated This method is only used from configuration modules and thus callers of it + * should use service injection to make the executor configurable. + */ + @Deprecated public static synchronized final ListeningExecutorService getDefaultCommitExecutor() { if (COMMIT_EXECUTOR == null) { - COMMIT_EXECUTOR = createNamedExecutor("md-sal-binding-commit-%d"); + ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("md-sal-binding-commit-%d").build(); + /* + * FIXME: this used to be newCacheThreadPool(), but MD-SAL does not have transaction + * ordering guarantees, which means that using a concurrent threadpool results + * in application data being committed in random order, potentially resulting + * in inconsistent data being present. Once proper primitives are introduced, + * concurrency can be reintroduced. + */ + ExecutorService executor = Executors.newSingleThreadExecutor(factory); + COMMIT_EXECUTOR = MoreExecutors.listeningDecorator(executor); } return COMMIT_EXECUTOR; @@ -43,7 +64,5 @@ public class SingletonHolder { ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat(format).build(); ExecutorService executor = Executors.newCachedThreadPool(factory); return MoreExecutors.listeningDecorator(executor); - } - } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java index 0069de9802..3cc66c30c1 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl; import java.util.Set; @@ -117,4 +124,4 @@ public class DataBrokerImpl extends AbstractDataBroker interestListeners = ListenerRegistry.create; + val Multimap, NotificationListener> listeners; @Property var ExecutorService executor; + + val logger = LoggerFactory.getLogger(NotificationBrokerImpl) new() { listeners = Multimaps.synchronizedSetMultimap(HashMultimap.create()) @@ -101,14 +107,26 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab NotificationListener listener) { val reg = new GenericNotificationRegistration(notificationType, listener, this); listeners.put(notificationType, listener); + announceNotificationSubscription(notificationType); return reg; } + + def announceNotificationSubscription(Class notification) { + for (listener : interestListeners) { + try { + listener.instance.onNotificationSubscribtion(notification); + } catch (Exception e) { + logger.error("", e.message) + } + } + } override registerNotificationListener( org.opendaylight.yangtools.yang.binding.NotificationListener listener) { val invoker = SingletonHolder.INVOKER_FACTORY.invokerFor(listener); for (notifyType : invoker.supportedNotifications) { listeners.put(notifyType, invoker.invocationProxy) + announceNotificationSubscription(notifyType) } val registration = new GeneratedListenerRegistration(listener, invoker,this); return registration as Registration; @@ -128,6 +146,14 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab //FIXME: implement properly. } + override registerInterestListener(NotificationInterestListener interestListener) { + val registration = interestListeners.register(interestListener); + + for(notification : listeners.keySet) { + interestListener.onNotificationSubscribtion(notification); + } + return registration + } } class GenericNotificationRegistration extends AbstractObjectRegistration> implements ListenerRegistration> { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java index 35c2bee646..5292487d03 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl; import static com.google.common.base.Preconditions.checkState; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java index 1b6c56d15d..a1cae266c1 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl; import org.opendaylight.controller.config.yang.md.sal.binding.impl.Data; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java index a21b3f1a61..978c79ea02 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java @@ -80,12 +80,14 @@ public class BindingDomConnectorDeployer { connector.startDataForwarding(); } - public static void startNotificationForwarding(BindingIndependentConnector connector, NotificationProviderService baService, NotificationPublishService domService) { + public static void startNotificationForwarding(BindingIndependentConnector connector, + NotificationProviderService baService, NotificationPublishService domService) { if(connector.isNotificationForwarding()) { return; } - - // FIXME + connector.setBindingNotificationService(baService); + connector.setDomNotificationService(domService); + connector.startNotificationForwarding(); } // diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java index aaed12f740..5630664a67 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java @@ -17,6 +17,7 @@ import java.lang.reflect.Proxy; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -37,6 +38,8 @@ import org.opendaylight.controller.md.sal.common.api.data.DataReader; import org.opendaylight.controller.md.sal.common.api.routing.RouteChange; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService.NotificationInterestListener; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; import org.opendaylight.controller.sal.binding.api.data.DataProviderService; import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider; @@ -55,6 +58,8 @@ import org.opendaylight.controller.sal.core.api.Provider; import org.opendaylight.controller.sal.core.api.RpcImplementation; import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry; import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction; +import org.opendaylight.controller.sal.core.api.notify.NotificationListener; +import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.concepts.util.ClassLoaderUtils; @@ -65,6 +70,7 @@ import org.opendaylight.yangtools.yang.binding.BindingMapping; import org.opendaylight.yangtools.yang.binding.DataContainer; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.Notification; import org.opendaylight.yangtools.yang.binding.RpcService; import org.opendaylight.yangtools.yang.binding.util.BindingReflections; import org.opendaylight.yangtools.yang.common.QName; @@ -93,7 +99,7 @@ public class BindingIndependentConnector implements // private final Logger LOG = LoggerFactory.getLogger(BindingIndependentConnector.class); - @SuppressWarnings( "deprecation") + @SuppressWarnings("deprecation") private static final InstanceIdentifier ROOT = InstanceIdentifier.builder().toInstance(); private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier ROOT_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier @@ -101,7 +107,6 @@ public class BindingIndependentConnector implements // private final static Method EQUALS_METHOD; - private BindingIndependentMappingService mappingService; private org.opendaylight.controller.sal.core.api.data.DataProviderService biDataService; @@ -146,10 +151,13 @@ public class BindingIndependentConnector implements // private org.opendaylight.controller.sal.dom.broker.spi.RpcRouter biRouter; + private NotificationProviderService baNotifyService; + + private NotificationPublishService domNotificationService; static { try { - EQUALS_METHOD = Object.class.getMethod("equals", Object.class); + EQUALS_METHOD = Object.class.getMethod("equals", Object.class); } catch (Exception e) { throw new RuntimeException(e); } @@ -311,7 +319,7 @@ public class BindingIndependentConnector implements // baRpcRegistryImpl.registerRouterInstantiationListener(domToBindingRpcManager.getInstance()); baRpcRegistryImpl.registerGlobalRpcRegistrationListener(domToBindingRpcManager.getInstance()); } - if(biRpcRegistry instanceof org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) { + if (biRpcRegistry instanceof org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) { biRouter = (org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) biRpcRegistry; } rpcForwarding = true; @@ -320,7 +328,11 @@ public class BindingIndependentConnector implements // public void startNotificationForwarding() { checkState(!notificationForwarding, "Connector is already forwarding notifications."); - notificationForwarding = true; + if (baNotifyService != null && domNotificationService != null) { + baNotifyService.registerInterestListener(new DomToBindingNotificationForwarder()); + + notificationForwarding = true; + } } protected void setMappingService(BindingIndependentMappingService mappingService) { @@ -616,7 +628,7 @@ public class BindingIndependentConnector implements // } createDefaultDomForwarder(); } catch (Exception e) { - LOG.error("Could not forward Rpcs of type {}", service.getName(),e); + LOG.error("Could not forward Rpcs of type {}", service.getName(), e); } registrations = registrationsBuilder.build(); } @@ -635,13 +647,13 @@ public class BindingIndependentConnector implements // @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if(EQUALS_METHOD.equals(method)) { + if (EQUALS_METHOD.equals(method)) { return false; } RpcInvocationStrategy strategy = strategiesByMethod.get(method); checkState(strategy != null); checkArgument(args.length <= 2); - if(args.length == 1) { + if (args.length == 1) { checkArgument(args[0] instanceof DataObject); return strategy.forwardToDomBroker((DataObject) args[0]); } @@ -719,9 +731,10 @@ public class BindingIndependentConnector implements // RpcInvocationStrategy strategy = null; if (outputClass.isPresent()) { if (inputClass.isPresent()) { - strategy = new DefaultInvocationStrategy(rpc,targetMethod, outputClass.get(), inputClass.get()); + strategy = new DefaultInvocationStrategy(rpc, targetMethod, outputClass.get(), inputClass + .get()); } else { - strategy = new NoInputNoOutputInvocationStrategy(rpc,targetMethod); + strategy = new NoInputNoOutputInvocationStrategy(rpc, targetMethod); } } else if(inputClass.isPresent()){ strategy = new NoOutputInvocationStrategy(rpc,targetMethod, inputClass.get()); @@ -740,7 +753,7 @@ public class BindingIndependentConnector implements // protected final Method targetMethod; protected final QName rpc; - public RpcInvocationStrategy(QName rpc,Method targetMethod) { + public RpcInvocationStrategy(QName rpc, Method targetMethod) { this.targetMethod = targetMethod; this.rpc = rpc; } @@ -766,19 +779,25 @@ public class BindingIndependentConnector implements // @SuppressWarnings({ "rawtypes", "unchecked" }) public DefaultInvocationStrategy(QName rpc, Method targetMethod, Class outputClass, Class inputClass) { - super(rpc,targetMethod); + super(rpc, targetMethod); this.outputClass = new WeakReference(outputClass); this.inputClass = new WeakReference(inputClass); } + @SuppressWarnings("unchecked") @Override public RpcResult uncheckedInvoke(RpcService rpcService, CompositeNode domInput) throws Exception { DataContainer bindingInput = mappingService.dataObjectFromDataDom(inputClass.get(), domInput); - Future> result = (Future>) targetMethod.invoke(rpcService, bindingInput); - if (result == null) { + Future> futureResult = (Future>) targetMethod.invoke(rpcService, bindingInput); + if (futureResult == null) { return Rpcs.getRpcResult(false); } - RpcResult bindingResult = result.get(); + RpcResult bindingResult = futureResult.get(); + final Object resultObj = bindingResult.getResult(); + if (resultObj instanceof DataObject) { + final CompositeNode output = mappingService.toDataDom((DataObject)resultObj); + return Rpcs.getRpcResult(true, output, Collections.emptySet()); + } return Rpcs.getRpcResult(true); } @@ -786,16 +805,16 @@ public class BindingIndependentConnector implements // public Future> forwardToDomBroker(DataObject input) { if(biRouter != null) { CompositeNode xml = mappingService.toDataDom(input); - CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc,ImmutableList.>of(xml)); + CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc, ImmutableList.> of(xml)); RpcResult result = biRouter.invokeRpc(rpc, wrappedXml); Object baResultValue = null; - if(result.getResult() != null) { + if (result.getResult() != null) { baResultValue = mappingService.dataObjectFromDataDom(outputClass.get(), result.getResult()); } RpcResult baResult = Rpcs.getRpcResult(result.isSuccessful(), baResultValue, result.getErrors()); - return Futures.>immediateFuture(baResult); + return Futures.> immediateFuture(baResult); } - return Futures.>immediateFuture(Rpcs.getRpcResult(false)); + return Futures.> immediateFuture(Rpcs.getRpcResult(false)); } } @@ -803,7 +822,7 @@ public class BindingIndependentConnector implements // private class NoInputNoOutputInvocationStrategy extends RpcInvocationStrategy { public NoInputNoOutputInvocationStrategy(QName rpc, Method targetMethod) { - super(rpc,targetMethod); + super(rpc, targetMethod); } public RpcResult uncheckedInvoke(RpcService rpcService, CompositeNode domInput) throws Exception { @@ -874,4 +893,54 @@ public class BindingIndependentConnector implements // public BindingIndependentMappingService getMappingService() { return mappingService; } + + public void setBindingNotificationService(NotificationProviderService baService) { + this.baNotifyService = baService; + + } + + public void setDomNotificationService(NotificationPublishService domService) { + this.domNotificationService = domService; + } + + private class DomToBindingNotificationForwarder implements NotificationInterestListener, NotificationListener { + + private ConcurrentMap>> notifications = new ConcurrentHashMap<>(); + private Set supportedNotifications = new HashSet<>(); + + @Override + public Set getSupportedNotifications() { + return Collections.unmodifiableSet(supportedNotifications); + } + + @Override + public void onNotification(CompositeNode notification) { + QName qname = notification.getNodeType(); + WeakReference> potential = notifications.get(qname); + if (potential != null) { + Class potentialClass = potential.get(); + if (potentialClass != null) { + final DataContainer baNotification = mappingService.dataObjectFromDataDom(potentialClass, + notification); + + if (baNotification instanceof Notification) { + baNotifyService.publish((Notification) baNotification); + } + } + } + } + + @Override + public void onNotificationSubscribtion(Class notificationType) { + QName qname = BindingReflections.findQName(notificationType); + if (qname != null) { + WeakReference> already = notifications.putIfAbsent(qname, + new WeakReference>(notificationType)); + if (already == null) { + domNotificationService.addNotificationListener(qname, this); + supportedNotifications.add(qname); + } + } + } + } } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentMountPointForwarder.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentMountPointForwarder.java deleted file mode 100644 index 604b3b8180..0000000000 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentMountPointForwarder.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.opendaylight.controller.sal.binding.impl.connect.dom; - -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance; -import org.opendaylight.controller.sal.binding.api.mount.MountProviderService; -import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService; -import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException; -import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance; -import org.opendaylight.controller.sal.core.api.mount.MountProvisionService; -import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public class BindingIndependentMountPointForwarder { - - private MountProvisionService domMountService; - private MountProviderService baMountService; - private BindingIndependentMappingService mappingService; - - private final DomMountPointForwardingManager domForwardingManager = new DomMountPointForwardingManager(); - private final BindingMountPointForwardingManager bindingForwardingManager = new BindingMountPointForwardingManager(); - - private ConcurrentMap, BindingIndependentConnector> connectors; - private ConcurrentMap, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> forwarded; - private ListenerRegistration domListenerRegistration; - private ListenerRegistration baListenerRegistration; - - public MountProvisionService getDomMountService() { - return domMountService; - } - - public void setDomMountService(MountProvisionService domMountService) { - this.domMountService = domMountService; - } - - public void start() { - if(domMountService != null && baMountService != null) { - domListenerRegistration = domMountService.registerProvisionListener(domForwardingManager); - baListenerRegistration = baMountService.registerProvisionListener(bindingForwardingManager); - } - } - - private void tryToDeployConnector(InstanceIdentifier baPath, - org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) { - org.opendaylight.yangtools.yang.data.api.InstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath); - if(previous != null) { - return; - } - MountProviderInstance baMountPoint = baMountService.getMountPoint(baPath); - MountProvisionInstance domMountPoint = domMountService.getMountPoint(biPath); - BindingIndependentConnector connector = createForwarder(baPath, baMountPoint, domMountPoint); - connectors.put(baPath, connector); - connector.startDataForwarding(); - connector.startRpcForwarding(); - connector.startNotificationForwarding(); - } - - private BindingIndependentConnector createForwarder(InstanceIdentifier path, MountProviderInstance baMountPoint, - MountProvisionInstance domMountPoint) { - BindingIndependentConnector connector = new BindingIndependentConnector(); - - connector.setBindingDataService(baMountPoint); - connector.setBindingRpcRegistry(baMountPoint); - //connector.setBindingNotificationBroker(baMountPoint); - - connector.setDomDataService(domMountPoint); - connector.setDomRpcRegistry(domMountPoint); - //connector.setDomNotificationBroker(domMountPoint); - return connector; - } - - public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) { - InstanceIdentifier baPath; - try { - baPath = mappingService.fromDataDom(domPath); - BindingIndependentConnector potentialConnector = connectors.get(baPath); - if(potentialConnector != null) { - return; - } - tryToDeployConnector(baPath,domPath); - } catch (DeserializationException e) { - - } - } - - public synchronized void tryToDeployBindingForwarder(InstanceIdentifier baPath) { - BindingIndependentConnector potentialConnector =connectors.get(baPath); - if(potentialConnector != null) { - return; - } - org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = mappingService.toDataDom(baPath); - tryToDeployConnector(baPath, domPath); - } - - public synchronized void undeployBindingForwarder(InstanceIdentifier baPath) { - // FIXME: Implement closeMountPoint - } - - public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) { - // FIXME: Implement closeMountPoint - } - - private class DomMountPointForwardingManager implements MountProvisionListener { - - @Override - public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) { - tryToDeployDomForwarder(path); - } - - @Override - public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) { - undeployDomForwarder(path); - } - } - - private class BindingMountPointForwardingManager implements - org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener { - - @Override - public void onMountPointCreated(InstanceIdentifier path) { - tryToDeployBindingForwarder(path); - } - - @Override - public void onMountPointRemoved(InstanceIdentifier path) { - undeployBindingForwarder(path); - } - } -} diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/CompositeNodeUtils.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/CompositeNodeUtils.java index 5d17d92cd4..1a8d17992f 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/CompositeNodeUtils.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/CompositeNodeUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.connect.dom; public class CompositeNodeUtils { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/Constants.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/Constants.java index 1c9a59d414..211589fc99 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/Constants.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/Constants.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.connect.dom; public class Constants { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java index 3fc377f176..e89797ca2d 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.connect.dom; import java.util.concurrent.ConcurrentHashMap; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java index 1f68b347ca..8c74008990 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.forward; import java.util.concurrent.ConcurrentHashMap; @@ -101,7 +108,7 @@ public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implem BindingDomConnectorDeployer.startRpcForwarding(mountConnector, baMountPoint, domMountPoint); BindingDomConnectorDeployer.startNotificationForwarding(mountConnector, baMountPoint, domMountPoint); // connector.setDomNotificationBroker(domMountPoint); - return connector; + return mountConnector; } public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java index c7dbcd4f5c..8d6f331452 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.forward; import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java index f90a4acf2a..3d0e4deb65 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.forward; import java.util.Collection; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java index 581b217bfa..e455bea19c 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.forward; import com.google.common.base.Preconditions; diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/util/BindingAwareDataReaderRouter.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/util/BindingAwareDataReaderRouter.xtend index f586a8b4c5..5b775806d5 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/util/BindingAwareDataReaderRouter.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/util/BindingAwareDataReaderRouter.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.impl.util import org.opendaylight.controller.md.sal.common.impl.routing.AbstractDataReadRouter @@ -10,4 +17,4 @@ class BindingAwareDataReaderRouter extends AbstractDataReadRouter + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-binding-config bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -64,12 +64,12 @@ org.opendaylight.controller yang-jmx-generator-plugin - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar @@ -100,12 +100,12 @@ org.opendaylight.controller config-api - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/sal-binding-dom-it/pom.xml b/opendaylight/md-sal/sal-binding-dom-it/pom.xml index 7391139d0f..8560848d5e 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-dom-it/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-binding-dom-it bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -57,26 +57,26 @@ org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT test org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT test-jar test org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT test org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT + 1.1-SNAPSHOT test diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java index ee0b356b00..ec8c8372c1 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; import java.util.ArrayList; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java index c311161c44..929eb66350 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug03Test.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug03Test.java index d3ef2f3d6e..f2576e9960 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug03Test.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug03Test.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; import java.util.Arrays; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java index e31ae6b8c7..023bd795af 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; import com.google.common.collect.ImmutableSet; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java index d9b16af469..8003e37e4e 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; import java.util.Arrays; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/RpcRegistrationNullPointer.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/RpcRegistrationNullPointer.java index 0c7f039642..23ae4cd532 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/RpcRegistrationNullPointer.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/RpcRegistrationNullPointer.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; public class RpcRegistrationNullPointer { diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java index e326fd0931..1480f0c610 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.connect.dom; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java index 0258c3e439..862c6ea269 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.connect.dom; import com.google.common.collect.ImmutableMap; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java index a99d80ff30..ab86836f95 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.connect.dom; import static junit.framework.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java index 74f07818d5..cfdab37651 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.connect.dom; import static junit.framework.Assert.assertNotNull; @@ -119,4 +126,4 @@ public class MessageCapturingFlowService implements SalFlowService, AutoCloseabl } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-binding-it/pom.xml b/opendaylight/md-sal/sal-binding-it/pom.xml index 595a0b323a..eaf5984c63 100644 --- a/opendaylight/md-sal/sal-binding-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-it/pom.xml @@ -1,17 +1,17 @@ - + 4.0.0 sal-parent org.opendaylight.controller - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-binding-it scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + 3.0.0 @@ -19,8 +19,8 @@ ../sal-binding-broker/target/jacoco.exec ../sal-binding-broker/target/jacoco-it.exec - 0.2.3-SNAPSHOT - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT + 0.2.4-SNAPSHOT 2.5.0 @@ -99,7 +99,7 @@ - + @@ -145,7 +145,7 @@ org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT provided @@ -255,18 +255,18 @@ org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT provided org.opendaylight.controller config-manager - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT + 1.1-SNAPSHOT provided diff --git a/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java b/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java index 884e7c914e..3c5efa5e3a 100644 --- a/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java +++ b/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; import static org.ops4j.pax.exam.CoreOptions.frameworkProperty; diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java index a19d2ed76b..9ac94e7b89 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; import org.junit.runner.RunWith; diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTestProvider.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTestProvider.java index 6f1551f12d..2aa7493e45 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTestProvider.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTestProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; import java.util.Collection; diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java index e1f109b88d..105f6e59a3 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java index 2f86ee4cc2..a55e395c5b 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java index fa3e6cc401..8c81987301 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-binding-util/pom.xml b/opendaylight/md-sal/sal-binding-util/pom.xml index 67c10f4a04..747e4205e1 100644 --- a/opendaylight/md-sal/sal-binding-util/pom.xml +++ b/opendaylight/md-sal/sal-binding-util/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-binding-util bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -22,7 +22,7 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java index ff6f6185ea..0c562f5d33 100644 --- a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java +++ b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.binding.util; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java index 278e90ee6b..c7d6640ce1 100644 --- a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java +++ b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.binding.util; import java.util.concurrent.ExecutorService; @@ -92,4 +99,10 @@ public abstract class AbstractBindingSalProviderInstance registerInterestListener( + NotificationInterestListener interestListener) { + return getNotificationBrokerChecked().registerInterestListener(interestListener); + } } diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java index 6f2186be88..d164f82222 100644 --- a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java +++ b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.binding.util; import java.awt.image.SinglePixelPackedSampleModel; diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java index 17de595a8b..3df33ba377 100644 --- a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java +++ b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.binding.util; import org.opendaylight.controller.md.sal.common.api.data.DataReader; diff --git a/opendaylight/md-sal/sal-common-api/pom.xml b/opendaylight/md-sal/sal-common-api/pom.xml index 2557026ffb..5dd08d062d 100644 --- a/opendaylight/md-sal/sal-common-api/pom.xml +++ b/opendaylight/md-sal/sal-common-api/pom.xml @@ -1,23 +1,23 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-common-api scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + org.opendaylight.controller sal-common - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools @@ -26,7 +26,6 @@ org.opendaylight.yangtools concepts - 0.6.0-SNAPSHOT org.osgi diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/RegistrationListener.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/RegistrationListener.java index f6efd57f06..b4f51f5771 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/RegistrationListener.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/RegistrationListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api; import java.util.EventListener; diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandlerRegistration.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandlerRegistration.java index 85db5a0878..86f1f9b138 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandlerRegistration.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandlerRegistration.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api.data; import org.opendaylight.yangtools.concepts.Path; diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java index d74b26dae2..29ba192ba8 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java @@ -37,8 +37,46 @@ public interface DataModification

*/, D> extends DataChange< @Deprecated void putRuntimeData(P path, D data); + /** + * Store a piece of data at specified path. This acts as a merge operation, + * which is to say that any pre-existing data which is not explicitly + * overwritten will be preserved. This means that if you store a container, + * its child lists will be merged. Performing the following put operations: + * + * 1) container { list [ a ] } + * 2) container { list [ b ] } + * + * will result in the following data being present: + * + * container { list [ a, b ] } + * + * This also means that storing the container will preserve any augmentations + * which have been attached to it. + * + * If you require an explicit replace operation, perform + * {@link removeOperationalData} first. + */ void putOperationalData(P path, D data); + /** + * Store a piece of data at specified path. This acts as a merge operation, + * which is to say that any pre-existing data which is not explicitly + * overwritten will be preserved. This means that if you store a container, + * its child lists will be merged. Performing the following put operations: + * + * 1) container { list [ a ] } + * 2) container { list [ b ] } + * + * will result in the following data being present: + * + * container { list [ a, b ] } + * + * This also means that storing the container will preserve any augmentations + * which have been attached to it. + * + * If you require an explicit replace operation, perform + * {@link removeConfigurationData} first. + */ void putConfigurationData(P path, D data); /** diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataStore.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataStore.java index f448d4e2ee..ed5499870a 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataStore.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataStore.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api.data; public interface DataStore extends // diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChain.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChain.java new file mode 100644 index 0000000000..ff3aa2e325 --- /dev/null +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChain.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.md.sal.common.api.data; + +/** + * A chain of transactions. Transactions in a chain need to be committed in sequence and each + * transaction should see the effects of previous transactions as if they happened. A chain + * makes no guarantees of atomicity, in fact transactions are committed as soon as possible. + */ +public interface TransactionChain

*/, D> extends AutoCloseable { + /** + * Create a new transaction which will continue the chain. The previous transaction + * has to be either COMMITTED or CANCELLED. + * + * @return New transaction in the chain. + * @throws IllegalStateException if the previous transaction was not COMMITTED or CANCELLED. + * @throws TransactionChainClosedException if the chain has been closed. + */ + DataModification newTransaction(); + + @Override + void close(); +} + diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainClosedException.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainClosedException.java new file mode 100644 index 0000000000..5e1b35dbe5 --- /dev/null +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainClosedException.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.md.sal.common.api.data; + +/** + * Exception thrown when an attempt is made to open a new transaction in a closed + * chain. + */ +public final class TransactionChainClosedException extends IllegalStateException { + private static final long serialVersionUID = 1L; + + public TransactionChainClosedException(final String message) { + super(message); + } + + public TransactionChainClosedException(final String message, final Throwable cause) { + super(message, cause); + } +} diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainFactory.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainFactory.java new file mode 100644 index 0000000000..4e7e12e0a1 --- /dev/null +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainFactory.java @@ -0,0 +1,24 @@ +/* + * 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.md.sal.common.api.data; + +/** + * Interface for creating transaction chains. + */ +public interface TransactionChainFactory

*/, D> { + /** + * Create a new transaction chain. The chain will be initialized to read + * from its backing datastore, with no outstanding transaction. Listener + * will be registered to handle chain-level events. + * + * @param listener Transaction chain event listener + * @return A new transaction chain. + */ + TransactionChain createTransactionChain(TransactionChainListener listener); +} + diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainListener.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainListener.java new file mode 100644 index 0000000000..4dac6f557e --- /dev/null +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionChainListener.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.md.sal.common.api.data; + +import java.util.EventListener; + +/** + * Listener for transaction chain events. + */ +public interface TransactionChainListener extends EventListener { + /** + * Invoked if when a transaction in the chain fails. All other transactions are automatically cancelled by the time + * this notification is invoked. Implementations should invoke chain.close() to close the chain. + * + * @param chain Transaction chain which failed + * @param transaction Transaction which caused the chain to fail + * @param cause The cause of transaction failure + */ + void onTransactionChainFailed(TransactionChain chain, DataModification transaction, Throwable cause); + + /** + * Invoked when a transaction chain is completed. A transaction chain is considered completed when it has been + * closed and all its instructions have completed successfully. + * + * @param chain Transaction chain which completed + */ + void onTransactionChainSuccessful(TransactionChain chain); +} + diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Route.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Route.java index afe9e9921e..fbf735fa75 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Route.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Route.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api.routing; import org.opendaylight.yangtools.concepts.Immutable; diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangeListener.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangeListener.java index 994f65b960..62206013f8 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangeListener.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangeListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api.routing; import java.util.EventListener; diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangePublisher.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangePublisher.java index bee29a1ad1..7bf61fab0b 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangePublisher.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangePublisher.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api.routing; import org.opendaylight.yangtools.concepts.ListenerRegistration; diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Router.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Router.java index 8d0a90c50b..6e45ed5cde 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Router.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Router.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.api.routing; import java.util.Map; diff --git a/opendaylight/md-sal/sal-common-impl/pom.xml b/opendaylight/md-sal/sal-common-impl/pom.xml index 47e9c611d8..46493ddad0 100644 --- a/opendaylight/md-sal/sal-common-impl/pom.xml +++ b/opendaylight/md-sal/sal-common-impl/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-common-impl bundle @@ -12,18 +11,19 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + org.opendaylight.controller sal-common-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT com.google.guava diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java index f0e8624eb9..a90595b060 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl; import java.util.Map; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java index fb3e38f44a..4b6a0185ab 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl; import static org.opendaylight.controller.md.sal.common.api.TransactionStatus.NEW; @@ -68,7 +75,6 @@ public abstract class AbstractDataModification

, D> implements } configurationUpdate.put(path, mergeConfigurationData(path,original, data)); - configurationRemove.remove(path); } @Override @@ -79,7 +85,6 @@ public abstract class AbstractDataModification

, D> implements operationalCreated.put(path, data); } operationalUpdate.put(path, mergeOperationalData(path,original,data)); - operationalRemove.remove(path); } @Override diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java index 4bda399d8b..bb8594f35d 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl; import org.opendaylight.yangtools.concepts.Registration; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java index 4fe1566a58..4ffb87d5d3 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl; import org.opendaylight.controller.md.sal.common.api.routing.RoutedRegistration; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java index d884dc81e0..fed75f72be 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java index 4ddceb3b5f..4d395267dd 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl.routing; import java.util.Map.Entry; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java index 60d0cdf766..bfa4f36c18 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl.routing; import java.util.Map; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.xtend b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.xtend index cef88fc375..2c3b0188f4 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.xtend +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl.service import com.google.common.collect.FluentIterable @@ -38,6 +45,8 @@ import org.slf4j.LoggerFactory import static com.google.common.base.Preconditions.* import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent import com.google.common.collect.Multimaps +import java.util.concurrent.locks.Lock +import java.util.concurrent.locks.ReentrantLock abstract class AbstractDataBroker

, D, DCL extends DataChangeListener> implements DataModificationTransactionFactory, // DataReader, // @@ -63,16 +72,20 @@ DataProvisionService { Multimap> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.create()); Multimap> commitHandlers = Multimaps.synchronizedSetMultimap(HashMultimap.create()); + + private val Lock registrationLock = new ReentrantLock; val ListenerRegistry>> commitHandlerRegistrationListeners = new ListenerRegistry(); public new() { } protected def /*Iterator>,D>>*/ affectedCommitHandlers( - HashSet

paths) { - return FluentIterable.from(commitHandlers.asMap.entrySet).filter[key.isAffectedBy(paths)] // - .transformAndConcat[value] // - .transform[instance].toList() + HashSet

paths) { + return withLock(registrationLock) [| + return FluentIterable.from(commitHandlers.asMap.entrySet).filter[key.isAffectedBy(paths)] // + .transformAndConcat[value] // + .transform[instance].toList() + ] } override final readConfigurationData(P path) { @@ -81,43 +94,56 @@ DataProvisionService { override final readOperationalData(P path) { return dataReadRouter.readOperationalData(path); - } - - override final registerCommitHandler(P path, DataCommitHandler commitHandler) { - val registration = new DataCommitHandlerRegistrationImpl(path, commitHandler, this); - commitHandlers.put(path, registration) - LOG.trace("Registering Commit Handler {} for path: {}",commitHandler,path); - for(listener : commitHandlerRegistrationListeners) { - try { - listener.instance.onRegister(registration); - } catch (Exception e) { - LOG.error("Unexpected exception in listener {} during invoking onRegister",listener.instance,e); - } - } - return registration; + } + + private static def withLock(Lock lock,Callable method) { + lock.lock + try { + return method.call + } finally { + lock.unlock + } + } + + override final registerCommitHandler(P path, DataCommitHandler commitHandler) { + return withLock(registrationLock) [| + val registration = new DataCommitHandlerRegistrationImpl(path, commitHandler, this); + commitHandlers.put(path, registration) + LOG.trace("Registering Commit Handler {} for path: {}",commitHandler,path); + for(listener : commitHandlerRegistrationListeners) { + try { + listener.instance.onRegister(registration); + } catch (Exception e) { + LOG.error("Unexpected exception in listener {} during invoking onRegister",listener.instance,e); + } + } + return registration; + ] } override final def registerDataChangeListener(P path, DCL listener) { - val reg = new DataChangeListenerRegistration(path, listener, this); - listeners.put(path, reg); - val initialConfig = dataReadRouter.readConfigurationData(path); - val initialOperational = dataReadRouter.readOperationalData(path); - val event = createInitialListenerEvent(path,initialConfig,initialOperational); - listener.onDataChanged(event); - return reg; + return withLock(registrationLock) [| + val reg = new DataChangeListenerRegistration(path, listener, this); + listeners.put(path, reg); + val initialConfig = dataReadRouter.readConfigurationData(path); + val initialOperational = dataReadRouter.readOperationalData(path); + val event = createInitialListenerEvent(path,initialConfig,initialOperational); + listener.onDataChanged(event); + return reg; + ] } final def registerDataReader(P path, DataReader reader) { - - val confReg = dataReadRouter.registerConfigurationReader(path, reader); - val dataReg = dataReadRouter.registerOperationalReader(path, reader); - - return new CompositeObjectRegistration(reader, Arrays.asList(confReg, dataReg)); + return withLock(registrationLock) [| + val confReg = dataReadRouter.registerConfigurationReader(path, reader); + val dataReg = dataReadRouter.registerOperationalReader(path, reader); + + return new CompositeObjectRegistration(reader, Arrays.asList(confReg, dataReg)); + ] } override registerCommitHandlerListener(RegistrationListener> commitHandlerListener) { val ret = commitHandlerRegistrationListeners.register(commitHandlerListener); - return ret; } @@ -126,21 +152,25 @@ DataProvisionService { } - protected final def removeListener(DataChangeListenerRegistration registration) { - listeners.remove(registration.path, registration); + protected final def removeListener(DataChangeListenerRegistration registration) { + return withLock(registrationLock) [| + listeners.remove(registration.path, registration); + ] } protected final def removeCommitHandler(DataCommitHandlerRegistrationImpl registration) { - commitHandlers.remove(registration.path, registration); - - LOG.trace("Removing Commit Handler {} for path: {}",registration.instance,registration.path); - for(listener : commitHandlerRegistrationListeners) { - try { - listener.instance.onUnregister(registration); - } catch (Exception e) { - LOG.error("Unexpected exception in listener {} during invoking onUnregister",listener.instance,e); - } - } + return withLock(registrationLock) [| + commitHandlers.remove(registration.path, registration); + LOG.trace("Removing Commit Handler {} for path: {}",registration.instance,registration.path); + for(listener : commitHandlerRegistrationListeners) { + try { + listener.instance.onUnregister(registration); + } catch (Exception e) { + LOG.error("Unexpected exception in listener {} during invoking onUnregister",listener.instance,e); + } + } + return null; + ] } protected final def getActiveCommitHandlers() { @@ -148,12 +178,14 @@ DataProvisionService { } protected def /*Iterator>,D>>*/ affectedListenersWithInitialState( - HashSet

paths) { - return FluentIterable.from(listeners.asMap.entrySet).filter[key.isAffectedBy(paths)].transform [ - val operationalState = readOperationalData(key) - val configurationState = readConfigurationData(key) - return new ListenerStateCapture(key, value, operationalState, configurationState) - ].toList() + HashSet

paths) { + return withLock(registrationLock) [| + return FluentIterable.from(listeners.asMap.entrySet).filter[key.isAffectedBy(paths)].transform [ + val operationalState = readOperationalData(key) + val configurationState = readConfigurationData(key) + return new ListenerStateCapture(key, value, operationalState, configurationState) + ].toList() + ] } protected def boolean isAffectedBy(P key, Set

paths) { @@ -260,12 +292,13 @@ package class TwoPhaseCommit

, D, DCL extends DataChangeListene affectedPaths.addAll(transaction.createdOperationalData.keySet); affectedPaths.addAll(transaction.updatedOperationalData.keySet); affectedPaths.addAll(transaction.removedOperationalData); - + val listeners = dataBroker.affectedListenersWithInitialState(affectedPaths); val transactionId = transaction.identifier; log.trace("Transaction: {} Started.",transactionId); + log.trace("Transaction: {} Affected Subtrees:",transactionId,affectedPaths); // requesting commits val Iterable> commitHandlers = dataBroker.affectedCommitHandlers(affectedPaths); val List> handlerTransactions = new ArrayList(); @@ -276,6 +309,7 @@ package class TwoPhaseCommit

, D, DCL extends DataChangeListene } catch (Exception e) { log.error("Transaction: {} Request Commit failed", transactionId,e); dataBroker.failedTransactionsCount.andIncrement + transaction.changeStatus(TransactionStatus.FAILED) return rollback(handlerTransactions, e); } val List> results = new ArrayList(); @@ -286,11 +320,13 @@ package class TwoPhaseCommit

, D, DCL extends DataChangeListene listeners.publishDataChangeEvent(); } catch (Exception e) { log.error("Transaction: {} Finish Commit failed",transactionId, e); - dataBroker.failedTransactionsCount.andIncrement + dataBroker.failedTransactionsCount.andIncrement + transaction.changeStatus(TransactionStatus.FAILED) return rollback(handlerTransactions, e); } log.trace("Transaction: {} Finished successfully.",transactionId); - dataBroker.finishedTransactionsCount.andIncrement; + dataBroker.finishedTransactionsCount.andIncrement; + transaction.changeStatus(TransactionStatus.COMMITED) return Rpcs.getRpcResult(true, TransactionStatus.COMMITED, Collections.emptySet()); } diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java index 83943a1f38..7f5e466c00 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl.service; import java.util.Map; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java index 474d4b8811..d904427502 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl.service; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java index 61abe664aa..bd9748d3c5 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.md.sal.common.impl.util; import java.util.concurrent.locks.Lock; diff --git a/opendaylight/md-sal/sal-common-util/pom.xml b/opendaylight/md-sal/sal-common-util/pom.xml index c65a2f51e5..3a9b00dce0 100644 --- a/opendaylight/md-sal/sal-common-util/pom.xml +++ b/opendaylight/md-sal/sal-common-util/pom.xml @@ -1,16 +1,16 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-common-util scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL + HEAD @@ -21,7 +21,6 @@ org.opendaylight.yangtools concepts - 0.6.0-SNAPSHOT com.google.guava diff --git a/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/CommitHandlerTransactions.java b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/CommitHandlerTransactions.java index bffeb59fab..5d73b1eefb 100644 --- a/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/CommitHandlerTransactions.java +++ b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/CommitHandlerTransactions.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.common.util; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-common/pom.xml b/opendaylight/md-sal/sal-common/pom.xml index 1de22ac853..cb7f70a16b 100644 --- a/opendaylight/md-sal/sal-common/pom.xml +++ b/opendaylight/md-sal/sal-common/pom.xml @@ -1,17 +1,17 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-common scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + diff --git a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java index 08df0a414a..ff9f037f5a 100644 --- a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java +++ b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compability; import org.opendaylight.controller.sal.core.*; diff --git a/opendaylight/md-sal/sal-connector-api/pom.xml b/opendaylight/md-sal/sal-connector-api/pom.xml index daeda3da6f..f28057e8a6 100644 --- a/opendaylight/md-sal/sal-connector-api/pom.xml +++ b/opendaylight/md-sal/sal-connector-api/pom.xml @@ -1,23 +1,23 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-connector-api scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + org.opendaylight.controller sal-core-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools diff --git a/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareRpcRouter.java b/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareRpcRouter.java index 11df1ff9c6..a1d573db08 100644 --- a/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareRpcRouter.java +++ b/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareRpcRouter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.api; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareZeroMqRpcRouter.java b/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareZeroMqRpcRouter.java index 1a360ad052..ac7120ffdb 100644 --- a/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareZeroMqRpcRouter.java +++ b/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareZeroMqRpcRouter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.api; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/RpcRouter.java b/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/RpcRouter.java index 08fce5783e..f161644f6d 100644 --- a/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/RpcRouter.java +++ b/opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/RpcRouter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.api; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-dom-api/pom.xml b/opendaylight/md-sal/sal-dom-api/pom.xml index ac273cd885..d7b0296ce1 100644 --- a/opendaylight/md-sal/sal-dom-api/pom.xml +++ b/opendaylight/md-sal/sal-dom-api/pom.xml @@ -1,17 +1,17 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-core-api scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -54,12 +54,12 @@ org.opendaylight.controller yang-jmx-generator-plugin - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar @@ -89,13 +89,13 @@ org.opendaylight.controller sal-common - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller config-api - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcConsumptionRegistry.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcConsumptionRegistry.java index c19ee1a7cb..665a50f9ca 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcConsumptionRegistry.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcConsumptionRegistry.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core.api; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java index faac6501c9..24cb99f8c3 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core.api; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher; diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataStore.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataStore.java index 87129d6863..8bdd061871 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataStore.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataStore.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core.api.data; import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler; diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java index e5fc4b7aa4..299fe1b558 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core.api.mount; import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry; diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java index c1f873c3af..c4c7889f57 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core.api.mount; import java.util.EventListener; diff --git a/opendaylight/md-sal/sal-dom-broker/pom.xml b/opendaylight/md-sal/sal-dom-broker/pom.xml index 57ad058c4e..8b193e03aa 100644 --- a/opendaylight/md-sal/sal-dom-broker/pom.xml +++ b/opendaylight/md-sal/sal-dom-broker/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-broker-impl bundle @@ -12,28 +11,29 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + org.opendaylight.controller sal-core-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-common-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-core-spi - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.slf4j @@ -50,7 +50,7 @@ org.opendaylight.controller config-api - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools @@ -99,12 +99,12 @@ org.opendaylight.controller yang-jmx-generator-plugin - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModule.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModule.java index 9a2a90445e..f4d642f82d 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModule.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModule.java @@ -1,12 +1,10 @@ -/** -* Generated file - -* Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: dom-broker-impl -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Wed Nov 20 17:04:41 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.dom.impl; import org.opendaylight.controller.config.yang.md.sal.dom.statistics.DomBrokerRuntimeMXBeanImpl; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModuleFactory.java index 8e9e9f6ac7..38f5009feb 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModuleFactory.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: dom-broker-impl - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:04:41 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.dom.impl; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModule.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModule.java index 4bcbb08963..df1b5a3403 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModule.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModule.java @@ -1,12 +1,10 @@ -/** -* Generated file - -* Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: hash-map-data-store -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Wed Nov 20 17:01:31 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.dom.impl; import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModuleFactory.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModuleFactory.java index b9b6816a20..6b5503f794 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModuleFactory.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/HashMapDataStoreModuleFactory.java @@ -1,12 +1,10 @@ -/** -* Generated file - -* Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: hash-map-data-store -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Wed Nov 20 17:01:31 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.dom.impl; /** diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModule.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModule.java index 8152cbd6b1..ba7414d42e 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModule.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModule.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: schema-service-singleton - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:01:31 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.dom.impl; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModuleFactory.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModuleFactory.java index 4b73656f72..22ad3fde00 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModuleFactory.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: schema-service-singleton - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Wed Nov 20 17:01:31 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.dom.impl; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/statistics/DomBrokerRuntimeMXBeanImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/statistics/DomBrokerRuntimeMXBeanImpl.java index bc13979d67..692a0babdf 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/statistics/DomBrokerRuntimeMXBeanImpl.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/statistics/DomBrokerRuntimeMXBeanImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.dom.statistics; import org.opendaylight.controller.config.yang.md.sal.dom.impl.Data; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ConsumerContextImpl.xtend b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ConsumerContextImpl.xtend index 9f21823e3e..e4808e9bd6 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ConsumerContextImpl.xtend +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ConsumerContextImpl.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java index 8f62be97d8..ba3dcc8c86 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker; import java.util.concurrent.atomic.AtomicLong; @@ -79,4 +86,4 @@ public class DataBrokerImpl extends AbstractDataBroker finish(HashMapDataStoreTransaction transaction) { val modification = transaction.modification; - configuration.putAll(modification.updatedConfigurationData); - operational.putAll(modification.updatedOperationalData); - for (removal : modification.removedConfigurationData) { remove(configuration,removal); } for (removal : modification.removedOperationalData) { remove(operational,removal); } + configuration.putAll(modification.updatedConfigurationData); + operational.putAll(modification.updatedOperationalData); + return Rpcs.getRpcResult(true, null, Collections.emptySet); } diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java index 763407f23a..0b184fc86e 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java @@ -40,14 +40,15 @@ public class NotificationRouterImpl implements NotificationRouter { private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class); private Multimap> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.>create()); - +// private Registration defaultListener; + private void sendNotification(CompositeNode notification) { - QName type = notification.getNodeType(); - Collection> toNotify = listeners.get(type); + final QName type = notification.getNodeType(); + final Collection> toNotify = listeners.get(type); log.trace("Publishing notification " + type); - if (toNotify == null) { - // No listeners were registered - returns. + if ((toNotify == null) || toNotify.isEmpty()) { + log.debug("No listener registered for handling of notification {}", type); return; } @@ -59,17 +60,17 @@ public class NotificationRouterImpl implements NotificationRouter { log.error("Uncaught exception in NotificationListener", e); } } - } @Override public void publish(CompositeNode notification) { sendNotification(notification); } - + @Override public Registration addNotificationListener(QName notification, NotificationListener listener) { ListenerRegistration ret = new ListenerRegistration(notification, listener); + listeners.put(notification, ret); return ret; } diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java index 0120231f8d..3e6a8252b7 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.impl; import java.util.ArrayList; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java index f0f5ac3e33..28d5ae914f 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.impl; import static com.google.common.base.Preconditions.checkArgument; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java index 7e3d9be59c..cfaf481e72 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java index 3eb7e22bef..5839db46ca 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import org.opendaylight.controller.sal.core.api.data.DataBrokerService; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java index 329219ebb0..1793c53a56 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import org.opendaylight.controller.md.sal.common.api.RegistrationListener; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java index 0021dd8f0f..0e63126bb3 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import org.opendaylight.controller.sal.core.api.data.DataBrokerService; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java index 170517bb7a..8a15d84f99 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import org.opendaylight.controller.sal.core.api.notify.NotificationListener; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationServiceProxy.java index d685370fea..a0051dc38e 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import org.opendaylight.controller.sal.core.api.notify.NotificationListener; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.xtend b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.xtend index 3f77133c2e..5b97443b92 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.xtend +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi import org.opendaylight.controller.sal.core.api.BrokerService diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceActivator.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceActivator.java index 617b13bc2b..344b3f3276 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceActivator.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceActivator.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import java.util.Hashtable; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceProxy.java index 7ac65ff66d..1d864eec5b 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceProxy.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; import org.opendaylight.controller.sal.core.api.model.SchemaService; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java index fc42d2ceb9..74923dd8b8 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.spi; import org.opendaylight.controller.sal.core.api.notify.NotificationListener; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RoutedRpcProcessor.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RoutedRpcProcessor.java index 97c2a151ce..02419ff529 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RoutedRpcProcessor.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RoutedRpcProcessor.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.spi; import java.util.Map; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java index 7ec8ce1d78..9881be0481 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.spi; import java.util.Set; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataOperations.xtend b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataOperations.xtend index f37fb0e5c0..1e89281df4 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataOperations.xtend +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataOperations.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.util import org.opendaylight.yangtools.yang.data.api.CompositeNode @@ -63,7 +70,7 @@ class YangDataOperations { if(node.keyDefinition === null || node.keyDefinition.empty) { return modified; - } + } val originalMap = (original as List).toIndexMap(node.keyDefinition); val modifiedMap = (modified as List).toIndexMap(node.keyDefinition); @@ -73,7 +80,8 @@ class YangDataOperations { if(originalEntry != null) { originalMap.remove(entry.key); mergedNodes.add(merge(node,originalEntry,entry.value,configurational)); - + } else { + mergedNodes.add(entry.value); } } mergedNodes.addAll(originalMap.values); diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataUtils.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataUtils.java index 166fe38328..8b78b83e2f 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataUtils.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.util; import java.util.HashMap; diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java index 9a862d7a0c..7f6918f2a1 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.util; @@ -24,7 +31,6 @@ import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; import org.opendaylight.yangtools.yang.model.api.UsesNode; -import org.opendaylight.yangtools.yang.model.api.YangNode; import static com.google.common.base.Preconditions.*; @@ -120,11 +126,6 @@ public class YangSchemaUtils { public NetconfDataRootNode(SchemaContext schema) { // TODO Auto-generated constructor stub } - - public YangNode getParent() { - // TODO Auto-generated method stub - return null; - } @Override public Set> getTypeDefinitions() { diff --git a/opendaylight/md-sal/sal-dom-spi/pom.xml b/opendaylight/md-sal/sal-dom-spi/pom.xml index 01dca0110b..8aa2a006f6 100644 --- a/opendaylight/md-sal/sal-dom-spi/pom.xml +++ b/opendaylight/md-sal/sal-dom-spi/pom.xml @@ -1,24 +1,24 @@ - - 4.0.0 - - org.opendaylight.controller - sal-parent - 1.0-SNAPSHOT - - sal-core-spi - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - - - - - org.opendaylight.controller - sal-core-api - 1.0-SNAPSHOT - - - bundle - + + 4.0.0 + + org.opendaylight.controller + sal-parent + 1.1-SNAPSHOT + + sal-core-spi + + scm:git:ssh://git.opendaylight.org:29418/controller.git + scm:git:ssh://git.opendaylight.org:29418/controller.git + https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL + HEAD + + + + + org.opendaylight.controller + sal-core-api + 1.1-SNAPSHOT + + + bundle + diff --git a/opendaylight/md-sal/sal-netconf-connector/pom.xml b/opendaylight/md-sal/sal-netconf-connector/pom.xml index 89f576ccc9..597b02ebb5 100644 --- a/opendaylight/md-sal/sal-netconf-connector/pom.xml +++ b/opendaylight/md-sal/sal-netconf-connector/pom.xml @@ -1,20 +1,20 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT sal-netconf-connector scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -24,7 +24,7 @@ ${project.groupId} sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.eclipse.xtend @@ -33,7 +33,7 @@ org.opendaylight.controller netty-threadgroup-config - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.controller @@ -47,7 +47,7 @@ org.opendaylight.controller sal-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT test jar @@ -160,35 +160,35 @@ org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT test org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT + 1.1-SNAPSHOT test-jar test org.opendaylight.controller ietf-netconf-monitoring - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools.model ietf-inet-types - 2010.09.24.2-SNAPSHOT + 2010.09.24.3 org.opendaylight.controller threadpool-config-api - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.controller netty-config-api - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT @@ -242,12 +242,12 @@ org.opendaylight.controller yang-jmx-generator-plugin - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java index 2403027e01..a04baaa912 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java @@ -1,26 +1,15 @@ -/** -* Generated file - -* Generated from: yang module name: opendaylight-sal-netconf-connector yang module local name: sal-netconf-connector -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Mon Nov 18 09:44:16 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.connector.netconf; +import com.google.common.net.InetAddresses; import io.netty.channel.EventLoopGroup; import io.netty.util.concurrent.GlobalEventExecutor; - -import java.io.File; -import java.io.InputStream; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import javax.net.ssl.SSLContext; - import org.opendaylight.controller.netconf.client.NetconfClientDispatcher; import org.opendaylight.controller.netconf.client.NetconfSshClientDispatcher; import org.opendaylight.controller.netconf.util.handler.ssh.authentication.AuthenticationHandler; @@ -33,17 +22,25 @@ import org.opendaylight.yangtools.yang.model.util.repo.FilesystemSchemaCachingPr import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider; import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProviders; import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import static com.google.common.base.Preconditions.*; +import java.io.File; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; -import com.google.common.base.Optional; -import com.google.common.net.InetAddresses; +import static org.opendaylight.controller.config.api.JmxAttributeValidationException.checkCondition; +import static org.opendaylight.controller.config.api.JmxAttributeValidationException.checkNotNull; /** * */ public final class NetconfConnectorModule extends org.opendaylight.controller.config.yang.md.sal.connector.netconf.AbstractNetconfConnectorModule { + private static final Logger logger = LoggerFactory.getLogger(NetconfConnectorModule.class); private static ExecutorService GLOBAL_PROCESSING_EXECUTOR = null; private static AbstractCachingSchemaSourceProvider GLOBAL_NETCONF_SOURCE_PROVIDER = null; @@ -58,14 +55,20 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co } @Override - public void validate(){ - super.validate(); - checkState(getAddress() != null,"Address must be set."); + protected void customValidation() { + checkNotNull(getAddress(), addressJmxAttribute); //checkState(getAddress().getIpv4Address() != null || getAddress().getIpv6Address() != null,"Address must be set."); - checkState(getPort() != null,"Port must be set."); - checkState(getDomRegistry() != null,"Dom Registry must be provided."); - } + checkNotNull(getPort(), portJmxAttribute); + checkNotNull(getDomRegistry(), portJmxAttribute); + checkNotNull(getDomRegistry(), domRegistryJmxAttribute); + + checkNotNull(getConnectionTimeoutMillis(), connectionTimeoutMillisJmxAttribute); + checkCondition(getConnectionTimeoutMillis() > 0, "must be > 0", connectionTimeoutMillisJmxAttribute); + checkNotNull(getBetweenAttemptsTimeoutMillis(), betweenAttemptsTimeoutMillisJmxAttribute); + checkCondition(getBetweenAttemptsTimeoutMillis() > 0, "must be > 0", betweenAttemptsTimeoutMillisJmxAttribute); + + } @Override public java.lang.AutoCloseable createInstance() { @@ -73,10 +76,15 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co getDomRegistryDependency(); NetconfDevice device = new NetconfDevice(getIdentifier().getInstanceName()); String addressValue = getAddress(); - - - int attemptMsTimeout = 60*1000; - int connectionAttempts = 5; + + Long connectionAttempts; + if (getMaxConnectionAttempts() != null && getMaxConnectionAttempts() > 0) { + connectionAttempts = getMaxConnectionAttempts(); + } else { + logger.trace("Setting {} on {} to infinity", maxConnectionAttemptsJmxAttribute, this); + connectionAttempts = null; + } + long clientConnectionTimeoutMillis = getConnectionTimeoutMillis(); /* * Uncomment after Switch to IP Address if(getAddress().getIpv4Address() != null) { @@ -85,8 +93,12 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co addressValue = getAddress().getIpv6Address().getValue(); } */ - ReconnectStrategy strategy = new TimedReconnectStrategy(GlobalEventExecutor.INSTANCE, attemptMsTimeout, 1000, 1.0, null, - Long.valueOf(connectionAttempts), null); + double sleepFactor = 1.0; + int minSleep = 1000; + Long maxSleep = null; + Long deadline = null; + ReconnectStrategy strategy = new TimedReconnectStrategy(GlobalEventExecutor.INSTANCE, getBetweenAttemptsTimeoutMillis(), + minSleep, sleepFactor, maxSleep, connectionAttempts, deadline); device.setReconnectStrategy(strategy); @@ -98,7 +110,7 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co device.setSocketAddress(socketAddress); device.setEventExecutor(getEventExecutorDependency()); - device.setDispatcher(createDispatcher()); + device.setDispatcher(createDispatcher(clientConnectionTimeoutMillis)); device.setSchemaSourceProvider(getGlobalNetconfSchemaProvider(bundleContext)); getDomRegistryDependency().registerProvider(device, bundleContext); @@ -126,14 +138,14 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co return GLOBAL_NETCONF_SOURCE_PROVIDER; } - private NetconfClientDispatcher createDispatcher() { + private NetconfClientDispatcher createDispatcher(long clientConnectionTimeoutMillis) { EventLoopGroup bossGroup = getBossThreadGroupDependency(); EventLoopGroup workerGroup = getWorkerThreadGroupDependency(); if(getTcpOnly()) { - return new NetconfClientDispatcher( bossGroup, workerGroup); + return new NetconfClientDispatcher( bossGroup, workerGroup, clientConnectionTimeoutMillis); } else { AuthenticationHandler authHandler = new LoginPassword(getUsername(),getPassword()); - return new NetconfSshClientDispatcher(authHandler , bossGroup, workerGroup); + return new NetconfSshClientDispatcher(authHandler , bossGroup, workerGroup, clientConnectionTimeoutMillis); } } diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java index 51e288d597..9842139dab 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java @@ -1,11 +1,9 @@ -/** - * Generated file - - * Generated from: yang module name: opendaylight-sal-netconf-connector yang module local name: sal-netconf-connector - * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator - * Generated at: Mon Nov 18 09:44:16 CET 2013 +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * - * Do not modify this file unless it is present under src/main directory + * This program and the accompanying materials are made available under the + * terms of the 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.config.yang.md.sal.connector.netconf; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/InventoryUtils.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/InventoryUtils.java index f2a09d9608..5c6702ae64 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/InventoryUtils.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/InventoryUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf; import java.net.URI; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend index 3799dd245e..7e88ea17d0 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf import com.google.common.base.Optional diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java index 8623d90fe5..69fe4aa190 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf; import com.google.common.base.Objects; @@ -71,17 +78,11 @@ class NetconfDeviceListener extends NetconfClientSessionListener { */ public void onNotification(final NetconfClientSession session, final NetconfMessage message) { this.device.logger.debug("Received NETCONF notification.", message); - CompositeNode _notificationBody = null; - CompositeNode _compositeNode = null; + CompositeNode domNotification = null; if (message != null) { - _compositeNode = NetconfMapping.toCompositeNode(message,device.getSchemaContext()); + domNotification = NetconfMapping.toNotificationNode(message, device.getSchemaContext()); } - if (_compositeNode != null) { - _notificationBody = NetconfDeviceListener.getNotificationBody(_compositeNode); - } - final CompositeNode domNotification = _notificationBody; - boolean _notEquals = (!Objects.equal(domNotification, null)); - if (_notEquals) { + if (domNotification != null) { MountProvisionInstance _mountInstance = null; if (this.device != null) { _mountInstance = this.device.getMountInstance(); diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java index 6df34cdb9e..a816819cb9 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfInventoryUtils.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfInventoryUtils.java index a69f6708a1..bae0f08947 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfInventoryUtils.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfInventoryUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf; import org.opendaylight.yangtools.yang.common.QName; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend index c151e42fbb..76a5506df3 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf import org.opendaylight.controller.netconf.api.NetconfMessage @@ -26,6 +33,8 @@ import com.google.common.base.Preconditions import com.google.common.base.Optional import org.opendaylight.yangtools.yang.model.api.SchemaContext import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils +import org.opendaylight.yangtools.yang.model.api.NotificationDefinition +import java.util.Set class NetconfMapping { @@ -96,7 +105,19 @@ class NetconfMapping { } static def CompositeNode toCompositeNode(NetconfMessage message,Optional ctx) { - return null//message.toRpcResult().result; + //TODO: implement general normalization to normalize incoming Netconf Message + // for Schema Context counterpart + return null + } + + static def CompositeNode toNotificationNode(NetconfMessage message,Optional ctx) { + if (ctx.present) { + val schemaContext = ctx.get + val notifications = schemaContext.notifications + val document = message.document + return XmlDocumentUtils.notificationToDomNodes(document, Optional.>fromNullable(notifications)) + } + return null } static def NetconfMessage toRpcMessage(QName rpc, CompositeNode node,Optional ctx) { @@ -127,11 +148,11 @@ class NetconfMapping { if(isDataRetrievalReply(rpc)) { val xmlData = message.document.dataSubtree - val dataNodes = XmlDocumentUtils.toDomNodes(xmlData,Optional.of(context.get.dataDefinitions)) + val dataNodes = XmlDocumentUtils.toDomNodes(xmlData, Optional.of(context.get.dataDefinitions)) val it = ImmutableCompositeNode.builder() setQName(NETCONF_RPC_REPLY_QNAME) - add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME,dataNodes)); + add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME, dataNodes)); rawRpc = it.toInstance; //sys(xmlData) diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java index 79264abe6c..49f702080c 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf; import java.util.Set; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/YangModelInputStreamAdapter.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/YangModelInputStreamAdapter.java index 0c0070ce9c..a34aaff757 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/YangModelInputStreamAdapter.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/YangModelInputStreamAdapter.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf; import java.io.IOException; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang b/opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang index 2331516877..f0fa452dc5 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang @@ -88,6 +88,25 @@ module odl-sal-netconf-connector-cfg { } } } + + leaf connection-timeout-millis { + description "Specifies timeout in milliseconds after which connection must be established."; + type uint32; + default 20000; + } + + leaf max-connection-attempts { + description "Maximum number of connection retries. Non positive value or null is interpreted as infinity."; + type uint32; + default 0; // retry forever + } + + + leaf between-attempts-timeout-millis { + description "Timeout in milliseconds to wait between connection attempts."; + type uint16; + default 10000; + } } } } \ No newline at end of file diff --git a/opendaylight/md-sal/sal-remote/pom.xml b/opendaylight/md-sal/sal-remote/pom.xml index 5e6f585511..b6d0632068 100644 --- a/opendaylight/md-sal/sal-remote/pom.xml +++ b/opendaylight/md-sal/sal-remote/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-remote jar @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -85,7 +85,7 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml index cb2f5482d6..ae31c2382f 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml @@ -189,7 +189,7 @@ org.opendaylight.yangtools maven-sal-api-gen-plugin - 0.6.0-SNAPSHOT + ${yangtools.version} jar diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java index 1117986429..f511ff7e76 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java @@ -1,12 +1,10 @@ -/** -* Generated file - -* Generated from: yang module name: odl-sal-dom-rpc-remote-cfg yang module local name: remote-zeromq-rpc-server -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Thu Dec 05 14:25:21 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.remote.rpc; import org.opendaylight.controller.sal.connector.remoterpc.*; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java index 3cc3ac0f68..c8d6806344 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java @@ -1,12 +1,10 @@ -/** -* Generated file - -* Generated from: yang module name: odl-sal-dom-rpc-remote-cfg yang module local name: remote-zeromq-rpc-server -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Thu Dec 05 14:25:21 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.config.yang.md.sal.remote.rpc; import org.opendaylight.controller.config.api.DependencyResolver; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/SocketPair.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/SocketPair.java index 67b3a830e3..f569944a7f 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/SocketPair.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/SocketPair.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.remoterpc; import org.zeromq.ZMQ; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientImplTest.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientImplTest.java index 5dd21429ff..f63584b7fc 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientImplTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientImplTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.remoterpc; import com.google.common.base.Optional; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientRequestHandlerTest.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientRequestHandlerTest.java index 84407fe828..a5c4d85fed 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientRequestHandlerTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientRequestHandlerTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.remoterpc; import junit.framework.Assert; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/MockRoutingTable.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/MockRoutingTable.java index 7b0ac2c6a0..9c74be93bd 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/MockRoutingTable.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/MockRoutingTable.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.remoterpc; import org.opendaylight.controller.sal.connector.remoterpc.api.RouteChangeListener; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/SerilizationTest.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/SerilizationTest.java index 36a4acddca..454dc374a9 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/SerilizationTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/SerilizationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connector.remoterpc; import org.junit.Test; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java index 87078ea712..7119a66113 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sample.zeromq.consumer; import java.io.FileNotFoundException; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java index 2bc151a0f3..e33011b92b 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sample.zeromq.provider; import org.opendaylight.controller.sal.common.util.RpcErrors; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml index 96eda6eb37..8813ee9613 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml @@ -329,12 +329,12 @@ org.opendaylight.yangtools.model yang-ext - 2013.09.07.2-SNAPSHOT + 2013.09.07.3 org.opendaylight.yangtools.model opendaylight-l2-types - 2013.08.27.2-SNAPSHOT + 2013.08.27.3 org.opendaylight.controller diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java index b4fa698a92..edd49485af 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.tests.zmqrouter.rest; import org.opendaylight.controller.sal.connector.api.RpcRouter; diff --git a/opendaylight/md-sal/sal-rest-connector/pom.xml b/opendaylight/md-sal/sal-rest-connector/pom.xml index 2d24e66711..a4d2f4ca25 100644 --- a/opendaylight/md-sal/sal-rest-connector/pom.xml +++ b/opendaylight/md-sal/sal-rest-connector/pom.xml @@ -1,23 +1,23 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-rest-connector scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL + HEAD ${project.groupId} sal-core-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT ${project.groupId} @@ -50,6 +50,15 @@ gson 2.2.4 + + org.opendaylight.yangtools + yang-parser-impl + + + io.netty + netty-codec-http + 4.0.10.Final + @@ -68,11 +77,6 @@ 1.0.9 test - - org.opendaylight.yangtools - yang-parser-impl - test - org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-grizzly2 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java deleted file mode 100644 index 557adb6129..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft01.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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.sal.rest.api; - -public class Draft01 { - public static class MediaTypes { - public static final String API = "application/vnd.yang.api"; - public static final String DATASTORE = "application/vnd.yang.datastore"; - public static final String DATA = "application/vnd.yang.data"; - public static final String EVENT = "application/vnd.yang.event"; - public static final String OPERATION = "application/vnd.yang.operation"; - public static final String PATCH = "application/vnd.yang.patch"; - } -} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft02.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft02.java index 70b2cf5797..d0eaa36dde 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft02.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/Draft02.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.api; public class Draft02 { diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java index 60a8f285a2..cef5df9e57 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java @@ -9,47 +9,45 @@ package org.opendaylight.controller.sal.rest.api; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; import org.opendaylight.controller.sal.restconf.impl.StructuredData; import org.opendaylight.yangtools.yang.data.api.CompositeNode; /** * The URI hierarchy for the RESTCONF resources consists of an entry - * point container, 3 top-level resources, and 1 field. Refer to - * Section 5 for details on each URI. - *

    + * point container, 4 top-level resources, and 1 field. + *
      *
    • /restconf - {@link #getRoot()} - *
      • /config - *
      • /operational - {@link #readAllData()} - Added in Draft02 - *
      • /datastore - {@link #readAllData()} - *
          - *
        • /(top-level-data-nodes) (config=true or false) - *
        - *
      • /modules - *
        • /module - *
        • /name - *
        • /revision - *
        • /namespace - *
        • /feature - *
        • /deviation - *
        - *
      • /operations - *
          - *
        • /(custom protocol operations) - *
        - *
      • /version (field) + *
          + *
        • /config - {@link #readConfigurationData(String)} + * {@link #updateConfigurationData(String, CompositeNode)} + * {@link #createConfigurationData(CompositeNode)} + * {@link #createConfigurationData(String, CompositeNode)} + * {@link #deleteConfigurationData(String)} + *
        • /operational - {@link #readOperationalData(String)} + *
        • /modules - {@link #getModules()} + *
            + *
          • /module + *
          + *
        • /operations - {@link #invokeRpc(String, CompositeNode)} + * {@link #invokeRpc(String, CompositeNode)} + *
        • /version (field) *
        + *
      */ @Path("/") -public interface RestconfService extends RestconfServiceLegacy { +public interface RestconfService { public static final String XML = "+xml"; public static final String JSON = "+json"; @@ -59,26 +57,50 @@ public interface RestconfService extends RestconfServiceLegacy { @GET @Path("/modules") - @Produces({Draft01.MediaTypes.API+JSON,Draft01.MediaTypes.API+XML, - Draft02.MediaTypes.API+JSON,Draft02.MediaTypes.API+XML}) + @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) public StructuredData getModules(); + @GET + @Path("/modules/{identifier:.+}") + @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) + public StructuredData getModules(@PathParam("identifier") String identifier); + + @GET + @Path("/modules/module/{identifier:.+}") + @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) + public StructuredData getModule(@PathParam("identifier") String identifier); + + @GET + @Path("/operations") + @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) + public StructuredData getOperations(); + + @GET + @Path("/operations/{identifier:.+}") + @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) + public StructuredData getOperations(@PathParam("identifier") String identifier); + @POST - @Path("/operations/{identifier}") - @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, + @Path("/operations/{identifier:.+}") + @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML, + Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, + @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML, + Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload); @POST - @Path("/operations/{identifier}") - @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, + @Path("/operations/{identifier:.+}") + @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML, + Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public StructuredData invokeRpc(@PathParam("identifier") String identifier); + public StructuredData invokeRpc(@PathParam("identifier") String identifier, @DefaultValue("") String noPayload); @GET @Path("/config/{identifier:.+}") @@ -114,4 +136,8 @@ public interface RestconfService extends RestconfServiceLegacy { @Path("/config/{identifier:.+}") public Response deleteConfigurationData(@PathParam("identifier") String identifier); + @GET + @Path("/streams/stream/{identifier:.+}") + public Response subscribeToStream(@PathParam("identifier") String identifier, @Context UriInfo uriInfo); + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java deleted file mode 100644 index 9b69c1f09a..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfServiceLegacy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.opendaylight.controller.sal.rest.api; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.opendaylight.controller.sal.restconf.impl.StructuredData; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; - -public interface RestconfServiceLegacy { - - public static final String XML = "+xml"; - public static final String JSON = "+json"; - - @Deprecated - @GET - @Path("/datastore") - @Produces({Draft01.MediaTypes.DATASTORE+JSON,Draft01.MediaTypes.DATASTORE+XML}) - public StructuredData readAllData(); - - @Deprecated - @GET - @Path("/datastore/{identifier:.+}") - @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public StructuredData readData(@PathParam("identifier") String identifier); - - @Deprecated - @POST - @Path("/datastore/{identifier:.+}") - @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public Response createConfigurationDataLegacy(@PathParam("identifier") String identifier, CompositeNode payload); - - @Deprecated - @PUT - @Path("/datastore/{identifier:.+}") - @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML, - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML}) - public Response updateConfigurationDataLegacy(@PathParam("identifier") String identifier, CompositeNode payload); - -} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/package-info.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/package-info.java index 9721b9ae82..fc3674eefe 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/package-info.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/package-info.java @@ -1,5 +1,8 @@ -/** - * +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.sal.rest.api; \ No newline at end of file +package org.opendaylight.controller.sal.rest.api; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java index 4c5fd9ff7c..d1441d7b9d 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import static com.google.common.base.Preconditions.checkNotNull; @@ -127,7 +134,7 @@ class JsonMapper { private DataSchemaNode findFirstSchemaForNode(Node node, Set dataSchemaNode) { for (DataSchemaNode dsn : dataSchemaNode) { - if (node.getNodeType().getLocalName().equals(dsn.getQName().getLocalName())) { + if (node.getNodeType().equals(dsn.getQName())) { return dsn; } else if (dsn instanceof ChoiceNode) { for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) { @@ -196,7 +203,6 @@ class JsonMapper { + baseType.getClass().getSimpleName() + "."); } - // TODO check InstanceIdentifierTypeDefinition if (baseType instanceof IdentityrefTypeDefinition) { if (node.getValue() instanceof QName) { IdentityValuesDTO valueDTO = (IdentityValuesDTO) RestCodec.from(baseType, mountPoint).serialize( @@ -245,14 +251,18 @@ class JsonMapper { result.append("/"); writeModuleNameAndIdentifier(result, identityValue); - if (identityValue.getPredicates() != null) { + if (identityValue.getPredicates() != null && !identityValue.getPredicates().isEmpty()) { for (Predicate predicate : identityValue.getPredicates()) { IdentityValue identityValuePredicate = predicate.getName(); result.append("["); - writeModuleNameAndIdentifier(result, identityValuePredicate); - result.append("=\""); + if (identityValuePredicate == null) { + result.append("."); + } else { + writeModuleNameAndIdentifier(result, identityValuePredicate); + } + result.append("='"); result.append(predicate.getValue()); - result.append("\""); + result.append("'"); result.append("]"); } } @@ -293,10 +303,16 @@ class JsonMapper { String nameForOutput = node.getNodeType().getLocalName(); if (schema.isAugmenting()) { ControllerContext contContext = ControllerContext.getInstance(); - CharSequence moduleName; - moduleName = contContext.toRestconfIdentifier(schema.getQName()); + CharSequence moduleName = null; + if (mountPoint == null) { + moduleName = contContext.toRestconfIdentifier(schema.getQName()); + } else { + moduleName = contContext.toRestconfIdentifier(mountPoint, schema.getQName()); + } if (moduleName != null) { nameForOutput = moduleName.toString(); + } else { + logger.info("Module '{}' was not found in schema from mount point", schema.getQName()); } } writer.name(nameForOutput); diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonReader.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonReader.java index 3fc402ca3a..e19f9f5805 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonReader.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonReader.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.io.InputStream; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java index 2b1abaa987..0d73485c80 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.io.IOException; @@ -13,13 +20,12 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.yangtools.yang.data.api.CompositeNode; @Provider -@Consumes({ Draft01.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON, +@Consumes({ Draft02.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.OPERATION + RestconfService.JSON, MediaType.APPLICATION_JSON }) public enum JsonToCompositeNodeProvider implements MessageBodyReader { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestUtil.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestUtil.java index 0c8c75839b..225eb7de6a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestUtil.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestUtil.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.util.ArrayList; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfApplication.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfApplication.java index bede249c94..6166a084c1 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfApplication.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfApplication.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.util.HashSet; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java index 09cf01091e..1870bdf0bf 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.util.Collection; @@ -11,6 +18,7 @@ import org.opendaylight.controller.sal.core.api.model.SchemaService; import org.opendaylight.controller.sal.core.api.mount.MountService; import org.opendaylight.controller.sal.restconf.impl.BrokerFacade; import org.opendaylight.controller.sal.restconf.impl.ControllerContext; +import org.opendaylight.controller.sal.streams.websockets.WebSocketServer; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener; import org.osgi.framework.BundleActivator; @@ -27,6 +35,7 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack private ServiceTracker brokerServiceTrancker; private BundleContext bundleContext; private ProviderSession session; + private Thread webSocketServerThread; @Override public void onSessionInitiated(ProviderSession session) { @@ -46,6 +55,9 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack bundleContext = context; brokerServiceTrancker = new ServiceTracker<>(context, Broker.class, this); brokerServiceTrancker.open(); + webSocketServerThread = new Thread(new WebSocketServer()); + webSocketServerThread.setName("Web socket server"); + webSocketServerThread.start(); } @Override @@ -57,6 +69,7 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack e.printStackTrace(); } } + webSocketServerThread.interrupt(); session.close(); brokerServiceTrancker.close(); } diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java index b10384c6f5..5dba7474ca 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.io.IOException; @@ -14,7 +21,6 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.controller.sal.restconf.impl.ResponseException; @@ -25,8 +31,8 @@ import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import com.google.gson.stream.JsonWriter; @Provider -@Produces({ Draft01.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON, - MediaType.APPLICATION_JSON }) +@Produces({ Draft02.MediaTypes.API + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON, + Draft02.MediaTypes.OPERATION + RestconfService.JSON, MediaType.APPLICATION_JSON }) public enum StructuredDataToJsonProvider implements MessageBodyWriter { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java index fbddd05caf..7d6b329cfa 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.io.IOException; @@ -19,7 +26,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.controller.sal.restconf.impl.ResponseException; @@ -31,8 +37,8 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @Provider -@Produces({ Draft01.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML, - MediaType.APPLICATION_XML, MediaType.TEXT_XML }) +@Produces({ Draft02.MediaTypes.API + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML, + Draft02.MediaTypes.OPERATION + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML }) public enum StructuredDataToXmlProvider implements MessageBodyWriter { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/UnsupportedFormatException.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/UnsupportedFormatException.java index 615f209037..aad5a0f71d 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/UnsupportedFormatException.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/UnsupportedFormatException.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; public class UnsupportedFormatException extends Exception { diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java index 0dd4668a74..e76e1962a0 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import javax.activation.UnsupportedDataTypeException; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java index d6f8a9874b..d807070dbd 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import static com.google.common.base.Preconditions.checkArgument; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java index f09c3b4cc1..13d617031a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.rest.impl; import java.io.IOException; @@ -14,14 +21,13 @@ import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import javax.xml.stream.XMLStreamException; -import org.opendaylight.controller.sal.rest.api.Draft01; import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.api.RestconfService; import org.opendaylight.controller.sal.restconf.impl.ResponseException; import org.opendaylight.yangtools.yang.data.api.CompositeNode; @Provider -@Consumes({ Draft01.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML, +@Consumes({ Draft02.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.OPERATION + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML }) public enum XmlToCompositeNodeProvider implements MessageBodyReader { INSTANCE; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/package-info.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/package-info.java index 71dee0496d..62afdbd10d 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/package-info.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/package-info.java @@ -1,8 +1,8 @@ -/** - * - */ -/** - * @author ttkacik +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.sal.rest.impl; \ No newline at end of file +package org.opendaylight.controller.sal.rest.impl; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.xtend b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.xtend index 6e05d3f24a..d3050061da 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.xtend +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.xtend @@ -1,16 +1,24 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl import javax.ws.rs.core.Response import org.opendaylight.controller.md.sal.common.api.data.DataReader import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession import org.opendaylight.controller.sal.core.api.data.DataBrokerService +import org.opendaylight.controller.sal.core.api.mount.MountInstance import org.opendaylight.controller.sal.rest.impl.RestconfProvider +import org.opendaylight.controller.sal.streams.listeners.ListenerAdapter import org.opendaylight.yangtools.yang.common.QName import org.opendaylight.yangtools.yang.common.RpcResult import org.opendaylight.yangtools.yang.data.api.CompositeNode import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier import org.slf4j.LoggerFactory -import org.opendaylight.controller.sal.core.api.mount.MountInstance class BrokerFacade implements DataReader { @@ -126,4 +134,13 @@ class BrokerFacade implements DataReader { return transaction.commit } + def registerToListenDataChanges(ListenerAdapter listener) { + checkPreconditions + if (listener.listening) { + return; + } + val registration = dataService.registerDataChangeListener(listener.path, listener) + listener.setRegistration(registration) + } + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/CompositeNodeWrapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/CompositeNodeWrapper.java index 8c5870522e..e0ae788703 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/CompositeNodeWrapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/CompositeNodeWrapper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import java.net.URI; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend index ced272e00b..c2b82eae63 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend @@ -1,9 +1,18 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl import com.google.common.base.Preconditions +import com.google.common.base.Splitter import com.google.common.collect.BiMap import com.google.common.collect.FluentIterable import com.google.common.collect.HashBiMap +import com.google.common.collect.Lists import java.net.URI import java.net.URLDecoder import java.net.URLEncoder @@ -79,27 +88,55 @@ class ControllerContext implements SchemaServiceListener { onGlobalContextUpdated(schemas) } - public def InstanceIdWithSchemaNode toInstanceIdentifier(String restconfInstance) { + def InstanceIdWithSchemaNode toInstanceIdentifier(String restconfInstance) { + return restconfInstance.toIdentifier(false) + } + + def InstanceIdWithSchemaNode toMountPointIdentifier(String restconfInstance) { + return restconfInstance.toIdentifier(true) + } + + private def InstanceIdWithSchemaNode toIdentifier(String restconfInstance, boolean toMountPointIdentifier) { checkPreconditions - val pathArgs = restconfInstance.split("/"); + val pathArgs = Lists.newArrayList(Splitter.on("/").split(restconfInstance)) + pathArgs.omitFirstAndLastEmptyString if (pathArgs.empty) { return null; } - if (pathArgs.head.empty) { - pathArgs.remove(0) - } val startModule = pathArgs.head.toModuleName(); if (startModule === null) { throw new ResponseException(BAD_REQUEST, "First node in URI has to be in format \"moduleName:nodeName\"") } - val iiWithSchemaNode = collectPathArguments(InstanceIdentifier.builder(), pathArgs, - globalSchema.getLatestModule(startModule), null); + var InstanceIdWithSchemaNode iiWithSchemaNode = null; + if (toMountPointIdentifier) { + iiWithSchemaNode = collectPathArguments(InstanceIdentifier.builder(), pathArgs, + globalSchema.getLatestModule(startModule), null, true); + } else { + iiWithSchemaNode = collectPathArguments(InstanceIdentifier.builder(), pathArgs, + globalSchema.getLatestModule(startModule), null, false); + } if (iiWithSchemaNode === null) { throw new ResponseException(BAD_REQUEST, "URI has bad format") } return iiWithSchemaNode } + private def omitFirstAndLastEmptyString(List list) { + if (list.empty) { + return list; + } + if (list.head.empty) { + list.remove(0) + } + if (list.empty) { + return list; + } + if (list.last.empty) { + list.remove(list.indexOf(list.last)) + } + return list; + } + private def getLatestModule(SchemaContext schema, String moduleName) { checkArgument(schema !== null); checkArgument(moduleName !== null && !moduleName.empty) @@ -143,31 +180,63 @@ class ControllerContext implements SchemaServiceListener { return moduleSchemas?.filterLatestModule } + def findModuleByNameAndRevision(QName module) { + checkPreconditions + checkArgument(module !== null && module.localName !== null && module.revision !== null) + return globalSchema.findModuleByName(module.localName, module.revision) + } + + def findModuleByNameAndRevision(MountInstance mountPoint, QName module) { + checkPreconditions + checkArgument(module !== null && module.localName !== null && module.revision !== null && mountPoint !== null) + return mountPoint.schemaContext?.findModuleByName(module.localName, module.revision) + } + + def getDataNodeContainerFor(InstanceIdentifier path) { + checkPreconditions + val elements = path.path; + val startQName = elements.head.nodeType; + val initialModule = globalSchema.findModuleByNamespaceAndRevision(startQName.namespace, startQName.revision) + var node = initialModule as DataNodeContainer; + for (element : elements) { + val potentialNode = node.childByQName(element.nodeType); + if (potentialNode === null || !potentialNode.listOrContainer) { + return null + } + node = potentialNode as DataNodeContainer + } + return node + } + def String toFullRestconfIdentifier(InstanceIdentifier path) { checkPreconditions val elements = path.path; val ret = new StringBuilder(); - val startQName = elements.get(0).nodeType; + val startQName = elements.head.nodeType; val initialModule = globalSchema.findModuleByNamespaceAndRevision(startQName.namespace, startQName.revision) - var node = initialModule as DataSchemaNode; + var node = initialModule as DataNodeContainer; for (element : elements) { - node = node.childByQName(element.nodeType); - ret.append(element.toRestconfIdentifier(node)); + val potentialNode = node.childByQName(element.nodeType); + if (!potentialNode.listOrContainer) { + return null + } + node = potentialNode as DataNodeContainer + ret.append(element.convertToRestconfIdentifier(node)); } return ret.toString } - private def dispatch CharSequence toRestconfIdentifier(NodeIdentifier argument, DataSchemaNode node) { + private def dispatch CharSequence convertToRestconfIdentifier(NodeIdentifier argument, ContainerSchemaNode node) { '''/«argument.nodeType.toRestconfIdentifier()»''' } - private def dispatch CharSequence toRestconfIdentifier(NodeIdentifierWithPredicates argument, ListSchemaNode node) { + private def dispatch CharSequence convertToRestconfIdentifier(NodeIdentifierWithPredicates argument, ListSchemaNode node) { val nodeIdentifier = argument.nodeType.toRestconfIdentifier(); val keyValues = argument.keyValues; return '''/«nodeIdentifier»/«FOR key : node.keyDefinition SEPARATOR "/"»«keyValues.get(key).toUriString»«ENDFOR»''' } - private def dispatch CharSequence toRestconfIdentifier(PathArgument argument, DataSchemaNode node) { + private def dispatch CharSequence convertToRestconfIdentifier(PathArgument argument, DataNodeContainer node) { throw new IllegalArgumentException("Conversion of generic path argument is not supported"); } @@ -204,18 +273,35 @@ class ControllerContext implements SchemaServiceListener { return module?.namespace } + def getAllModules(MountInstance mountPoint) { + checkPreconditions + return mountPoint?.schemaContext?.modules + } + + def getAllModules() { + checkPreconditions + return globalSchema.modules + } + def CharSequence toRestconfIdentifier(QName qname) { checkPreconditions var module = uriToModuleName.get(qname.namespace) if (module === null) { val moduleSchema = globalSchema.findModuleByNamespaceAndRevision(qname.namespace, qname.revision); - if(moduleSchema === null) throw new IllegalArgumentException() + if(moduleSchema === null) return null uriToModuleName.put(qname.namespace, moduleSchema.name) module = moduleSchema.name; } return '''«module»:«qname.localName»'''; } + def CharSequence toRestconfIdentifier(MountInstance mountPoint, QName qname) { + val moduleSchema = mountPoint?.schemaContext.findModuleByNamespaceAndRevision(qname.namespace, qname.revision); + if(moduleSchema === null) return null + val module = moduleSchema.name; + return '''«module»:«qname.localName»'''; + } + private static dispatch def DataSchemaNode childByQName(ChoiceNode container, QName name) { for (caze : container.cases) { val ret = caze.childByQName(name) @@ -239,6 +325,10 @@ class ControllerContext implements SchemaServiceListener { return container.dataNodeChildByQName(name); } + private static dispatch def DataSchemaNode childByQName(Module container, QName name) { + return container.dataNodeChildByQName(name); + } + private static dispatch def DataSchemaNode childByQName(DataSchemaNode container, QName name) { return null; } @@ -267,7 +357,7 @@ class ControllerContext implements SchemaServiceListener { } private def InstanceIdWithSchemaNode collectPathArguments(InstanceIdentifierBuilder builder, List strings, - DataNodeContainer parentNode, MountInstance mountPoint) { + DataNodeContainer parentNode, MountInstance mountPoint, boolean returnJustMountPoint) { checkNotNull(strings) if (parentNode === null) { return null; @@ -304,6 +394,10 @@ class ControllerContext implements SchemaServiceListener { throw new ResponseException(BAD_REQUEST, "Mount point does not contain any schema with modules.") } + if (returnJustMountPoint) { + return new InstanceIdWithSchemaNode(InstanceIdentifier.builder().toInstance, mountPointSchema, mount) + } + if (strings.size == 1) { // any data node is not behind mount point return new InstanceIdWithSchemaNode(InstanceIdentifier.builder().toInstance, mountPointSchema, mount) } @@ -321,7 +415,7 @@ class ControllerContext implements SchemaServiceListener { } return collectPathArguments(InstanceIdentifier.builder(), strings.subList(1, strings.size), - moduleBehindMountPoint, mount); + moduleBehindMountPoint, mount, returnJustMountPoint); } var Module module = null; @@ -361,7 +455,7 @@ class ControllerContext implements SchemaServiceListener { } } - if (!(targetNode instanceof ListSchemaNode) && !(targetNode instanceof ContainerSchemaNode)) { + if (!targetNode.isListOrContainer) { throw new ResponseException(BAD_REQUEST,"URI has bad format. Node \"" + strings.head + "\" must be Container or List yang type.") } // Number of consumed elements @@ -398,7 +492,7 @@ class ControllerContext implements SchemaServiceListener { } if (targetNode instanceof DataNodeContainer) { val remaining = strings.subList(consumed, strings.length); - val result = builder.collectPathArguments(remaining, targetNode as DataNodeContainer, mountPoint); + val result = builder.collectPathArguments(remaining, targetNode as DataNodeContainer, mountPoint, returnJustMountPoint); return result } @@ -484,14 +578,24 @@ class ControllerContext implements SchemaServiceListener { private def QName toQName(String name) { val module = name.toModuleName; val node = name.toNodeName; - val namespace = FluentIterable.from(globalSchema.modules.sort[o1,o2 | o1.revision.compareTo(o2.revision)]) // + val namespace = FluentIterable.from(globalSchema.modules.sort[o1,o2 | o1.revision.compareTo(o2.revision)]) .transform[QName.create(namespace,revision,it.name)].findFirst[module == localName] - ; - return QName.create(namespace,node); + if (namespace === null) { + return null + } + return QName.create(namespace, node); + } + + private def boolean isListOrContainer(DataSchemaNode node) { + return ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) } def getRpcDefinition(String name) { - return qnameToRpc.get(name.toQName) + val validName = name.toQName + if (validName === null) { + return null + } + return qnameToRpc.get(validName) } override onGlobalContextUpdated(SchemaContext context) { diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java index c601414a61..f7f70e8d87 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import java.net.URI; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/IdentityValuesDTO.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/IdentityValuesDTO.java index 5fd36cb196..4fb75141d5 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/IdentityValuesDTO.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/IdentityValuesDTO.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import java.util.ArrayList; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java index 1c958b901b..68135dea95 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import org.opendaylight.controller.sal.core.api.mount.MountInstance; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NodeWrapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NodeWrapper.java index 811e534b4a..f9bd7d7aaa 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NodeWrapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NodeWrapper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import java.net.URI; @@ -20,4 +27,4 @@ public interface NodeWrapper> { void setNamespace(URI namespace); String getLocalName(); -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ResponseException.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ResponseException.java index e2edd5dcb2..b08126b5de 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ResponseException.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ResponseException.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import javax.ws.rs.WebApplicationException; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java index 096425d0a6..d6b530039e 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import java.net.URI; @@ -205,6 +212,11 @@ public class RestCodec { List predicates = keyValuesToPredicateList(((NodeIdentifierWithPredicates) pathArgument) .getKeyValues()); identityValue.setPredicates(predicates); + } else if (pathArgument instanceof NodeWithValue && identityValue != null) { + List predicates = new ArrayList<>(); + String value = String.valueOf(((NodeWithValue) pathArgument).getValue()); + predicates.add(new Predicate(null, value)); + identityValue.setPredicates(predicates); } identityValuesDTO.add(identityValue); } diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend index db2342a35d..cfbce736fb 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend @@ -1,14 +1,29 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl import com.google.common.base.Preconditions +import com.google.common.base.Splitter +import com.google.common.collect.Lists import java.net.URI +import java.text.ParseException +import java.text.SimpleDateFormat import java.util.ArrayList import java.util.HashMap import java.util.List +import java.util.Set import javax.ws.rs.core.Response +import javax.ws.rs.core.UriInfo import org.opendaylight.controller.md.sal.common.api.TransactionStatus import org.opendaylight.controller.sal.core.api.mount.MountInstance import org.opendaylight.controller.sal.rest.api.RestconfService +import org.opendaylight.controller.sal.streams.listeners.Notificator +import org.opendaylight.controller.sal.streams.websockets.WebSocketServer import org.opendaylight.yangtools.yang.common.QName import org.opendaylight.yangtools.yang.common.RpcResult import org.opendaylight.yangtools.yang.data.api.CompositeNode @@ -27,6 +42,9 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition import org.opendaylight.yangtools.yang.model.api.SchemaContext import org.opendaylight.yangtools.yang.model.api.TypeDefinition import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition +import org.opendaylight.yangtools.yang.model.util.EmptyType +import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder +import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder import static javax.ws.rs.core.Response.Status.* @@ -34,6 +52,17 @@ class RestconfImpl implements RestconfService { val static RestconfImpl INSTANCE = new RestconfImpl val static MOUNT_POINT_MODULE_NAME = "ietf-netconf" + val static REVISION_FORMAT = new SimpleDateFormat("yyyy-MM-dd") + val static RESTCONF_MODULE_DRAFT02_REVISION = "2013-10-19" + val static RESTCONF_MODULE_DRAFT02_NAME = "ietf-restconf" + val static RESTCONF_MODULE_DRAFT02_NAMESPACE = "urn:ietf:params:xml:ns:yang:ietf-restconf" + val static RESTCONF_MODULE_DRAFT02_RESTCONF_GROUPING_SCHEMA_NODE = "restconf" + val static RESTCONF_MODULE_DRAFT02_RESTCONF_CONTAINER_SCHEMA_NODE = "restconf" + val static RESTCONF_MODULE_DRAFT02_MODULES_CONTAINER_SCHEMA_NODE = "modules" + val static RESTCONF_MODULE_DRAFT02_MODULE_LIST_SCHEMA_NODE = "module" + val static RESTCONF_MODULE_DRAFT02_OPERATIONS_CONTAINER_SCHEMA_NODE = "operations" + val static SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote" + val static SAL_REMOTE_RPC_SUBSRCIBE = "create-data-change-event-subscription" @Property BrokerFacade broker @@ -51,14 +80,149 @@ class RestconfImpl implements RestconfService { return INSTANCE } - override readAllData() { + override getModules() { + val restconfModule = getRestconfModule() + val List> modulesAsData = new ArrayList + val moduleSchemaNode = restconfModule.getSchemaNode(RESTCONF_MODULE_DRAFT02_MODULE_LIST_SCHEMA_NODE) + for (module : allModules) { + modulesAsData.add(module.toModuleCompositeNode(moduleSchemaNode)) + } + val modulesSchemaNode = restconfModule.getSchemaNode(RESTCONF_MODULE_DRAFT02_MODULES_CONTAINER_SCHEMA_NODE) + val modulesNode = NodeFactory.createImmutableCompositeNode(modulesSchemaNode.QName, null, modulesAsData) + return new StructuredData(modulesNode, modulesSchemaNode, null) + } + + override getModules(String identifier) { + var Set modules = null + var MountInstance mountPoint = null + if (identifier.contains(ControllerContext.MOUNT)) { + mountPoint = identifier.toMountPointIdentifier.mountPoint + modules = mountPoint.allModules + } else { + throw new ResponseException(BAD_REQUEST, "URI has bad format. If modules behind mount point should be showed, URI has to end with " + ControllerContext.MOUNT) + } + val List> modulesAsData = new ArrayList + val moduleSchemaNode = restconfModule.getSchemaNode(RESTCONF_MODULE_DRAFT02_MODULE_LIST_SCHEMA_NODE) + for (module : modules) { + modulesAsData.add(module.toModuleCompositeNode(moduleSchemaNode)) + } + val modulesSchemaNode = restconfModule.getSchemaNode(RESTCONF_MODULE_DRAFT02_MODULES_CONTAINER_SCHEMA_NODE) + val modulesNode = NodeFactory.createImmutableCompositeNode(modulesSchemaNode.QName, null, modulesAsData) + return new StructuredData(modulesNode, modulesSchemaNode, mountPoint) + } - // return broker.readOperationalData("".toInstanceIdentifier.getInstanceIdentifier); - throw new UnsupportedOperationException("Reading all data is currently not supported.") + override getModule(String identifier) { + val moduleNameAndRevision = identifier.moduleNameAndRevision + var Module module = null + var MountInstance mountPoint = null + if (identifier.contains(ControllerContext.MOUNT)) { + mountPoint = identifier.toMountPointIdentifier.mountPoint + module = mountPoint.findModuleByNameAndRevision(moduleNameAndRevision) + } else { + module = findModuleByNameAndRevision(moduleNameAndRevision) + } + if (module === null) { + throw new ResponseException(BAD_REQUEST, + "Module with name '" + moduleNameAndRevision.localName + "' and revision '" + + moduleNameAndRevision.revision + "' was not found.") + } + val moduleSchemaNode = restconfModule.getSchemaNode(RESTCONF_MODULE_DRAFT02_MODULE_LIST_SCHEMA_NODE) + val moduleNode = module.toModuleCompositeNode(moduleSchemaNode) + return new StructuredData(moduleNode, moduleSchemaNode, mountPoint) } - override getModules() { - throw new UnsupportedOperationException("TODO: auto-generated method stub") + override getOperations() { + return operationsFromModulesToStructuredData(allModules,null) + } + + override getOperations(String identifier) { + var Set modules = null + var MountInstance mountPoint = null + if (identifier.contains(ControllerContext.MOUNT)) { + mountPoint = identifier.toMountPointIdentifier.mountPoint + modules = mountPoint.allModules + } else { + throw new ResponseException(BAD_REQUEST, "URI has bad format. If operations behind mount point should be showed, URI has to end with " + ControllerContext.MOUNT) + } + return operationsFromModulesToStructuredData(modules,mountPoint) + } + + private def StructuredData operationsFromModulesToStructuredData(Set modules,MountInstance mountPoint) { + val List> operationsAsData = new ArrayList + val operationsSchemaNode = restconfModule.getSchemaNode(RESTCONF_MODULE_DRAFT02_OPERATIONS_CONTAINER_SCHEMA_NODE) + val fakeOperationsSchemaNode = new ContainerSchemaNodeBuilder(RESTCONF_MODULE_DRAFT02_NAME, 0, operationsSchemaNode.QName, operationsSchemaNode.path) + for (module : modules) { + for (rpc : module.rpcs) { + operationsAsData.add(NodeFactory.createImmutableSimpleNode(rpc.QName, null, null)) + val fakeRpcSchemaNode = new LeafSchemaNodeBuilder(module.name, 0, rpc.QName, null) + fakeRpcSchemaNode.setAugmenting(true) + fakeRpcSchemaNode.setType(EmptyType.instance) + fakeOperationsSchemaNode.addChildNode(fakeRpcSchemaNode.build) + } + } + val operationsNode = NodeFactory.createImmutableCompositeNode(operationsSchemaNode.QName, null, operationsAsData) + return new StructuredData(operationsNode, fakeOperationsSchemaNode.build, mountPoint) + } + + private def Module getRestconfModule() { + val restconfModule = findModuleByNameAndRevision( + QName.create(RESTCONF_MODULE_DRAFT02_NAMESPACE, RESTCONF_MODULE_DRAFT02_REVISION, + RESTCONF_MODULE_DRAFT02_NAME)) + if (restconfModule === null) { + throw new ResponseException(INTERNAL_SERVER_ERROR, "Restconf module was not found.") + } + return restconfModule + } + + private def QName getModuleNameAndRevision(String identifier) { + val indexOfMountPointFirstLetter = identifier.indexOf(ControllerContext.MOUNT) + var moduleNameAndRevision = ""; + if (indexOfMountPointFirstLetter !== -1) { // module and revision is behind mount point string + moduleNameAndRevision = identifier.substring(indexOfMountPointFirstLetter + ControllerContext.MOUNT.length) + } else ( + moduleNameAndRevision = identifier + ) + val pathArgs = Lists.newArrayList(Splitter.on("/").omitEmptyStrings.split(moduleNameAndRevision)) + if (pathArgs.length < 2) { + throw new ResponseException(BAD_REQUEST, + "URI has bad format. End of URI should be in format 'moduleName/yyyy-MM-dd'") + } + try { + val moduleName = pathArgs.head + val moduleRevision = REVISION_FORMAT.parse(pathArgs.get(1)) + return QName.create(null, moduleRevision, moduleName) + } catch(ParseException e) { + throw new ResponseException(BAD_REQUEST, "URI has bad format. It should be 'moduleName/yyyy-MM-dd'") + } + } + + private def CompositeNode toModuleCompositeNode(Module module, DataSchemaNode moduleSchemaNode) { + val List> moduleNodeValues = new ArrayList + val nameSchemaNode = (moduleSchemaNode as DataNodeContainer).findInstanceDataChildrenByName("name").head + moduleNodeValues.add(NodeFactory.createImmutableSimpleNode(nameSchemaNode.QName, null, module.name)) + val revisionSchemaNode = (moduleSchemaNode as DataNodeContainer).findInstanceDataChildrenByName("revision").head + moduleNodeValues.add(NodeFactory.createImmutableSimpleNode(revisionSchemaNode.QName, null, REVISION_FORMAT.format(module.revision))) + val namespaceSchemaNode = (moduleSchemaNode as DataNodeContainer).findInstanceDataChildrenByName("namespace").head + moduleNodeValues.add(NodeFactory.createImmutableSimpleNode(namespaceSchemaNode.QName, null, module.namespace.toString)) + val featureSchemaNode = (moduleSchemaNode as DataNodeContainer).findInstanceDataChildrenByName("feature").head + for (feature : module.features) { + moduleNodeValues.add(NodeFactory.createImmutableSimpleNode(featureSchemaNode.QName, null, feature.QName.localName)) + } + return NodeFactory.createImmutableCompositeNode(moduleSchemaNode.QName, null, moduleNodeValues) + } + + private def DataSchemaNode getSchemaNode(Module restconfModule, String schemaNodeName) { + val restconfGrouping = restconfModule.groupings.filter[g|g.QName.localName == RESTCONF_MODULE_DRAFT02_RESTCONF_GROUPING_SCHEMA_NODE].head + val restconfContainer = restconfGrouping.findInstanceDataChildrenByName(RESTCONF_MODULE_DRAFT02_RESTCONF_CONTAINER_SCHEMA_NODE).head + if (schemaNodeName == RESTCONF_MODULE_DRAFT02_OPERATIONS_CONTAINER_SCHEMA_NODE) { + return (restconfContainer as DataNodeContainer).findInstanceDataChildrenByName(RESTCONF_MODULE_DRAFT02_OPERATIONS_CONTAINER_SCHEMA_NODE).head + } else if (schemaNodeName == RESTCONF_MODULE_DRAFT02_MODULES_CONTAINER_SCHEMA_NODE) { + return (restconfContainer as DataNodeContainer).findInstanceDataChildrenByName(RESTCONF_MODULE_DRAFT02_MODULES_CONTAINER_SCHEMA_NODE).head + } else if (schemaNodeName == RESTCONF_MODULE_DRAFT02_MODULE_LIST_SCHEMA_NODE) { + val modules = (restconfContainer as DataNodeContainer).findInstanceDataChildrenByName(RESTCONF_MODULE_DRAFT02_MODULES_CONTAINER_SCHEMA_NODE).head + return (modules as DataNodeContainer).findInstanceDataChildrenByName(RESTCONF_MODULE_DRAFT02_MODULE_LIST_SCHEMA_NODE).head + } + return null } override getRoot() { @@ -66,10 +230,43 @@ class RestconfImpl implements RestconfService { } override invokeRpc(String identifier, CompositeNode payload) { + val rpc = identifier.rpcDefinition + if (rpc === null) { + throw new ResponseException(NOT_FOUND, "RPC does not exist."); + } + if (rpc.QName.namespace.toString == SAL_REMOTE_NAMESPACE && rpc.QName.localName == SAL_REMOTE_RPC_SUBSRCIBE) { + val value = normalizeNode(payload, rpc.input, null) + val pathNode = value?.getFirstSimpleByName(QName.create(rpc.QName, "path")) + val pathValue = pathNode?.value + if (pathValue === null && !(pathValue instanceof InstanceIdentifier)) { + throw new ResponseException(INTERNAL_SERVER_ERROR, "Instance identifier was not normalized correctly."); + } + val pathIdentifier = (pathValue as InstanceIdentifier) + var String streamName = null + if (!pathIdentifier.path.nullOrEmpty) { + streamName = Notificator.createStreamNameFromUri(pathIdentifier.toFullRestconfIdentifier) + } + if (streamName.nullOrEmpty) { + throw new ResponseException(BAD_REQUEST, "Path is empty or contains data node which is not Container or List build-in type."); + } + val streamNameNode = NodeFactory.createImmutableSimpleNode(QName.create(rpc.output.QName, "stream-name"), null, streamName) + val List> output = new ArrayList + output.add(streamNameNode) + val responseData = NodeFactory.createMutableCompositeNode(rpc.output.QName, null, output, null, null) + + if (!Notificator.existListenerFor(pathIdentifier)) { + Notificator.createListener(pathIdentifier, streamName) + } + + return new StructuredData(responseData, rpc.output, null) + } return callRpc(identifier.rpcDefinition, payload) } - override invokeRpc(String identifier) { + override invokeRpc(String identifier, String noPayload) { + if (!noPayload.nullOrEmpty) { + throw new ResponseException(UNSUPPORTED_MEDIA_TYPE, "Content-Type contains unsupported Media Type."); + } return callRpc(identifier.rpcDefinition, null) } @@ -96,17 +293,6 @@ class RestconfImpl implements RestconfService { return new StructuredData(rpcResult.result, rpc.output, null) } - override readData(String identifier) { - val iiWithData = identifier.toInstanceIdentifier - var CompositeNode data = null; - if (iiWithData.mountPoint !== null) { - data = broker.readOperationalDataBehindMountPoint(iiWithData.mountPoint, iiWithData.instanceIdentifier) - } else { - data = broker.readOperationalData(iiWithData.getInstanceIdentifier); - } - return new StructuredData(data, iiWithData.schemaNode, iiWithData.mountPoint) - } - override readConfigurationData(String identifier) { val iiWithData = identifier.toInstanceIdentifier var CompositeNode data = null; @@ -129,10 +315,6 @@ class RestconfImpl implements RestconfService { return new StructuredData(data, iiWithData.schemaNode, iiWithData.mountPoint) } - override updateConfigurationDataLegacy(String identifier, CompositeNode payload) { - updateConfigurationData(identifier, payload); - } - override updateConfigurationData(String identifier, CompositeNode payload) { val iiWithData = identifier.toInstanceIdentifier val value = normalizeNode(payload, iiWithData.schemaNode, iiWithData.mountPoint) @@ -149,10 +331,6 @@ class RestconfImpl implements RestconfService { } } - override createConfigurationDataLegacy(String identifier, CompositeNode payload) { - createConfigurationData(identifier, payload); - } - override createConfigurationData(String identifier, CompositeNode payload) { if (payload.namespace === null) { throw new ResponseException(BAD_REQUEST, @@ -239,6 +417,21 @@ class RestconfImpl implements RestconfService { } } + override subscribeToStream(String identifier, UriInfo uriInfo) { + val streamName = Notificator.createStreamNameFromUri(identifier) + if (streamName.nullOrEmpty) { + throw new ResponseException(BAD_REQUEST, "Stream name is empty.") + } + val listener = Notificator.getListenerFor(streamName); + if (listener === null) { + throw new ResponseException(BAD_REQUEST, "Stream was not found.") + } + broker.registerToListenDataChanges(listener) + val uriBuilder = uriInfo.getAbsolutePathBuilder() + val uriToWebsocketServer = uriBuilder.port(WebSocketServer.PORT).replacePath(streamName).build() + return Response.status(OK).location(uriToWebsocketServer).build + } + private def dispatch URI namespace(CompositeNode data) { return data.nodeType.namespace } diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java index b0a215f90b..4d22bfa73a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import java.net.URI; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/StructuredData.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/StructuredData.java index 38853c47d3..8c344a79da 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/StructuredData.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/StructuredData.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl; import org.opendaylight.controller.sal.core.api.mount.MountInstance; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/package-info.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/package-info.java index 5e9c17439b..6008b1d3c7 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/package-info.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/package-info.java @@ -1,5 +1,8 @@ -/** - * @author ttkacik +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.sal.restconf.impl; \ No newline at end of file +package org.opendaylight.controller.sal.restconf.impl; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java new file mode 100644 index 0000000000..fdd6ba0317 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java @@ -0,0 +1,406 @@ +package org.opendaylight.controller.sal.streams.listeners; + +import io.netty.channel.Channel; +import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; +import io.netty.util.internal.ConcurrentSet; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.Executors; + +import javax.activation.UnsupportedDataTypeException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent; +import org.opendaylight.controller.sal.core.api.data.DataChangeListener; +import org.opendaylight.controller.sal.rest.impl.XmlMapper; +import org.opendaylight.controller.sal.restconf.impl.ControllerContext; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.google.common.base.Preconditions; +import com.google.common.eventbus.AsyncEventBus; +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; + +public class ListenerAdapter implements DataChangeListener { + + private static final Logger logger = LoggerFactory.getLogger(ListenerAdapter.class); + private final XmlMapper xmlMapper = new XmlMapper(); + private final SimpleDateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ"); + + private final InstanceIdentifier path; + private ListenerRegistration registration; + private final String streamName; + private Set subscribers = new ConcurrentSet<>(); + private final EventBus eventBus; + private final EventBusChangeRecorder eventBusChangeRecorder; + + ListenerAdapter(InstanceIdentifier path, String streamName) { + Preconditions.checkNotNull(path); + Preconditions.checkArgument(streamName != null && !streamName.isEmpty()); + this.path = path; + this.streamName = streamName; + eventBus = new AsyncEventBus(Executors.newSingleThreadExecutor()); + eventBusChangeRecorder = new EventBusChangeRecorder(); + eventBus.register(eventBusChangeRecorder); + } + + @Override + public void onDataChanged(DataChangeEvent change) { + if (!change.getCreatedConfigurationData().isEmpty() || !change.getCreatedOperationalData().isEmpty() + || !change.getUpdatedConfigurationData().isEmpty() || !change.getUpdatedOperationalData().isEmpty() + || !change.getRemovedConfigurationData().isEmpty() || !change.getRemovedOperationalData().isEmpty()) { + String xml = prepareXmlFrom(change); + Event event = new Event(EventType.NOTIFY); + event.setData(xml); + eventBus.post(event); + } + } + + private final class EventBusChangeRecorder { + @Subscribe public void recordCustomerChange(Event event) { + if (event.getType() == EventType.REGISTER) { + Channel subscriber = event.getSubscriber(); + if (!subscribers.contains(subscriber)) { + subscribers.add(subscriber); + } + } else if (event.getType() == EventType.DEREGISTER) { + subscribers.remove(event.getSubscriber()); + Notificator.removeListenerIfNoSubscriberExists(ListenerAdapter.this); + } else if (event.getType() == EventType.NOTIFY) { + for (Channel subscriber : subscribers) { + if (subscriber.isActive()) { + logger.debug("Data are sent to subscriber {}:", subscriber.remoteAddress()); + subscriber.writeAndFlush(new TextWebSocketFrame(event.getData())); + } else { + logger.debug("Subscriber {} is removed - channel is not active yet.", subscriber.remoteAddress()); + subscribers.remove(subscriber); + } + } + } + } + } + + private final class Event { + private final EventType type; + private Channel subscriber; + private String data; + + public Event(EventType type) { + this.type = type; + } + + public Channel getSubscriber() { + return subscriber; + } + + public void setSubscriber(Channel subscriber) { + this.subscriber = subscriber; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public EventType getType() { + return type; + } + } + + private enum EventType { + REGISTER, + DEREGISTER, + NOTIFY; + } + + private String prepareXmlFrom(DataChangeEvent change) { + Document doc = createDocument(); + Element notificationElement = doc.createElementNS("urn:ietf:params:xml:ns:netconf:notification:1.0", + "notification"); + doc.appendChild(notificationElement); + + Element eventTimeElement = doc.createElement("eventTime"); + eventTimeElement.setTextContent(toRFC3339(new Date())); + notificationElement.appendChild(eventTimeElement); + + Element dataChangedNotificationEventElement = doc.createElementNS( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote", "data-changed-notification"); + addValuesToDataChangedNotificationEventElement(doc, dataChangedNotificationEventElement, change); + notificationElement.appendChild(dataChangedNotificationEventElement); + + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + transformer.transform(new DOMSource(doc), new StreamResult(new OutputStreamWriter(out, "UTF-8"))); + byte[] charData = out.toByteArray(); + return new String(charData, "UTF-8"); + } catch (TransformerException | UnsupportedEncodingException e) { + String msg = "Error during transformation of Document into String"; + logger.error(msg, e); + return msg; + } + } + + private String toRFC3339(Date d) { + return rfc3339.format(d).replaceAll("(\\d\\d)(\\d\\d)$", "$1:$2"); + } + + private Document createDocument() { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + Document doc = null; + try { + DocumentBuilder bob = dbf.newDocumentBuilder(); + doc = bob.newDocument(); + } catch (ParserConfigurationException e) { + return null; + } + return doc; + } + + private void addValuesToDataChangedNotificationEventElement(Document doc, + Element dataChangedNotificationEventElement, DataChangeEvent change) { + addValuesFromDataToElement(doc, change.getCreatedConfigurationData(), dataChangedNotificationEventElement, Store.CONFIG, Operation.CREATED); + addValuesFromDataToElement(doc, change.getCreatedOperationalData(), dataChangedNotificationEventElement, Store.OPERATION, Operation.CREATED); + if (change.getCreatedConfigurationData().isEmpty()) { + addValuesFromDataToElement(doc, change.getUpdatedConfigurationData(), dataChangedNotificationEventElement, Store.CONFIG, Operation.UPDATED); + } + if (change.getCreatedOperationalData().isEmpty()) { + addValuesFromDataToElement(doc, change.getUpdatedOperationalData(), dataChangedNotificationEventElement, Store.OPERATION, Operation.UPDATED); + } + addValuesFromDataToElement(doc, change.getRemovedConfigurationData(), dataChangedNotificationEventElement, Store.CONFIG, Operation.DELETED); + addValuesFromDataToElement(doc, change.getRemovedOperationalData(), dataChangedNotificationEventElement, Store.OPERATION, Operation.DELETED); + } + + private void addValuesFromDataToElement(Document doc, Set data, Element element, Store store, + Operation operation) { + if (data == null || data.isEmpty()) { + return; + } + for (InstanceIdentifier path : data) { + Node node = createDataChangeEventElement(doc, path, null, store, operation); + element.appendChild(node); + } + } + + private void addValuesFromDataToElement(Document doc, Map data, Element element, Store store, + Operation operation) { + if (data == null || data.isEmpty()) { + return; + } + for (Entry entry : data.entrySet()) { + Node node = createDataChangeEventElement(doc, entry.getKey(), entry.getValue(), store, operation); + element.appendChild(node); + } + } + + private Node createDataChangeEventElement(Document doc, InstanceIdentifier path, CompositeNode data, Store store, + Operation operation) { + Element dataChangeEventElement = doc.createElement("data-change-event"); + + Element pathElement = doc.createElement("path"); + addPathAsValueToElement(path, pathElement); + dataChangeEventElement.appendChild(pathElement); + + Element storeElement = doc.createElement("store"); + storeElement.setTextContent(store.value); + dataChangeEventElement.appendChild(storeElement); + + Element operationElement = doc.createElement("operation"); + operationElement.setTextContent(operation.value); + dataChangeEventElement.appendChild(operationElement); + + if (data != null) { + Element dataElement = doc.createElement("data"); + Node dataAnyXml = translateToXml(path, data); + Node adoptedNode = doc.adoptNode(dataAnyXml); + dataElement.appendChild(adoptedNode); + dataChangeEventElement.appendChild(dataElement); + } + + return dataChangeEventElement; + } + + private Node translateToXml(InstanceIdentifier path, CompositeNode data) { + DataNodeContainer schemaNode = ControllerContext.getInstance().getDataNodeContainerFor(path); + if (schemaNode == null) { + logger.info("Path '{}' contains node with unsupported type (supported type is Container or List) or some node was not found.", path); + return null; + } + try { + Document xml = xmlMapper.write(data, schemaNode); + return xml.getFirstChild(); + } catch (UnsupportedDataTypeException e) { + logger.error("Error occured during translation of notification to XML.", e); + return null; + } + } + + private void addPathAsValueToElement(InstanceIdentifier path, Element element) { + // Map< key = namespace, value = prefix> + Map prefixes = new HashMap<>(); + InstanceIdentifier instanceIdentifier = path; + StringBuilder textContent = new StringBuilder(); + for (PathArgument pathArgument : instanceIdentifier.getPath()) { + textContent.append("/"); + writeIdentifierWithNamespacePrefix(element, textContent, pathArgument.getNodeType(), prefixes); + if (pathArgument instanceof NodeIdentifierWithPredicates) { + Map predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues(); + for (QName keyValue : predicates.keySet()) { + String predicateValue = String.valueOf(predicates.get(keyValue)); + textContent.append("["); + writeIdentifierWithNamespacePrefix(element, textContent, keyValue, prefixes); + textContent.append("='"); + textContent.append(predicateValue); + textContent.append("'"); + textContent.append("]"); + } + } else if (pathArgument instanceof NodeWithValue) { + textContent.append("[.='"); + textContent.append(((NodeWithValue)pathArgument).getValue()); + textContent.append("'"); + textContent.append("]"); + } + } + element.setTextContent(textContent.toString()); + } + + private static void writeIdentifierWithNamespacePrefix(Element element, StringBuilder textContent, QName qName, + Map prefixes) { + String namespace = qName.getNamespace().toString(); + String prefix = prefixes.get(namespace); + if (prefix == null) { + prefix = qName.getPrefix(); + if (prefix == null || prefix.isEmpty() || prefixes.containsValue(prefix)) { + prefix = generateNewPrefix(prefixes.values()); + } + } + + element.setAttribute("xmlns:" + prefix, namespace.toString()); + textContent.append(prefix); + prefixes.put(namespace, prefix); + + textContent.append(":"); + textContent.append(qName.getLocalName()); + } + + private static String generateNewPrefix(Collection prefixes) { + StringBuilder result = null; + Random random = new Random(); + do { + result = new StringBuilder(); + for (int i = 0; i < 4; i++) { + int randomNumber = 0x61 + (Math.abs(random.nextInt()) % 26); + result.append(Character.toChars(randomNumber)); + } + } while (prefixes.contains(result.toString())); + + return result.toString(); + } + + public InstanceIdentifier getPath() { + return path; + } + + public void setRegistration(ListenerRegistration registration) { + this.registration = registration; + } + + public String getStreamName() { + return streamName; + } + + public void close() throws Exception { + subscribers = new ConcurrentSet<>(); + registration.close(); + registration = null; + eventBus.unregister(eventBusChangeRecorder); + } + + public boolean isListening() { + return registration == null ? false : true; + } + + public void addSubscriber(Channel subscriber) { + if (!subscriber.isActive()) { + logger.debug("Channel is not active between websocket server and subscriber {}" + + subscriber.remoteAddress()); + } + Event event = new Event(EventType.REGISTER); + event.setSubscriber(subscriber); + eventBus.post(event); + } + + public void removeSubscriber(Channel subscriber) { + logger.debug("Subscriber {} is removed.", subscriber.remoteAddress()); + Event event = new Event(EventType.DEREGISTER); + event.setSubscriber(subscriber); + eventBus.post(event); + } + + public boolean hasSubscribers() { + return !subscribers.isEmpty(); + } + + private static enum Store { + CONFIG("config"), + OPERATION("operation"); + + private final String value; + + private Store(String value) { + this.value = value; + } + } + + private static enum Operation { + CREATED("created"), + UPDATED("updated"), + DELETED("deleted"); + + private final String value; + + private Operation(String value) { + this.value = value; + } + } + +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java new file mode 100644 index 0000000000..d1cb25861a --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java @@ -0,0 +1,100 @@ +package org.opendaylight.controller.sal.streams.listeners; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; + +public class Notificator { + + private static Map listenersByStreamName = new ConcurrentHashMap<>(); + private static Map listenersByInstanceIdentifier = new ConcurrentHashMap<>(); + private static final Lock lock = new ReentrantLock(); + + private Notificator() { + } + + public static ListenerAdapter getListenerFor(String streamName) { + return listenersByStreamName.get(streamName); + } + + public static ListenerAdapter getListenerFor(InstanceIdentifier path) { + return listenersByInstanceIdentifier.get(path); + } + + public static boolean existListenerFor(InstanceIdentifier path) { + return listenersByInstanceIdentifier.containsKey(path); + } + + public static ListenerAdapter createListener(InstanceIdentifier path, String streamName) { + ListenerAdapter listener = new ListenerAdapter(path, streamName); + try { + lock.lock(); + listenersByInstanceIdentifier.put(path, listener); + listenersByStreamName.put(streamName, listener); + } finally { + lock.unlock(); + } + return listener; + } + + public static void removeListener(InstanceIdentifier path) { + ListenerAdapter listener = listenersByInstanceIdentifier.get(path); + deleteListener(listener); + } + + public static String createStreamNameFromUri(String uri) { + if (uri == null) { + return null; + } + String result = uri; + if (result.startsWith("/")) { + result = result.substring(1); + } + if (result.endsWith("/")) { + result = result.substring(0, result.length()); + } + return result; + } + + public static void removeAllListeners() { + for (ListenerAdapter listener : listenersByInstanceIdentifier.values()) { + try { + listener.close(); + } catch (Exception e) { + } + } + try { + lock.lock(); + listenersByStreamName = new ConcurrentHashMap<>(); + listenersByInstanceIdentifier = new ConcurrentHashMap<>(); + } finally { + lock.unlock(); + } + } + + public static void removeListenerIfNoSubscriberExists(ListenerAdapter listener) { + if (!listener.hasSubscribers()) { + deleteListener(listener); + } + } + + private static void deleteListener(ListenerAdapter listener) { + if (listener != null) { + try { + listener.close(); + } catch (Exception e) { + } + try { + lock.lock(); + listenersByInstanceIdentifier.remove(listener.getPath()); + listenersByStreamName.remove(listener.getStreamName()); + } finally { + lock.unlock(); + } + } + } + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServer.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServer.java new file mode 100644 index 0000000000..142cde1400 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServer.java @@ -0,0 +1,52 @@ +package org.opendaylight.controller.sal.streams.websockets; + +import org.opendaylight.controller.sal.streams.listeners.Notificator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.nio.NioServerSocketChannel; + +public class WebSocketServer implements Runnable { + + private static final Logger logger = LoggerFactory.getLogger(WebSocketServer.class); + + public static final int PORT = 8181; + private EventLoopGroup bossGroup; + private EventLoopGroup workerGroup; + + @Override + public void run() { + bossGroup = new NioEventLoopGroup(); + workerGroup = new NioEventLoopGroup(); + try { + ServerBootstrap b = new ServerBootstrap(); + b.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .childHandler(new WebSocketServerInitializer()); + + Channel ch = b.bind(PORT).sync().channel(); + logger.info("Web socket server started at port {}.", PORT); + + ch.closeFuture().sync(); + } catch (InterruptedException e) { + // NOOP + } finally { + stop(); + } + } + + private void stop() { + Notificator.removeAllListeners(); + if (bossGroup != null) { + bossGroup.shutdownGracefully(); + } + if (workerGroup != null) { + workerGroup.shutdownGracefully(); + } + } + +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerHandler.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerHandler.java new file mode 100644 index 0000000000..618ee57aba --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerHandler.java @@ -0,0 +1,134 @@ +package org.opendaylight.controller.sal.streams.websockets; + +import static io.netty.handler.codec.http.HttpHeaders.isKeepAlive; +import static io.netty.handler.codec.http.HttpHeaders.setContentLength; +import static io.netty.handler.codec.http.HttpHeaders.Names.HOST; +import static io.netty.handler.codec.http.HttpMethod.GET; +import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; +import static io.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN; +import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR; +import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.handler.codec.http.DefaultFullHttpResponse; +import io.netty.handler.codec.http.FullHttpRequest; +import io.netty.handler.codec.http.FullHttpResponse; +import io.netty.handler.codec.http.HttpRequest; +import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; +import io.netty.handler.codec.http.websocketx.PingWebSocketFrame; +import io.netty.handler.codec.http.websocketx.PongWebSocketFrame; +import io.netty.handler.codec.http.websocketx.WebSocketFrame; +import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker; +import io.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory; +import io.netty.util.CharsetUtil; + +import java.io.IOException; + +import org.opendaylight.controller.sal.streams.listeners.ListenerAdapter; +import org.opendaylight.controller.sal.streams.listeners.Notificator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WebSocketServerHandler extends SimpleChannelInboundHandler { + + private static final Logger logger = LoggerFactory.getLogger(WebSocketServerHandler.class); + + private WebSocketServerHandshaker handshaker; + + @Override + protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { + if (msg instanceof FullHttpRequest) { + handleHttpRequest(ctx, (FullHttpRequest) msg); + } else if (msg instanceof WebSocketFrame) { + handleWebSocketFrame(ctx, (WebSocketFrame) msg); + } + } + + private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req) + throws Exception { + // Handle a bad request. + if (!req.getDecoderResult().isSuccess()) { + sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, BAD_REQUEST)); + return; + } + + // Allow only GET methods. + if (req.getMethod() != GET) { + sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, FORBIDDEN)); + return; + } + + String streamName = Notificator.createStreamNameFromUri(req.getUri()); + ListenerAdapter listener = Notificator.getListenerFor(streamName); + if (listener != null) { + listener.addSubscriber(ctx.channel()); + logger.debug("Subscriber successfully registered."); + } else { + logger.error("Listener for stream with name '{}' was not found.", streamName); + sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, INTERNAL_SERVER_ERROR)); + } + + // Handshake + WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( + getWebSocketLocation(req), null, false); + handshaker = wsFactory.newHandshaker(req); + if (handshaker == null) { + WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel()); + } else { + handshaker.handshake(ctx.channel(), req); + } + + } + + private static void sendHttpResponse(ChannelHandlerContext ctx, + HttpRequest req, FullHttpResponse res) { + // Generate an error page if response getStatus code is not OK (200). + if (res.getStatus().code() != 200) { + ByteBuf buf = Unpooled.copiedBuffer(res.getStatus().toString(), CharsetUtil.UTF_8); + res.content().writeBytes(buf); + buf.release(); + setContentLength(res, res.content().readableBytes()); + } + + // Send the response and close the connection if necessary. + ChannelFuture f = ctx.channel().writeAndFlush(res); + if (!isKeepAlive(req) || res.getStatus().code() != 200) { + f.addListener(ChannelFutureListener.CLOSE); + } + } + + private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) throws IOException { + if (frame instanceof CloseWebSocketFrame) { + handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain()); + String streamName = Notificator.createStreamNameFromUri(((CloseWebSocketFrame) frame).reasonText()); + ListenerAdapter listener = Notificator.getListenerFor(streamName); + if (listener != null) { + listener.removeSubscriber(ctx.channel()); + logger.debug("Subscriber successfully registered."); + } + Notificator.removeListenerIfNoSubscriberExists(listener); + return; + } else if (frame instanceof PingWebSocketFrame) { + ctx.channel().write(new PongWebSocketFrame(frame.content().retain())); + return; + } + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) + throws Exception { + if (cause instanceof java.nio.channels.ClosedChannelException == false) { + //cause.printStackTrace(); + } + ctx.close(); + } + + private static String getWebSocketLocation(HttpRequest req) { + return "http://" + req.headers().get(HOST) + req.getUri(); + } + +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerInitializer.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerInitializer.java new file mode 100644 index 0000000000..5eb71ef491 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerInitializer.java @@ -0,0 +1,19 @@ +package org.opendaylight.controller.sal.streams.websockets; + +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.socket.SocketChannel; +import io.netty.handler.codec.http.HttpObjectAggregator; +import io.netty.handler.codec.http.HttpServerCodec; + +public class WebSocketServerInitializer extends ChannelInitializer { + + @Override + protected void initChannel(SocketChannel ch) throws Exception { + ChannelPipeline pipeline = ch.pipeline(); + pipeline.addLast("codec-http", new HttpServerCodec()); + pipeline.addLast("aggregator", new HttpObjectAggregator(65536)); + pipeline.addLast("handler", new WebSocketServerHandler()); + } + +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/iml/varioustests/VariousTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/iml/varioustests/VariousTest.java deleted file mode 100644 index 04f2331ca3..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/iml/varioustests/VariousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opendaylight.controller.sal.restconf.iml.varioustests; - -import org.junit.Ignore; -import org.junit.Test; -import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider; -import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; -import org.w3c.dom.Document; - - -public class VariousTest { - - @Ignore - @Test - public void test() { - String[] split = "/something:dfsa/s:sda".split("/"); - System.out.println(split.length); - for (String str : split) { - System.out.println(">"+str+"<"); - } - - } - - @Test - public void loadXml() { - TestUtils.readInputToCnSn("/varioustest/xmldata.xml", XmlToCompositeNodeProvider.INSTANCE); -// TestUtils.normalizeCompositeNode(compositeNode, modules, schemaNodePath) - } - - @Test - public void buildXml() { -// Document doc; -// doc.createElementNS(namespaceURI, qualifiedName) - } - - -} diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java index e754fdec5f..874e8b0d1f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertEquals; @@ -44,6 +51,7 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { * Test of json output when as input are specified composite node with empty * data + YANG file */ + @Test public void compositeNodeAndYangWithJsonReaderEmptyDataTest() { CompositeNode compositeNode = prepareCompositeNodeWithEmpties(); @@ -531,49 +539,49 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { TestUtils.buildQName("cont1", "simple:yang:types", "2013-11-5"), null, null, ModifyAction.CREATE, null); // lst11_1 - MutableCompositeNode lst11_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11"), cont1, + MutableCompositeNode lst11_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11","simple:yang:types","2013-11-5"), cont1, null, ModifyAction.CREATE, null); cont1.getChildren().add(lst11_1); - MutableSimpleNode lf111_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111"), lst11_1, + MutableSimpleNode lf111_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111","simple:yang:types","2013-11-5"), lst11_1, (short) 1, ModifyAction.CREATE, null); lst11_1.getChildren().add(lf111_1); // lst111_1_1 - MutableCompositeNode lst111_1_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111"), + MutableCompositeNode lst111_1_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), lst11_1, null, ModifyAction.CREATE, null); lst11_1.getChildren().add(lst111_1_1); - MutableSimpleNode lf1111_1_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111"), + MutableSimpleNode lf1111_1_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111","simple:yang:types","2013-11-5"), lst111_1_1, (int) 34, ModifyAction.CREATE, null); lst111_1_1.getChildren().add(lf1111_1_1); lst111_1_1.init(); // :lst111_1_1 // lst111_1_2 - MutableCompositeNode lst111_1_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111"), + MutableCompositeNode lst111_1_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), lst11_1, null, ModifyAction.CREATE, null); lst11_1.getChildren().add(lst111_1_2); - MutableSimpleNode lf1111_1_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111"), + MutableSimpleNode lf1111_1_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111","simple:yang:types","2013-11-5"), lst111_1_2, (int) 35, ModifyAction.CREATE, null); lst111_1_2.getChildren().add(lf1111_1_2); lst111_1_2.init(); // :lst111_1_2 // lst111_1_3 - MutableCompositeNode lst111_1_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111"), + MutableCompositeNode lst111_1_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), lst11_1, null, ModifyAction.CREATE, null); lst11_1.getChildren().add(lst111_1_3); lst111_1_2.init(); // :lst111_1_3 // lst111_1_4 - MutableCompositeNode lst111_1_4 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111"), + MutableCompositeNode lst111_1_4 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), lst11_1, null, ModifyAction.CREATE, null); lst11_1.getChildren().add(lst111_1_4); lst111_1_2.init(); // :lst111_1_4 - MutableCompositeNode cont111_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111"), + MutableCompositeNode cont111_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111","simple:yang:types","2013-11-5"), lst11_1, null, ModifyAction.CREATE, null); lst11_1.getChildren().add(cont111_1); @@ -581,39 +589,39 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { // :lst11_1 // lst11_2 - MutableCompositeNode lst11_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11"), cont1, + MutableCompositeNode lst11_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11","simple:yang:types","2013-11-5"), cont1, null, ModifyAction.CREATE, null); cont1.getChildren().add(lst11_2); - MutableSimpleNode lf111_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111"), lst11_2, + MutableSimpleNode lf111_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111","simple:yang:types","2013-11-5"), lst11_2, (short) 2, ModifyAction.CREATE, null); lst11_2.getChildren().add(lf111_2); // cont111_2 - MutableCompositeNode cont111_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111"), + MutableCompositeNode cont111_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111","simple:yang:types","2013-11-5"), lst11_2, null, ModifyAction.CREATE, null); lst11_2.getChildren().add(cont111_2); - MutableSimpleNode lflst1111_2_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lflst1111"), + MutableSimpleNode lflst1111_2_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lflst1111","simple:yang:types","2013-11-5"), cont111_2, (int) 1024, ModifyAction.CREATE, null); cont111_2.getChildren().add(lflst1111_2_2); - MutableSimpleNode lflst1111_2_3 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lflst1111"), + MutableSimpleNode lflst1111_2_3 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lflst1111","simple:yang:types","2013-11-5"), cont111_2, (int) 4096, ModifyAction.CREATE, null); cont111_2.getChildren().add(lflst1111_2_3); // lst1111_2 - MutableCompositeNode lst1111_2_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111"), + MutableCompositeNode lst1111_2_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), cont111_2, null, ModifyAction.CREATE, null); cont111_2.getChildren().add(lst1111_2_1); - MutableSimpleNode lf1111B_2_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111B"), + MutableSimpleNode lf1111B_2_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111B","simple:yang:types","2013-11-5"), lst1111_2_1, (short) 4, ModifyAction.CREATE, null); lst1111_2_1.getChildren().add(lf1111B_2_1); lst1111_2_1.init(); - MutableCompositeNode lst1111_2_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111"), + MutableCompositeNode lst1111_2_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), cont111_2, null, ModifyAction.CREATE, null); cont111_2.getChildren().add(lst1111_2_2); - MutableSimpleNode lf1111A_2_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111A"), + MutableSimpleNode lf1111A_2_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111A","simple:yang:types","2013-11-5"), lst1111_2_2, "lf1111A str12", ModifyAction.CREATE, null); lst1111_2_2.getChildren().add(lf1111A_2_2); lst1111_2_2.init(); @@ -622,7 +630,7 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { cont111_2.init(); // :cont111_2 - MutableCompositeNode lst112_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst112"), lst11_2, + MutableCompositeNode lst112_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst112","simple:yang:types","2013-11-5"), lst11_2, null, ModifyAction.CREATE, null); lst11_2.getChildren().add(lst112_2); lst112_2.init(); @@ -631,25 +639,25 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { // :lst11_2 // lst11_3 - MutableCompositeNode lst11_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11"), cont1, + MutableCompositeNode lst11_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11","simple:yang:types","2013-11-5"), cont1, null, ModifyAction.CREATE, null); cont1.getChildren().add(lst11_3); - MutableSimpleNode lf111_3 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111"), lst11_3, + MutableSimpleNode lf111_3 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111","simple:yang:types","2013-11-5"), lst11_3, (short) 3, ModifyAction.CREATE, null); lst11_3.getChildren().add(lf111_3); // cont111_3 - MutableCompositeNode cont111_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111"), + MutableCompositeNode cont111_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111","simple:yang:types","2013-11-5"), lst11_3, null, ModifyAction.CREATE, null); lst11_3.getChildren().add(cont111_3); - MutableCompositeNode lst1111_3_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111"), + MutableCompositeNode lst1111_3_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), cont111_3, null, ModifyAction.CREATE, null); cont111_3.getChildren().add(lst1111_3_1); lst1111_3_1.init(); - MutableCompositeNode lst1111_3_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111"), + MutableCompositeNode lst1111_3_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), cont111_3, null, ModifyAction.CREATE, null); cont111_3.getChildren().add(lst1111_3_2); lst1111_3_2.init(); diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java index 1eb3779730..8abf366bf7 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertTrue; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java index c45c0b3288..312365585e 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIdentityrefTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIdentityrefTest.java index 6920b0f1ff..745f11c210 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIdentityrefTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIdentityrefTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertNotNull; @@ -15,7 +22,10 @@ import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.*; +import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.ModifyAction; +import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode; +import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode; import org.opendaylight.yangtools.yang.data.impl.NodeFactory; public class CnSnToJsonIdentityrefTest extends YangAndXmlAndDataSchemaLoader { @@ -64,13 +74,13 @@ public class CnSnToJsonIdentityrefTest extends YangAndXmlAndDataSchemaLoader { } private CompositeNode prepareCompositeNode(Object value) { - MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont"), null, null, + MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont","identityref:module","2013-12-2"), null, null, ModifyAction.CREATE, null); - MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont1"), cont, null, + MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont1","identityref:module","2013-12-2"), cont, null, ModifyAction.CREATE, null); cont.getChildren().add(cont1); - MutableSimpleNode lf1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1"), cont1, value, + MutableSimpleNode lf1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1","identityref:module","2013-12-2"), cont1, value, ModifyAction.CREATE, null); cont1.getChildren().add(lf1); diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java index 47222571b8..050a9925ff 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertTrue; @@ -26,7 +33,6 @@ import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; import org.opendaylight.yangtools.yang.model.api.UsesNode; -import org.opendaylight.yangtools.yang.model.api.YangNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java index 3215e81719..12555bc9a2 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java index 7fdd6cac47..17d7fe6be0 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertNotNull; @@ -13,8 +20,13 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; -import org.opendaylight.controller.sal.restconf.impl.test.*; -import org.opendaylight.yangtools.yang.data.api.*; +import org.opendaylight.controller.sal.restconf.impl.test.DummyType; +import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; +import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader; +import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.ModifyAction; +import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode; +import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode; import org.opendaylight.yangtools.yang.data.impl.NodeFactory; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.Module; @@ -32,20 +44,13 @@ public class CnSnToJsonNotExistingLeafTypeTest extends YangAndXmlAndDataSchemaLo dataLoad("/cnsn-to-json/simple-data-types"); } - // FIXME - @Ignore @Test - public void incorrectTopLevelElementTest() { - + public void incorrectTopLevelElementTest() throws WebApplicationException, IOException { String jsonOutput = null; - try { - jsonOutput = TestUtils - .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(), - (Set) Collections.EMPTY_SET, prepareDataSchemaNode(), - StructuredDataToJsonProvider.INSTANCE); - } catch (WebApplicationException | IOException e) { - LOG.error("WebApplicationException or IOException was raised"); - } + jsonOutput = TestUtils + .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(), + (Set) Collections.EMPTY_SET, prepareDataSchemaNode(), + StructuredDataToJsonProvider.INSTANCE); assertNotNull(jsonOutput); assertTrue(jsonOutput.contains("\"lf1\": \"\"")); } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithAugmentTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithAugmentTest.java index 3c2325c0f3..e116129bf7 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithAugmentTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithAugmentTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java index fdc10b7150..348edbd294 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java @@ -1,9 +1,15 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertTrue; import java.io.IOException; -import java.net.URI; import java.net.URISyntaxException; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -13,19 +19,19 @@ import javax.ws.rs.WebApplicationException; import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; -import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; -import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; -import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper; import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader; import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode; +import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode; +import org.opendaylight.yangtools.yang.data.impl.NodeFactory; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class CnSnToJsonWithDataFromSeveralModulesTest extends YangAndXmlAndDataSchemaLoader { @BeforeClass public static void initialize() { - dataLoad("/xml-to-cnsn/data-of-several-modules/yang",2,"module1","cont_m1"); + dataLoad("/xml-to-cnsn/data-of-several-modules/yang", 2, "module1", "cont_m1"); } @Test @@ -34,15 +40,15 @@ public class CnSnToJsonWithDataFromSeveralModulesTest extends YangAndXmlAndDataS String output = TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCnSn(), modules, schemaContext, StructuredDataToJsonProvider.INSTANCE); -// String output = -// String.format("\"data\" : {\n" + -// "\t\"cont_m1\" : {\n" + -// "\t\t\"lf1_m1\" : \"lf1 m1 value\"\n" + -// "\t}\n" + -// "\t\"cont_m2\" : {\n" + -// "\t\t\"lf1_m2\" : \"lf1 m2 value\"\n" + -// "\t}\n" + -// "}"); + // String output = + // String.format("\"data\" : {\n" + + // "\t\"cont_m1\" : {\n" + + // "\t\t\"lf1_m1\" : \"lf1 m1 value\"\n" + + // "\t}\n" + + // "\t\"cont_m2\" : {\n" + + // "\t\t\"lf1_m2\" : \"lf1 m2 value\"\n" + + // "\t}\n" + + // "}"); StringBuilder regex = new StringBuilder(); regex.append("^"); @@ -50,27 +56,27 @@ public class CnSnToJsonWithDataFromSeveralModulesTest extends YangAndXmlAndDataS regex.append(".*\"data\""); regex.append(".*:"); regex.append(".*\\{"); - - regex.append(".*\"contB_m1\""); + + regex.append(".*\"cont_m1\""); regex.append(".*:"); regex.append(".*\\{"); regex.append(".*\\}"); - - regex.append(".*\"cont_m1\""); + + regex.append(".*\"contB_m1\""); regex.append(".*:"); regex.append(".*\\{"); regex.append(".*\\}"); - regex.append(".*\"contB_m2\""); + regex.append(".*\"cont_m2\""); regex.append(".*:"); regex.append(".*\\{"); regex.append(".*\\}"); - - regex.append(".*\"cont_m2\""); + + regex.append(".*\"contB_m2\""); regex.append(".*:"); regex.append(".*\\{"); regex.append(".*\\}"); - + regex.append(".*\\}"); regex.append(".*"); @@ -84,24 +90,44 @@ public class CnSnToJsonWithDataFromSeveralModulesTest extends YangAndXmlAndDataS } private CompositeNode prepareCnSn() throws URISyntaxException { - CompositeNodeWrapper data = new CompositeNodeWrapper(new URI("urn:ietf:params:xml:ns:netconf:base:1.0"), "data"); - - URI uriModule1 = new URI("module:one"); - CompositeNodeWrapper cont_m1 = new CompositeNodeWrapper(uriModule1, "cont_m1"); - SimpleNodeWrapper lf1_m1 = new SimpleNodeWrapper(uriModule1, "lf1_m1", "lf1 m1 value"); - cont_m1.addValue(lf1_m1); - CompositeNodeWrapper contB_m1 = new CompositeNodeWrapper(uriModule1, "contB_m1"); - - data.addValue(contB_m1); - data.addValue(cont_m1); - - URI uriModule2 = new URI("module:two"); - CompositeNodeWrapper cont_m2 = new CompositeNodeWrapper(uriModule2, "cont_m2"); - SimpleNodeWrapper lf1_m2 = new SimpleNodeWrapper(uriModule2, "lf1_m2", "lf1 m2 value"); - cont_m2.addValue(lf1_m2); - CompositeNodeWrapper contB_m2 = new CompositeNodeWrapper(uriModule2, "contB_m2"); - data.addValue(contB_m2); - data.addValue(cont_m2); + String uri1 = "module:one"; + String rev1 = "2014-01-17"; + + MutableCompositeNode data = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("data", "urn:ietf:params:xml:ns:netconf:base:1.0", "2000-01-01"), null, null, + null, null); + + MutableCompositeNode cont_m1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont_m1", uri1, rev1), data, null, null, null); + data.getChildren().add(cont_m1); + + MutableSimpleNode lf1_m1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1_m1", uri1, rev1), + cont_m1, "lf1 m1 value", null, null); + cont_m1.getChildren().add(lf1_m1); + cont_m1.init(); + + MutableCompositeNode contB_m1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("contB_m1", uri1, rev1), data, null, null, null); + data.getChildren().add(contB_m1); + contB_m1.init(); + + String uri2 = "module:two"; + String rev2 = "2014-01-17"; + MutableCompositeNode cont_m2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont_m2", uri2, rev2), data, null, null, null); + data.getChildren().add(cont_m2); + + MutableSimpleNode lf1_m2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1_m2", uri2, rev2), + cont_m1, "lf1 m2 value", null, null); + cont_m2.getChildren().add(lf1_m2); + cont_m2.init(); + + MutableCompositeNode contB_m2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("contB_m2", uri2, rev2), data, null, null, null); + data.getChildren().add(contB_m2); + contB_m2.init(); + + data.init(); return data; } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnInstanceIdentifierToXmlTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnInstanceIdentifierToXmlTest.java index d1bcf9b5f5..92de14bba4 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnInstanceIdentifierToXmlTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnInstanceIdentifierToXmlTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test; import static org.junit.Assert.assertNotNull; @@ -28,7 +35,7 @@ public class CnSnInstanceIdentifierToXmlTest extends YangAndXmlAndDataSchemaLoad @BeforeClass public static void initialization() throws URISyntaxException { - dataLoad("/instanceidentifier/yang", 3, "instance-identifier-module", "cont"); + dataLoad("/instanceidentifier/yang", 4, "instance-identifier-module", "cont"); } @Test diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlNotExistingLeafTypeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlNotExistingLeafTypeTest.java index 555f2b3e3c..4218a69d3b 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlNotExistingLeafTypeTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlNotExistingLeafTypeTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlTest.java index af54c7de91..6b4b153252 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithChoiceTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithChoiceTest.java index a23501cbe6..a3e33ce30b 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithChoiceTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithChoiceTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test; import static org.junit.Assert.assertTrue; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java index 57a149516f..b7a58886dc 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test; import static org.junit.Assert.assertTrue; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java index e9b1dbe1a5..9e726baf55 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.json.to.cnsn.test; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonLeafrefToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonLeafrefToCnSnTest.java index 2bb42d903a..2030d9125a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonLeafrefToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonLeafrefToCnSnTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.json.to.cnsn.test; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java index 3a90e73acb..8b1dc3475f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.json.to.cnsn.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java index 80cfb17026..18b5ce490f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertNotNull; @@ -21,43 +28,87 @@ import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; -import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; -import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode; +import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode; +import org.opendaylight.yangtools.yang.data.impl.NodeFactory; public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSchemaLoader { @BeforeClass public static void initialize() { - dataLoad("/instanceidentifier/yang", 3, "instance-identifier-module", "cont"); + dataLoad("/instanceidentifier/yang", 4, "instance-identifier-module", "cont"); } @Test - public void saveCnSnToXml() throws WebApplicationException, IOException, URISyntaxException, XMLStreamException { - CompositeNode cnSn = prepareCnSn(); + public void saveCnSnToXmlTest() throws WebApplicationException, IOException, URISyntaxException, XMLStreamException { + CompositeNode cnSn = prepareCnSn(createInstanceIdentifier()); String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode, StructuredDataToXmlProvider.INSTANCE); + //uncomment for debug + // System.out.println(output); validateXmlOutput(output); + + } + + @Ignore + @Test + public void saveCnSnWithLeafListInstIdentifierToXmlTest() throws WebApplicationException, IOException, + URISyntaxException, XMLStreamException { + CompositeNode cnSn = prepareCnSn(createInstanceIdentifierWithLeafList()); + String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode, + StructuredDataToXmlProvider.INSTANCE); + //uncomment for debug // System.out.println(output); + validateXmlOutputWithLeafList(output); + } + + @Test + public void saveCnSnToJsonTest() throws WebApplicationException, IOException, URISyntaxException { + CompositeNode cnSn = prepareCnSn(createInstanceIdentifier()); + String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode, + StructuredDataToJsonProvider.INSTANCE); + boolean strInOutput = false; + strInOutput = output + .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11[augment-module:keyvalue111=\\\"value1\\\"][augment-module:keyvalue112=\\\"value2\\\"]/augment-augment-module:lf112\""); + if (!strInOutput) { + strInOutput = output + .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11[augment-module:keyvalue111='value1'][augment-module:keyvalue112='value2']/augment-augment-module:lf112\""); + } + //uncomment for debug + // System.out.println(output); + assertTrue(strInOutput); } + @Test - public void saveCnSnToJson() throws WebApplicationException, IOException, URISyntaxException { - CompositeNode cnSn = prepareCnSn(); + public void saveCnSnWithLeafListInstIdentifierToJsonTest() throws WebApplicationException, IOException, + URISyntaxException { + CompositeNode cnSn = prepareCnSn(createInstanceIdentifierWithLeafList()); String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode, StructuredDataToJsonProvider.INSTANCE); - assertTrue(output - .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11[augment-module:keyvalue111=\\\"value1\\\"][augment-module:keyvalue112=\\\"value2\\\"]/augment-augment-module:lf112\"")); + //uncomment for debug // System.out.println(output); + boolean strInOutput = false; + strInOutput = output + .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.='lflst11_1']\""); + if (!strInOutput) { + strInOutput = output + .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\\\"lflst11_1\\\"]\""); + } + + assertTrue(strInOutput); } private void validateXmlOutput(String xml) throws XMLStreamException { @@ -97,21 +148,66 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch + ":lst11[" + aModulePrefix + ":keyvalue111='value1'][" + aModulePrefix + ":keyvalue112='value2']/" + aaModulePrefix + ":lf112"; -// System.out.println(xml); assertTrue(xml.contains(instanceIdentifierValue)); } - private CompositeNode prepareCnSn() throws URISyntaxException { - CompositeNodeWrapper cont = new CompositeNodeWrapper(new URI("instance:identifier:module"), "cont"); - CompositeNodeWrapper cont1 = new CompositeNodeWrapper(new URI("instance:identifier:module"), "cont1"); - CompositeNodeWrapper lst11 = new CompositeNodeWrapper(new URI("augment:module"), "lst11"); - InstanceIdentifier instanceIdentifier = createInstanceIdentifier(); - SimpleNodeWrapper lf111 = new SimpleNodeWrapper(new URI("augment:augment:module"), "lf111", instanceIdentifier); + private void validateXmlOutputWithLeafList(String xml) throws XMLStreamException { + XMLInputFactory xmlInFactory = XMLInputFactory.newInstance(); + XMLEventReader eventReader; - lst11.addValue(lf111); - cont1.addValue(lst11); - cont.addValue(cont1); + eventReader = xmlInFactory.createXMLEventReader(new ByteArrayInputStream(xml.getBytes())); + String aModuleLfLstPrefix = null; + String iiModulePrefix = null; + while (eventReader.hasNext()) { + XMLEvent nextEvent = eventReader.nextEvent(); + if (nextEvent.isStartElement()) { + StartElement startElement = (StartElement) nextEvent; + if (startElement.getName().getLocalPart().equals("lf111")) { + Iterator prefixes = startElement.getNamespaceContext().getPrefixes("augment:module:leaf:list"); + + while (prefixes.hasNext() && aModuleLfLstPrefix == null) { + String prefix = (String) prefixes.next(); + if (!prefix.isEmpty()) { + aModuleLfLstPrefix = prefix; + } + } + iiModulePrefix = startElement.getNamespaceContext().getPrefix("instance:identifier:module"); + break; + } + } + } + + assertNotNull(aModuleLfLstPrefix); + assertNotNull(iiModulePrefix); + + String instanceIdentifierValue = "/" + iiModulePrefix + ":cont/" + iiModulePrefix + ":cont1/" + + aModuleLfLstPrefix + ":lflst11[.='lflst11_1']"; + + assertTrue(xml.contains(instanceIdentifierValue)); + + } + + private CompositeNode prepareCnSn(InstanceIdentifier instanceIdentifier) throws URISyntaxException { + MutableCompositeNode cont = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont", "instance:identifier:module", "2014-01-17"), null, null,null,null); + MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont1", "instance:identifier:module", "2014-01-17"), cont, null,null,null); + MutableCompositeNode lst11 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst11", "augment:module", "2014-01-17"), cont1, null,null,null); + + MutableSimpleNode lf111 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111", "augment:augment:module", "2014-01-17"), + lst11, instanceIdentifier,null,null); + + + lst11.getChildren().add(lf111); + lst11.init(); + + cont1.getChildren().add(lst11); + cont1.init(); + + cont.getChildren().add(cont1); + cont.init(); return cont; } @@ -133,4 +229,13 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch return new InstanceIdentifier(pathArguments); } + private InstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException { + List pathArguments = new ArrayList<>(); + pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont"))); + pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1"))); + pathArguments.add(new NodeWithValue(new QName(new URI("augment:module:leaf:list"), "lflst11"), "lflst11_1")); + + return new InstanceIdentifier(pathArguments); + } + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java index 251b212513..67b5b8c93a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import java.util.concurrent.*; @@ -87,4 +94,4 @@ public class DummyFuture implements Future> { return new DummyFuture(this); } } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java index 7f23776a84..acc5c00935 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import java.util.Collection; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyType.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyType.java index 0876584cab..9caaf6b83a 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyType.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyType.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import java.util.List; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java index c5f5a1eddc..5689a82875 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java index bbedd2b42b..e1d7e6a624 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.mockito.Matchers.any; @@ -65,9 +72,9 @@ public class MediaTypesTest extends JerseyTest { String uriPath = "ietf-interfaces:interfaces"; String uri = createUri(uriPrefix, uriPath); when(restconfService.invokeRpc(eq(uriPath), any(CompositeNode.class))).thenReturn(null); - post(uri, Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+JSON, jsonData); + post(uri, Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+JSON, jsonData); verify(restconfService, times(1)).invokeRpc(eq(uriPath), any(CompositeNode.class)); - post(uri, Draft02.MediaTypes.DATA+XML, Draft02.MediaTypes.DATA+XML, xmlData); + post(uri, Draft02.MediaTypes.OPERATION+XML, Draft02.MediaTypes.OPERATION+XML, xmlData); verify(restconfService, times(2)).invokeRpc(eq(uriPath), any(CompositeNode.class)); post(uri, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, jsonData); verify(restconfService, times(3)).invokeRpc(eq(uriPath), any(CompositeNode.class)); diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java index 83e6ae51d0..6d2723c2f1 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestCodecExceptionsTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestCodecExceptionsTest.java index 2b6efbdc4d..983377e1e8 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestCodecExceptionsTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestCodecExceptionsTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java index 4b36d63539..73b4b3a2af 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java index 94791cfe8d..a6391894c2 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java index 681444efd4..f2d6aaf44f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java @@ -1,10 +1,18 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; +import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML; +import static org.mockito.Mockito.verify; import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri; import java.io.FileNotFoundException; @@ -13,21 +21,19 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - - import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; -import org.glassfish.jersey.test.TestProperties; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.sal.core.api.mount.MountInstance; import org.opendaylight.controller.sal.core.api.mount.MountService; -import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; @@ -50,6 +56,9 @@ public class RestGetOperationTest extends JerseyTest { private static SchemaContext schemaContextTestModule; private static CompositeNode answerFromGet; + private static SchemaContext schemaContextModules; + private static SchemaContext schemaContextBehindMountPoint; + @BeforeClass public static void init() throws FileNotFoundException { schemaContextYangsIetf = TestUtils.loadSchemaContext("/full-versions/yangs"); @@ -61,15 +70,18 @@ public class RestGetOperationTest extends JerseyTest { restconfImpl.setBroker(brokerFacade); restconfImpl.setControllerContext(controllerContext); answerFromGet = prepareCompositeNodeWithIetfInterfacesInterfacesData(); + + schemaContextModules = TestUtils.loadSchemaContext("/modules"); + schemaContextBehindMountPoint = TestUtils.loadSchemaContext("/modules/modules-behind-mount-point"); } @Override protected Application configure() { /* enable/disable Jersey logs to console */ -// enable(TestProperties.LOG_TRAFFIC); -// enable(TestProperties.DUMP_ENTITY); -// enable(TestProperties.RECORD_LOG_LEVEL); -// set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue()); + // enable(TestProperties.LOG_TRAFFIC); + // enable(TestProperties.DUMP_ENTITY); + // enable(TestProperties.RECORD_LOG_LEVEL); + // set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue()); ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE, StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE, @@ -77,24 +89,6 @@ public class RestGetOperationTest extends JerseyTest { return resourceConfig; } - /** - * Tests of status codes for "/datastore/{identifier}". - */ - @Test - public void getDatastoreStatusCodes() throws FileNotFoundException, UnsupportedEncodingException { - mockReadOperationalDataMethod(); - String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0"); - assertEquals(200, get(uri, MediaType.APPLICATION_XML)); - - uri = createUri("/datastore/", "wrong-module:interfaces/interface/eth0"); - assertEquals(400, get(uri, MediaType.APPLICATION_XML)); - - // Test of request for not existing data. Returning status code 404 - uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0"); - when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null); - assertEquals(404, get(uri, MediaType.APPLICATION_XML)); - } - /** * Tests of status codes for "/operational/{identifier}". */ @@ -135,7 +129,7 @@ public class RestGetOperationTest extends JerseyTest { when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance); ControllerContext.getInstance().setMountService(mockMountService); - + String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont/cont1"); assertEquals(200, get(uri, MediaType.APPLICATION_XML)); @@ -146,7 +140,8 @@ public class RestGetOperationTest extends JerseyTest { @Test public void getDataMountPointIntoHighestElement() throws UnsupportedEncodingException, URISyntaxException { - when(brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class), + when( + brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class), any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest()); MountInstance mountInstance = mock(MountInstance.class); when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule); @@ -155,11 +150,342 @@ public class RestGetOperationTest extends JerseyTest { ControllerContext.getInstance().setMountService(mockMountService); - String uri = createUri("/config/", - "ietf-interfaces:interfaces/interface/0/yang-ext:mount/"); + String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/"); assertEquals(200, get(uri, MediaType.APPLICATION_XML)); } + // /modules + @Test + public void getModulesTest() throws UnsupportedEncodingException, FileNotFoundException { + ControllerContext.getInstance().setGlobalSchema(schemaContextModules); + + String uri = createUri("/modules", ""); + + Response response = target(uri).request("application/yang.api+json").get(); + validateModulesResponseJson(response); + + response = target(uri).request("application/yang.api+xml").get(); + validateModulesResponseXml(response); + } + + // /modules/module + @Test + public void getModuleTest() throws FileNotFoundException, UnsupportedEncodingException { + ControllerContext.getInstance().setGlobalSchema(schemaContextModules); + + String uri = createUri("/modules/module/module2/2014-01-02", ""); + + Response response = target(uri).request("application/yang.api+xml").get(); + assertEquals(200, response.getStatus()); + String responseBody = response.readEntity(String.class); + assertTrue("Module2 in xml wasn't found", prepareXmlRegex("module2", "2014-01-02", "module:2", responseBody) + .find()); + String[] split = responseBody.split(""); + + regex.append(".*<"); + regex.append(".*" + rpcName); + regex.append(".*" + namespace); + regex.append(".*/"); + regex.append(".*>"); + + regex.append(".*"); + + regex.append(".*"); + regex.append("$"); + Pattern ptrn = Pattern.compile(regex.toString(), Pattern.DOTALL); + return ptrn.matcher(searchIn); + } + + // /restconf/modules/pathToMountPoint/yang-ext:mount + @Test + public void getModulesBehindMountPoint() throws FileNotFoundException, UnsupportedEncodingException { + ControllerContext controllerContext = ControllerContext.getInstance(); + controllerContext.setGlobalSchema(schemaContextModules); + + MountInstance mountInstance = mock(MountInstance.class); + when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint); + MountService mockMountService = mock(MountService.class); + when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance); + + controllerContext.setMountService(mockMountService); + + String uri = createUri("/modules/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/"); + + Response response = target(uri).request("application/yang.api+json").get(); + assertEquals(200, response.getStatus()); + String responseBody = response.readEntity(String.class); + + assertTrue( + "module1-behind-mount-point in json wasn't found", + prepareJsonRegex("module1-behind-mount-point", "2014-02-03", "module:1:behind:mount:point", + responseBody).find()); + assertTrue( + "module2-behind-mount-point in json wasn't found", + prepareJsonRegex("module2-behind-mount-point", "2014-02-04", "module:2:behind:mount:point", + responseBody).find()); + + response = target(uri).request("application/yang.api+xml").get(); + assertEquals(200, response.getStatus()); + responseBody = response.readEntity(String.class); + assertTrue( + "module1-behind-mount-point in json wasn't found", + prepareXmlRegex("module1-behind-mount-point", "2014-02-03", "module:1:behind:mount:point", responseBody) + .find()); + assertTrue( + "module2-behind-mount-point in json wasn't found", + prepareXmlRegex("module2-behind-mount-point", "2014-02-04", "module:2:behind:mount:point", responseBody) + .find()); + + } + + // /restconf/modules/module/pathToMountPoint/yang-ext:mount/moduleName/revision + @Test + public void getModuleBehindMountPoint() throws FileNotFoundException, UnsupportedEncodingException { + ControllerContext controllerContext = ControllerContext.getInstance(); + controllerContext.setGlobalSchema(schemaContextModules); + + MountInstance mountInstance = mock(MountInstance.class); + when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint); + MountService mockMountService = mock(MountService.class); + when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance); + + controllerContext.setMountService(mockMountService); + + String uri = createUri("/modules/module/", + "ietf-interfaces:interfaces/interface/0/yang-ext:mount/module1-behind-mount-point/2014-02-03"); + + Response response = target(uri).request("application/yang.api+json").get(); + assertEquals(200, response.getStatus()); + String responseBody = response.readEntity(String.class); + + assertTrue( + "module1-behind-mount-point in json wasn't found", + prepareJsonRegex("module1-behind-mount-point", "2014-02-03", "module:1:behind:mount:point", + responseBody).find()); + String[] split = responseBody.split("\"module\""); + assertEquals("\"module\" element is returned more then once",2,split.length); + + + response = target(uri).request("application/yang.api+xml").get(); + assertEquals(200, response.getStatus()); + responseBody = response.readEntity(String.class); + assertTrue( + "module1-behind-mount-point in json wasn't found", + prepareXmlRegex("module1-behind-mount-point", "2014-02-03", "module:1:behind:mount:point", responseBody) + .find()); + split = responseBody.split(""); + + regex.append(".*"); + regex.append(".*" + module); + regex.append(".*<\\/name>"); + + regex.append(".*"); + regex.append(".*" + revision); + regex.append(".*<\\/revision>"); + + regex.append(".*"); + regex.append(".*" + namespace); + regex.append(".*<\\/namespace>"); + + regex.append(".*<\\/module.*>"); + + regex.append(".*"); + regex.append("$"); + + Pattern ptrn = Pattern.compile(regex.toString(), Pattern.DOTALL); + return ptrn.matcher(searchIn); + } + + private void prepareMockForModulesTest(ControllerContext mockedControllerContext) throws FileNotFoundException { + SchemaContext schemaContext = TestUtils.loadSchemaContext("/modules"); + mockedControllerContext.setGlobalSchema(schemaContext); + // when(mockedControllerContext.getGlobalSchema()).thenReturn(schemaContext); + } + private int get(String uri, String mediaType) { return target(uri).request(mediaType).get().getStatus(); } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestOperationUtils.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestOperationUtils.java index 186dafb168..a0e61a6fa1 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestOperationUtils.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestOperationUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import java.io.UnsupportedEncodingException; @@ -8,13 +15,13 @@ import com.google.common.base.Charsets; public class RestOperationUtils { - static final String JSON = "+json"; - static final String XML = "+xml"; + public static final String JSON = "+json"; + public static final String XML = "+xml"; private RestOperationUtils() { } - static String createUri(String prefix, String encodedPart) throws UnsupportedEncodingException { + public static String createUri(String prefix, String encodedPart) throws UnsupportedEncodingException { return URI.create(prefix + URLEncoder.encode(encodedPart, Charsets.US_ASCII.name()).toString()).toASCIIString(); } } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java index 5f8262ae70..050aa9ab24 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; @@ -7,7 +14,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML; -import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri; import java.io.IOException; import java.io.InputStream; @@ -22,7 +28,6 @@ import java.util.concurrent.Future; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -36,7 +41,6 @@ import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; -import org.opendaylight.controller.sal.rest.impl.XmlMapper; import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider; import org.opendaylight.controller.sal.restconf.impl.BrokerFacade; import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; @@ -146,20 +150,6 @@ public class RestPostOperationTest extends JerseyTest { assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); } - @Test - public void postDatastoreStatusCodes() throws UnsupportedEncodingException { - controllerContext.setSchemas(schemaContextYangsIetf); - mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED); - String uri = createUri("/datastore/", "ietf-interfaces:interfaces"); - assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); - - mockCommitConfigurationDataPostMethod(null); - assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); - - mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED); - assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); - } - @Test public void postDataViaUrlMountPoint() throws UnsupportedEncodingException { controllerContext.setSchemas(schemaContextYangsIetf); diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java index 45ead9bfdd..2ba4a38c88 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java @@ -1,10 +1,16 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML; import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri; import java.io.FileNotFoundException; @@ -17,17 +23,14 @@ import java.util.concurrent.Future; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.md.sal.common.api.TransactionStatus; import org.opendaylight.controller.sal.core.api.mount.MountInstance; import org.opendaylight.controller.sal.core.api.mount.MountService; -import org.opendaylight.controller.sal.rest.api.Draft02; import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; @@ -100,19 +103,6 @@ public class RestPutOperationTest extends JerseyTest { assertEquals(500, put(uri, MediaType.APPLICATION_XML, xmlData)); } - /** - * Tests of status codes for "/datastore/{identifier}". - */ - @Test - public void putDatastoreStatusCodes() throws UnsupportedEncodingException { - String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0"); - mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED); - assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData)); - - mockCommitConfigurationDataPutMethod(TransactionStatus.FAILED); - assertEquals(500, put(uri, MediaType.APPLICATION_XML, xmlData)); - } - @Test public void testRpcResultCommitedToStatusCodesWithMountPoint() throws UnsupportedEncodingException, FileNotFoundException, URISyntaxException { @@ -124,10 +114,6 @@ public class RestPutOperationTest extends JerseyTest { brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class), any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture); - InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/full-versions/test-data2/data2.xml"); - String xml = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream)); - Entity entity = Entity.entity(xml, Draft02.MediaTypes.DATA + XML); - MountInstance mountInstance = mock(MountInstance.class); when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule); MountService mockMountService = mock(MountService.class); diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java index c15cd53082..359b68dc4c 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java index bae5a2332d..eb623096de 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java index d7522706fd..eef9e414e9 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlAndJsonToCnSnInstanceIdentifierTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlAndJsonToCnSnInstanceIdentifierTest.java index 1608efbdf8..5476d71320 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlAndJsonToCnSnInstanceIdentifierTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlAndJsonToCnSnInstanceIdentifierTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; @@ -19,6 +26,7 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.SimpleNode; @@ -26,7 +34,7 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch @BeforeClass public static void initialize() { - dataLoad("/instanceidentifier/yang", 3, "instance-identifier-module", "cont"); + dataLoad("/instanceidentifier/yang", 4, "instance-identifier-module", "cont"); } @Test @@ -34,7 +42,15 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch CompositeNode cnSn = TestUtils.readInputToCnSn("/instanceidentifier/xml/xmldata.xml", XmlToCompositeNodeProvider.INSTANCE); TestUtils.normalizeCompositeNode(cnSn, modules, schemaNodePath); - verify(cnSn); + verifyListPredicate(cnSn); + } + + @Test + public void loadXmlLeafListToCnSn() throws WebApplicationException, IOException, URISyntaxException { + CompositeNode cnSn = TestUtils.readInputToCnSn("/instanceidentifier/xml/xmldata_leaf_list.xml", + XmlToCompositeNodeProvider.INSTANCE); + TestUtils.normalizeCompositeNode(cnSn, modules, schemaNodePath); + verifyLeafListPredicate(cnSn); } @Test @@ -42,11 +58,40 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch CompositeNode cnSn = TestUtils.readInputToCnSn("/instanceidentifier/json/jsondata.json", JsonToCompositeNodeProvider.INSTANCE); TestUtils.normalizeCompositeNode(cnSn, modules, schemaNodePath); - verify(cnSn); + verifyListPredicate(cnSn); } - private void verify(CompositeNode cnSn) throws URISyntaxException { - SimpleNode lf111 = getSnWithInstanceIdentifier(cnSn); + @Test + public void loadJsonLeafListToCnSn() throws WebApplicationException, IOException, URISyntaxException { + CompositeNode cnSn = TestUtils.readInputToCnSn("/instanceidentifier/json/jsondata_leaf_list.json", + JsonToCompositeNodeProvider.INSTANCE); + TestUtils.normalizeCompositeNode(cnSn, modules, schemaNodePath); + verifyLeafListPredicate(cnSn); + } + + private void verifyLeafListPredicate(CompositeNode cnSn) throws URISyntaxException { + SimpleNode lf11 = getSnWithInstanceIdentifierWhenLeafList(cnSn); + Object value = lf11.getValue(); + assertTrue(value instanceof InstanceIdentifier); + + InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value; + List pathArguments = instanceIdentifier.getPath(); + assertEquals(3, pathArguments.size()); + String revisionDate = "2014-01-17"; + assertEquals(TestUtils.buildQName("cont", "instance:identifier:module", revisionDate), pathArguments.get(0) + .getNodeType()); + assertEquals(TestUtils.buildQName("cont1", "instance:identifier:module", revisionDate), pathArguments.get(1) + .getNodeType()); + assertEquals(TestUtils.buildQName("lflst11", "augment:module:leaf:list", "2014-01-27"), pathArguments.get(2) + .getNodeType()); + + assertTrue(pathArguments.get(2) instanceof NodeWithValue); + assertEquals("lflst11_1", ((NodeWithValue) pathArguments.get(2)).getValue()); + + } + + private void verifyListPredicate(CompositeNode cnSn) throws URISyntaxException { + SimpleNode lf111 = getSnWithInstanceIdentifierWhenList(cnSn); Object value = lf111.getValue(); assertTrue(value instanceof InstanceIdentifier); @@ -69,7 +114,7 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch assertEquals("value2", predicates.get(TestUtils.buildQName("keyvalue112", "augment:module", revisionDate))); } - private SimpleNode getSnWithInstanceIdentifier(CompositeNode cnSn) throws URISyntaxException { + private SimpleNode getSnWithInstanceIdentifierWhenList(CompositeNode cnSn) throws URISyntaxException { CompositeNode cont1 = cnSn.getFirstCompositeByName(TestUtils.buildQName("cont1", "instance:identifier:module", "2014-01-17")); assertNotNull(cont1); @@ -82,4 +127,14 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch return lf111; } + private SimpleNode getSnWithInstanceIdentifierWhenLeafList(CompositeNode cnSn) throws URISyntaxException { + CompositeNode cont1 = cnSn.getFirstCompositeByName(TestUtils.buildQName("cont1", "instance:identifier:module", + "2014-01-17")); + assertNotNull(cont1); + SimpleNode lf11 = cont1.getFirstSimpleByName(TestUtils.buildQName("lf11", "augment:module:leaf:list", + "2014-01-27")); + assertNotNull(lf11); + return lf11; + } + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java index 3d24c6ba67..d5759bedb1 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java index 96b9b35edb..e935a268a2 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java index 00783537d8..0f4e43a3fe 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; public class Cont extends LstItem { diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java index afd40d1c2b..2ab7fbc9cf 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; public class Lf extends YangElement { diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java index dda590944a..719adf73bb 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; import java.util.HashSet; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java index 56928e81e9..d4c7671c45 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; import java.util.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java index 10582de083..9b382d210e 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; import java.util.HashMap; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java index ed234582b8..005e5fedaf 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.test.structures; public class YangElement { diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/IClientMessageCallback.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/IClientMessageCallback.java new file mode 100644 index 0000000000..63b8e6b4b7 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/IClientMessageCallback.java @@ -0,0 +1,9 @@ +package org.opendaylight.controller.sal.restconf.impl.websockets.client; + +/** + * Created by mbobak on 1/22/14. + */ +public interface IClientMessageCallback { + + public void onMessageReceived(Object message); +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClient.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClient.java new file mode 100644 index 0000000000..845d54ea1f --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClient.java @@ -0,0 +1,130 @@ +/* + * 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.sal.restconf.impl.websockets.client; + +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpObjectAggregator; +import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; +import io.netty.handler.codec.http.websocketx.PingWebSocketFrame; +import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; +import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory; +import io.netty.handler.codec.http.websocketx.WebSocketVersion; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URI; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WebSocketClient { + + private final URI uri; + private Bootstrap bootstrap = new Bootstrap();; + private final WebSocketClientHandler clientHandler; + private static final Logger logger = LoggerFactory.getLogger(WebSocketClient.class); + private Channel clientChannel; + private final EventLoopGroup group = new NioEventLoopGroup(); + + public WebSocketClient(URI uri,IClientMessageCallback clientMessageCallback) { + this.uri = uri; + clientHandler = new WebSocketClientHandler( + WebSocketClientHandshakerFactory.newHandshaker( + uri, WebSocketVersion.V13, null, false,null),clientMessageCallback); // last null could be replaced with DefaultHttpHeaders + initialize(); + } + private void initialize(){ + + String protocol = uri.getScheme(); + if (!"http".equals(protocol)) { + throw new IllegalArgumentException("Unsupported protocol: " + protocol); + } + + bootstrap.group(group) + .channel(NioSocketChannel.class) + .handler(new ChannelInitializer() { + @Override + public void initChannel(SocketChannel ch) throws Exception { + ChannelPipeline pipeline = ch.pipeline(); + pipeline.addLast("http-codec", new HttpClientCodec()); + pipeline.addLast("aggregator", new HttpObjectAggregator(8192)); + pipeline.addLast("ws-handler", clientHandler); + } + }); + } + public void connect() throws InterruptedException{ + System.out.println("WebSocket Client connecting"); + clientChannel = bootstrap.connect(uri.getHost(), uri.getPort()).sync().channel(); + clientHandler.handshakeFuture().sync(); + } + + public void writeAndFlush(String message){ + clientChannel.writeAndFlush(new TextWebSocketFrame(message)); + } + public void writeAndFlush(Object message){ + clientChannel.writeAndFlush(message); + } + + public void ping(){ + clientChannel.writeAndFlush(new PingWebSocketFrame(Unpooled.copiedBuffer(new byte[]{1, 2, 3, 4, 5, 6}))); + } + + public void close(String reasonText) throws InterruptedException { + CloseWebSocketFrame closeWebSocketFrame = new CloseWebSocketFrame(1000,reasonText); + clientChannel.writeAndFlush(closeWebSocketFrame); + + // WebSocketClientHandler will close the connection when the server + // responds to the CloseWebSocketFrame. + clientChannel.closeFuture().sync(); + group.shutdownGracefully(); + } + + public static void main(String[] args) throws Exception { + URI uri; + if (args.length > 0) { + uri = new URI(args[0]); + } else { + uri = new URI("http://192.168.1.101:8181/opendaylight-inventory:nodes"); + } + IClientMessageCallback messageCallback = new ClientMessageCallback(); + WebSocketClient webSocketClient = new WebSocketClient(uri, messageCallback); + webSocketClient.connect(); + + while (true) { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String input = br.readLine(); + if (input.equals("q")) { + System.out.print("Would you like to close stream? (Y = yes, empty = yes)\n"); + input = br.readLine(); + if (input.equals("yes") || input.isEmpty()) { + webSocketClient.close("opendaylight-inventory:nodes"); + break; + } + } + } + } + + private static class ClientMessageCallback implements IClientMessageCallback { + @Override + public void onMessageReceived(Object message) { + if (message instanceof TextWebSocketFrame) { + logger.info("received message {}"+ ((TextWebSocketFrame)message).text()); + } + } + } + +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClientHandler.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClientHandler.java new file mode 100644 index 0000000000..02e1632057 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClientHandler.java @@ -0,0 +1,96 @@ +/* + * 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.sal.restconf.impl.websockets.client; + +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelPromise; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.handler.codec.http.FullHttpResponse; +import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; +import io.netty.handler.codec.http.websocketx.PongWebSocketFrame; +import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; +import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; +import io.netty.handler.codec.http.websocketx.WebSocketFrame; +import io.netty.util.CharsetUtil; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WebSocketClientHandler extends SimpleChannelInboundHandler { + + private static final Logger logger = LoggerFactory.getLogger(WebSocketClientHandler.class.toString()); + private final WebSocketClientHandshaker handshaker; + private ChannelPromise handshakeFuture; + private IClientMessageCallback messageListener; + + + public WebSocketClientHandler(WebSocketClientHandshaker handshaker,IClientMessageCallback listener) { + this.handshaker = handshaker; + this.messageListener = listener; + } + + public ChannelFuture handshakeFuture() { + return handshakeFuture; + } + + @Override + public void handlerAdded(ChannelHandlerContext ctx) throws Exception { + handshakeFuture = ctx.newPromise(); + } + + @Override + public void channelActive(ChannelHandlerContext ctx) throws Exception { + handshaker.handshake(ctx.channel()); + } + + @Override + public void channelInactive(ChannelHandlerContext ctx) throws Exception { + logger.info("WebSocket Client disconnected!"); + } + + @Override + public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { + Channel ch = ctx.channel(); + if (!handshaker.isHandshakeComplete()) { + handshaker.finishHandshake(ch, (FullHttpResponse) msg); + logger.info("WebSocket Client connected!"); + handshakeFuture.setSuccess(); + return; + } + + if (msg instanceof FullHttpResponse) { + FullHttpResponse response = (FullHttpResponse) msg; + throw new Exception("Unexpected FullHttpResponse (getStatus=" + response.getStatus() + ", content=" + + response.content().toString(CharsetUtil.UTF_8) + ')'); + } + + messageListener.onMessageReceived(msg); + WebSocketFrame frame = (WebSocketFrame) msg; + + if (frame instanceof PongWebSocketFrame) { + logger.info("WebSocket Client received pong"); + } else if (frame instanceof CloseWebSocketFrame) { + logger.info("WebSocket Client received closing"); + ch.close(); + } + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + cause.printStackTrace(); + + if (!handshakeFuture.isDone()) { + handshakeFuture.setFailure(cause); + } + + ctx.close(); + } +} + diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/test/RestStream.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/test/RestStream.java new file mode 100644 index 0000000000..4dcc63e89a --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/test/RestStream.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.restconf.impl.websockets.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri; + +import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.junit.BeforeClass; +import org.junit.Test; +import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; +import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; +import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider; +import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider; +import org.opendaylight.controller.sal.restconf.impl.BrokerFacade; +import org.opendaylight.controller.sal.restconf.impl.ControllerContext; +import org.opendaylight.controller.sal.restconf.impl.RestconfImpl; +import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; + +public class RestStream extends JerseyTest { + + private static BrokerFacade brokerFacade; + private static RestconfImpl restconfImpl; + private static SchemaContext schemaContextYangsIetf; + + @BeforeClass + public static void init() throws FileNotFoundException { + schemaContextYangsIetf = TestUtils.loadSchemaContext("/full-versions/yangs"); + ControllerContext controllerContext = ControllerContext.getInstance(); + controllerContext.setSchemas(schemaContextYangsIetf); + brokerFacade = mock(BrokerFacade.class); + restconfImpl = RestconfImpl.getInstance(); + restconfImpl.setBroker(brokerFacade); + restconfImpl.setControllerContext(controllerContext); + } + + @Override + protected Application configure() { + /* enable/disable Jersey logs to console */ +// enable(TestProperties.LOG_TRAFFIC); +// enable(TestProperties.DUMP_ENTITY); +// enable(TestProperties.RECORD_LOG_LEVEL); +// set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue()); + ResourceConfig resourceConfig = new ResourceConfig(); + resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE, + StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE, + JsonToCompositeNodeProvider.INSTANCE); + return resourceConfig; + } + + @Test + public void testCallRpcCallGet() throws UnsupportedEncodingException, InterruptedException { + String uri = createUri("/operations/", "sal-remote:create-data-change-event-subscription"); + Response responseWithStreamName = post(uri, MediaType.APPLICATION_XML, getRpcInput()); + String xmlResponse = responseWithStreamName.readEntity(String.class); + assertNotNull(xmlResponse); + assertTrue(xmlResponse.contains("ietf-interfaces:interfaces/ietf-interfaces:interface/eth0")); + + uri = createUri("/streams/stream/", "ietf-interfaces:interfaces/ietf-interfaces:interface/eth0"); + Response responseWithRedirectionUri = get(uri, MediaType.APPLICATION_XML); + final URI websocketServerUri = responseWithRedirectionUri.getLocation(); + assertNotNull(websocketServerUri); + assertEquals(websocketServerUri.toString(), "http://localhost:8181/ietf-interfaces:interfaces/ietf-interfaces:interface/eth0"); + } + + private Response post(String uri, String mediaType, String data) { + return target(uri).request(mediaType).post(Entity.entity(data, mediaType)); + } + + private Response get(String uri, String mediaType) { + return target(uri).request(mediaType).get(); + } + + private String getRpcInput() { + StringBuilder sb = new StringBuilder(); + sb.append(""); + sb.append("/int:interfaces/int:interface[int:name='eth0']"); + sb.append(""); + return sb.toString(); + } + +} diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlAugmentedElementToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlAugmentedElementToCnSnTest.java index 4a4f9f1bbf..ffddb00485 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlAugmentedElementToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlAugmentedElementToCnSnTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.xml.to.cnsn.test; import static org.junit.Assert.assertNotNull; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java index 14818d02cd..7a949b8f2d 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.xml.to.cnsn.test; import static org.junit.Assert.assertEquals; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java index 7c7df56133..f1a18d56a8 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.restconf.impl.xml.to.cnsn.test; import static org.junit.Assert.*; diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/full-versions/yangs/sal-remote@2014-01-14.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/full-versions/yangs/sal-remote@2014-01-14.yang new file mode 100644 index 0000000000..d12e252711 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/full-versions/yangs/sal-remote@2014-01-14.yang @@ -0,0 +1,98 @@ +module sal-remote { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote"; + prefix "sal-remote"; + + + organization "Cisco Systems, Inc."; + contact "Martin Bobak "; + + description + "This module contains the definition of methods related to + sal remote model. + + Copyright (c)2013 Cisco Systems, Inc. All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which + accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html"; + + revision "2014-01-14" { + description + "Initial revision"; + } + + + typedef q-name { + type string; + reference + "http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#QName"; + } + + rpc create-data-change-event-subscription { + input { + leaf path { + type instance-identifier; + description "Subtree path. "; + } + } + output { + leaf stream-name { + type string; + description "Notification stream name."; + } + } + } + + notification data-changed-notification { + description "Data change notification."; + list data-change-event { + key path; + leaf path { + type instance-identifier; + } + leaf store { + type enumeration { + enum config; + enum operation; + } + } + leaf operation { + type enumeration { + enum created; + enum updated; + enum deleted; + } + } + anyxml data{ + description "DataObject "; + } + } + } + + rpc create-notification-stream { + input { + leaf-list notifications { + type q-name; + description "Notification QNames"; + } + } + output { + leaf notification-stream-identifier { + type string; + description "Unique notification stream identifier, in which notifications will be propagated"; + } + } + } + + rpc begin-transaction{ + output{ + anyxml data-modification-transaction{ + description "DataModificationTransaction xml"; + } + } + } + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/json/jsondata_leaf_list.json b/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/json/jsondata_leaf_list.json new file mode 100644 index 0000000000..63be4b9d5d --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/json/jsondata_leaf_list.json @@ -0,0 +1,7 @@ +{ + "instance-identifier-module:cont": { + "cont1": { + "augment-module-leaf-list:lf11" : "/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\"lflst11_1\"]" + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/xml/xmldata_leaf_list.xml b/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/xml/xmldata_leaf_list.xml new file mode 100644 index 0000000000..00d58c2cb7 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/xml/xmldata_leaf_list.xml @@ -0,0 +1,8 @@ + + + lflst11_1 + lflst11_2 + lflst11_3 + /a:cont/a:cont1/b:lflst11[.="lflst11_1"] + + diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/yang/augment-module-leaf-list.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/yang/augment-module-leaf-list.yang new file mode 100644 index 0000000000..54c305b208 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/yang/augment-module-leaf-list.yang @@ -0,0 +1,20 @@ +module augment-module-leaf-list { + namespace "augment:module:leaf:list"; + + prefix "amodulelflst"; + + import instance-identifier-module {prefix imodule; revision-date 2014-01-17;} + + revision 2014-01-27 { + } + + augment "/imodule:cont/imodule:cont1" { + leaf-list lflst11 { + type string; + } + leaf lf11 { + type instance-identifier; + } + } + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/iana-if-type.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/iana-if-type.yang new file mode 100644 index 0000000000..7bd0003b5d --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/iana-if-type.yang @@ -0,0 +1,1517 @@ +module iana-if-type { + namespace "urn:ietf:params:xml:ns:yang:iana-if-type"; + prefix ianaift; + + organization "IANA"; + contact + " Internet Assigned Numbers Authority + + Postal: ICANN + 4676 Admiralty Way, Suite 330 + Marina del Rey, CA 90292 + + Tel: +1 310 823 9358 + E-Mail: iana&iana.org"; + description + "This YANG module defines the iana-if-type typedef, which + contains YANG definitions for IANA-registered interface types. + + This YANG module is maintained by IANA, and reflects the + 'ifType definitions' registry. + + The latest revision of this YANG module can be obtained from + the IANA web site. + + Copyright (c) 2011 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC XXXX; see + the RFC itself for full legal notices."; + // RFC Ed.: replace XXXX with actual RFC number and remove this + // note. + + // RFC Ed.: update the date below with the date of RFC publication + // and remove this note. + revision 2013-07-04 { + description + "Initial revision."; + reference + "RFC XXXX: IANA Interface Type YANG Module"; + } + + typedef iana-if-type { + type enumeration { + enum "other" { + value 1; + description + "None of the following"; + } + enum "regular1822" { + value 2; + } + enum "hdh1822" { + value 3; + } + enum "ddnX25" { + value 4; + } + enum "rfc877x25" { + value 5; + reference + "RFC 1382 - SNMP MIB Extension for the X.25 Packet Layer"; + } + enum "ethernetCsmacd" { + value 6; + description + "For all ethernet-like interfaces, regardless of speed, + as per RFC3635."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types."; + } + enum "iso88023Csmacd" { + value 7; + status deprecated; + description + "Deprecated via RFC3635. + Use ethernetCsmacd(6) instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types."; + } + enum "iso88024TokenBus" { + value 8; + } + enum "iso88025TokenRing" { + value 9; + } + enum "iso88026Man" { + value 10; + } + enum "starLan" { + value 11; + status deprecated; + description + "Deprecated via RFC3635. + Use ethernetCsmacd(6) instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types."; + } + enum "proteon10Mbit" { + value 12; + } + enum "proteon80Mbit" { + value 13; + } + enum "hyperchannel" { + value 14; + } + enum "fddi" { + value 15; + reference + "RFC 1512 - FDDI Management Information Base"; + } + enum "lapb" { + value 16; + reference + "RFC 1381 - SNMP MIB Extension for X.25 LAPB"; + } + enum "sdlc" { + value 17; + } + enum "ds1" { + value 18; + description + "DS1-MIB"; + reference + "RFC 4805 - Definitions of Managed Objects for the + DS1, J1, E1, DS2, and E2 Interface Types"; + } + enum "e1" { + value 19; + status obsolete; + description + "Obsolete see DS1-MIB"; + reference + "RFC 4805 - Definitions of Managed Objects for the + DS1, J1, E1, DS2, and E2 Interface Types"; + } + enum "basicISDN" { + value 20; + description + "see also RFC2127"; + } + enum "primaryISDN" { + value 21; + } + enum "propPointToPointSerial" { + value 22; + description + "proprietary serial"; + } + enum "ppp" { + value 23; + } + enum "softwareLoopback" { + value 24; + } + enum "eon" { + value 25; + description + "CLNP over IP"; + } + enum "ethernet3Mbit" { + value 26; + } + enum "nsip" { + value 27; + description + "XNS over IP"; + } + enum "slip" { + value 28; + description + "generic SLIP"; + } + enum "ultra" { + value 29; + description + "ULTRA technologies"; + } + enum "ds3" { + value 30; + description + "DS3-MIB"; + reference + "RFC 3896 - Definitions of Managed Objects for the + DS3/E3 Interface Type"; + } + enum "sip" { + value 31; + description + "SMDS, coffee"; + reference + "RFC 1694 - Definitions of Managed Objects for SMDS + Interfaces using SMIv2"; + } + enum "frameRelay" { + value 32; + description + "DTE only."; + reference + "RFC 2115 - Management Information Base for Frame Relay + DTEs Using SMIv2"; + } + enum "rs232" { + value 33; + reference + "RFC 1659 - Definitions of Managed Objects for RS-232-like + Hardware Devices using SMIv2"; + } + enum "para" { + value 34; + description + "parallel-port"; + reference + "RFC 1660 - Definitions of Managed Objects for + Parallel-printer-like Hardware Devices using + SMIv2"; + } + enum "arcnet" { + value 35; + description + "arcnet"; + } + enum "arcnetPlus" { + value 36; + description + "arcnet plus"; + } + enum "atm" { + value 37; + description + "ATM cells"; + } + enum "miox25" { + value 38; + reference + "RFC 1461 - SNMP MIB extension for Multiprotocol + Interconnect over X.25"; + } + enum "sonet" { + value 39; + description + "SONET or SDH"; + } + enum "x25ple" { + value 40; + reference + "RFC 2127 - ISDN Management Information Base using SMIv2"; + } + enum "iso88022llc" { + value 41; + } + enum "localTalk" { + value 42; + } + enum "smdsDxi" { + value 43; + } + enum "frameRelayService" { + value 44; + description + "FRNETSERV-MIB"; + reference + "RFC 2954 - Definitions of Managed Objects for Frame + Relay Service"; + } + enum "v35" { + value 45; + } + enum "hssi" { + value 46; + } + enum "hippi" { + value 47; + } + enum "modem" { + value 48; + description + "Generic modem"; + } + enum "aal5" { + value 49; + description + "AAL5 over ATM"; + } + enum "sonetPath" { + value 50; + } + enum "sonetVT" { + value 51; + } + enum "smdsIcip" { + value 52; + description + "SMDS InterCarrier Interface"; + } + enum "propVirtual" { + value 53; + description + "proprietary virtual/internal"; + reference + "RFC 2863 - The Interfaces Group MIB"; + } + enum "propMultiplexor" { + value 54; + description + "proprietary multiplexing"; + reference + "RFC 2863 - The Interfaces Group MIB"; + } + enum "ieee80212" { + value 55; + description + "100BaseVG"; + } + enum "fibreChannel" { + value 56; + description + "Fibre Channel"; + } + enum "hippiInterface" { + value 57; + description + "HIPPI interfaces"; + } + enum "frameRelayInterconnect" { + value 58; + status obsolete; + description + "Obsolete use either + frameRelay(32) or frameRelayService(44)."; + } + enum "aflane8023" { + value 59; + description + "ATM Emulated LAN for 802.3"; + } + enum "aflane8025" { + value 60; + description + "ATM Emulated LAN for 802.5"; + } + enum "cctEmul" { + value 61; + description + "ATM Emulated circuit"; + } + enum "fastEther" { + value 62; + status deprecated; + description + "Obsoleted via RFC3635. + ethernetCsmacd(6) should be used instead"; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types."; + } + enum "isdn" { + value 63; + description + "ISDN and X.25"; + reference + "RFC 1356 - Multiprotocol Interconnect on X.25 and ISDN + in the Packet Mode"; + } + enum "v11" { + value 64; + description + "CCITT V.11/X.21"; + } + enum "v36" { + value 65; + description + "CCITT V.36"; + } + enum "g703at64k" { + value 66; + description + "CCITT G703 at 64Kbps"; + } + enum "g703at2mb" { + value 67; + status obsolete; + description + "Obsolete see DS1-MIB"; + } + enum "qllc" { + value 68; + description + "SNA QLLC"; + } + enum "fastEtherFX" { + value 69; + status deprecated; + description + "Obsoleted via RFC3635 + ethernetCsmacd(6) should be used instead"; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types."; + } + enum "channel" { + value 70; + description + "channel"; + } + enum "ieee80211" { + value 71; + description + "radio spread spectrum"; + } + enum "ibm370parChan" { + value 72; + description + "IBM System 360/370 OEMI Channel"; + } + enum "escon" { + value 73; + description + "IBM Enterprise Systems Connection"; + } + enum "dlsw" { + value 74; + description + "Data Link Switching"; + } + enum "isdns" { + value 75; + description + "ISDN S/T interface"; + } + enum "isdnu" { + value 76; + description + "ISDN U interface"; + } + enum "lapd" { + value 77; + description + "Link Access Protocol D"; + } + enum "ipSwitch" { + value 78; + description + "IP Switching Objects"; + } + enum "rsrb" { + value 79; + description + "Remote Source Route Bridging"; + } + enum "atmLogical" { + value 80; + description + "ATM Logical Port"; + reference + "RFC 3606 - Definitions of Supplemental Managed Objects + for ATM Interface"; + } + enum "ds0" { + value 81; + description + "Digital Signal Level 0"; + reference + "RFC 2494 - Definitions of Managed Objects for the DS0 + and DS0 Bundle Interface Type"; + } + enum "ds0Bundle" { + value 82; + description + "group of ds0s on the same ds1"; + reference + "RFC 2494 - Definitions of Managed Objects for the DS0 + and DS0 Bundle Interface Type"; + } + enum "bsc" { + value 83; + description + "Bisynchronous Protocol"; + } + enum "async" { + value 84; + description + "Asynchronous Protocol"; + } + enum "cnr" { + value 85; + description + "Combat Net Radio"; + } + enum "iso88025Dtr" { + value 86; + description + "ISO 802.5r DTR"; + } + enum "eplrs" { + value 87; + description + "Ext Pos Loc Report Sys"; + } + enum "arap" { + value 88; + description + "Appletalk Remote Access Protocol"; + } + enum "propCnls" { + value 89; + description + "Proprietary Connectionless Protocol"; + } + enum "hostPad" { + value 90; + description + "CCITT-ITU X.29 PAD Protocol"; + } + enum "termPad" { + value 91; + description + "CCITT-ITU X.3 PAD Facility"; + } + enum "frameRelayMPI" { + value 92; + description + "Multiproto Interconnect over FR"; + } + enum "x213" { + value 93; + description + "CCITT-ITU X213"; + } + enum "adsl" { + value 94; + description + "Asymmetric Digital Subscriber Loop"; + } + enum "radsl" { + value 95; + description + "Rate-Adapt. Digital Subscriber Loop"; + } + enum "sdsl" { + value 96; + description + "Symmetric Digital Subscriber Loop"; + } + enum "vdsl" { + value 97; + description + "Very H-Speed Digital Subscrib. Loop"; + } + enum "iso88025CRFPInt" { + value 98; + description + "ISO 802.5 CRFP"; + } + enum "myrinet" { + value 99; + description + "Myricom Myrinet"; + } + enum "voiceEM" { + value 100; + description + "voice recEive and transMit"; + } + enum "voiceFXO" { + value 101; + description + "voice Foreign Exchange Office"; + } + enum "voiceFXS" { + value 102; + description + "voice Foreign Exchange Station"; + } + enum "voiceEncap" { + value 103; + description + "voice encapsulation"; + } + enum "voiceOverIp" { + value 104; + description + "voice over IP encapsulation"; + } + enum "atmDxi" { + value 105; + description + "ATM DXI"; + } + enum "atmFuni" { + value 106; + description + "ATM FUNI"; + } + enum "atmIma" { + value 107; + description + "ATM IMA"; + } + enum "pppMultilinkBundle" { + value 108; + description + "PPP Multilink Bundle"; + } + enum "ipOverCdlc" { + value 109; + description + "IBM ipOverCdlc"; + } + enum "ipOverClaw" { + value 110; + description + "IBM Common Link Access to Workstn"; + } + enum "stackToStack" { + value 111; + description + "IBM stackToStack"; + } + enum "virtualIpAddress" { + value 112; + description + "IBM VIPA"; + } + enum "mpc" { + value 113; + description + "IBM multi-protocol channel support"; + } + enum "ipOverAtm" { + value 114; + description + "IBM ipOverAtm"; + reference + "RFC 2320 - Definitions of Managed Objects for Classical IP + and ARP Over ATM Using SMIv2 (IPOA-MIB)"; + } + enum "iso88025Fiber" { + value 115; + description + "ISO 802.5j Fiber Token Ring"; + } + enum "tdlc" { + value 116; + description + "IBM twinaxial data link control"; + } + enum "gigabitEthernet" { + value 117; + status deprecated; + description + "Obsoleted via RFC3635 + ethernetCsmacd(6) should be used instead"; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types."; + } + enum "hdlc" { + value 118; + description + "HDLC"; + } + enum "lapf" { + value 119; + description + "LAP F"; + } + enum "v37" { + value 120; + description + "V.37"; + } + enum "x25mlp" { + value 121; + description + "Multi-Link Protocol"; + } + enum "x25huntGroup" { + value 122; + description + "X25 Hunt Group"; + } + enum "transpHdlc" { + value 123; + description + "Transp HDLC"; + } + enum "interleave" { + value 124; + description + "Interleave channel"; + } + enum "fast" { + value 125; + description + "Fast channel"; + } + enum "ip" { + value 126; + description + "IP (for APPN HPR in IP networks)"; + } + enum "docsCableMaclayer" { + value 127; + description + "CATV Mac Layer"; + } + enum "docsCableDownstream" { + value 128; + description + "CATV Downstream interface"; + } + enum "docsCableUpstream" { + value 129; + description + "CATV Upstream interface"; + } + enum "a12MppSwitch" { + value 130; + description + "Avalon Parallel Processor"; + } + enum "tunnel" { + value 131; + description + "Encapsulation interface"; + } + enum "coffee" { + value 132; + description + "coffee pot"; + reference + "RFC 2325 - Coffee MIB"; + } + enum "ces" { + value 133; + description + "Circuit Emulation Service"; + } + enum "atmSubInterface" { + value 134; + description + "ATM Sub Interface"; + } + enum "l2vlan" { + value 135; + description + "Layer 2 Virtual LAN using 802.1Q"; + } + enum "l3ipvlan" { + value 136; + description + "Layer 3 Virtual LAN using IP"; + } + enum "l3ipxvlan" { + value 137; + description + "Layer 3 Virtual LAN using IPX"; + } + enum "digitalPowerline" { + value 138; + description + "IP over Power Lines"; + } + enum "mediaMailOverIp" { + value 139; + description + "Multimedia Mail over IP"; + } + enum "dtm" { + value 140; + description + "Dynamic syncronous Transfer Mode"; + } + enum "dcn" { + value 141; + description + "Data Communications Network"; + } + enum "ipForward" { + value 142; + description + "IP Forwarding Interface"; + } + enum "msdsl" { + value 143; + description + "Multi-rate Symmetric DSL"; + } + enum "ieee1394" { + value 144; + description + "IEEE1394 High Performance Serial Bus"; + } + enum "if-gsn" { + value 145; + description + "HIPPI-6400"; + } + enum "dvbRccMacLayer" { + value 146; + description + "DVB-RCC MAC Layer"; + } + enum "dvbRccDownstream" { + value 147; + description + "DVB-RCC Downstream Channel"; + } + enum "dvbRccUpstream" { + value 148; + description + "DVB-RCC Upstream Channel"; + } + enum "atmVirtual" { + value 149; + description + "ATM Virtual Interface"; + } + enum "mplsTunnel" { + value 150; + description + "MPLS Tunnel Virtual Interface"; + } + enum "srp" { + value 151; + description + "Spatial Reuse Protocol"; + } + enum "voiceOverAtm" { + value 152; + description + "Voice Over ATM"; + } + enum "voiceOverFrameRelay" { + value 153; + description + "Voice Over Frame Relay"; + } + enum "idsl" { + value 154; + description + "Digital Subscriber Loop over ISDN"; + } + enum "compositeLink" { + value 155; + description + "Avici Composite Link Interface"; + } + enum "ss7SigLink" { + value 156; + description + "SS7 Signaling Link"; + } + enum "propWirelessP2P" { + value 157; + description + "Prop. P2P wireless interface"; + } + enum "frForward" { + value 158; + description + "Frame Forward Interface"; + } + enum "rfc1483" { + value 159; + description + "Multiprotocol over ATM AAL5"; + reference + "RFC 1483 - Multiprotocol Encapsulation over ATM + Adaptation Layer 5"; + } + enum "usb" { + value 160; + description + "USB Interface"; + } + enum "ieee8023adLag" { + value 161; + description + "IEEE 802.3ad Link Aggregate"; + } + enum "bgppolicyaccounting" { + value 162; + description + "BGP Policy Accounting"; + } + enum "frf16MfrBundle" { + value 163; + description + "FRF .16 Multilink Frame Relay"; + } + enum "h323Gatekeeper" { + value 164; + description + "H323 Gatekeeper"; + } + enum "h323Proxy" { + value 165; + description + "H323 Voice and Video Proxy"; + } + enum "mpls" { + value 166; + description + "MPLS"; + } + enum "mfSigLink" { + value 167; + description + "Multi-frequency signaling link"; + } + enum "hdsl2" { + value 168; + description + "High Bit-Rate DSL - 2nd generation"; + } + enum "shdsl" { + value 169; + description + "Multirate HDSL2"; + } + enum "ds1FDL" { + value 170; + description + "Facility Data Link 4Kbps on a DS1"; + } + enum "pos" { + value 171; + description + "Packet over SONET/SDH Interface"; + } + enum "dvbAsiIn" { + value 172; + description + "DVB-ASI Input"; + } + enum "dvbAsiOut" { + value 173; + description + "DVB-ASI Output"; + } + enum "plc" { + value 174; + description + "Power Line Communtications"; + } + enum "nfas" { + value 175; + description + "Non Facility Associated Signaling"; + } + enum "tr008" { + value 176; + description + "TR008"; + } + enum "gr303RDT" { + value 177; + description + "Remote Digital Terminal"; + } + enum "gr303IDT" { + value 178; + description + "Integrated Digital Terminal"; + } + enum "isup" { + value 179; + description + "ISUP"; + } + enum "propDocsWirelessMaclayer" { + value 180; + description + "Cisco proprietary Maclayer"; + } + enum "propDocsWirelessDownstream" { + value 181; + description + "Cisco proprietary Downstream"; + } + enum "propDocsWirelessUpstream" { + value 182; + description + "Cisco proprietary Upstream"; + } + enum "hiperlan2" { + value 183; + description + "HIPERLAN Type 2 Radio Interface"; + } + enum "propBWAp2Mp" { + value 184; + description + "PropBroadbandWirelessAccesspt2multipt use of this value + for IEEE 802.16 WMAN interfaces as per IEEE Std 802.16f + is deprecated and ieee80216WMAN(237) should be used + instead."; + } + enum "sonetOverheadChannel" { + value 185; + description + "SONET Overhead Channel"; + } + enum "digitalWrapperOverheadChannel" { + value 186; + description + "Digital Wrapper"; + } + enum "aal2" { + value 187; + description + "ATM adaptation layer 2"; + } + enum "radioMAC" { + value 188; + description + "MAC layer over radio links"; + } + enum "atmRadio" { + value 189; + description + "ATM over radio links"; + } + enum "imt" { + value 190; + description + "Inter Machine Trunks"; + } + enum "mvl" { + value 191; + description + "Multiple Virtual Lines DSL"; + } + enum "reachDSL" { + value 192; + description + "Long Reach DSL"; + } + enum "frDlciEndPt" { + value 193; + description + "Frame Relay DLCI End Point"; + } + enum "atmVciEndPt" { + value 194; + description + "ATM VCI End Point"; + } + enum "opticalChannel" { + value 195; + description + "Optical Channel"; + } + enum "opticalTransport" { + value 196; + description + "Optical Transport"; + } + enum "propAtm" { + value 197; + description + "Proprietary ATM"; + } + enum "voiceOverCable" { + value 198; + description + "Voice Over Cable Interface"; + } + enum "infiniband" { + value 199; + description + "Infiniband"; + } + enum "teLink" { + value 200; + description + "TE Link"; + } + enum "q2931" { + value 201; + description + "Q.2931"; + } + enum "virtualTg" { + value 202; + description + "Virtual Trunk Group"; + } + enum "sipTg" { + value 203; + description + "SIP Trunk Group"; + } + enum "sipSig" { + value 204; + description + "SIP Signaling"; + } + enum "docsCableUpstreamChannel" { + value 205; + description + "CATV Upstream Channel"; + } + enum "econet" { + value 206; + description + "Acorn Econet"; + } + enum "pon155" { + value 207; + description + "FSAN 155Mb Symetrical PON interface"; + } + enum "pon622" { + value 208; + description + "FSAN622Mb Symetrical PON interface"; + } + enum "bridge" { + value 209; + description + "Transparent bridge interface"; + } + enum "linegroup" { + value 210; + description + "Interface common to multiple lines"; + } + enum "voiceEMFGD" { + value 211; + description + "voice E&M Feature Group D"; + } + enum "voiceFGDEANA" { + value 212; + description + "voice FGD Exchange Access North American"; + } + enum "voiceDID" { + value 213; + description + "voice Direct Inward Dialing"; + } + enum "mpegTransport" { + value 214; + description + "MPEG transport interface"; + } + enum "sixToFour" { + value 215; + status deprecated; + description + "6to4 interface (DEPRECATED)"; + reference + "RFC 4087 - IP Tunnel MIB"; + } + enum "gtp" { + value 216; + description + "GTP (GPRS Tunneling Protocol)"; + } + enum "pdnEtherLoop1" { + value 217; + description + "Paradyne EtherLoop 1"; + } + enum "pdnEtherLoop2" { + value 218; + description + "Paradyne EtherLoop 2"; + } + enum "opticalChannelGroup" { + value 219; + description + "Optical Channel Group"; + } + enum "homepna" { + value 220; + description + "HomePNA ITU-T G.989"; + } + enum "gfp" { + value 221; + description + "Generic Framing Procedure (GFP)"; + } + enum "ciscoISLvlan" { + value 222; + description + "Layer 2 Virtual LAN using Cisco ISL"; + } + enum "actelisMetaLOOP" { + value 223; + description + "Acteleis proprietary MetaLOOP High Speed Link"; + } + enum "fcipLink" { + value 224; + description + "FCIP Link"; + } + enum "rpr" { + value 225; + description + "Resilient Packet Ring Interface Type"; + } + enum "qam" { + value 226; + description + "RF Qam Interface"; + } + enum "lmp" { + value 227; + description + "Link Management Protocol"; + reference + "RFC 4327 - Link Management Protocol (LMP) Management + Information Base (MIB)"; + } + enum "cblVectaStar" { + value 228; + description + "Cambridge Broadband Networks Limited VectaStar"; + } + enum "docsCableMCmtsDownstream" { + value 229; + description + "CATV Modular CMTS Downstream Interface"; + } + enum "adsl2" { + value 230; + status deprecated; + description + "Asymmetric Digital Subscriber Loop Version 2 + (DEPRECATED/OBSOLETED - please use adsl2plus(238) + instead)"; + reference + "RFC 4706 - Definitions of Managed Objects for Asymmetric + Digital Subscriber Line 2 (ADSL2)"; + } + enum "macSecControlledIF" { + value 231; + description + "MACSecControlled"; + } + enum "macSecUncontrolledIF" { + value 232; + description + "MACSecUncontrolled"; + } + enum "aviciOpticalEther" { + value 233; + description + "Avici Optical Ethernet Aggregate"; + } + enum "atmbond" { + value 234; + description + "atmbond"; + } + enum "voiceFGDOS" { + value 235; + description + "voice FGD Operator Services"; + } + enum "mocaVersion1" { + value 236; + description + "MultiMedia over Coax Alliance (MoCA) Interface + as documented in information provided privately to IANA"; + } + enum "ieee80216WMAN" { + value 237; + description + "IEEE 802.16 WMAN interface"; + } + enum "adsl2plus" { + value 238; + description + "Asymmetric Digital Subscriber Loop Version 2, + Version 2 Plus and all variants"; + } + enum "dvbRcsMacLayer" { + value 239; + description + "DVB-RCS MAC Layer"; + reference + "RFC 5728 - The SatLabs Group DVB-RCS MIB"; + } + enum "dvbTdm" { + value 240; + description + "DVB Satellite TDM"; + reference + "RFC 5728 - The SatLabs Group DVB-RCS MIB"; + } + enum "dvbRcsTdma" { + value 241; + description + "DVB-RCS TDMA"; + reference + "RFC 5728 - The SatLabs Group DVB-RCS MIB"; + } + enum "x86Laps" { + value 242; + description + "LAPS based on ITU-T X.86/Y.1323"; + } + enum "wwanPP" { + value 243; + description + "3GPP WWAN"; + } + enum "wwanPP2" { + value 244; + description + "3GPP2 WWAN"; + } + enum "voiceEBS" { + value 245; + description + "voice P-phone EBS physical interface"; + } + enum "ifPwType" { + value 246; + description + "Pseudowire interface type"; + reference + "RFC 5601 - Pseudowire (PW) Management Information Base"; + } + enum "ilan" { + value 247; + description + "Internal LAN on a bridge per IEEE 802.1ap"; + } + enum "pip" { + value 248; + description + "Provider Instance Port on a bridge per IEEE 802.1ah PBB"; + } + enum "aluELP" { + value 249; + description + "Alcatel-Lucent Ethernet Link Protection"; + } + enum "gpon" { + value 250; + description + "Gigabit-capable passive optical networks (G-PON) as per + ITU-T G.948"; + } + enum "vdsl2" { + value 251; + description + "Very high speed digital subscriber line Version 2 + (as per ITU-T Recommendation G.993.2)"; + reference + "RFC 5650 - Definitions of Managed Objects for Very High + Speed Digital Subscriber Line 2 (VDSL2)"; + } + enum "capwapDot11Profile" { + value 252; + description + "WLAN Profile Interface"; + reference + "RFC 5834 - Control and Provisioning of Wireless Access + Points (CAPWAP) Protocol Binding MIB for + IEEE 802.11"; + } + enum "capwapDot11Bss" { + value 253; + description + "WLAN BSS Interface"; + reference + "RFC 5834 - Control and Provisioning of Wireless Access + Points (CAPWAP) Protocol Binding MIB for + IEEE 802.11"; + } + enum "capwapWtpVirtualRadio" { + value 254; + description + "WTP Virtual Radio Interface"; + reference + "RFC 5833 - Control and Provisioning of Wireless Access + Points (CAPWAP) Protocol Base MIB"; + } + enum "bits" { + value 255; + description + "bitsport"; + } + enum "docsCableUpstreamRfPort" { + value 256; + description + "DOCSIS CATV Upstream RF Port"; + } + enum "cableDownstreamRfPort" { + value 257; + description + "CATV downstream RF port"; + } + enum "vmwareVirtualNic" { + value 258; + description + "VMware Virtual Network Interface"; + } + enum "ieee802154" { + value 259; + description + "IEEE 802.15.4 WPAN interface"; + reference + "IEEE 802.15.4-2006"; + } + enum "otnOdu" { + value 260; + description + "OTN Optical Data Unit"; + } + enum "otnOtu" { + value 261; + description + "OTN Optical channel Transport Unit"; + } + enum "ifVfiType" { + value 262; + description + "VPLS Forwarding Instance Interface Type"; + } + enum "g9981" { + value 263; + description + "G.998.1 bonded interface"; + } + enum "g9982" { + value 264; + description + "G.998.2 bonded interface"; + } + enum "g9983" { + value 265; + description + "G.998.3 bonded interface"; + } + enum "aluEpon" { + value 266; + description + "Ethernet Passive Optical Networks (E-PON)"; + } + enum "aluEponOnu" { + value 267; + description + "EPON Optical Network Unit"; + } + enum "aluEponPhysicalUni" { + value 268; + description + "EPON physical User to Network interface"; + } + enum "aluEponLogicalLink" { + value 269; + description + "The emulation of a point-to-point link over the EPON + layer"; + } + enum "aluGponOnu" { + value 270; + description + "GPON Optical Network Unit"; + reference + "ITU-T G.984.2"; + } + enum "aluGponPhysicalUni" { + value 271; + description + "GPON physical User to Network interface"; + reference + "ITU-T G.984.2"; + } + enum "vmwareNicTeam" { + value 272; + description + "VMware NIC Team"; + } + // value 273 reserved by IANA + } + description + "This data type is used as the syntax of the 'type' + leaf in the 'interface' list in the YANG module + ietf-interface. + + The definition of this typedef with the + addition of newly assigned values is published + periodically by the IANA, in either the Assigned + Numbers RFC, or some derivative of it specific to + Internet Network Management number assignments. (The + latest arrangements can be obtained by contacting the + IANA.) + + Requests for new values should be made to IANA via + email (iana&iana.org)."; + reference + "IANA ifType definitions registry. + "; + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-inet-types.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-inet-types.yang new file mode 100644 index 0000000000..de20febbb7 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-inet-types.yang @@ -0,0 +1,418 @@ + module ietf-inet-types { + + namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types"; + prefix "inet"; + + organization + "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; + + contact + "WG Web: + WG List: + + WG Chair: David Partain + + + WG Chair: David Kessens + + + Editor: Juergen Schoenwaelder + "; + + description + "This module contains a collection of generally useful derived + YANG data types for Internet addresses and related things. + + Copyright (c) 2010 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in Section + 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 6021; see + the RFC itself for full legal notices."; + + revision 2010-09-24 { + description + "Initial revision."; + reference + "RFC 6021: Common YANG Data Types"; + } + + /*** collection of protocol field related types ***/ + + typedef ip-version { + type enumeration { + enum unknown { + value "0"; + description + "An unknown or unspecified version of the Internet protocol."; + } + enum ipv4 { + value "1"; + description + "The IPv4 protocol as defined in RFC 791."; + } + enum ipv6 { + value "2"; + description + "The IPv6 protocol as defined in RFC 2460."; + } + } + description + "This value represents the version of the IP protocol. + + In the value set and its semantics, this type is equivalent + to the InetVersion textual convention of the SMIv2."; + reference + "RFC 791: Internet Protocol + RFC 2460: Internet Protocol, Version 6 (IPv6) Specification + RFC 4001: Textual Conventions for Internet Network Addresses"; + } + + typedef dscp { + type uint8 { + range "0..63"; + } + description + "The dscp type represents a Differentiated Services Code-Point + that may be used for marking packets in a traffic stream. + + In the value set and its semantics, this type is equivalent + to the Dscp textual convention of the SMIv2."; + reference + "RFC 3289: Management Information Base for the Differentiated + Services Architecture + RFC 2474: Definition of the Differentiated Services Field + (DS Field) in the IPv4 and IPv6 Headers + RFC 2780: IANA Allocation Guidelines For Values In + the Internet Protocol and Related Headers"; + } + + typedef ipv6-flow-label { + type uint32 { + range "0..1048575"; + } + description + "The flow-label type represents flow identifier or Flow Label + in an IPv6 packet header that may be used to discriminate + traffic flows. + + In the value set and its semantics, this type is equivalent + to the IPv6FlowLabel textual convention of the SMIv2."; + reference + "RFC 3595: Textual Conventions for IPv6 Flow Label + RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"; + } + + typedef port-number { + type uint16 { + range "0..65535"; + } + description + "The port-number type represents a 16-bit port number of an + Internet transport layer protocol such as UDP, TCP, DCCP, or + SCTP. Port numbers are assigned by IANA. A current list of + all assignments is available from . + + Note that the port number value zero is reserved by IANA. In + situations where the value zero does not make sense, it can + be excluded by subtyping the port-number type. + + In the value set and its semantics, this type is equivalent + to the InetPortNumber textual convention of the SMIv2."; + reference + "RFC 768: User Datagram Protocol + RFC 793: Transmission Control Protocol + RFC 4960: Stream Control Transmission Protocol + RFC 4340: Datagram Congestion Control Protocol (DCCP) + RFC 4001: Textual Conventions for Internet Network Addresses"; + } + + /*** collection of autonomous system related types ***/ + + typedef as-number { + type uint32; + description + "The as-number type represents autonomous system numbers + which identify an Autonomous System (AS). An AS is a set + of routers under a single technical administration, using + an interior gateway protocol and common metrics to route + packets within the AS, and using an exterior gateway + protocol to route packets to other ASs'. IANA maintains + the AS number space and has delegated large parts to the + regional registries. + + Autonomous system numbers were originally limited to 16 + bits. BGP extensions have enlarged the autonomous system + number space to 32 bits. This type therefore uses an uint32 + base type without a range restriction in order to support + a larger autonomous system number space. + + In the value set and its semantics, this type is equivalent + to the InetAutonomousSystemNumber textual convention of + the SMIv2."; + reference + "RFC 1930: Guidelines for creation, selection, and registration + of an Autonomous System (AS) + RFC 4271: A Border Gateway Protocol 4 (BGP-4) + RFC 4893: BGP Support for Four-octet AS Number Space + RFC 4001: Textual Conventions for Internet Network Addresses"; + } + + /*** collection of IP address and hostname related types ***/ + + typedef ip-address { + type union { + type inet:ipv4-address; + type inet:ipv6-address; + } + description + "The ip-address type represents an IP address and is IP + version neutral. The format of the textual representations + implies the IP version."; + } + + typedef ipv4-address { + type string { + pattern + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' + + '(%[\p{N}\p{L}]+)?'; + } + description + "The ipv4-address type represents an IPv4 address in + dotted-quad notation. The IPv4 address may include a zone + index, separated by a % sign. + + The zone index is used to disambiguate identical address + values. For link-local addresses, the zone index will + typically be the interface index number or the name of an + interface. If the zone index is not present, the default + zone of the device will be used. + + The canonical format for the zone index is the numerical + format"; + } + + typedef ipv6-address { + type string { + pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' + + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' + + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' + + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' + + '(%[\p{N}\p{L}]+)?'; + pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' + + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' + + '(%.+)?'; + } + description + "The ipv6-address type represents an IPv6 address in full, + mixed, shortened, and shortened-mixed notation. The IPv6 + address may include a zone index, separated by a % sign. + + The zone index is used to disambiguate identical address + values. For link-local addresses, the zone index will + typically be the interface index number or the name of an + interface. If the zone index is not present, the default + zone of the device will be used. + + The canonical format of IPv6 addresses uses the compressed + format described in RFC 4291, Section 2.2, item 2 with the + following additional rules: the :: substitution must be + applied to the longest sequence of all-zero 16-bit chunks + in an IPv6 address. If there is a tie, the first sequence + of all-zero 16-bit chunks is replaced by ::. Single + all-zero 16-bit chunks are not compressed. The canonical + format uses lowercase characters and leading zeros are + not allowed. The canonical format for the zone index is + the numerical format as described in RFC 4007, Section + 11.2."; + reference + "RFC 4291: IP Version 6 Addressing Architecture + RFC 4007: IPv6 Scoped Address Architecture + RFC 5952: A Recommendation for IPv6 Address Text Representation"; + } + + typedef ip-prefix { + type union { + type inet:ipv4-prefix; + type inet:ipv6-prefix; + } + description + "The ip-prefix type represents an IP prefix and is IP + version neutral. The format of the textual representations + implies the IP version."; + } + + typedef ipv4-prefix { + type string { + pattern + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' + + '/(([0-9])|([1-2][0-9])|(3[0-2]))'; + } + description + "The ipv4-prefix type represents an IPv4 address prefix. + The prefix length is given by the number following the + slash character and must be less than or equal to 32. + + A prefix length value of n corresponds to an IP address + mask that has n contiguous 1-bits from the most + significant bit (MSB) and all other bits set to 0. + + The canonical format of an IPv4 prefix has all bits of + the IPv4 address set to zero that are not part of the + IPv4 prefix."; + } + + typedef ipv6-prefix { + type string { + pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' + + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' + + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' + + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' + + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'; + pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' + + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' + + '(/.+)'; + } + description + "The ipv6-prefix type represents an IPv6 address prefix. + The prefix length is given by the number following the + slash character and must be less than or equal 128. + + A prefix length value of n corresponds to an IP address + mask that has n contiguous 1-bits from the most + significant bit (MSB) and all other bits set to 0. + + The IPv6 address should have all bits that do not belong + to the prefix set to zero. + + The canonical format of an IPv6 prefix has all bits of + the IPv6 address set to zero that are not part of the + IPv6 prefix. Furthermore, IPv6 address is represented + in the compressed format described in RFC 4291, Section + 2.2, item 2 with the following additional rules: the :: + substitution must be applied to the longest sequence of + all-zero 16-bit chunks in an IPv6 address. If there is + a tie, the first sequence of all-zero 16-bit chunks is + replaced by ::. Single all-zero 16-bit chunks are not + compressed. The canonical format uses lowercase + characters and leading zeros are not allowed."; + reference + "RFC 4291: IP Version 6 Addressing Architecture"; + } + + /*** collection of domain name and URI types ***/ + + typedef domain-name { + type string { + pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' + + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' + + '|\.'; + length "1..253"; + } + description + "The domain-name type represents a DNS domain name. The + name SHOULD be fully qualified whenever possible. + + Internet domain names are only loosely specified. Section + 3.5 of RFC 1034 recommends a syntax (modified in Section + 2.1 of RFC 1123). The pattern above is intended to allow + for current practice in domain name use, and some possible + future expansion. It is designed to hold various types of + domain names, including names used for A or AAAA records + (host names) and other records, such as SRV records. Note + that Internet host names have a stricter syntax (described + in RFC 952) than the DNS recommendations in RFCs 1034 and + 1123, and that systems that want to store host names in + schema nodes using the domain-name type are recommended to + adhere to this stricter standard to ensure interoperability. + + The encoding of DNS names in the DNS protocol is limited + to 255 characters. Since the encoding consists of labels + prefixed by a length bytes and there is a trailing NULL + byte, only 253 characters can appear in the textual dotted + notation. + + The description clause of schema nodes using the domain-name + type MUST describe when and how these names are resolved to + IP addresses. Note that the resolution of a domain-name value + may require to query multiple DNS records (e.g., A for IPv4 + and AAAA for IPv6). The order of the resolution process and + which DNS record takes precedence can either be defined + explicitely or it may depend on the configuration of the + resolver. + + Domain-name values use the US-ASCII encoding. Their canonical + format uses lowercase US-ASCII characters. Internationalized + domain names MUST be encoded in punycode as described in RFC + 3492"; + reference + "RFC 952: DoD Internet Host Table Specification + RFC 1034: Domain Names - Concepts and Facilities + RFC 1123: Requirements for Internet Hosts -- Application + and Support + RFC 2782: A DNS RR for specifying the location of services + (DNS SRV) + RFC 3492: Punycode: A Bootstring encoding of Unicode for + Internationalized Domain Names in Applications + (IDNA) + RFC 5891: Internationalizing Domain Names in Applications + (IDNA): Protocol"; + } + + typedef host { + type union { + type inet:ip-address; + type inet:domain-name; + } + description + "The host type represents either an IP address or a DNS + domain name."; + } + + typedef uri { + type string; + description + "The uri type represents a Uniform Resource Identifier + (URI) as defined by STD 66. + + Objects using the uri type MUST be in US-ASCII encoding, + and MUST be normalized as described by RFC 3986 Sections + 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary + percent-encoding is removed, and all case-insensitive + characters are set to lowercase except for hexadecimal + digits, which are normalized to uppercase as described in + Section 6.2.2.1. + + The purpose of this normalization is to help provide + unique URIs. Note that this normalization is not + sufficient to provide uniqueness. Two URIs that are + textually distinct after this normalization may still be + equivalent. + + Objects using the uri type may restrict the schemes that + they permit. For example, 'data:' and 'urn:' schemes + might not be appropriate. + + A zero-length URI is not a valid URI. This can be used to + express 'URI absent' where required. + + In the value set and its semantics, this type is equivalent + to the Uri SMIv2 textual convention defined in RFC 5017."; + reference + "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax + RFC 3305: Report from the Joint W3C/IETF URI Planning Interest + Group: Uniform Resource Identifiers (URIs), URLs, + and Uniform Resource Names (URNs): Clarifications + and Recommendations + RFC 5017: MIB Textual Conventions for Uniform Resource + Identifiers (URIs)"; + } + + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-interfaces@2013-07-04.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-interfaces@2013-07-04.yang new file mode 100644 index 0000000000..9db753c440 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-interfaces@2013-07-04.yang @@ -0,0 +1,673 @@ +module ietf-interfaces { + + namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces"; + prefix if; + + import ietf-yang-types { + prefix yang; + } + import iana-if-type { + prefix ianaift; + } + + organization + "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; + + contact + "WG Web: + WG List: + + WG Chair: David Kessens + + + WG Chair: Juergen Schoenwaelder + + + Editor: Martin Bjorklund + "; + + description + "This module contains a collection of YANG definitions for + managing network interfaces. + + Copyright (c) 2013 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC XXXX; see + the RFC itself for full legal notices."; + + // RFC Ed.: replace XXXX with actual RFC number and remove this + // note. + + // RFC Ed.: update the date below with the date of RFC publication + // and remove this note. + revision 2013-07-04 { + description + "Initial revision."; + reference + "RFC XXXX: A YANG Data Model for Interface Management"; + } + + /* Typedefs */ + + typedef interface-ref { + type leafref { + path "/if:interfaces/if:interface/if:name"; + } + description + "This type is used by data models that need to reference + configured interfaces."; + } + + typedef interface-state-ref { + type leafref { + path "/if:interfaces-state/if:interface/if:name"; + } + description + "This type is used by data models that need to reference + the operationally present interfaces."; + } + + /* Features */ + + feature arbitrary-names { + description + "This feature indicates that the device allows user-controlled + interfaces to be named arbitrarily."; + } + + feature pre-provisioning { + description + "This feature indicates that the device supports + pre-provisioning of interface configuration, i.e., it is + possible to configure an interface whose physical interface + hardware is not present on the device."; + } + + feature if-mib { + description + "This feature indicates that the device implements IF-MIB."; + reference + "RFC 2863: The Interfaces Group MIB"; + } + + /* Data nodes */ + + container interfaces { + description + "Interface configuration parameters."; + + list interface { + key "name"; + + description + "The list of configured interfaces on the device. + + The operational state of an interface is available in the + /interfaces-state/interface list. If the configuration of a + system-controlled interface cannot be used by the system + (e.g., the interface hardware present does not match the + interface type), then the configuration is not applied to + the system-controlled interface shown in the + /interfaces-state/interface list. If the the configuration + of a user-controlled interface cannot be used by the system, + the configured interface is not instantiated in the + /interfaces-state/interface list."; + + leaf name { + type string; + description + "The name of the interface. + + A device MAY restrict the allowed values for this leaf, + possibly depending on the type of the interface. + + For system-controlled interfaces, this leaf is the + device-specific name of the interface. The 'config false' + list /interfaces-state/interface contains the currently + existing interfaces on the device. + + If a client tries to create configuration for a + system-controlled interface that is not present in the + /interfaces-state/interface list, the server MAY reject + the request, if the implementation does not support + pre-provisioning of interfaces, or if the name refers to + an interface that can never exist in the system. A + NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case. + + If the device supports pre-provisioning of interface + configuration, the feature 'pre-provisioning' is + advertised. + + If the device allows arbitrarily named user-controlled + interfaces, the feature 'arbitrary-names' is advertised. + + When a configured user-controlled interface is created by + the system, it is instantiated with the same name in the + /interface-state/interface list. Since the name in that + list MAY be mapped to ifName by an implementation, such an + implementation MUST restrict the allowed values for this + leaf so that it matches the restrictions of ifName. + + If a NETCONF server that implements this restriction is + sent a value that doesn't match the restriction, it MUST + reply with an rpc-error with the error-tag + 'invalid-value'."; + } + + leaf description { + type string; + description + "A textual description of the interface. + + This leaf MAY be mapped to ifAlias by an implementation. + Such an implementation MUST restrict the allowed values + for this leaf so that it matches the restrictions of + ifAlias. + + If a NETCONF server that implements this restriction is + sent a value that doesn't match the restriction, it MUST + reply with an rpc-error with the error-tag + 'invalid-value'. + + Since ifAlias is defined to be stored in non-volatile + storage, the MIB implementation MUST map ifAlias to the + value of 'description' in the persistently stored + datastore. + + Specifically, if the device supports ':startup', when + ifAlias is read the device MUST return the value of + 'description' in the 'startup' datastore, and when it is + written, it MUST be written to the 'running' and 'startup' + datastores. Note that it is up to the implementation if + it modifies this single leaf in 'startup', or if it + performs an implicit copy-config from 'running' to + 'startup'. + + If the device does not support ':startup', ifAlias MUST + be mapped to the 'description' leaf in the 'running' + datastore."; + reference + "RFC 2863: The Interfaces Group MIB - ifAlias"; + } + + leaf type { + type ianaift:iana-if-type; + mandatory true; + description + "The type of the interface. + + When an interface entry is created, a server MAY + initialize the type leaf with a valid value, e.g., if it + is possible to derive the type from the name of the + interface. + + If a client tries to set the type of an interface to a + value that can never be used by the system, e.g., if the + type is not supported or if the type does not match the + name of the interface, the server MUST reject the request. + A NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf enabled { + type boolean; + default "true"; + description + "This leaf contains the configured, desired state of the + interface. + + Systems that implement the IF-MIB use the value of this + leaf in the 'running' datastore to set + IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry + has been initialized, as described in RFC 2863. + + Changes in this leaf in the 'running' datastore are + reflected in ifAdminStatus, but if ifAdminStatus is + changed over SNMP, this leaf is not affected."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf link-up-down-trap-enable { + if-feature if-mib; + type enumeration { + enum enabled { + value 1; + } + enum disabled { + value 2; + } + } + description + "Controls whether linkUp/linkDown SNMP notifications + should be generated for this interface. + + If this node is not configured, the value 'enabled' is + operationally used by the server for interfaces which do + not operate on top of any other interface (i.e., there are + no 'lower-layer-if' entries), and 'disabled' otherwise."; + reference + "RFC 2863: The Interfaces Group MIB - + ifLinkUpDownTrapEnable"; + } + } + } + + container interfaces-state { + config false; + description + "Data nodes for the operational state of interfaces."; + + list interface { + key "name"; + + description + "The list of interfaces on the device. + + System-controlled interfaces created by the system are + always present in this list, whether they are configured or + not."; + + leaf name { + type string; + description + "The name of the interface. + + This leaf MAY be mapped to ifName by an implementation."; + reference + "RFC 2863: The Interfaces Group MIB - ifName"; + } + + leaf type { + type ianaift:iana-if-type; + mandatory true; + description + "The type of the interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf admin-status { + if-feature if-mib; + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "Not ready to pass packets and not in some test mode."; + } + enum testing { + value 3; + description + "In some test mode."; + } + } + mandatory true; + description + "The desired state of the interface. + + This leaf has the same read semantics as ifAdminStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf oper-status { + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "The interface does not pass any packets."; + } + enum testing { + value 3; + description + "In some test mode. No operational packets can + be passed."; + } + enum unknown { + value 4; + description + "Status cannot be determined for some reason."; + } + enum dormant { + value 5; + description + "Waiting for some external event."; + } + enum not-present { + value 6; + description + "Some component (typically hardware) is missing."; + } + enum lower-layer-down { + value 7; + description + "Down due to state of lower-layer interface(s)."; + } + } + mandatory true; + description + "The current operational state of the interface. + + This leaf has the same semantics as ifOperStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifOperStatus"; + } + + leaf last-change { + type yang:date-and-time; + description + "The time the interface entered its current operational + state. If the current state was entered prior to the + last re-initialization of the local network management + subsystem, then this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifLastChange"; + } + + leaf if-index { + if-feature if-mib; + type int32 { + range "1..2147483647"; + } + mandatory true; + description + "The ifIndex value for the ifEntry represented by this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifIndex"; + } + + leaf phys-address { + type yang:phys-address; + description + "The interface's address at its protocol sub-layer. For + example, for an 802.x interface, this object normally + contains a MAC address. The interface's media-specific + modules must define the bit and byte ordering and the + format of the value of this object. For interfaces that do + not have such an address (e.g., a serial line), this node + is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifPhysAddress"; + } + + leaf-list higher-layer-if { + type interface-state-ref; + description + "A list of references to interfaces layered on top of this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf-list lower-layer-if { + type interface-state-ref; + description + "A list of references to interfaces layered underneath this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf speed { + type yang:gauge64; + units "bits / second"; + description + "An estimate of the interface's current bandwidth in bits + per second. For interfaces that do not vary in + bandwidth or for those where no accurate estimation can + be made, this node should contain the nominal bandwidth. + For interfaces that have no concept of bandwidth, this + node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - + ifSpeed, ifHighSpeed"; + } + + container statistics { + description + "A collection of interface-related statistics objects."; + + leaf discontinuity-time { + type yang:date-and-time; + mandatory true; + description + "The time on the most recent occasion at which any one or + more of this interface's counters suffered a + discontinuity. If no such discontinuities have occurred + since the last re-initialization of the local management + subsystem, then this node contains the time the local + management subsystem re-initialized itself."; + } + + leaf in-octets { + type yang:counter64; + description + "The total number of octets received on the interface, + including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInOctets"; + } + leaf in-unicast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, which were not addressed to a + multicast or broadcast address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts"; + } + leaf in-broadcast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, which were addressed to a broadcast + address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInBroadcastPkts"; + } + leaf in-multicast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, which were addressed to a multicast + address at this sub-layer. For a MAC layer protocol, + this includes both Group and Functional addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInMulticastPkts"; + } + leaf in-discards { + type yang:counter32; + description + "The number of inbound packets which were chosen to be + discarded even though no errors had been detected to + prevent their being deliverable to a higher-layer + protocol. One possible reason for discarding such a + packet could be to free up buffer space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInDiscards"; + } + leaf in-errors { + type yang:counter32; + description + "For packet-oriented interfaces, the number of inbound + packets that contained errors preventing them from being + deliverable to a higher-layer protocol. For character- + oriented or fixed-length interfaces, the number of + inbound transmission units that contained errors + preventing them from being deliverable to a higher-layer + protocol. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInErrors"; + } + leaf in-unknown-protos { + type yang:counter32; + description + "For packet-oriented interfaces, the number of packets + received via the interface which were discarded because + of an unknown or unsupported protocol. For + character-oriented or fixed-length interfaces that + support protocol multiplexing the number of transmission + units received via the interface which were discarded + because of an unknown or unsupported protocol. For any + interface that does not support protocol multiplexing, + this counter is not present. + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos"; + } + + leaf out-octets { + type yang:counter64; + description + "The total number of octets transmitted out of the + interface, including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutOctets"; + } + leaf out-unicast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and which were not addressed + to a multicast or broadcast address at this sub-layer, + including those that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts"; + } + leaf out-broadcast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and which were addressed to a + broadcast address at this sub-layer, including those + that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutBroadcastPkts"; + } + leaf out-multicast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and which were addressed to a + multicast address at this sub-layer, including those + that were discarded or not sent. For a MAC layer + protocol, this includes both Group and Functional + addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutMulticastPkts"; + } + leaf out-discards { + type yang:counter32; + description + "The number of outbound packets which were chosen to be + discarded even though no errors had been detected to + prevent their being transmitted. One possible reason + for discarding such a packet could be to free up buffer + space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutDiscards"; + } + leaf out-errors { + type yang:counter32; + description + "For packet-oriented interfaces, the number of outbound + packets that could not be transmitted because of errors. + For character-oriented or fixed-length interfaces, the + number of outbound transmission units that could not be + transmitted because of errors. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutErrors"; + } + } + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-restconf@2013-10-19.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-restconf@2013-10-19.yang new file mode 100644 index 0000000000..16766b0979 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-restconf@2013-10-19.yang @@ -0,0 +1,684 @@ +module ietf-restconf { + namespace "urn:ietf:params:xml:ns:yang:ietf-restconf"; + prefix "restconf"; + + import ietf-yang-types { prefix yang; } + import ietf-inet-types { prefix inet; } + + organization + "IETF NETCONF (Network Configuration) Working Group"; + + contact + "Editor: Andy Bierman + + + Editor: Martin Bjorklund + + + Editor: Kent Watsen + + + Editor: Rex Fernando + "; + + description + "This module contains conceptual YANG specifications + for the YANG Patch and error content that is used in + RESTCONF protocol messages. A conceptual container + representing the RESTCONF API nodes (media type + application/yang.api). + + Note that the YANG definitions within this module do not + represent configuration data of any kind. + The YANG grouping statements provide a normative syntax + for XML and JSON message encoding purposes. + Copyright (c) 2013 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC XXXX; see + the RFC itself for full legal notices."; + + // RFC Ed.: replace XXXX with actual RFC number and remove this + // note. + + // RFC Ed.: remove this note + // Note: extracted from draft-bierman-netconf-restconf-02.txt + + // RFC Ed.: update the date below with the date of RFC publication + // and remove this note. + revision 2013-10-19 { + description + "Initial revision."; + reference + "RFC XXXX: RESTCONF Protocol."; + } + + typedef data-resource-identifier { + type string { + length "1 .. max"; + } + description + "Contains a Data Resource Identifier formatted string + to identify a specific data node. The data node that + uses this data type SHOULD define the document root + for data resource identifiers. The default document + root is the target datastore conceptual root node. + Data resource identifiers are defined relative to + this document root."; + reference + "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]"; + } + + // this typedef is TBD; not currently used + typedef datastore-identifier { + type union { + type enumeration { + enum candidate { + description + "Identifies the NETCONF shared candidate datastore."; + reference + "RFC 6241, section 8.3"; + } + enum running { + description + "Identifies the NETCONF running datastore."; + reference + "RFC 6241, section 5.1"; + } + enum startup { + description + "Identifies the NETCONF startup datastore."; + reference + "RFC 6241, section 8.7"; + } + } + type string; + } + description + "Contains a string to identify a specific datastore. + The enumerated datastore identifier values are + reserved for standard datastore names."; + } + + typedef revision-identifier { + type string { + pattern '\d{4}-\d{2}-\d{2}'; + } + description + "Represents a specific date in YYYY-MM-DD format. + TBD: make pattern more precise to exclude leading zeros."; + } + + grouping yang-patch { + description + "A grouping that contains a YANG container + representing the syntax and semantics of a + YANG Patch edit request message."; + + container yang-patch { + description + "Represents a conceptual sequence of datastore edits, + called a patch. Each patch is given a client-assigned + patch identifier. Each edit MUST be applied + in ascending order, and all edits MUST be applied. + If any errors occur, then the target datastore MUST NOT + be changed by the patch operation. + + A patch MUST be validated by the server to be a + well-formed message before any of the patch edits + are validated or attempted. + + YANG datastore validation (defined in RFC 6020, section + 8.3.3) is performed after all edits have been + individually validated. + + It is possible for a datastore constraint violation to occur + due to any node in the datastore, including nodes not + included in the edit list. Any validation errors MUST + be reported in the reply message."; + + reference + "RFC 6020, section 8.3."; + + leaf patch-id { + type string; + description + "An arbitrary string provided by the client to identify + the entire patch. This value SHOULD be present in any + audit logging records generated by the server for the + patch. Error messages returned by the server pertaining + to this patch will be identified by this patch-id value."; + } + + leaf comment { + type string { + length "0 .. 1024"; + } + description + "An arbitrary string provided by the client to describe + the entire patch. This value SHOULD be present in any + audit logging records generated by the server for the + patch."; + } + + list edit { + key edit-id; + ordered-by user; + + description + "Represents one edit within the YANG Patch + request message."; + leaf edit-id { + type string; + description + "Arbitrary string index for the edit. + Error messages returned by the server pertaining + to a specific edit will be identified by this + value."; + } + + leaf operation { + type enumeration { + enum create { + description + "The target data node is created using the + supplied value, only if it does not already + exist."; + } + enum delete { + description + "Delete the target node, only if the data resource + currently exists, otherwise return an error."; + } + enum insert { + description + "Insert the supplied value into a user-ordered + list or leaf-list entry. The target node must + represent a new data resource."; + } + enum merge { + description + "The supplied value is merged with the target data + node."; + } + enum move { + description + "Move the target node. Reorder a user-ordered + list or leaf-list. The target node must represent + an existing data resource."; + } + enum replace { + description + "The supplied value is used to replace the target + data node."; + } + enum remove { + description + "Delete the target node if it currently exists."; + } + } + mandatory true; + description + "The datastore operation requested for the associated + edit entry"; + } + + leaf target { + type data-resource-identifier; + mandatory true; + description + "Identifies the target data resource for the edit + operation."; + } + + leaf point { + when "(../operation = 'insert' or " + + "../operation = 'move') and " + + "(../where = 'before' or ../where = 'after')" { + description + "Point leaf only applies for insert or move + operations, before or after an existing entry."; + } + type data-resource-identifier; + description + "The absolute URL path for the data node that is being + used as the insertion point or move point for the + target of this edit entry."; + } + + leaf where { + when "../operation = 'insert' or ../operation = 'move'" { + description + "Where leaf only applies for insert or move + operations."; + } + type enumeration { + enum before { + description + "Insert or move a data node before the data resource + identified by the 'point' parameter."; + } + enum after { + description + "Insert or move a data node after the data resource + identified by the 'point' parameter."; + } + enum first { + description + "Insert or move a data node so it becomes ordered + as the first entry."; + } + enum last { + description + "Insert or move a data node so it becomes ordered + as the last entry."; + } + + } + default last; + description + "Identifies where a data resource will be inserted or + moved. YANG only allows these operations for + list and leaf-list data nodes that are ordered-by + user."; + } + + anyxml value { + when "(../operation = 'create' or " + + "../operation = 'merge' " + + "or ../operation = 'replace' or " + + "../operation = 'insert')" { + description + "Value node only used for create, merge, + replace, and insert operations"; + } + description + "Value used for this edit operation."; + } + } + } + + } // grouping yang-patch + + + grouping yang-patch-status { + + description + "A grouping that contains a YANG container + representing the syntax and semantics of + YANG Patch status response message."; + + container yang-patch-status { + description + "A container representing the response message + sent by the server after a YANG Patch edit + request message has been processed."; + + leaf patch-id { + type string; + description + "The patch-id value used in the request"; + } + + choice global-status { + description + "Report global errors or complete success. + If there is no case selected then errors + are reported in the edit-status container."; + + case global-errors { + uses errors; + description + "This container will be present if global + errors unrelated to a specific edit occurred."; + } + leaf ok { + type empty; + description + "This leaf will be present if the request succeeded + and there are no errors reported in the edit-status + container."; + } + } + + container edit-status { + description + "This container will be present if there are + edit-specific status responses to report."; + + list edit { + key edit-id; + + description + "Represents a list of status responses, + corresponding to edits in the YANG Patch + request message. If an edit entry was + skipped or not reached by the server, + then this list will not contain a corresponding + entry for that edit."; + + leaf edit-id { + type string; + description + "Response status is for the edit list entry + with this edit-id value."; + } + choice edit-status-choice { + description + "A choice between different types of status + responses for each edit entry."; + leaf ok { + type empty; + description + "This edit entry was invoked without any + errors detected by the server associated + with this edit."; + } + leaf location { + type inet:uri; + description + "Contains the Location header value that would be + returned if this edit causes a new resource to be + created. If the edit identified by the same edit-id + value was successfully invoked and a new resource + was created, then this field will be returned + instead of 'ok'."; + } + case errors { + uses errors; + description + "The server detected errors associated with the + edit identified by the same edit-id value."; + } + } + } + } + } + } // grouping yang-patch-status + + + grouping errors { + + description + "A grouping that contains a YANG container + representing the syntax and semantics of a + YANG Patch errors report within a response message."; + + container errors { + config false; // needed so list error does not need a key + description + "Represents an error report returned by the server if + a request results in an error."; + + list error { + description + "An entry containing information about one + specific error that occurred while processing + a RESTCONF request."; + reference "RFC 6241, Section 4.3"; + + leaf error-type { + type enumeration { + enum transport { + description "The transport layer"; + } + enum rpc { + description "The rpc or notification layer"; + } + enum protocol { + description "The protocol operation layer"; + } + enum application { + description "The server application layer"; + } + } + mandatory true; + description + "The protocol layer where the error occurred."; + } + + leaf error-tag { + type string; + mandatory true; + description + "The enumerated error tag."; + } + + leaf error-app-tag { + type string; + description + "The application-specific error tag."; + } + + leaf error-path { + type data-resource-identifier; + description + "The target data resource identifier associated + with the error, if any."; + } + leaf error-message { + type string; + description + "A message describing the error."; + } + + container error-info { + description + "A container allowing additional information + to be included in the error report."; + // arbitrary anyxml content here + } + } + } + } // grouping errors + + + grouping restconf { + + description + "A grouping that contains a YANG container + representing the syntax and semantics of + the RESTCONF API resource."; + + container restconf { + description + "Conceptual container representing the + application/yang.api resource type."; + + container config { + description + "Container representing the application/yang.datastore + resource type. Represents the conceptual root of the + unified configuration datastore containing YANG data + nodes. The child nodes of this container are + configuration data resources (application/yang.data) + defined as top-level YANG data nodes from the modules + advertised by the server in /restconf/modules."; + } + + container operational { + description + "Container representing the application/yang.datastore + resource type. Represents the conceptual root of the + operational data supported by the server. The child + nodes of this container are operational data resources + (application/yang.data) defined as top-level + YANG data nodes from the modules advertised by + the server in /restconf/modules."; + } + + container modules { + description + "Contains a list of module description entries. + These modules are currently loaded into the server."; + + list module { + key "name revision"; + description + "Each entry represents one module currently + supported by the server."; + + leaf name { + type yang:yang-identifier; + description "The YANG module name."; + } + leaf revision { + type union { + type revision-identifier; + type string { length 0; } + } + description + "The YANG module revision date. An empty string is + used if no revision statement is present in the + YANG module."; + } + leaf namespace { + type inet:uri; + mandatory true; + description + "The XML namespace identifier for this module."; + } + leaf-list feature { + type yang:yang-identifier; + description + "List of YANG feature names from this module that are + supported by the server."; + } + leaf-list deviation { + type yang:yang-identifier; + description + "List of YANG deviation module names used by this + server to modify the conformance of the module + associated with this entry."; + } + } + } + + container operations { + description + "Container for all operation resources + (application/yang.operation), + + Each resource is represented as an empty leaf with the + name of the RPC operation from the YANG rpc statement. + + E.g.; + + POST /restconf/operations/show-log-errors + + leaf show-log-errors { + type empty; + } + "; + } + + container streams { + description + "Container representing the notification event streams + supported by the server."; + reference + "RFC 5277, Section 3.4, element."; + + list stream { + key name; + description + "Each entry describes an event stream supported by + the server."; + + leaf name { + type string; + description "The stream name"; + reference "RFC 5277, Section 3.4, element."; + } + + leaf description { + type string; + description "Description of stream content"; + reference + "RFC 5277, Section 3.4, element."; + } + + leaf replay-support { + type boolean; + description + "Indicates if replay buffer supported for this stream"; + reference + "RFC 5277, Section 3.4, element."; + } + + leaf replay-log-creation-time { + type yang:date-and-time; + description + "Indicates the time the replay log for this stream + was created."; + reference + "RFC 5277, Section 3.4, + element."; + } + + leaf events { + type empty; + description + "Represents the entry point for establishing + notification delivery via server sent events."; + } + } + } + + leaf version { + type enumeration { + enum "1.0" { + description + "Version 1.0 of the RESTCONF protocol."; + } + } + config false; + description + "Contains the RESTCONF protocol version."; + } + } + } // grouping restconf + + + grouping notification { + description + "Contains the notification message wrapper definition."; + + container notification { + description + "RESTCONF notification message wrapper."; + leaf event-time { + type yang:date-and-time; + mandatory true; + description + "The time the event was generated by the + event source."; + reference + "RFC 5277, section 4, element."; + } + + /* The YANG-specific notification container is encoded + * after the 'event-time' element. The format + * corresponds to the notificationContent element + * in RFC 5277, section 4. For example: + * + * module example-one { + * ... + * notification event1 { ... } + * + * } + * + * Encoded as element 'event1' in the namespace + * for module 'example-one'. + */ + } + } // grouping notification + + } \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-yang-types.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-yang-types.yang new file mode 100644 index 0000000000..07e50b3913 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/ietf-yang-types.yang @@ -0,0 +1,417 @@ + module ietf-yang-types { + + namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types"; + prefix "yang"; + + organization + "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; + + contact + "WG Web: + WG List: + + WG Chair: David Partain + + + WG Chair: David Kessens + + + Editor: Juergen Schoenwaelder + "; + + description + "This module contains a collection of generally useful derived + YANG data types. + + Copyright (c) 2010 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in Section + 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 6021; see + the RFC itself for full legal notices."; + + revision 2010-09-24 { + description + "Initial revision."; + reference + "RFC 6021: Common YANG Data Types"; + } + + /*** collection of counter and gauge types ***/ + + typedef counter32 { + type uint32; + description + "The counter32 type represents a non-negative integer + that monotonically increases until it reaches a + maximum value of 2^32-1 (4294967295 decimal), when it + wraps around and starts increasing again from zero. + + Counters have no defined 'initial' value, and thus, a + single value of a counter has (in general) no information + content. Discontinuities in the monotonically increasing + value normally occur at re-initialization of the + management system, and at other times as specified in the + description of a schema node using this type. If such + other times can occur, for example, the creation of + a schema node of type counter32 at times other than + re-initialization, then a corresponding schema node + should be defined, with an appropriate type, to indicate + the last discontinuity. + + The counter32 type should not be used for configuration + schema nodes. A default statement SHOULD NOT be used in + combination with the type counter32. + + In the value set and its semantics, this type is equivalent + to the Counter32 type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; + } + + typedef zero-based-counter32 { + type yang:counter32; + default "0"; + description + "The zero-based-counter32 type represents a counter32 + that has the defined 'initial' value zero. + + A schema node of this type will be set to zero (0) on creation + and will thereafter increase monotonically until it reaches + a maximum value of 2^32-1 (4294967295 decimal), when it + wraps around and starts increasing again from zero. + + Provided that an application discovers a new schema node + of this type within the minimum time to wrap, it can use the + 'initial' value as a delta. It is important for a management + station to be aware of this minimum time and the actual time + between polls, and to discard data if the actual time is too + long or there is no defined minimum time. + + In the value set and its semantics, this type is equivalent + to the ZeroBasedCounter32 textual convention of the SMIv2."; + reference + "RFC 4502: Remote Network Monitoring Management Information + Base Version 2"; + } + + typedef counter64 { + type uint64; + description + "The counter64 type represents a non-negative integer + that monotonically increases until it reaches a + maximum value of 2^64-1 (18446744073709551615 decimal), + when it wraps around and starts increasing again from zero. + + Counters have no defined 'initial' value, and thus, a + single value of a counter has (in general) no information + content. Discontinuities in the monotonically increasing + value normally occur at re-initialization of the + management system, and at other times as specified in the + description of a schema node using this type. If such + other times can occur, for example, the creation of + a schema node of type counter64 at times other than + re-initialization, then a corresponding schema node + should be defined, with an appropriate type, to indicate + the last discontinuity. + + The counter64 type should not be used for configuration + schema nodes. A default statement SHOULD NOT be used in + combination with the type counter64. + + In the value set and its semantics, this type is equivalent + to the Counter64 type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; + } + + typedef zero-based-counter64 { + type yang:counter64; + default "0"; + description + "The zero-based-counter64 type represents a counter64 that + has the defined 'initial' value zero. + + A schema node of this type will be set to zero (0) on creation + and will thereafter increase monotonically until it reaches + a maximum value of 2^64-1 (18446744073709551615 decimal), + when it wraps around and starts increasing again from zero. + + Provided that an application discovers a new schema node + of this type within the minimum time to wrap, it can use the + 'initial' value as a delta. It is important for a management + station to be aware of this minimum time and the actual time + between polls, and to discard data if the actual time is too + long or there is no defined minimum time. + + In the value set and its semantics, this type is equivalent + to the ZeroBasedCounter64 textual convention of the SMIv2."; + reference + "RFC 2856: Textual Conventions for Additional High Capacity + Data Types"; + } + + typedef gauge32 { + type uint32; + description + "The gauge32 type represents a non-negative integer, which + may increase or decrease, but shall never exceed a maximum + value, nor fall below a minimum value. The maximum value + cannot be greater than 2^32-1 (4294967295 decimal), and + the minimum value cannot be smaller than 0. The value of + a gauge32 has its maximum value whenever the information + being modeled is greater than or equal to its maximum + value, and has its minimum value whenever the information + being modeled is smaller than or equal to its minimum value. + If the information being modeled subsequently decreases + below (increases above) the maximum (minimum) value, the + gauge32 also decreases (increases). + + In the value set and its semantics, this type is equivalent + to the Gauge32 type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; + } + + typedef gauge64 { + type uint64; + description + "The gauge64 type represents a non-negative integer, which + may increase or decrease, but shall never exceed a maximum + value, nor fall below a minimum value. The maximum value + cannot be greater than 2^64-1 (18446744073709551615), and + the minimum value cannot be smaller than 0. The value of + a gauge64 has its maximum value whenever the information + being modeled is greater than or equal to its maximum + value, and has its minimum value whenever the information + being modeled is smaller than or equal to its minimum value. + If the information being modeled subsequently decreases + below (increases above) the maximum (minimum) value, the + gauge64 also decreases (increases). + + In the value set and its semantics, this type is equivalent + to the CounterBasedGauge64 SMIv2 textual convention defined + in RFC 2856"; + reference + "RFC 2856: Textual Conventions for Additional High Capacity + Data Types"; + } + + /*** collection of identifier related types ***/ + + typedef object-identifier { + type string { + pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))' + + '(\.(0|([1-9]\d*)))*'; + } + description + "The object-identifier type represents administratively + assigned names in a registration-hierarchical-name tree. + + Values of this type are denoted as a sequence of numerical + non-negative sub-identifier values. Each sub-identifier + value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers + are separated by single dots and without any intermediate + whitespace. + + The ASN.1 standard restricts the value space of the first + sub-identifier to 0, 1, or 2. Furthermore, the value space + of the second sub-identifier is restricted to the range + 0 to 39 if the first sub-identifier is 0 or 1. Finally, + the ASN.1 standard requires that an object identifier + has always at least two sub-identifier. The pattern + captures these restrictions. + + Although the number of sub-identifiers is not limited, + module designers should realize that there may be + implementations that stick with the SMIv2 limit of 128 + sub-identifiers. + + This type is a superset of the SMIv2 OBJECT IDENTIFIER type + since it is not restricted to 128 sub-identifiers. Hence, + this type SHOULD NOT be used to represent the SMIv2 OBJECT + IDENTIFIER type, the object-identifier-128 type SHOULD be + used instead."; + reference + "ISO9834-1: Information technology -- Open Systems + Interconnection -- Procedures for the operation of OSI + Registration Authorities: General procedures and top + arcs of the ASN.1 Object Identifier tree"; + } + + + + + typedef object-identifier-128 { + type object-identifier { + pattern '\d*(\.\d*){1,127}'; + } + description + "This type represents object-identifiers restricted to 128 + sub-identifiers. + + In the value set and its semantics, this type is equivalent + to the OBJECT IDENTIFIER type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; + } + + typedef yang-identifier { + type string { + length "1..max"; + pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*'; + pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*'; + } + description + "A YANG identifier string as defined by the 'identifier' + rule in Section 12 of RFC 6020. An identifier must + start with an alphabetic character or an underscore + followed by an arbitrary sequence of alphabetic or + numeric characters, underscores, hyphens, or dots. + + A YANG identifier MUST NOT start with any possible + combination of the lowercase or uppercase character + sequence 'xml'."; + reference + "RFC 6020: YANG - A Data Modeling Language for the Network + Configuration Protocol (NETCONF)"; + } + + /*** collection of date and time related types ***/ + + typedef date-and-time { + type string { + pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?' + + '(Z|[\+\-]\d{2}:\d{2})'; + } + description + "The date-and-time type is a profile of the ISO 8601 + standard for representation of dates and times using the + Gregorian calendar. The profile is defined by the + date-time production in Section 5.6 of RFC 3339. + + The date-and-time type is compatible with the dateTime XML + schema type with the following notable exceptions: + + (a) The date-and-time type does not allow negative years. + + (b) The date-and-time time-offset -00:00 indicates an unknown + time zone (see RFC 3339) while -00:00 and +00:00 and Z all + represent the same time zone in dateTime. + + (c) The canonical format (see below) of data-and-time values + differs from the canonical format used by the dateTime XML + schema type, which requires all times to be in UTC using the + time-offset 'Z'. + + This type is not equivalent to the DateAndTime textual + convention of the SMIv2 since RFC 3339 uses a different + separator between full-date and full-time and provides + higher resolution of time-secfrac. + + The canonical format for date-and-time values with a known time + zone uses a numeric time zone offset that is calculated using + the device's configured known offset to UTC time. A change of + the device's offset to UTC time will cause date-and-time values + to change accordingly. Such changes might happen periodically + in case a server follows automatically daylight saving time + (DST) time zone offset changes. The canonical format for + date-and-time values with an unknown time zone (usually referring + to the notion of local time) uses the time-offset -00:00."; + reference + "RFC 3339: Date and Time on the Internet: Timestamps + RFC 2579: Textual Conventions for SMIv2 + XSD-TYPES: XML Schema Part 2: Datatypes Second Edition"; + } + + typedef timeticks { + type uint32; + description + "The timeticks type represents a non-negative integer that + represents the time, modulo 2^32 (4294967296 decimal), in + hundredths of a second between two epochs. When a schema + node is defined that uses this type, the description of + the schema node identifies both of the reference epochs. + + In the value set and its semantics, this type is equivalent + to the TimeTicks type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; + } + + typedef timestamp { + type yang:timeticks; + description + "The timestamp type represents the value of an associated + timeticks schema node at which a specific occurrence happened. + The specific occurrence must be defined in the description + of any schema node defined using this type. When the specific + occurrence occurred prior to the last time the associated + timeticks attribute was zero, then the timestamp value is + zero. Note that this requires all timestamp values to be + reset to zero when the value of the associated timeticks + attribute reaches 497+ days and wraps around to zero. + + The associated timeticks schema node must be specified + in the description of any schema node using this type. + + In the value set and its semantics, this type is equivalent + to the TimeStamp textual convention of the SMIv2."; + reference + "RFC 2579: Textual Conventions for SMIv2"; + } + + /*** collection of generic address types ***/ + + typedef phys-address { + type string { + pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?'; + } + description + "Represents media- or physical-level addresses represented + as a sequence octets, each octet represented by two hexadecimal + numbers. Octets are separated by colons. The canonical + representation uses lowercase characters. + + In the value set and its semantics, this type is equivalent + to the PhysAddress textual convention of the SMIv2."; + reference + "RFC 2579: Textual Conventions for SMIv2"; + } + + typedef mac-address { + type string { + pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'; + } + description + "The mac-address type represents an IEEE 802 MAC address. + The canonical representation uses lowercase characters. + + In the value set and its semantics, this type is equivalent + to the MacAddress textual convention of the SMIv2."; + reference + "IEEE 802: IEEE Standard for Local and Metropolitan Area + Networks: Overview and Architecture + RFC 2579: Textual Conventions for SMIv2"; + } + + /*** collection of XML specific types ***/ + + typedef xpath1.0 { + type string; + description + "This type represents an XPATH 1.0 expression. + + When a schema node is defined that uses this type, the + description of the schema node MUST specify the XPath + context in which the XPath expression is evaluated."; + reference + "XPATH: XML Path Language (XPath) Version 1.0"; + } + + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module1.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module1.yang new file mode 100644 index 0000000000..604fe9458c --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module1.yang @@ -0,0 +1,12 @@ +module module1 { + namespace "module:1"; + prefix "mod1"; + revision "2014-01-01"; + + rpc dummy-rpc1-module1 { + } + + rpc dummy-rpc2-module1 { + } + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module2.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module2.yang new file mode 100644 index 0000000000..7b359f3efb --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module2.yang @@ -0,0 +1,11 @@ +module module2 { + namespace "module:2"; + prefix "mod2"; + revision "2014-01-02"; + + rpc dummy-rpc1-module2 { + } + + rpc dummy-rpc2-module2 { + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module3.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module3.yang new file mode 100644 index 0000000000..39bb690be0 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/module3.yang @@ -0,0 +1,5 @@ +module module3 { + namespace "module:3"; + prefix "mod3"; + revision "2014-01-03"; +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/modules-behind-mount-point/module1-behind-mount-point.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/modules-behind-mount-point/module1-behind-mount-point.yang new file mode 100644 index 0000000000..e48184b4df --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/modules-behind-mount-point/module1-behind-mount-point.yang @@ -0,0 +1,10 @@ +module module1-behind-mount-point { + namespace "module:1:behind:mount:point"; + prefix "mod1bemopo"; + revision "2014-02-03"; + + rpc rpc-behind-module1 { + } + + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/modules-behind-mount-point/module2-behind-mount-point.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/modules-behind-mount-point/module2-behind-mount-point.yang new file mode 100644 index 0000000000..89b8c02eba --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/modules/modules-behind-mount-point/module2-behind-mount-point.yang @@ -0,0 +1,9 @@ +module module2-behind-mount-point { + namespace "module:2:behind:mount:point"; + prefix "mod2bemopo"; + revision "2014-02-04"; + + rpc rpc-behind-module2 { + } + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-restconf-broker/pom.xml b/opendaylight/md-sal/sal-restconf-broker/pom.xml index 8f31e6f96c..8294c101e9 100644 --- a/opendaylight/md-sal/sal-restconf-broker/pom.xml +++ b/opendaylight/md-sal/sal-restconf-broker/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT sal-restconf-broker jar @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -27,17 +27,17 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-remote - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-core-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.yangtools diff --git a/opendaylight/md-sal/samples/pom.xml b/opendaylight/md-sal/samples/pom.xml index 6b87a22418..a332ef77b6 100644 --- a/opendaylight/md-sal/samples/pom.xml +++ b/opendaylight/md-sal/samples/pom.xml @@ -1,9 +1,8 @@ - + 4.0.0 sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller pom @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + toaster diff --git a/opendaylight/md-sal/samples/toaster-consumer/pom.xml b/opendaylight/md-sal/samples/toaster-consumer/pom.xml index 49cf97d11b..ff09c1dbf0 100644 --- a/opendaylight/md-sal/samples/toaster-consumer/pom.xml +++ b/opendaylight/md-sal/samples/toaster-consumer/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 sal-samples org.opendaylight.controller.samples - 1.0-SNAPSHOT + 1.1-SNAPSHOT sample-toaster-consumer bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -39,7 +39,7 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java b/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java index f42cd01cf7..a7e1e9b445 100644 --- a/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java +++ b/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sample.toaster.it; import org.junit.Test; diff --git a/opendaylight/md-sal/samples/toaster-provider/pom.xml b/opendaylight/md-sal/samples/toaster-provider/pom.xml index 510f316d8f..3f9ac737a2 100644 --- a/opendaylight/md-sal/samples/toaster-provider/pom.xml +++ b/opendaylight/md-sal/samples/toaster-provider/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 sal-samples org.opendaylight.controller.samples - 1.0-SNAPSHOT + 1.1-SNAPSHOT sample-toaster-provider bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -38,12 +38,12 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java b/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java index ce541bae20..c3b9716783 100644 --- a/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java +++ b/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sample.toaster.provider; import java.util.Collections; diff --git a/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterActivator.java b/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterActivator.java index 010023a6eb..7e6e7e5d75 100644 --- a/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterActivator.java +++ b/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterActivator.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sample.toaster.provider; public class ToasterActivator { diff --git a/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterProvider.java b/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterProvider.java index 3762740fca..5ba67474b3 100644 --- a/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterProvider.java +++ b/opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterProvider.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sample.toaster.provider; import java.util.Collection; diff --git a/opendaylight/md-sal/samples/toaster/pom.xml b/opendaylight/md-sal/samples/toaster/pom.xml index 2c97063cc6..599fd714b8 100644 --- a/opendaylight/md-sal/samples/toaster/pom.xml +++ b/opendaylight/md-sal/samples/toaster/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 sal-samples org.opendaylight.controller.samples - 1.0-SNAPSHOT + 1.1-SNAPSHOT sample-toaster bundle @@ -12,7 +11,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -45,7 +45,7 @@ org.opendaylight.yangtools maven-sal-api-gen-plugin - ${yang.codegen.version} + ${yangtools.version} jar @@ -98,7 +98,7 @@ - + diff --git a/opendaylight/md-sal/statistics-manager/pom.xml b/opendaylight/md-sal/statistics-manager/pom.xml index b85fc681c0..0f90ecac60 100644 --- a/opendaylight/md-sal/statistics-manager/pom.xml +++ b/opendaylight/md-sal/statistics-manager/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.md statistics-manager @@ -13,7 +12,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -23,17 +23,17 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-statistics - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-base - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.eclipse.xtend diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java index 19f25944b4..5f264abc2c 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java @@ -412,8 +412,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList cache.put(notification.getId(), new NodeStatisticsAger(statisticsManager,key)); } NodeStatisticsAger nsa = cache.get(notification.getId()); - FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flowRule); - cache.get(notification.getId()).updateFlowStats(flowStatsEntry); //Augment the data to the flow node @@ -466,6 +464,11 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build()); sucLogger.debug("Found matching flow in the datastore, augmenting statistics"); foundOriginalFlow = true; + // Update entry with timestamp of latest response + flow.setKey(existingFlow.getKey()); + FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flow.build()); + cache.get(notification.getId()).updateFlowStats(flowStatsEntry); + it.putOperationalData(flowRef, flowBuilder.build()); it.commit(); } @@ -490,6 +493,12 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build()); sucLogger.debug("Found matching unaccounted flow in the operational datastore, augmenting statistics"); foundOriginalFlow = true; + + // Update entry with timestamp of latest response + flow.setKey(existingFlow.getKey()); + FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flow.build()); + cache.get(notification.getId()).updateFlowStats(flowStatsEntry); + it.putOperationalData(flowRef, flowBuilder.build()); it.commit(); break; @@ -498,9 +507,9 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList } } if(!foundOriginalFlow){ - long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"0"+Integer.toString(this.unaccountedFlowsCounter))); + String flowKey = "#UF$TABLE*"+Short.toString(tableId)+"*"+Integer.toString(this.unaccountedFlowsCounter); this.unaccountedFlowsCounter++; - FlowKey newFlowKey = new FlowKey(new FlowId(Long.toString(flowKey))); + FlowKey newFlowKey = new FlowKey(new FlowId(flowKey)); InstanceIdentifier flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key) .augmentation(FlowCapableNode.class) .child(Table.class, new TableKey(tableId)) @@ -508,6 +517,12 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList flowBuilder.setKey(newFlowKey); flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build()); sucLogger.debug("Flow {} is not present in config data store, augmenting statistics as an unaccounted flow",flowBuilder.build()); + + // Update entry with timestamp of latest response + flow.setKey(newFlowKey); + FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flow.build()); + cache.get(notification.getId()).updateFlowStats(flowStatsEntry); + it.putOperationalData(flowRef, flowBuilder.build()); it.commit(); } diff --git a/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java b/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java index a15e8d616c..08aeea2678 100644 --- a/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java +++ b/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.restconf.it; import static junit.framework.Assert.assertEquals; diff --git a/opendaylight/md-sal/topology-lldp-discovery/pom.xml b/opendaylight/md-sal/topology-lldp-discovery/pom.xml index aa4210ee57..53cf2bd5c1 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/pom.xml +++ b/opendaylight/md-sal/topology-lldp-discovery/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT ../ org.opendaylight.controller.md @@ -13,7 +12,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git - + HEAD + 14.0.1 2.4.3 @@ -28,27 +28,27 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-base - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-inventory - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.eclipse.xtend @@ -76,7 +76,7 @@ org.opendaylight.controller sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT @@ -91,7 +91,7 @@ org.opendaylight.md.controller.topology.lldp.LLDPActivator org.opendaylight.md.controller.topology.lldp.utils - commons-lang> + commons-lang> ${project.groupId}.${project.artifactId} ${project.basedir}/META-INF diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java index 095d12e6ef..ed96e3aa0c 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java +++ b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.md.controller.topology.lldp; import org.opendaylight.md.controller.topology.lldp.utils.LLDPDiscoveryUtils; diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java index 171783b0a2..7d2570551d 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java +++ b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.md.controller.topology.lldp; import java.util.Date; diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java index c0bcbaa8ad..ce42283ebe 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java +++ b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.md.controller.topology.lldp.utils; import java.nio.charset.Charset; diff --git a/opendaylight/md-sal/topology-manager/pom.xml b/opendaylight/md-sal/topology-manager/pom.xml index 76300864fd..3c676c8d8f 100644 --- a/opendaylight/md-sal/topology-manager/pom.xml +++ b/opendaylight/md-sal/topology-manager/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller sal-parent - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.md topology-manager @@ -13,7 +12,8 @@ scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - + HEAD + @@ -23,27 +23,27 @@ org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller sal-binding-util - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-inventory - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.opendaylight.controller.model model-topology - 1.0-SNAPSHOT + 1.1-SNAPSHOT org.eclipse.xtend diff --git a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableNodeMapping.xtend b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableNodeMapping.xtend index 8576b0d1fc..017e2b877e 100644 --- a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableNodeMapping.xtend +++ b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableNodeMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.md.controller.topology.manager import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey diff --git a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.xtend b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.xtend index bc4e611b5c..666a8bf57a 100644 --- a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.xtend +++ b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.md.controller.topology.manager import com.google.common.collect.FluentIterable diff --git a/opendaylight/netconf/config-netconf-connector/pom.xml b/opendaylight/netconf/config-netconf-connector/pom.xml index 023856464f..6db7f3a56d 100644 --- a/opendaylight/netconf/config-netconf-connector/pom.xml +++ b/opendaylight/netconf/config-netconf-connector/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT config-netconf-connector ${project.artifactId} diff --git a/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java b/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java index 53e14ba5fb..13f8cad968 100644 --- a/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java +++ b/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java @@ -67,7 +67,7 @@ public class NetconfOperationServiceImplTest { try { NetconfOperationServiceImpl.checkConsistencyBetweenYangStoreAndConfig(mockJmxClient("qname1"), mockYangStoreSnapshot("qname2", "qname1")); - fail("An exception of type " + IllegalArgumentException.class + " was expected"); + fail("An exception of type " + IllegalStateException.class + " was expected"); } catch (IllegalStateException e) { String message = e.getMessage(); Assert.assertThat( diff --git a/opendaylight/netconf/config-persister-impl/pom.xml b/opendaylight/netconf/config-persister-impl/pom.xml index fc00177c50..590381038a 100644 --- a/opendaylight/netconf/config-persister-impl/pom.xml +++ b/opendaylight/netconf/config-persister-impl/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT config-persister-impl ${project.artifactId} diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java index 889fa8428c..e319d2cb67 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java @@ -12,7 +12,6 @@ import org.opendaylight.controller.config.persist.api.Persister; import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification; import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean; import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification; -import org.opendaylight.controller.netconf.client.NetconfClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,40 +26,60 @@ import java.io.IOException; import java.util.regex.Pattern; /** - * Responsible for listening for notifications from netconf containing latest + * Responsible for listening for notifications from netconf (via JMX) containing latest * committed configuration that should be persisted, and also for loading last * configuration. */ @ThreadSafe -public class ConfigPersisterNotificationHandler implements NotificationListener, Closeable { +public class ConfigPersisterNotificationHandler implements Closeable { private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationHandler.class); private final MBeanServerConnection mBeanServerConnection; - private final NetconfClient netconfClient; - private final Persister persisterAggregator; - private final Pattern ignoredMissingCapabilityRegex; + private final ConfigPersisterNotificationListener listener; + - public ConfigPersisterNotificationHandler(MBeanServerConnection mBeanServerConnection, NetconfClient netconfClient, + public ConfigPersisterNotificationHandler(MBeanServerConnection mBeanServerConnection, Persister persisterAggregator, Pattern ignoredMissingCapabilityRegex) { this.mBeanServerConnection = mBeanServerConnection; - this.netconfClient = netconfClient; - this.persisterAggregator = persisterAggregator; - this.ignoredMissingCapabilityRegex = ignoredMissingCapabilityRegex; - } + listener = new ConfigPersisterNotificationListener(persisterAggregator, ignoredMissingCapabilityRegex); + registerAsJMXListener(mBeanServerConnection, listener); - public void init() { - registerAsJMXListener(); } - private void registerAsJMXListener() { + private static void registerAsJMXListener(MBeanServerConnection mBeanServerConnection, ConfigPersisterNotificationListener listener) { logger.trace("Called registerAsJMXListener"); try { - mBeanServerConnection.addNotificationListener(DefaultCommitOperationMXBean.objectName, this, null, null); + mBeanServerConnection.addNotificationListener(DefaultCommitOperationMXBean.objectName, listener, null, null); } catch (InstanceNotFoundException | IOException e) { throw new RuntimeException("Cannot register as JMX listener to netconf", e); } } + @Override + public synchronized void close() { + // unregister from JMX + ObjectName on = DefaultCommitOperationMXBean.objectName; + try { + if (mBeanServerConnection.isRegistered(on)) { + mBeanServerConnection.removeNotificationListener(on, listener); + } + } catch (Exception e) { + logger.warn("Unable to unregister {} as listener for {}", listener, on, e); + } + } +} + +class ConfigPersisterNotificationListener implements NotificationListener { + private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationListener.class); + + private final Persister persisterAggregator; + private final Pattern ignoredMissingCapabilityRegex; + + ConfigPersisterNotificationListener(Persister persisterAggregator, Pattern ignoredMissingCapabilityRegex) { + this.persisterAggregator = persisterAggregator; + this.ignoredMissingCapabilityRegex = ignoredMissingCapabilityRegex; + } + @Override public void handleNotification(Notification notification, Object handback) { if (notification instanceof NetconfJMXNotification == false) @@ -92,22 +111,4 @@ public class ConfigPersisterNotificationHandler implements NotificationListener, throw new RuntimeException("Unable to persist configuration snapshot", e); } } - - @Override - public synchronized void close() { - // unregister from JMX - ObjectName on = DefaultCommitOperationMXBean.objectName; - try { - if (mBeanServerConnection.isRegistered(on)) { - mBeanServerConnection.removeNotificationListener(on, this); - } - } catch (Exception e) { - logger.warn("Unable to unregister {} as listener for {}", this, on, e); - } - } - - public NetconfClient getNetconfClient() { - return netconfClient; - } - -} +} \ No newline at end of file diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java index c8af4ccd83..01d872d89c 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java @@ -33,6 +33,7 @@ import java.io.InputStream; import java.net.InetSocketAddress; import java.util.Collections; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -44,100 +45,98 @@ public class ConfigPusher { private static final int NETCONF_SEND_ATTEMPTS = 20; private final InetSocketAddress address; - private final EventLoopGroup nettyThreadgroup; + private final EventLoopGroup nettyThreadGroup; // Default timeout for netconf becoming stable - public static final long DEFAULT_TIMEOUT = TimeUnit.MINUTES.toNanos(2); + public static final long DEFAULT_MAX_WAIT_FOR_CAPABILITIES_MILLIS = TimeUnit.MINUTES.toMillis(2); + public static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = 5000; private final int delayMillis = 5000; - private final long timeoutNanos; + private final long maxWaitForCapabilitiesMillis; + private final long connectionTimeoutMillis; - public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadgroup) { - this(address, nettyThreadgroup, DEFAULT_TIMEOUT); + public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadGroup) { + this(address, nettyThreadGroup, DEFAULT_MAX_WAIT_FOR_CAPABILITIES_MILLIS, DEFAULT_CONNECTION_TIMEOUT_MILLIS); } - @Deprecated - public ConfigPusher(InetSocketAddress address, long timeoutMillis, EventLoopGroup nettyThreadgroup) { - this(address, nettyThreadgroup, TimeUnit.MILLISECONDS.toNanos(timeoutMillis)); - } - - public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadgroup, long timeoutNanos) { + public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadGroup, + long maxWaitForCapabilitiesMillis, long connectionTimeoutMillis) { this.address = address; - this.nettyThreadgroup = nettyThreadgroup; - this.timeoutNanos = timeoutNanos; + this.nettyThreadGroup = nettyThreadGroup; + this.maxWaitForCapabilitiesMillis = maxWaitForCapabilitiesMillis; + this.connectionTimeoutMillis = connectionTimeoutMillis; } - public synchronized NetconfClient init(List configs) throws InterruptedException { + public synchronized LinkedHashMap pushConfigs( + List configs) throws InterruptedException { logger.debug("Last config snapshots to be pushed to netconf: {}", configs); - return pushAllConfigs(configs); - } - private synchronized NetconfClient pushAllConfigs(List configs) throws InterruptedException { // first just make sure we can connect to netconf, even if nothing is being pushed - NetconfClient netconfClient = makeNetconfConnection(Collections.emptySet(), Optional.absent()); + { + NetconfClient netconfClient = makeNetconfConnection(Collections.emptySet()); + Util.closeClientAndDispatcher(netconfClient); + } + LinkedHashMap result = new LinkedHashMap<>(); // start pushing snapshots: - for (ConfigSnapshotHolder configSnapshotHolder: configs){ - netconfClient = pushSnapshotWithRetries(configSnapshotHolder, Optional.of(netconfClient)); - logger.debug("Config snapshot pushed successfully: {}", configSnapshotHolder); + for (ConfigSnapshotHolder configSnapshotHolder : configs) { + EditAndCommitResponseWithRetries editAndCommitResponseWithRetries = pushSnapshotWithRetries(configSnapshotHolder); + logger.debug("Config snapshot pushed successfully: {}, result: {}", configSnapshotHolder, result); + result.put(configSnapshotHolder, editAndCommitResponseWithRetries); } - logger.debug("All configuration snapshots have been pushed successfully."); - return netconfClient; + return result; } - private synchronized NetconfClient pushSnapshotWithRetries(ConfigSnapshotHolder configSnapshotHolder, - Optional oldClientForPossibleReuse) + /** + * Checks for ConflictingVersionException and retries until optimistic lock succeeds or maximal + * number of attempts is reached. + */ + private synchronized EditAndCommitResponseWithRetries pushSnapshotWithRetries(ConfigSnapshotHolder configSnapshotHolder) throws InterruptedException { ConflictingVersionException lastException = null; int maxAttempts = 30; - for(int i = 0 ; i < maxAttempts; i++) { - NetconfClient netconfClient = makeNetconfConnection(configSnapshotHolder.getCapabilities(), oldClientForPossibleReuse); + + for (int retryAttempt = 1; retryAttempt <= maxAttempts; retryAttempt++) { + NetconfClient netconfClient = makeNetconfConnection(configSnapshotHolder.getCapabilities()); logger.trace("Pushing following xml to netconf {}", configSnapshotHolder); try { - pushLastConfig(configSnapshotHolder, netconfClient); - return netconfClient; - } catch(ConflictingVersionException e) { - Util.closeClientAndDispatcher(netconfClient); + EditAndCommitResponse editAndCommitResponse = pushLastConfig(configSnapshotHolder, netconfClient); + return new EditAndCommitResponseWithRetries(editAndCommitResponse, retryAttempt); + } catch (ConflictingVersionException e) { lastException = e; Thread.sleep(1000); - } catch (SAXException | IOException e) { - throw new IllegalStateException("Unable to load last config", e); + } catch (RuntimeException e) { + throw new IllegalStateException("Unable to load " + configSnapshotHolder, e); + } finally { + Util.closeClientAndDispatcher(netconfClient); } } - throw new IllegalStateException("Failed to push configuration, maximum attempt count has been reached: " - + maxAttempts, lastException); + throw new IllegalStateException("Maximum attempt count has been reached for pushing " + configSnapshotHolder, + lastException); } /** * @param expectedCaps capabilities that server hello must contain. Will retry until all are found or throws RuntimeException. * If empty set is provided, will only make sure netconf client successfuly connected to the server. - * @param maybeOldClient if present, close it. * @return NetconfClient that has all required capabilities from server. */ - private synchronized NetconfClient makeNetconfConnection(Set expectedCaps, - Optional maybeOldClient) - throws InterruptedException { - - if (maybeOldClient.isPresent()) { - NetconfClient oldClient = maybeOldClient.get(); - Util.closeClientAndDispatcher(oldClient); - } + private synchronized NetconfClient makeNetconfConnection(Set expectedCaps) throws InterruptedException { // TODO think about moving capability subset check to netconf client // could be utilized by integration tests - final long pollingStart = System.nanoTime(); - final long deadline = pollingStart + timeoutNanos; + final long pollingStartNanos = System.nanoTime(); + final long deadlineNanos = pollingStartNanos + TimeUnit.MILLISECONDS.toNanos(maxWaitForCapabilitiesMillis); int attempt = 0; String additionalHeader = NetconfMessageAdditionalHeader.toString("unknown", address.getAddress().getHostAddress(), Integer.toString(address.getPort()), "tcp", Optional.of("persister")); - Set latestCapabilities = new HashSet<>(); - while (System.nanoTime() < deadline) { + Set latestCapabilities = null; + while (System.nanoTime() < deadlineNanos) { attempt++; - NetconfClientDispatcher netconfClientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, - nettyThreadgroup, additionalHeader); + NetconfClientDispatcher netconfClientDispatcher = new NetconfClientDispatcher(nettyThreadGroup, + nettyThreadGroup, additionalHeader, connectionTimeoutMillis); NetconfClient netconfClient; try { netconfClient = new NetconfClient(this.toString(), address, delayMillis, netconfClientDispatcher); @@ -157,6 +156,10 @@ public class ConfigPusher { Util.closeClientAndDispatcher(netconfClient); Thread.sleep(delayMillis); } + if (latestCapabilities == null) { + logger.error("Could not connect to the server in {} ms", maxWaitForCapabilitiesMillis); + throw new RuntimeException("Could not connect to netconf server"); + } Set allNotFound = new HashSet<>(expectedCaps); allNotFound.removeAll(latestCapabilities); logger.error("Netconf server did not provide required capabilities. Expected but not found: {}, all expected {}, current {}", @@ -165,68 +168,152 @@ public class ConfigPusher { } - private synchronized void pushLastConfig(ConfigSnapshotHolder configSnapshotHolder, NetconfClient netconfClient) - throws ConflictingVersionException, IOException, SAXException { + /** + * Sends two RPCs to the netconf server: edit-config and commit. + * + * @param configSnapshotHolder + * @param netconfClient + * @throws ConflictingVersionException if commit fails on optimistic lock failure inside of config-manager + * @throws java.lang.RuntimeException if edit-config or commit fails otherwise + */ + private synchronized EditAndCommitResponse pushLastConfig(ConfigSnapshotHolder configSnapshotHolder, NetconfClient netconfClient) + throws ConflictingVersionException { - Element xmlToBePersisted = XmlUtil.readXmlToElement(configSnapshotHolder.getConfigSnapshot()); + Element xmlToBePersisted; + try { + xmlToBePersisted = XmlUtil.readXmlToElement(configSnapshotHolder.getConfigSnapshot()); + } catch (SAXException | IOException e) { + throw new IllegalStateException("Cannot parse " + configSnapshotHolder); + } logger.trace("Pushing last configuration to netconf: {}", configSnapshotHolder); - StringBuilder response = new StringBuilder("editConfig response = {"); - NetconfMessage message = createEditConfigMessage(xmlToBePersisted, "/netconfOp/editConfig.xml"); + NetconfMessage editConfigMessage = createEditConfigMessage(xmlToBePersisted); // sending message to netconf - NetconfMessage responseMessage = getResponse(message, netconfClient); - - NetconfUtil.checkIsMessageOk(responseMessage); - response.append(XmlUtil.toString(responseMessage.getDocument())); - response.append("}"); - responseMessage = getResponse(getNetconfMessageFromResource("/netconfOp/commit.xml"), netconfClient); - + NetconfMessage editResponseMessage; + try { + editResponseMessage = sendRequestGetResponseCheckIsOK(editConfigMessage, netconfClient); + } catch (IOException e) { + throw new IllegalStateException("Edit-config failed on " + configSnapshotHolder, e); + } + // commit + NetconfMessage commitResponseMessage; + try { + commitResponseMessage = sendRequestGetResponseCheckIsOK(getCommitMessage(), netconfClient); + } catch (IOException e) { + throw new IllegalStateException("Edit commit succeeded, but commit failed on " + configSnapshotHolder, e); + } - NetconfUtil.checkIsMessageOk(responseMessage); - response.append("commit response = {"); - response.append(XmlUtil.toString(responseMessage.getDocument())); - response.append("}"); - logger.trace("Last configuration loaded successfully"); - logger.trace("Detailed message {}", response); + if (logger.isTraceEnabled()) { + StringBuilder response = new StringBuilder("editConfig response = {"); + response.append(XmlUtil.toString(editResponseMessage.getDocument())); + response.append("}"); + response.append("commit response = {"); + response.append(XmlUtil.toString(commitResponseMessage.getDocument())); + response.append("}"); + logger.trace("Last configuration loaded successfully"); + logger.trace("Detailed message {}", response); + } + return new EditAndCommitResponse(editResponseMessage, commitResponseMessage); } - private static NetconfMessage getResponse(NetconfMessage request, NetconfClient netconfClient) { + + private static NetconfMessage sendRequestGetResponseCheckIsOK(NetconfMessage request, NetconfClient netconfClient) throws IOException { try { - return netconfClient.sendMessage(request, NETCONF_SEND_ATTEMPTS, NETCONF_SEND_ATTEMPT_MS_DELAY); - } catch(RuntimeException e) { - logger.error("Error while sending message {} to {}", request, netconfClient); - throw e; + NetconfMessage netconfMessage = netconfClient.sendMessage(request, NETCONF_SEND_ATTEMPTS, NETCONF_SEND_ATTEMPT_MS_DELAY); + NetconfUtil.checkIsMessageOk(netconfMessage); + return netconfMessage; + } catch (RuntimeException e) { // TODO: change NetconfClient#sendMessage to throw checked exceptions + logger.debug("Error while executing netconf transaction {} to {}", request, netconfClient, e); + throw new IOException("Failed to execute netconf transaction", e); } } - private static NetconfMessage createEditConfigMessage(Element dataElement, String editConfigResourcename) { - try (InputStream stream = ConfigPersisterNotificationHandler.class.getResourceAsStream(editConfigResourcename)) { - Preconditions.checkNotNull(stream, "Unable to load resource " + editConfigResourcename); + + // load editConfig.xml template, populate /rpc/edit-config/config with parameter + private static NetconfMessage createEditConfigMessage(Element dataElement) { + String editConfigResourcePath = "/netconfOp/editConfig.xml"; + try (InputStream stream = ConfigPersisterNotificationHandler.class.getResourceAsStream(editConfigResourcePath)) { + Preconditions.checkNotNull(stream, "Unable to load resource " + editConfigResourcePath); Document doc = XmlUtil.readXmlToDocument(stream); - doc.getDocumentElement(); XmlElement editConfigElement = XmlElement.fromDomDocument(doc).getOnlyChildElement(); XmlElement configWrapper = editConfigElement.getOnlyChildElement(XmlNetconfConstants.CONFIG_KEY); editConfigElement.getDomElement().removeChild(configWrapper.getDomElement()); for (XmlElement el : XmlElement.fromDomElement(dataElement).getChildElements()) { - configWrapper.appendChild((Element) doc.importNode(el.getDomElement(), true)); + boolean deep = true; + configWrapper.appendChild((Element) doc.importNode(el.getDomElement(), deep)); } editConfigElement.appendChild(configWrapper.getDomElement()); return new NetconfMessage(doc); } catch (IOException | SAXException e) { - throw new RuntimeException("Unable to parse message from resources " + editConfigResourcename, e); + // error reading the xml file bundled into the jar + throw new RuntimeException("Error while opening local resource " + editConfigResourcePath, e); } } - private static NetconfMessage getNetconfMessageFromResource(String resource) { + private static NetconfMessage getCommitMessage() { + String resource = "/netconfOp/commit.xml"; try (InputStream stream = ConfigPusher.class.getResourceAsStream(resource)) { Preconditions.checkNotNull(stream, "Unable to load resource " + resource); return new NetconfMessage(XmlUtil.readXmlToDocument(stream)); } catch (SAXException | IOException e) { - throw new RuntimeException("Unable to parse message from resources " + resource, e); + // error reading the xml file bundled into the jar + throw new RuntimeException("Error while opening local resource " + resource, e); + } + } + + static class EditAndCommitResponse { + private final NetconfMessage editResponse, commitResponse; + + EditAndCommitResponse(NetconfMessage editResponse, NetconfMessage commitResponse) { + this.editResponse = editResponse; + this.commitResponse = commitResponse; + } + + public NetconfMessage getEditResponse() { + return editResponse; + } + + public NetconfMessage getCommitResponse() { + return commitResponse; + } + + @Override + public String toString() { + return "EditAndCommitResponse{" + + "editResponse=" + editResponse + + ", commitResponse=" + commitResponse + + '}'; + } + } + + + static class EditAndCommitResponseWithRetries { + private final EditAndCommitResponse editAndCommitResponse; + private final int retries; + + EditAndCommitResponseWithRetries(EditAndCommitResponse editAndCommitResponse, int retries) { + this.editAndCommitResponse = editAndCommitResponse; + this.retries = retries; + } + + public int getRetries() { + return retries; + } + + public EditAndCommitResponse getEditAndCommitResponse() { + return editAndCommitResponse; + } + + @Override + public String toString() { + return "EditAndCommitResponseWithRetries{" + + "editAndCommitResponse=" + editAndCommitResponse + + ", retries=" + retries + + '}'; } } -} +} \ No newline at end of file diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java index 179c9681fc..1157ddbd83 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java @@ -10,11 +10,9 @@ package org.opendaylight.controller.netconf.persist.impl.osgi; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; -import org.opendaylight.controller.netconf.client.NetconfClient; import org.opendaylight.controller.netconf.persist.impl.ConfigPersisterNotificationHandler; import org.opendaylight.controller.netconf.persist.impl.ConfigPusher; import org.opendaylight.controller.netconf.persist.impl.PersisterAggregator; -import org.opendaylight.controller.netconf.persist.impl.Util; import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -25,7 +23,6 @@ import javax.management.MBeanServer; import java.lang.management.ManagementFactory; import java.net.InetSocketAddress; import java.util.regex.Pattern; -import java.util.concurrent.TimeUnit; public class ConfigPersisterActivator implements BundleActivator { @@ -34,7 +31,7 @@ public class ConfigPersisterActivator implements BundleActivator { private final static MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer(); private static final String IGNORED_MISSING_CAPABILITY_REGEX_SUFFIX = "ignoredMissingCapabilityRegex"; - private static final String PUSH_TIMEOUT = "pushTimeout"; + private static final String MAX_WAIT_FOR_CAPABILITIES_MILLIS = "maxWaitForCapabilitiesMillis"; public static final String NETCONF_CONFIG_PERSISTER = "netconf.config.persister"; @@ -44,9 +41,8 @@ public class ConfigPersisterActivator implements BundleActivator { private volatile ConfigPersisterNotificationHandler jmxNotificationHandler; - private volatile NetconfClient netconfClient; private Thread initializationThread; - private EventLoopGroup nettyThreadgroup; + private EventLoopGroup nettyThreadGroup; private PersisterAggregator persisterAggregator; @Override @@ -63,15 +59,22 @@ public class ConfigPersisterActivator implements BundleActivator { regex = DEFAULT_IGNORED_REGEX; } - String timeoutProperty = propertiesProvider.getProperty(PUSH_TIMEOUT); - long timeout = timeoutProperty == null ? ConfigPusher.DEFAULT_TIMEOUT : TimeUnit.SECONDS.toNanos(Integer.valueOf(timeoutProperty)); + String timeoutProperty = propertiesProvider.getProperty(MAX_WAIT_FOR_CAPABILITIES_MILLIS); + long maxWaitForCapabilitiesMillis; + if (timeoutProperty == null) { + maxWaitForCapabilitiesMillis = ConfigPusher.DEFAULT_MAX_WAIT_FOR_CAPABILITIES_MILLIS; + } else { + maxWaitForCapabilitiesMillis = Integer.valueOf(timeoutProperty); + } final Pattern ignoredMissingCapabilityRegex = Pattern.compile(regex); - nettyThreadgroup = new NioEventLoopGroup(); + nettyThreadGroup = new NioEventLoopGroup(); persisterAggregator = PersisterAggregator.createFromProperties(propertiesProvider); - final InetSocketAddress address = NetconfConfigUtil.extractTCPNetconfAddress(context, "Netconf is not configured, persister is not operational", true); - final ConfigPusher configPusher = new ConfigPusher(address, nettyThreadgroup); + final InetSocketAddress address = NetconfConfigUtil.extractTCPNetconfAddress(context, + "Netconf is not configured, persister is not operational", true); + final ConfigPusher configPusher = new ConfigPusher(address, nettyThreadGroup, maxWaitForCapabilitiesMillis, + ConfigPusher.DEFAULT_CONNECTION_TIMEOUT_MILLIS); // offload initialization to another thread in order to stop blocking activator @@ -79,11 +82,9 @@ public class ConfigPersisterActivator implements BundleActivator { @Override public void run() { try { - netconfClient = configPusher.init(persisterAggregator.loadLastConfigs()); - jmxNotificationHandler = new ConfigPersisterNotificationHandler( - platformMBeanServer, netconfClient, persisterAggregator, + configPusher.pushConfigs(persisterAggregator.loadLastConfigs()); + jmxNotificationHandler = new ConfigPersisterNotificationHandler(platformMBeanServer, persisterAggregator, ignoredMissingCapabilityRegex); - jmxNotificationHandler.init(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Interrupted while waiting for netconf connection"); @@ -103,15 +104,7 @@ public class ConfigPersisterActivator implements BundleActivator { if (jmxNotificationHandler != null) { jmxNotificationHandler.close(); } - if (netconfClient != null) { - netconfClient = jmxNotificationHandler.getNetconfClient(); - try { - Util.closeClientAndDispatcher(netconfClient); - } catch (Exception e) { - logger.warn("Unable to close connection to netconf {}", netconfClient, e); - } - } - nettyThreadgroup.shutdownGracefully(); + nettyThreadGroup.shutdownGracefully(); persisterAggregator.close(); } } diff --git a/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml b/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml index d71354451e..c6111ab395 100644 --- a/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml +++ b/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml @@ -2,7 +2,7 @@ netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 ietf-netconf-monitoring-extension @@ -30,53 +30,10 @@ org.opendaylight.yangtools yang-maven-plugin - ${yangtools.version} - - - - generate-sources - - - src/main/yang - - - - org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl - - - ${project.build.directory}/generated-sources/monitoring - - - - true - - - - - - org.opendaylight.yangtools - maven-sal-api-gen-plugin - ${yangtools.version} - - org.codehaus.mojo build-helper-maven-plugin - 1.7 - - - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/monitoring - - - - diff --git a/opendaylight/netconf/ietf-netconf-monitoring/pom.xml b/opendaylight/netconf/ietf-netconf-monitoring/pom.xml index eafc8354a0..e6a186c881 100644 --- a/opendaylight/netconf/ietf-netconf-monitoring/pom.xml +++ b/opendaylight/netconf/ietf-netconf-monitoring/pom.xml @@ -1,11 +1,9 @@ - + netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 ietf-netconf-monitoring @@ -39,53 +37,10 @@ org.opendaylight.yangtools yang-maven-plugin - ${yangtools.version} - - - - generate-sources - - - src/main/yang - - - - org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl - - - ${project.build.directory}/generated-sources/monitoring - - - - true - - - - - - org.opendaylight.yangtools - maven-sal-api-gen-plugin - ${yangtools.version} - - org.codehaus.mojo build-helper-maven-plugin - 1.7 - - - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/monitoring - - - - diff --git a/opendaylight/netconf/netconf-api/pom.xml b/opendaylight/netconf/netconf-api/pom.xml index d085986d2a..971f4a7bb4 100644 --- a/opendaylight/netconf/netconf-api/pom.xml +++ b/opendaylight/netconf/netconf-api/pom.xml @@ -1,12 +1,10 @@ - + netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 netconf-api diff --git a/opendaylight/netconf/netconf-client/pom.xml b/opendaylight/netconf/netconf-client/pom.xml index 56982a134b..e6cba9258e 100644 --- a/opendaylight/netconf/netconf-client/pom.xml +++ b/opendaylight/netconf/netconf-client/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT netconf-client ${project.artifactId} diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java index 67d95bb90f..b8951a4789 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java @@ -8,16 +8,11 @@ package org.opendaylight.controller.netconf.client; +import com.google.common.base.Preconditions; +import com.google.common.base.Stopwatch; +import com.google.common.collect.Sets; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GlobalEventExecutor; - -import java.io.Closeable; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.util.Set; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; - import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.protocol.framework.NeverReconnectStrategy; import org.opendaylight.protocol.framework.ReconnectStrategy; @@ -25,8 +20,13 @@ import org.opendaylight.protocol.framework.TimedReconnectStrategy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; +import java.io.Closeable; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.Set; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; public class NetconfClient implements Closeable { @@ -61,18 +61,18 @@ public class NetconfClient implements Closeable { try { return clientFuture.get(); } catch (CancellationException e) { - throw new RuntimeException("Netconf client interrupted", e); + throw new RuntimeException("Cancelling " + this, e); } catch (ExecutionException e) { - throw new IllegalStateException("Unable to create netconf client", e); + throw new IllegalStateException("Unable to create " + this, e); } } - public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat, NetconfClientDispatcher netconfClientDispatcher) throws InterruptedException { - return new NetconfClient(clientLabelForLogging,address,strat,netconfClientDispatcher); + public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strategy, NetconfClientDispatcher netconfClientDispatcher) throws InterruptedException { + return new NetconfClient(clientLabelForLogging,address,strategy,netconfClientDispatcher); } - public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat, NetconfClientDispatcher netconfClientDispatcher,NetconfClientSessionListener listener) throws InterruptedException { - return new NetconfClient(clientLabelForLogging,address,strat,netconfClientDispatcher,listener); + public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strategy, NetconfClientDispatcher netconfClientDispatcher,NetconfClientSessionListener listener) throws InterruptedException { + return new NetconfClient(clientLabelForLogging,address,strategy,netconfClientDispatcher,listener); } public NetconfClient(String clientLabelForLogging, InetSocketAddress address, int connectTimeoutMs, @@ -87,12 +87,12 @@ public class NetconfClient implements Closeable { DEFAULT_CONNECT_TIMEOUT), netconfClientDispatcher); } - public NetconfClient(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat, + public NetconfClient(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strategy, NetconfClientDispatcher netconfClientDispatcher, NetconfClientSessionListener listener) throws InterruptedException{ this.label = clientLabelForLogging; dispatch = netconfClientDispatcher; sessionListener = listener; - Future clientFuture = dispatch.createClient(address, sessionListener, strat); + Future clientFuture = dispatch.createClient(address, sessionListener, strategy); this.address = address; clientSession = get(clientFuture); this.sessionId = clientSession.getSessionId(); @@ -103,7 +103,7 @@ public class NetconfClient implements Closeable { } public NetconfMessage sendMessage(NetconfMessage message, int attempts, int attemptMsDelay) { - long startTime = System.currentTimeMillis(); + Stopwatch stopwatch = new Stopwatch().start(); Preconditions.checkState(clientSession.isUp(), "Session was not up yet"); //logger.debug("Sending message: {}",XmlUtil.toString(message.getDocument())); clientSession.sendMessage(message); @@ -115,8 +115,8 @@ public class NetconfClient implements Closeable { } catch (IllegalStateException e) { throw new IllegalStateException(this + " Cannot read message from " + address, e); } finally { - long diffMillis = System.currentTimeMillis() - startTime; - logger.debug("Total time spent waiting for response {}", diffMillis); + stopwatch.stop(); + logger.debug("Total time spent waiting for response {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); } } diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java index fc6f87db5d..1228a84a8a 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java @@ -8,15 +8,12 @@ package org.opendaylight.controller.netconf.client; +import com.google.common.base.Optional; import io.netty.channel.EventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.util.HashedWheelTimer; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Promise; - -import java.io.Closeable; -import java.net.InetSocketAddress; - import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.NetconfSession; import org.opendaylight.controller.netconf.api.NetconfTerminationReason; @@ -28,7 +25,8 @@ import org.opendaylight.protocol.framework.SessionListenerFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; +import java.io.Closeable; +import java.net.InetSocketAddress; public class NetconfClientDispatcher extends AbstractDispatcher implements Closeable { @@ -37,16 +35,16 @@ public class NetconfClientDispatcher extends AbstractDispatcherabsent()); + this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.absent(), clientConnectionTimeoutMillis); } - public NetconfClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup, String additionalHeader) { + public NetconfClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup, String additionalHeader, long connectionTimeoutMillis) { super(bossGroup, workerGroup); timer = new HashedWheelTimer(); - this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader)); + this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader), connectionTimeoutMillis); } public Future createClient(InetSocketAddress address, diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java index dd8e3c9664..100b98c15a 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java @@ -34,8 +34,9 @@ public class NetconfClientSessionNegotiator extends AbstractNetconfSessionNegotiator { protected NetconfClientSessionNegotiator(NetconfSessionPreferences sessionPreferences, - Promise promise, Channel channel, Timer timer, SessionListener sessionListener) { - super(sessionPreferences, promise, channel, timer, sessionListener); + Promise promise, Channel channel, Timer timer, SessionListener sessionListener, + long connectionTimeoutMillis) { + super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis); } private static Collection getCapabilities(Document doc) { diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactory.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactory.java index abfbdd526c..db6c024e5a 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactory.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactory.java @@ -8,13 +8,11 @@ package org.opendaylight.controller.netconf.client; +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; import io.netty.channel.Channel; import io.netty.util.Timer; import io.netty.util.concurrent.Promise; - -import java.io.IOException; -import java.io.InputStream; - import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.NetconfSessionPreferences; import org.opendaylight.controller.netconf.util.xml.XmlUtil; @@ -23,18 +21,20 @@ import org.opendaylight.protocol.framework.SessionNegotiator; import org.opendaylight.protocol.framework.SessionNegotiatorFactory; import org.xml.sax.SAXException; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; +import java.io.IOException; +import java.io.InputStream; public class NetconfClientSessionNegotiatorFactory implements SessionNegotiatorFactory { private final Timer timer; private final Optional additionalHeader; + private final long connectionTimeoutMillis; - public NetconfClientSessionNegotiatorFactory(Timer timer, Optional additionalHeader) { + public NetconfClientSessionNegotiatorFactory(Timer timer, Optional additionalHeader, long connectionTimeoutMillis) { this.timer = timer; this.additionalHeader = additionalHeader; + this.connectionTimeoutMillis = connectionTimeoutMillis; } private static NetconfMessage loadHelloMessageTemplate() { @@ -57,7 +57,7 @@ public class NetconfClientSessionNegotiatorFactory implements SessionNegotiatorF } NetconfSessionPreferences proposal = new NetconfSessionPreferences(helloMessage); return new NetconfClientSessionNegotiator(proposal, promise, channel, timer, - sessionListenerFactory.getSessionListener()); + sessionListenerFactory.getSessionListener(), connectionTimeoutMillis); } } diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java index ee07b3949d..06239b2bfd 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java @@ -8,16 +8,13 @@ package org.opendaylight.controller.netconf.client; +import com.google.common.base.Optional; import io.netty.channel.ChannelHandler; import io.netty.channel.EventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.util.HashedWheelTimer; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Promise; - -import java.io.IOException; -import java.net.InetSocketAddress; - import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.NetconfSession; import org.opendaylight.controller.netconf.api.NetconfTerminationReason; @@ -33,7 +30,8 @@ import org.opendaylight.protocol.framework.ReconnectStrategy; import org.opendaylight.protocol.framework.SessionListener; import org.opendaylight.protocol.framework.SessionListenerFactory; -import com.google.common.base.Optional; +import java.io.IOException; +import java.net.InetSocketAddress; public class NetconfSshClientDispatcher extends NetconfClientDispatcher { @@ -42,19 +40,19 @@ public class NetconfSshClientDispatcher extends NetconfClientDispatcher { private NetconfClientSessionNegotiatorFactory negotatorFactory; public NetconfSshClientDispatcher(AuthenticationHandler authHandler, EventLoopGroup bossGroup, - EventLoopGroup workerGroup) { - super(bossGroup, workerGroup); + EventLoopGroup workerGroup, long connectionTimeoutMillis) { + super(bossGroup, workerGroup, connectionTimeoutMillis); this.authHandler = authHandler; this.timer = new HashedWheelTimer(); - this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.absent()); + this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.absent(), connectionTimeoutMillis); } public NetconfSshClientDispatcher(AuthenticationHandler authHandler, EventLoopGroup bossGroup, - EventLoopGroup workerGroup, String additionalHeader) { - super(bossGroup, workerGroup, additionalHeader); + EventLoopGroup workerGroup, String additionalHeader, long socketTimeoutMillis) { + super(bossGroup, workerGroup, additionalHeader, socketTimeoutMillis); this.authHandler = authHandler; this.timer = new HashedWheelTimer(); - this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader)); + this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader), socketTimeoutMillis); } public Future createClient(InetSocketAddress address, diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java index 7f1d289c5b..1357201f57 100644 --- a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java +++ b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java @@ -12,38 +12,78 @@ import io.netty.channel.nio.NioEventLoopGroup; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.util.NetconfUtil; import org.opendaylight.controller.netconf.util.handler.ssh.authentication.LoginPassword; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.IOException; import java.net.InetSocketAddress; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; @Ignore public class SSHNetconfClientLiveTest { + private static final Logger logger = LoggerFactory.getLogger(SSHNetconfClientLiveTest.class); NioEventLoopGroup nettyThreadgroup; NetconfSshClientDispatcher netconfClientDispatcher; + InetSocketAddress address; + final int connectionAttempts = 10, attemptMsTimeout = 1000; + final int connectionTimeoutMillis = 20000; @Before public void setUp() { nettyThreadgroup = new NioEventLoopGroup(); + netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword( System.getProperty("username"), System.getProperty("password")), - nettyThreadgroup, nettyThreadgroup); + nettyThreadgroup, nettyThreadgroup, connectionTimeoutMillis); + + address = new InetSocketAddress(System.getProperty("host"), Integer.parseInt(System.getProperty("port"))); } + @Ignore @Test public void test() throws Exception { - InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), 830); - int connectionAttempts = 10, attemptMsTimeout = 1000; + //runnable.run(); + } - NetconfClient netconfClient = new NetconfClient("client", address, connectionAttempts, - attemptMsTimeout, netconfClientDispatcher); + @Test + public void testInExecutor() throws Exception { + int threads = 4; + ExecutorService executorService = Executors.newFixedThreadPool(threads); + try { + for (int i= 0;i< threads;i++) { + InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), + Integer.parseInt(System.getProperty("port"))); + NetconfRunnable runnable = new NetconfRunnable(address); + executorService.execute(runnable); + } + executorService.shutdown(); + executorService.awaitTermination(1, TimeUnit.MINUTES); - netconfClient.getCapabilities(); - NetconfMessage netconfMessage = NetconfUtil.createMessage(getClass().getResourceAsStream("/get_schema.xml")); - NetconfMessage response = netconfClient.sendMessage(netconfMessage); - NetconfUtil.checkIsMessageOk(response); + } finally { + executorService.shutdownNow(); + } } + + class NetconfRunnable implements Runnable { + private final InetSocketAddress address; + + NetconfRunnable(InetSocketAddress address) { + this.address = address; + } + + @Override + public void run() { + try (NetconfClient netconfClient = new NetconfClient(address.toString(), address, connectionAttempts, + attemptMsTimeout, netconfClientDispatcher);) { + logger.info("OK {}", address); + } catch (InterruptedException | IOException e) { + logger.error("Failed {}", address, e); + } + } + }; } diff --git a/opendaylight/netconf/netconf-impl/pom.xml b/opendaylight/netconf/netconf-impl/pom.xml index 2d56883e30..f4fc1ff0d5 100644 --- a/opendaylight/netconf/netconf-impl/pom.xml +++ b/opendaylight/netconf/netconf-impl/pom.xml @@ -1,11 +1,10 @@ - + netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 netconf-impl diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiator.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiator.java index 8ba4cdc052..91555861dc 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiator.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiator.java @@ -8,12 +8,10 @@ package org.opendaylight.controller.netconf.impl; +import com.google.common.base.Optional; import io.netty.channel.Channel; import io.netty.util.Timer; import io.netty.util.concurrent.Promise; - -import java.net.InetSocketAddress; - import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.NetconfServerSessionPreferences; import org.opendaylight.controller.netconf.impl.util.AdditionalHeaderUtil; @@ -22,7 +20,7 @@ import org.opendaylight.protocol.framework.SessionListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; +import java.net.InetSocketAddress; public class NetconfServerSessionNegotiator extends AbstractNetconfSessionNegotiator { @@ -30,8 +28,9 @@ public class NetconfServerSessionNegotiator extends static final Logger logger = LoggerFactory.getLogger(NetconfServerSessionNegotiator.class); protected NetconfServerSessionNegotiator(NetconfServerSessionPreferences sessionPreferences, - Promise promise, Channel channel, Timer timer, SessionListener sessionListener) { - super(sessionPreferences, promise, channel, timer, sessionListener); + Promise promise, Channel channel, Timer timer, SessionListener sessionListener, + long connectionTimeoutMillis) { + super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis); } @Override diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java index 3c14d5124f..98462b8025 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java @@ -40,12 +40,14 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF private static final Document helloMessageTemplate = loadHelloMessageTemplate(); private final SessionIdProvider idProvider; private final NetconfOperationServiceFactoryListener factoriesListener; + private final long connectionTimeoutMillis; public NetconfServerSessionNegotiatorFactory(Timer timer, NetconfOperationServiceFactoryListener factoriesListener, - SessionIdProvider idProvider) { + SessionIdProvider idProvider, long connectionTimeoutMillis) { this.timer = timer; this.factoriesListener = factoriesListener; this.idProvider = idProvider; + this.connectionTimeoutMillis = connectionTimeoutMillis; } private static Document loadHelloMessageTemplate() { @@ -64,7 +66,7 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF NetconfServerSessionPreferences proposal = new NetconfServerSessionPreferences(createHelloMessage(sessionId), sessionId); return new NetconfServerSessionNegotiator(proposal, promise, channel, timer, - sessionListenerFactory.getSessionListener()); + sessionListenerFactory.getSessionListener(), connectionTimeoutMillis); } private static final XPathExpression sessionIdXPath = XMLNetconfUtil diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java index abebacf974..95f7353600 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java @@ -48,8 +48,9 @@ public class NetconfImplActivator implements BundleActivator { SessionIdProvider idProvider = new SessionIdProvider(); timer = new HashedWheelTimer(); + long connectionTimeoutMillis = NetconfConfigUtil.extractTimeoutMillis(context); NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( - timer, factoriesListener, idProvider); + timer, factoriesListener, idProvider, connectionTimeoutMillis); commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer()); diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java index 958ac42398..0ef2c285e4 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java @@ -8,34 +8,14 @@ package org.opendaylight.controller.netconf.impl; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; +import com.google.common.base.Optional; +import com.google.common.collect.Sets; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; - -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.management.ManagementFactory; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import javax.management.ObjectName; - import org.apache.commons.io.IOUtils; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -63,15 +43,30 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; -import com.google.common.base.Optional; -import com.google.common.collect.Sets; +import javax.management.ObjectName; +import java.io.DataOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import static com.google.common.base.Preconditions.checkNotNull; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; public class ConcurrentClientsTest { private static final int CONCURRENCY = 16; - private static EventLoopGroup nettyGroup = new NioEventLoopGroup(); - public static final NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER = - new NetconfClientDispatcher( nettyGroup, nettyGroup); + private EventLoopGroup nettyGroup; + private NetconfClientDispatcher netconfClientDispatcher; @Mock private YangStoreService yangStoreService; @@ -88,6 +83,8 @@ public class ConcurrentClientsTest { @Mock private SessionMonitoringService monitoring; + HashedWheelTimer hashedWheelTimer; + @Before public void setUp() throws Exception { { // init mocks @@ -102,12 +99,16 @@ public class ConcurrentClientsTest { doReturn(Collections.emptySet()).when(jmxClient).lookupConfigBeans(); } + nettyGroup = new NioEventLoopGroup(); + netconfClientDispatcher = new NetconfClientDispatcher( nettyGroup, nettyGroup, 5000); + NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl(); factoriesListener.onAddNetconfOperationServiceFactory(mockOpF()); SessionIdProvider idProvider = new SessionIdProvider(); + hashedWheelTimer = new HashedWheelTimer(); NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( - new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider); + hashedWheelTimer, factoriesListener, idProvider, 5000); commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer()); @@ -123,8 +124,9 @@ public class ConcurrentClientsTest { s.await(); } - @AfterClass - public static void tearDownStatic() { + @After + public void tearDown(){ + hashedWheelTimer.stop(); nettyGroup.shutdownGracefully(); } @@ -285,7 +287,7 @@ public class ConcurrentClientsTest { @Override public void run() { try { - final NetconfClient netconfClient = new NetconfClient(clientId, netconfAddress, NETCONF_CLIENT_DISPATCHER); + final NetconfClient netconfClient = new NetconfClient(clientId, netconfAddress, netconfClientDispatcher); long sessionId = netconfClient.getSessionId(); logger.info("Client with sessionid {} hello exchanged", sessionId); diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java index 0ecc1cb383..9835c2393b 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java @@ -26,6 +26,7 @@ public class NetconfDispatcherImplTest { private EventLoopGroup nettyGroup; private NetconfServerDispatcher dispatch; private DefaultCommitNotificationProducer commitNot; + private HashedWheelTimer hashedWheelTimer; @Before public void setUp() throws Exception { @@ -36,8 +37,9 @@ public class NetconfDispatcherImplTest { NetconfOperationServiceFactoryListener factoriesListener = new NetconfOperationServiceFactoryListenerImpl(); SessionIdProvider idProvider = new SessionIdProvider(); + hashedWheelTimer = new HashedWheelTimer(); NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( - new HashedWheelTimer(), factoriesListener, idProvider); + hashedWheelTimer, factoriesListener, idProvider, 5000); NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( factoriesListener, commitNot, idProvider, null); @@ -49,6 +51,7 @@ public class NetconfDispatcherImplTest { @After public void tearDown() throws Exception { + hashedWheelTimer.stop(); commitNot.close(); nettyGroup.shutdownGracefully(); } diff --git a/opendaylight/netconf/netconf-it/pom.xml b/opendaylight/netconf/netconf-it/pom.xml index 5e8f29193a..9b0c7ab08a 100644 --- a/opendaylight/netconf/netconf-it/pom.xml +++ b/opendaylight/netconf/netconf-it/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT netconf-it diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java new file mode 100644 index 0000000000..b261218bf1 --- /dev/null +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java @@ -0,0 +1,60 @@ +/* + * 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.netconf.it; + +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.util.HashedWheelTimer; +import org.junit.After; +import org.junit.Before; +import org.opendaylight.controller.config.manager.impl.AbstractConfigTest; +import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer; +import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; +import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory; +import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory; +import org.opendaylight.controller.netconf.impl.SessionIdProvider; +import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; +import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService; + +public class AbstractNetconfConfigTest extends AbstractConfigTest { + + protected EventLoopGroup nettyThreadgroup; + private HashedWheelTimer hashedWheelTimer; + + @Before + public void setUpAbstractNetconfConfigTest() { + nettyThreadgroup = new NioEventLoopGroup(); + hashedWheelTimer = new HashedWheelTimer(); + } + + + protected NetconfServerDispatcher createDispatcher( + NetconfOperationServiceFactoryListenerImpl factoriesListener, SessionMonitoringService sessionMonitoringService, + DefaultCommitNotificationProducer commitNotifier) { + SessionIdProvider idProvider = new SessionIdProvider(); + + NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( + hashedWheelTimer, factoriesListener, idProvider, 5000); + + NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( + factoriesListener, commitNotifier, idProvider, + sessionMonitoringService); + + NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer( + serverNegotiatorFactory, listenerFactory); + return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup); + } + + + @After + public void cleanUpTimer() { + hashedWheelTimer.stop(); + nettyThreadgroup.shutdownGracefully(); + } + +} diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java index 14f70d398c..0037981a3e 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java @@ -10,17 +10,14 @@ package org.opendaylight.controller.netconf.it; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import io.netty.channel.ChannelFuture; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.util.HashedWheelTimer; import org.apache.commons.lang3.StringUtils; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.matchers.JUnitMatchers; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.opendaylight.controller.config.manager.impl.AbstractConfigTest; import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver; import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder; import org.opendaylight.controller.config.persist.api.Persister; @@ -35,9 +32,6 @@ import org.opendaylight.controller.netconf.client.NetconfClientDispatcher; import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl; import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer; import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; -import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory; -import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory; -import org.opendaylight.controller.netconf.impl.SessionIdProvider; import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; @@ -63,7 +57,6 @@ import java.net.InetSocketAddress; import java.util.Collection; import java.util.List; import java.util.Set; -import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; import static junit.framework.Assert.assertEquals; @@ -74,16 +67,18 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; -public class NetconfConfigPersisterITTest extends AbstractConfigTest { +public class NetconfConfigPersisterITTest extends AbstractNetconfConfigTest { private static final Logger logger = LoggerFactory.getLogger(NetconfConfigPersisterITTest.class); private static final InetSocketAddress tcpAddress = new InetSocketAddress("127.0.0.1", 12023); - private EventLoopGroup nettyThreadgroup; + private NetconfClientDispatcher clientDispatcher; + DefaultCommitNotificationProducer commitNotifier; + @Before public void setUp() throws Exception { super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(NetconfITTest.getModuleFactoriesS().toArray( @@ -97,13 +92,18 @@ public class NetconfConfigPersisterITTest extends AbstractConfigTest { .onAddNetconfOperationServiceFactory(new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory( new NetconfMonitoringOperationService(monitoringService))); - nettyThreadgroup = new NioEventLoopGroup(); - NetconfServerDispatcher dispatch = createDispatcher(factoriesListener); + commitNotifier = new DefaultCommitNotificationProducer(platformMBeanServer); + NetconfServerDispatcher dispatch = createDispatcher(factoriesListener, mockSessionMonitoringService(), commitNotifier); ChannelFuture s = dispatch.createServer(tcpAddress); s.await(); - clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup); + clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup, 5000); + } + + @After + public void cleanUp(){ + commitNotifier.close(); } private HardcodedYangStoreService getYangStore() throws YangStoreException, IOException { @@ -111,27 +111,16 @@ public class NetconfConfigPersisterITTest extends AbstractConfigTest { return new HardcodedYangStoreService(yangDependencies); } - private NetconfServerDispatcher createDispatcher( - NetconfOperationServiceFactoryListenerImpl factoriesListener) { - SessionIdProvider idProvider = new SessionIdProvider(); - NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( - new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider); - - NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( - factoriesListener, new DefaultCommitNotificationProducer(platformMBeanServer), idProvider, mockSessionMonitoringService()); - - NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer( - serverNegotiatorFactory, listenerFactory); - return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup); - } - private SessionMonitoringService mockSessionMonitoringService() { + protected SessionMonitoringService mockSessionMonitoringService() { SessionMonitoringService mockedSessionMonitor = mock(SessionMonitoringService.class); doNothing().when(mockedSessionMonitor).onSessionUp(any(NetconfManagementSession.class)); doNothing().when(mockedSessionMonitor).onSessionDown(any(NetconfManagementSession.class)); return mockedSessionMonitor; } + + @Test public void testNetconfCommitNotifications() throws Exception { @@ -139,22 +128,22 @@ public class NetconfConfigPersisterITTest extends AbstractConfigTest { VerifyingPersister mockedAggregator = mockAggregator(); try (NetconfClient persisterClient = new NetconfClient("persister", tcpAddress, 4000, clientDispatcher)) { - ConfigPersisterNotificationHandler configPersisterNotificationHandler = new ConfigPersisterNotificationHandler( - platformMBeanServer, persisterClient, mockedAggregator, - Pattern.compile("")); - configPersisterNotificationHandler.init(); - - try (NetconfClient netconfClient = new NetconfClient("client", tcpAddress, 4000, clientDispatcher)) { - NetconfMessage response = netconfClient.sendMessage(loadGetConfigMessage()); - assertResponse(response, " - + netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 netconf-mapping-api diff --git a/opendaylight/netconf/netconf-monitoring/pom.xml b/opendaylight/netconf/netconf-monitoring/pom.xml index fa0aae5236..d1fb6aabeb 100644 --- a/opendaylight/netconf/netconf-monitoring/pom.xml +++ b/opendaylight/netconf/netconf-monitoring/pom.xml @@ -1,11 +1,9 @@ - + netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT 4.0.0 netconf-monitoring diff --git a/opendaylight/netconf/netconf-ssh/pom.xml b/opendaylight/netconf/netconf-ssh/pom.xml index d91564ba0b..3b4125b386 100644 --- a/opendaylight/netconf/netconf-ssh/pom.xml +++ b/opendaylight/netconf/netconf-ssh/pom.xml @@ -1,9 +1,8 @@ - + netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ../ 4.0.0 @@ -36,7 +35,7 @@ org.opendaylight.controller usermanager - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT diff --git a/opendaylight/netconf/netconf-util/pom.xml b/opendaylight/netconf/netconf-util/pom.xml index 3c96897a2c..0e06ab372f 100644 --- a/opendaylight/netconf/netconf-util/pom.xml +++ b/opendaylight/netconf/netconf-util/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 netconf-subsystem org.opendaylight.controller - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT netconf-util ${project.artifactId} diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java index 26ea7ceb79..a485a4ea94 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java @@ -42,9 +42,6 @@ import java.util.concurrent.TimeUnit; public abstract class AbstractNetconfSessionNegotiator

      extends AbstractSessionNegotiator { - // TODO Adjust wait time for negotiation, now is 1 minute ? - private static final long INITIAL_HOLDTIMER = 1; - private static final Logger logger = LoggerFactory.getLogger(AbstractNetconfSessionNegotiator.class); public static final String NAME_OF_EXCEPTION_HANDLER = "lastExceptionHandler"; @@ -62,13 +59,15 @@ public abstract class AbstractNetconfSessionNegotiator

      promise, Channel channel, Timer timer, - SessionListener sessionListener) { + SessionListener sessionListener, long connectionTimeoutMillis) { super(promise, channel); this.sessionPreferences = sessionPreferences; this.timer = timer; this.sessionListener = sessionListener; + this.connectionTimeoutMillis = connectionTimeoutMillis; } @Override @@ -120,6 +119,7 @@ public abstract class AbstractNetconfSessionNegotiator

      inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp, exceptionMessageIfNotFound, forClient); @@ -32,7 +57,12 @@ public class NetconfConfigUtil { if (inetSocketAddressOptional.isPresent() == false) { throw new IllegalStateException("Netconf tcp address not found." + exceptionMessageIfNotFound); } - return inetSocketAddressOptional.get(); + InetSocketAddress inetSocketAddress = inetSocketAddressOptional.get(); + if (inetSocketAddress.getAddress().isAnyLocalAddress()) { + logger.warn("Unprotected netconf TCP address is configured to ANY local address. This is a security risk. " + + "Consider changing {} to 127.0.0.1", PREFIX_PROP + InfixProp.tcp + ADDRESS_SUFFIX_PROP); + } + return inetSocketAddress; } public static Optional extractSSHNetconfAddress(BundleContext context, String exceptionMessage) { diff --git a/opendaylight/netconf/pom.xml b/opendaylight/netconf/pom.xml index 9d9cad792f..2c2ef3b507 100644 --- a/opendaylight/netconf/pom.xml +++ b/opendaylight/netconf/pom.xml @@ -1,15 +1,14 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../commons/opendaylight - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT netconf-subsystem pom ${project.artifactId} @@ -49,8 +48,9 @@ 2.4.0 1.7.2 4.0.10.Final - 0.2.3-SNAPSHOT - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT + 0.2.4-SNAPSHOT + ${project.build.directory}/generated-sources/sal @@ -226,6 +226,61 @@ + + org.opendaylight.yangtools + yang-maven-plugin + ${yangtools.version} + + + + generate-sources + + + src/main/yang + + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + + + ${salGeneratorPath} + + + + org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl + ${project.build.directory}/site/models + + + true + + + + + + org.opendaylight.yangtools + maven-sal-api-gen-plugin + ${yangtools.version} + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + generate-sources + + add-source + + + + ${salGeneratorPath} + + + + + diff --git a/opendaylight/networkconfiguration/neutron/implementation/pom.xml b/opendaylight/networkconfiguration/neutron/implementation/pom.xml index c5c231d652..83e251aed8 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/pom.xml +++ b/opendaylight/networkconfiguration/neutron/implementation/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -37,7 +36,7 @@ org.opendaylight.controller networkconfig.neutron.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/networkconfiguration/neutron/pom.xml b/opendaylight/networkconfiguration/neutron/pom.xml index 3f02ec18b3..fc728dc89f 100644 --- a/opendaylight/networkconfiguration/neutron/pom.xml +++ b/opendaylight/networkconfiguration/neutron/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -36,7 +35,7 @@ org.opendaylight.controller networkconfig.neutron - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java index 11a1be2118..6582d8c021 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java @@ -269,22 +269,26 @@ public class NeutronSubnet extends ConfigurationObject implements Serializable { } gatewayIPAssigned = false; dnsNameservers = new ArrayList(); - allocationPools = new ArrayList(); - hostRoutes = new ArrayList(); - try { - SubnetUtils util = new SubnetUtils(cidr); - SubnetInfo info = util.getInfo(); - if (gatewayIP == null) { - gatewayIP = info.getLowAddress(); - } - if (allocationPools.size() < 1) { - NeutronSubnet_IPAllocationPool source = - new NeutronSubnet_IPAllocationPool(info.getLowAddress(), - info.getHighAddress()); - allocationPools = source.splitPool(gatewayIP); + if (hostRoutes == null) { + hostRoutes = new ArrayList(); + } + if (allocationPools == null) { + allocationPools = new ArrayList(); + try { + SubnetUtils util = new SubnetUtils(cidr); + SubnetInfo info = util.getInfo(); + if (gatewayIP == null) { + gatewayIP = info.getLowAddress(); + } + if (allocationPools.size() < 1) { + NeutronSubnet_IPAllocationPool source = + new NeutronSubnet_IPAllocationPool(info.getLowAddress(), + info.getHighAddress()); + allocationPools = source.splitPool(gatewayIP); + } + } catch (Exception e) { + return false; } - } catch (Exception e) { - return false; } return true; } diff --git a/opendaylight/northbound/bundlescanner/api/pom.xml b/opendaylight/northbound/bundlescanner/api/pom.xml index 44b48cb2eb..a0a3c9cfc6 100644 --- a/opendaylight/northbound/bundlescanner/api/pom.xml +++ b/opendaylight/northbound/bundlescanner/api/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -16,7 +15,7 @@ bundlescanner - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/bundlescanner/implementation/pom.xml b/opendaylight/northbound/bundlescanner/implementation/pom.xml index a3d53ed011..d4e08079a6 100644 --- a/opendaylight/northbound/bundlescanner/implementation/pom.xml +++ b/opendaylight/northbound/bundlescanner/implementation/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -16,7 +15,7 @@ bundlescanner.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanServiceImpl.java b/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanServiceImpl.java index 751b597e78..ec3f5ad568 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanServiceImpl.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanServiceImpl.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.northbound.bundlescanner.internal; import java.util.List; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Animal.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Animal.java index e9fb31fc35..693c6aeb85 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Animal.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Animal.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_base; import javax.xml.bind.annotation.XmlRootElement; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/BasePerson.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/BasePerson.java index 2c6d7d358e..bfb8b35265 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/BasePerson.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/BasePerson.java @@ -1,7 +1,14 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_base; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement -public class BasePerson { } \ No newline at end of file +public class BasePerson { } diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Mammal.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Mammal.java index 53ab14d6d6..d6162b6939 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Mammal.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Mammal.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_base; import javax.xml.bind.annotation.XmlRootElement; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NoAnnotation.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NoAnnotation.java index b8f3d10f71..7e9069b599 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NoAnnotation.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NoAnnotation.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_base; public class NoAnnotation { } diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NonRelevantAnnotation.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NonRelevantAnnotation.java index 9429345a84..4a04a3b6c9 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NonRelevantAnnotation.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/NonRelevantAnnotation.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_base; @Deprecated diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Person.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Person.java index 9a6acc0ceb..edd3782817 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Person.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_base/Person.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_base; import javax.xml.bind.annotation.XmlElement; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_misc/Misc.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_misc/Misc.java index cb33ce98bc..eb49eb0fb9 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_misc/Misc.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_misc/Misc.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_misc; import javax.xml.bind.annotation.XmlRootElement; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/NoAnnotation.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/NoAnnotation.java index 9a08fc99dd..19f2b0ddf0 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/NoAnnotation.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/NoAnnotation.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_sub1; public class NoAnnotation { diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/Zoo.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/Zoo.java index 1eadad61fa..c44e48e22f 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/Zoo.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub1/Zoo.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_sub1; import javax.xml.bind.annotation.XmlElementRef; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Agent.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Agent.java index 2b982706c3..025f35af9a 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Agent.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Agent.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_sub2; import javax.xml.bind.annotation.XmlRootElement; @@ -8,4 +15,4 @@ import bundle_base.Person; @XmlRootElement public class Agent extends Person { -} \ No newline at end of file +} diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Customer.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Customer.java index a3f5dcaa53..d822ce757b 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Customer.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/Customer.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_sub2; import java.util.ArrayList; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/NoAnnotation.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/NoAnnotation.java index 430f10b8db..e477e61959 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/NoAnnotation.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/bundle_sub2/NoAnnotation.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package bundle_sub2; public class NoAnnotation { diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java index 5bbdd87c7c..1c35404c80 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.northbound.bundlescanner.internal; diff --git a/opendaylight/northbound/commons/pom.xml b/opendaylight/northbound/commons/pom.xml index afd2f2e47f..684744c015 100644 --- a/opendaylight/northbound/commons/pom.xml +++ b/opendaylight/northbound/commons/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ commons.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java index 58ba776970..4e78c201c1 100644 --- a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.northbound.commons.utils; import java.util.HashMap; diff --git a/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/CommonsNorthboundTest.java b/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/CommonsNorthboundTest.java index 1e910d18fb..ec9590b442 100644 --- a/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/CommonsNorthboundTest.java +++ b/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/CommonsNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.northbound.commons; import org.junit.Assert; diff --git a/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/exception/CommonsNorthboundExceptionTest.java b/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/exception/CommonsNorthboundExceptionTest.java index c329644110..8784950330 100644 --- a/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/exception/CommonsNorthboundExceptionTest.java +++ b/opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/exception/CommonsNorthboundExceptionTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.northbound.commons.exception; import javax.ws.rs.core.Response; diff --git a/opendaylight/northbound/connectionmanager/pom.xml b/opendaylight/northbound/connectionmanager/pom.xml index 8fed221bf8..c62f4bab71 100644 --- a/opendaylight/northbound/connectionmanager/pom.xml +++ b/opendaylight/northbound/connectionmanager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ connectionmanager.northbound - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/containermanager/pom.xml b/opendaylight/northbound/containermanager/pom.xml index 7cc3964713..2d980910f4 100644 --- a/opendaylight/northbound/containermanager/pom.xml +++ b/opendaylight/northbound/containermanager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +16,7 @@ org.opendaylight.controller containermanager.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/controllermanager/pom.xml b/opendaylight/northbound/controllermanager/pom.xml index 866f166c4b..33926af0c8 100644 --- a/opendaylight/northbound/controllermanager/pom.xml +++ b/opendaylight/northbound/controllermanager/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight controllermanager.northbound - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT bundle scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/northbound/controllermanager/src/main/java/org/opendaylight/controller/controllermanager/northbound/ControllerProperties.java b/opendaylight/northbound/controllermanager/src/main/java/org/opendaylight/controller/controllermanager/northbound/ControllerProperties.java index 1560f96072..3d45257ce2 100644 --- a/opendaylight/northbound/controllermanager/src/main/java/org/opendaylight/controller/controllermanager/northbound/ControllerProperties.java +++ b/opendaylight/northbound/controllermanager/src/main/java/org/opendaylight/controller/controllermanager/northbound/ControllerProperties.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.controllermanager.northbound; import java.util.HashMap; diff --git a/opendaylight/northbound/controllermanager/src/test/java/org/opendaylight/controller/controllermanager/northbound/ControllerManagerNorthboundTest.java b/opendaylight/northbound/controllermanager/src/test/java/org/opendaylight/controller/controllermanager/northbound/ControllerManagerNorthboundTest.java index 7f8b0b43bf..a25c75928d 100644 --- a/opendaylight/northbound/controllermanager/src/test/java/org/opendaylight/controller/controllermanager/northbound/ControllerManagerNorthboundTest.java +++ b/opendaylight/northbound/controllermanager/src/test/java/org/opendaylight/controller/controllermanager/northbound/ControllerManagerNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.controllermanager.northbound; import java.util.HashSet; diff --git a/opendaylight/northbound/flowprogrammer/pom.xml b/opendaylight/northbound/flowprogrammer/pom.xml index 2948237007..ce91d67288 100644 --- a/opendaylight/northbound/flowprogrammer/pom.xml +++ b/opendaylight/northbound/flowprogrammer/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ flowprogrammer.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java b/opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java index 493168cd51..10767e8777 100644 --- a/opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java +++ b/opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.flowprogrammer.northbound; import java.util.ArrayList; diff --git a/opendaylight/northbound/hosttracker/pom.xml b/opendaylight/northbound/hosttracker/pom.xml index 54a1fa025e..1dd6371ee0 100644 --- a/opendaylight/northbound/hosttracker/pom.xml +++ b/opendaylight/northbound/hosttracker/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight hosttracker.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java b/opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java index c11312375a..14d6cf7667 100644 --- a/opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java +++ b/opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.hosttracker.northbound; import java.net.InetAddress; diff --git a/opendaylight/northbound/httpservice-bridge/pom.xml b/opendaylight/northbound/httpservice-bridge/pom.xml index 37e8df1a95..20d60fbbc7 100644 --- a/opendaylight/northbound/httpservice-bridge/pom.xml +++ b/opendaylight/northbound/httpservice-bridge/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight httpservice-bridge - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT HttpService bridge web application bundle diff --git a/opendaylight/northbound/integrationtest/pom.xml b/opendaylight/northbound/integrationtest/pom.xml index d5283e35a9..a6b3855d1f 100644 --- a/opendaylight/northbound/integrationtest/pom.xml +++ b/opendaylight/northbound/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -16,7 +16,7 @@ org.opendaylight.controller northbound.integrationtest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT central 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 cabfb0ee5a..1a39a21e1a 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 @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.northbound.integrationtest; import static org.junit.Assert.assertFalse; diff --git a/opendaylight/northbound/java-client/pom.xml b/opendaylight/northbound/java-client/pom.xml index 48bbdc6091..7ec7afa045 100644 --- a/opendaylight/northbound/java-client/pom.xml +++ b/opendaylight/northbound/java-client/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight diff --git a/opendaylight/northbound/jolokia/pom.xml b/opendaylight/northbound/jolokia/pom.xml index 1ff43834b1..ac0bf1bda0 100644 --- a/opendaylight/northbound/jolokia/pom.xml +++ b/opendaylight/northbound/jolokia/pom.xml @@ -4,13 +4,13 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight jolokia-bridge Jolokia bridge web application - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml b/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml index 9792de1dbe..9d2818365f 100644 --- a/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml +++ b/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -15,7 +15,7 @@ networkconfig.bridgedomain.northbound - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT bundle diff --git a/opendaylight/northbound/networkconfiguration/neutron/pom.xml b/opendaylight/northbound/networkconfiguration/neutron/pom.xml index be934d2627..a6596f886d 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/pom.xml +++ b/opendaylight/northbound/networkconfiguration/neutron/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -36,7 +36,7 @@ org.opendaylight.controller networkconfig.neutron.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/staticrouting/pom.xml b/opendaylight/northbound/staticrouting/pom.xml index 71e45de0b3..937eea1396 100644 --- a/opendaylight/northbound/staticrouting/pom.xml +++ b/opendaylight/northbound/staticrouting/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ forwarding.staticrouting.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java b/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java index ac15a91f43..5a5da4ef1f 100644 --- a/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java +++ b/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.forwarding.staticrouting.northbound; import java.util.ArrayList; diff --git a/opendaylight/northbound/statistics/pom.xml b/opendaylight/northbound/statistics/pom.xml index db15c9c7ab..63332f4d22 100644 --- a/opendaylight/northbound/statistics/pom.xml +++ b/opendaylight/northbound/statistics/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ statistics.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/subnets/pom.xml b/opendaylight/northbound/subnets/pom.xml index e46350f0ea..fe0de36554 100644 --- a/opendaylight/northbound/subnets/pom.xml +++ b/opendaylight/northbound/subnets/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ subnets.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java b/opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java index 66b71e70a2..833b5d4ce7 100644 --- a/opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java +++ b/opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.subnets.northbound; import java.util.ArrayList; diff --git a/opendaylight/northbound/switchmanager/pom.xml b/opendaylight/northbound/switchmanager/pom.xml index faa75a9e57..dca8c2f060 100644 --- a/opendaylight/northbound/switchmanager/pom.xml +++ b/opendaylight/northbound/switchmanager/pom.xml @@ -1,15 +1,14 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight switchmanager.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java b/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java index f9a88d2e28..89a5c96a29 100644 --- a/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java +++ b/opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.switchmanager.northbound; diff --git a/opendaylight/northbound/topology/pom.xml b/opendaylight/northbound/topology/pom.xml index 98ccd97a47..a24f087b75 100644 --- a/opendaylight/northbound/topology/pom.xml +++ b/opendaylight/northbound/topology/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ topology.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java b/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java index def7d46ed1..298f32877a 100644 --- a/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java +++ b/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.topology.northbound; diff --git a/opendaylight/northbound/usermanager/pom.xml b/opendaylight/northbound/usermanager/pom.xml index c8231f144e..9c5626cd20 100644 --- a/opendaylight/northbound/usermanager/pom.xml +++ b/opendaylight/northbound/usermanager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ usermanager.northbound - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT bundle diff --git a/opendaylight/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java b/opendaylight/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java index 03eb8a6c0c..ac0307a721 100644 --- a/opendaylight/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java +++ b/opendaylight/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.subnets.northbound; import java.util.ArrayList; diff --git a/opendaylight/protocol_plugins/openflow/pom.xml b/opendaylight/protocol_plugins/openflow/pom.xml index 8f9c4488ad..48555de525 100644 --- a/opendaylight/protocol_plugins/openflow/pom.xml +++ b/opendaylight/protocol_plugins/openflow/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ protocol_plugins.openflow - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsListener.java index 6980479fa8..9a2d4ffbc4 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IOFStatisticsListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugin.openflow; import java.util.List; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IReadFilterInternalListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IReadFilterInternalListener.java index 9622af97ef..eb46c60466 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IReadFilterInternalListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IReadFilterInternalListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugin.openflow; import java.util.List; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java index 72ee7a679b..63dd0bc29a 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/Controller.java @@ -48,6 +48,7 @@ public class Controller implements IController, CommandProvider, IPluginInConnec .getLogger(Controller.class); private ControllerIO controllerIO; private Thread switchEventThread; + private volatile boolean shutdownSwitchEventThread;// default to false private ConcurrentHashMap switches; private PriorityBlockingQueue switchEvents; // only 1 message listener per OFType @@ -69,6 +70,12 @@ public class Controller implements IController, CommandProvider, IPluginInConnec while (true) { try { + if(shutdownSwitchEventThread) { + // break out of the infinite loop + // if you are shutting down + logger.info("Switch Event Thread is shutting down"); + break; + } SwitchEvent ev = switchEvents.take(); SwitchEvent.SwitchEventType eType = ev.getEventType(); ISwitch sw = ev.getSwitch(); @@ -104,12 +111,14 @@ public class Controller implements IController, CommandProvider, IPluginInConnec logger.error("Unknown switch event {}", eType.ordinal()); } } catch (InterruptedException e) { - switchEvents.clear(); - return; + // nothing to do except retry + } catch (Exception e) { + // log the exception and retry + logger.warn("Exception in Switch Event Thread is {}" ,e); } } + switchEvents.clear(); } - } /** @@ -167,6 +176,7 @@ public class Controller implements IController, CommandProvider, IPluginInConnec ((SwitchHandler) entry.getValue()).stop(); it.remove(); } + shutdownSwitchEventThread = true; switchEventThread.interrupt(); try { controllerIO.shutDown(); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java index 90b47cf264..d60bcab8b3 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java @@ -407,9 +407,9 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { this.myAppData = ByteBuffer .allocate(session.getApplicationBufferSize()); this.peerAppData = ByteBuffer.allocate(session - .getApplicationBufferSize()); + .getApplicationBufferSize() * 2); this.myNetData = ByteBuffer.allocate(session.getPacketBufferSize()); - this.peerNetData = ByteBuffer.allocate(session.getPacketBufferSize()); + this.peerNetData = ByteBuffer.allocate(session.getPacketBufferSize() * 2); } @Override diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java index 78a2ea5120..6d1c563aa4 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java @@ -539,7 +539,7 @@ public class FlowConverter { salMatch.setField(new MatchField(MatchType.DL_VLAN, vlan)); } - if (ofMatch.getDataLayerVirtualLanPriorityCodePoint() != 0) { + if ((ofMatch.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) { salMatch.setField(MatchType.DL_VLAN_PR, ofMatch .getDataLayerVirtualLanPriorityCodePoint()); } @@ -612,7 +612,7 @@ public class FlowConverter { salMatch.setField(new MatchField(MatchType.DL_VLAN, vlan)); } - if (v6Match.getDataLayerVirtualLanPriorityCodePoint() != 0) { + if ((v6Match.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) { salMatch.setField(MatchType.DL_VLAN_PR, v6Match .getDataLayerVirtualLanPriorityCodePoint()); } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java index 9e44073e21..dfe931f448 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Error.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension; import java.nio.ByteBuffer; diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java index 4daa591ba1..cfe20a1fa2 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java @@ -216,7 +216,7 @@ public class V6Match extends OFMatch implements Cloneable { this.dlVlanIDState = MatchFieldState.MATCH_ABSENT; } - if (match.getDataLayerVirtualLanPriorityCodePoint() != 0) { + if ((match.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) { this.setDataLayerVirtualLanPriorityCodePoint( match.getDataLayerVirtualLanPriorityCodePoint(), (byte) 0); } else { @@ -839,14 +839,12 @@ public class V6Match extends OFMatch implements Cloneable { // extract the vlan id super.setDataLayerVirtualLan(getVlanID(firstByte, secondByte)); - } else { this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match } if ((this.dataLayerVirtualLanTCIMask & 0xe000) != 0) { // else if its a vlan pcp mask // extract the vlan pcp super.setDataLayerVirtualLanPriorityCodePoint(getVlanPCP(firstByte)); - } else { this.wildcards ^= (1 << 20); } this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_WITH_MASK; @@ -864,6 +862,8 @@ public class V6Match extends OFMatch implements Cloneable { super.setDataLayerVirtualLan(getVlanID(firstByte, secondByte)); this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY; this.match_len += 6; + this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match + this.wildcards ^= (1 << 20); } } } @@ -1216,8 +1216,6 @@ public class V6Match extends OFMatch implements Cloneable { // ipv4 dest processing this.wildcards ^= (((1 << 5) - 1) << 14); } - } else { - this.wildcards = 0; } } diff --git a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java index a751948de7..96f0d80022 100644 --- a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java +++ b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java @@ -18,9 +18,6 @@ import java.util.List; import org.junit.Assert; import org.junit.Test; import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6Match; -import org.openflow.protocol.OFMatch; -import org.openflow.protocol.action.OFAction; - import org.opendaylight.controller.sal.action.Action; import org.opendaylight.controller.sal.action.Flood; import org.opendaylight.controller.sal.action.FloodAll; @@ -46,6 +43,9 @@ import org.opendaylight.controller.sal.utils.EtherTypes; import org.opendaylight.controller.sal.utils.IPProtocols; import org.opendaylight.controller.sal.utils.NodeConnectorCreator; import org.opendaylight.controller.sal.utils.NodeCreator; +import org.openflow.protocol.OFMatch; +import org.openflow.protocol.action.OFAction; +import org.openflow.util.U32; public class FlowProgrammerServiceTest { @@ -298,6 +298,16 @@ public class FlowProgrammerServiceTest { */ FlowConverter salToOF = new FlowConverter(aFlow); V6Match v6Match = (V6Match) salToOF.getOFMatch(); + // need this hardcoding here to make the test pass. + // this should not be a problem in actual code. + // in the test the sal match is converted to a V6 match. + // we lose the wildcard info as the V6 match is used for nicira extensions + // and nicira deals with wildcards in a different way. + // converting the V6 match back to sal match is not going to preserve the wildcard info. + // and we need the wildcard info for reading the vlan pcp now. + // when creating a V6Match using the readFrom method + // we do convert the nicira extensions format correctly to populate the wildcard info. + v6Match.setWildcards(U32.t(Long.valueOf(~OFMatch.OFPFW_DL_VLAN_PCP))); List ofActions = salToOF.getOFActions(); /* diff --git a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6ExtensionTest.java b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6ExtensionTest.java index 2898dde363..abbc43809d 100644 --- a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6ExtensionTest.java +++ b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6ExtensionTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension; import static org.junit.Assert.fail; @@ -10,6 +17,7 @@ import java.util.Arrays; import org.junit.Assert; import org.junit.Test; import org.openflow.protocol.OFMatch; +import org.openflow.util.U32; public class V6ExtensionTest { @@ -45,20 +53,18 @@ public class V6ExtensionTest { match.fromString("input_port=1"); match.fromString("dl_dst=20:A0:11:10:00:99"); match.fromString("dl_src=00:10:08:22:12:75"); - match.fromString("ip_src=10.1.1.1"); match.fromString("ip_dst=1.2.3.4"); match.fromString("eth_type=0x800"); match.fromString("dl_vlan=10"); - match.fromString("dl_vpcp=1"); match.fromString("nw_proto=6"); match.fromString("nw_tos=100"); match.fromString("tp_dst=8080"); match.fromString("tp_src=60"); + match.fromString("dl_vpcp=1"); Assert.assertTrue(match.getInputPort() == 1); // Assert.assertTrue(match.getIPv6MatchLen()==6); - ofm.setInputPort((short) 1); // V6Match is meant for IPv6, but if using OFMatch, it will be set to // IPv4 values, as OF1.0 doesn't support IPv6. @@ -82,6 +88,13 @@ public class V6ExtensionTest { ofm.setTransportSource((short) 60); ofm.setTransportDestination((short) 8080); + // this v6match ctor now looks at the wildcard field to + // determine if vlan pcp has been set + // so set the wildcards appropriately to reflect that vlan pcp + // has been set. + int wildcards = OFMatch.OFPFW_ALL; + wildcards &= ~OFMatch.OFPFW_DL_VLAN_PCP; + ofm.setWildcards(U32.t(Long.valueOf(wildcards))); V6Match match3 = new V6Match(ofm); Assert.assertTrue(match.getInputPort() == match3.getInputPort()); diff --git a/opendaylight/protocol_plugins/stub/pom.xml b/opendaylight/protocol_plugins/stub/pom.xml index d2f347c3da..01822197bc 100644 --- a/opendaylight/protocol_plugins/stub/pom.xml +++ b/opendaylight/protocol_plugins/stub/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ protocol_plugins.stub - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java index 9f2454bbff..365813bd16 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugins.stub.internal; import java.util.HashMap; diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java index 82c0e593b3..0ff60835c8 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/ReadService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugins.stub.internal; import java.net.InetAddress; diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java index 53adef2427..743c4a54e7 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeConnectorFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugins.stub.internal; import org.opendaylight.controller.sal.core.NodeConnector; diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java index 25382429fd..c5a9de3032 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/StubNodeFactory.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.protocol_plugins.stub.internal; import org.opendaylight.controller.sal.core.ConstructionException; diff --git a/opendaylight/routing/dijkstra_implementation/pom.xml b/opendaylight/routing/dijkstra_implementation/pom.xml index 44e2efa790..5fe338528c 100644 --- a/opendaylight/routing/dijkstra_implementation/pom.xml +++ b/opendaylight/routing/dijkstra_implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ routing.dijkstra_implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/sal/api/pom.xml b/opendaylight/sal/api/pom.xml index b918720a44..16868f5517 100644 --- a/opendaylight/sal/api/pom.xml +++ b/opendaylight/sal/api/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNextHop.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNextHop.java index 80d457b8b4..3250137c10 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNextHop.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/SetNextHop.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.action; import java.net.InetAddress; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java index 88ab11b354..2e3707416a 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core; import javax.xml.bind.annotation.XmlAccessType; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java index c6d7f63409..ef68e11827 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.core; import javax.xml.bind.annotation.XmlAccessType; @@ -79,4 +86,4 @@ public class ForwardingMode extends Property { public String getStringValue() { return (modeValue == ForwardingMode.PROACTIVE_FORWARDING) ? "Proactive" : "Reactive"; } -} \ No newline at end of file +} diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java index 95edca943b..6f5cf04a52 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java @@ -198,6 +198,9 @@ public class LLDP extends Packet { while (lldpSize > 0) { LLDPTLV tlv = new LLDPTLV(); tlv.deserialize(data, lldpOffset, lldpSize); + if (tlv.getType() == 0 && tlv.getLength() == 0) { + break; + } int tlvSize = tlv.getTLVSize(); // Size of current TLV in bits lldpOffset += tlvSize; lldpSize -= tlvSize; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/IReadServiceListener.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/IReadServiceListener.java index 28d0905bae..2c10064383 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/IReadServiceListener.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/IReadServiceListener.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.reader; /** diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/IPProtocolsTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/IPProtocolsTest.java index fc6d78c260..0851c60349 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/IPProtocolsTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/IPProtocolsTest.java @@ -1,5 +1,9 @@ -/** +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.sal.utils; diff --git a/opendaylight/sal/connection/api/pom.xml b/opendaylight/sal/connection/api/pom.xml index 64c477171d..65ba5722a5 100644 --- a/opendaylight/sal/connection/api/pom.xml +++ b/opendaylight/sal/connection/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -15,7 +15,7 @@ sal.connection - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT bundle diff --git a/opendaylight/sal/connection/api/src/main/java/org/opendaylight/controller/sal/connection/ConnectionLocality.java b/opendaylight/sal/connection/api/src/main/java/org/opendaylight/controller/sal/connection/ConnectionLocality.java index 515acb5734..39dd80d179 100644 --- a/opendaylight/sal/connection/api/src/main/java/org/opendaylight/controller/sal/connection/ConnectionLocality.java +++ b/opendaylight/sal/connection/api/src/main/java/org/opendaylight/controller/sal/connection/ConnectionLocality.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connection; public enum ConnectionLocality { diff --git a/opendaylight/sal/connection/implementation/pom.xml b/opendaylight/sal/connection/implementation/pom.xml index fd8d5ec5c9..59a985fea2 100644 --- a/opendaylight/sal/connection/implementation/pom.xml +++ b/opendaylight/sal/connection/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -15,7 +15,7 @@ sal.connection.implementation - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT bundle diff --git a/opendaylight/sal/implementation/pom.xml b/opendaylight/sal/implementation/pom.xml index 7c92a6b52b..554260a3b4 100644 --- a/opendaylight/sal/implementation/pom.xml +++ b/opendaylight/sal/implementation/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ sal.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle @@ -59,7 +58,7 @@ org.opendaylight.controller sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT equinoxSDK381 diff --git a/opendaylight/sal/networkconfiguration/api/pom.xml b/opendaylight/sal/networkconfiguration/api/pom.xml index 3add82b1b5..8f9dd47dc3 100644 --- a/opendaylight/sal/networkconfiguration/api/pom.xml +++ b/opendaylight/sal/networkconfiguration/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -15,7 +15,7 @@ sal.networkconfiguration - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT bundle diff --git a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java index 27240e8f99..def1b336f9 100644 --- a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java +++ b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.networkconfig.bridgedomain; /** @@ -30,4 +37,4 @@ public enum ConfigConstants { public String toString() { return name; } -} \ No newline at end of file +} diff --git a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java index 432d82354f..590dff1ee5 100644 --- a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java +++ b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java @@ -1,7 +1,14 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.networkconfig.bridgedomain; /** * This interface is just a wrapper of IPluginInBridgeDomainConfigService */ public interface IBridgeDomainConfigService extends IPluginInBridgeDomainConfigService { -} \ No newline at end of file +} diff --git a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java index cdb14b7347..f8696b1cec 100644 --- a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java +++ b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.networkconfig.bridgedomain; import java.util.List; @@ -154,4 +161,4 @@ public interface IPluginInBridgeDomainConfigService { * returns null if there is no such nodeConnector is available or mapped. */ public NodeConnector getNodeConnector(Node configNode, String bridgeIdentifier, String portIdentifier); -} \ No newline at end of file +} diff --git a/opendaylight/sal/networkconfiguration/implementation/pom.xml b/opendaylight/sal/networkconfiguration/implementation/pom.xml index e157047f19..82cb8af4af 100644 --- a/opendaylight/sal/networkconfiguration/implementation/pom.xml +++ b/opendaylight/sal/networkconfiguration/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -15,7 +15,7 @@ sal.networkconfiguration.implementation - 0.0.2-SNAPSHOT + 0.0.3-SNAPSHOT bundle diff --git a/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java b/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java index 1c9ca573bd..64c72115f6 100644 --- a/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java +++ b/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.networkconfig.bridgedomain.internal; import java.util.List; @@ -216,4 +223,4 @@ public class BridgeDomainConfigService implements IBridgeDomainConfigService { } return null; } -} \ No newline at end of file +} diff --git a/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java b/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java index 7769a380d3..1fc7349d44 100644 --- a/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java +++ b/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.networkconfig.internal; import org.apache.felix.dm.Component; diff --git a/opendaylight/samples/loadbalancer/pom.xml b/opendaylight/samples/loadbalancer/pom.xml index f2cfbbc758..f7e9d7ebbc 100644 --- a/opendaylight/samples/loadbalancer/pom.xml +++ b/opendaylight/samples/loadbalancer/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ samples.loadbalancer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/opendaylight/samples/northbound/loadbalancer/pom.xml b/opendaylight/samples/northbound/loadbalancer/pom.xml index 024035663c..00551a1ce7 100644 --- a/opendaylight/samples/northbound/loadbalancer/pom.xml +++ b/opendaylight/samples/northbound/loadbalancer/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../../commons/opendaylight @@ -15,7 +15,7 @@ samples.loadbalancer.northbound - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle @@ -28,7 +28,7 @@ org.opendaylight.controller sal - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT diff --git a/opendaylight/samples/simpleforwarding/pom.xml b/opendaylight/samples/simpleforwarding/pom.xml index 4492cad88a..38a32f6b88 100644 --- a/opendaylight/samples/simpleforwarding/pom.xml +++ b/opendaylight/samples/simpleforwarding/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ samples.simpleforwarding - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/security/pom.xml b/opendaylight/security/pom.xml index 41f3149a20..8bb18367e9 100644 --- a/opendaylight/security/pom.xml +++ b/opendaylight/security/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../commons/opendaylight @@ -15,7 +15,7 @@ security - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/security/src/main/java/org/opendaylight/controller/security/ControllerCustomRealm.java b/opendaylight/security/src/main/java/org/opendaylight/controller/security/ControllerCustomRealm.java index a988673c7e..6657571f89 100644 --- a/opendaylight/security/src/main/java/org/opendaylight/controller/security/ControllerCustomRealm.java +++ b/opendaylight/security/src/main/java/org/opendaylight/controller/security/ControllerCustomRealm.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.security; import java.security.Principal; diff --git a/opendaylight/statisticsmanager/api/pom.xml b/opendaylight/statisticsmanager/api/pom.xml index 9757e8cadd..466eeccf51 100644 --- a/opendaylight/statisticsmanager/api/pom.xml +++ b/opendaylight/statisticsmanager/api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ statisticsmanager - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle diff --git a/opendaylight/statisticsmanager/implementation/pom.xml b/opendaylight/statisticsmanager/implementation/pom.xml index 8f2ad737f7..46368b0762 100644 --- a/opendaylight/statisticsmanager/implementation/pom.xml +++ b/opendaylight/statisticsmanager/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ statisticsmanager.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java b/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java index aa6e4ac383..5cd47f2f20 100644 --- a/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java +++ b/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java @@ -467,11 +467,8 @@ public class StatisticsManager implements IStatisticsManager, IReadServiceListen @Override public void nodeFlowStatisticsUpdated(Node node, List flowStatsList) { - List currentStat = this.flowStatistics.get(node); - // Update cache only if changed to avoid unnecessary cache sync operations - if (! flowStatsList.equals(currentStat)){ - this.flowStatistics.put(node, flowStatsList); - } + // No equality check because duration fields change constantly + this.flowStatistics.put(node, flowStatsList); } @Override diff --git a/opendaylight/statisticsmanager/integrationtest/pom.xml b/opendaylight/statisticsmanager/integrationtest/pom.xml index a1bd6aa300..142842ef90 100644 --- a/opendaylight/statisticsmanager/integrationtest/pom.xml +++ b/opendaylight/statisticsmanager/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -15,7 +15,7 @@ statisticsmanager.integrationtest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT org.opendaylight.controller diff --git a/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java b/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java index eeeaac0610..18cce74c1d 100644 --- a/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java +++ b/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.statisticsmanager.internal; import static org.junit.Assert.assertFalse; diff --git a/opendaylight/switchmanager/api/pom.xml b/opendaylight/switchmanager/api/pom.xml index ebaf83fd39..760d13b706 100644 --- a/opendaylight/switchmanager/api/pom.xml +++ b/opendaylight/switchmanager/api/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ switchmanager - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java index 28c811c669..de18b021ff 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java @@ -123,8 +123,8 @@ public class SwitchConfig extends ConfigurationObject implements Cloneable, Seri } private Status validateNodeId() { - if (nodeId == null || nodeId.isEmpty()) { - return new Status(StatusCode.BADREQUEST, "NodeId cannot be empty"); + if (!isValidResourceName(nodeId)) { + return new Status(StatusCode.BADREQUEST, "Invalid NodeId"); } return new Status(StatusCode.SUCCESS); } diff --git a/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SubnetConfigTest.java b/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SubnetConfigTest.java index b410063019..df6ed7456e 100644 --- a/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SubnetConfigTest.java +++ b/opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SubnetConfigTest.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.switchmanager; import java.util.ArrayList; diff --git a/opendaylight/switchmanager/implementation/pom.xml b/opendaylight/switchmanager/implementation/pom.xml index e16c6051d3..73b83a0e95 100644 --- a/opendaylight/switchmanager/implementation/pom.xml +++ b/opendaylight/switchmanager/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ switchmanager.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java index 770180c04e..19f45e63c5 100644 --- a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java +++ b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java @@ -839,9 +839,14 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa String prop = entry.getKey(); if (!updateProperties.containsKey(prop)) { if (prop.equals(Description.propertyName)) { - if (!advertisedDesc.isEmpty()) { - Property desc = new Description(advertisedDesc); - propMap.put(Description.propertyName, desc); + if (advertisedDesc != null) { + if (!advertisedDesc.isEmpty()) { + Property desc = new Description(advertisedDesc); + propMap.put(Description.propertyName, desc); + } + } + else { + propMap.remove(prop); } continue; } else if (prop.equals(ForwardingMode.name)) { @@ -1397,7 +1402,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa } catch (SocketException e) { log.error("Failed to acquire controller MAC: ", e); } - if (macAddress != null) { + if (macAddress != null && macAddress.length != 0) { break; } } diff --git a/opendaylight/switchmanager/integrationtest/pom.xml b/opendaylight/switchmanager/integrationtest/pom.xml index 204caf01b4..22ceeb419b 100644 --- a/opendaylight/switchmanager/integrationtest/pom.xml +++ b/opendaylight/switchmanager/integrationtest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest @@ -15,7 +15,7 @@ switchmanager.integrationtest - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT diff --git a/opendaylight/topologymanager/implementation/pom.xml b/opendaylight/topologymanager/implementation/pom.xml index 98b686c7ba..76d849c6a8 100644 --- a/opendaylight/topologymanager/implementation/pom.xml +++ b/opendaylight/topologymanager/implementation/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -16,7 +15,7 @@ topologymanager - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java b/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java index 3618547ac8..cc1a8b868d 100644 --- a/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java +++ b/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java @@ -522,7 +522,7 @@ public class TopologyManagerImpl implements } @Override - public void updateHostLink(NodeConnector port, Host h, UpdateType t, Set props) { + public synchronized void updateHostLink(NodeConnector port, Host h, UpdateType t, Set props) { // Clone the property set in case non null else just // create an empty one. Caches allocated via infinispan diff --git a/opendaylight/topologymanager/integrationtest/pom.xml b/opendaylight/topologymanager/integrationtest/pom.xml index 83050ead39..0a36cbdb1e 100644 --- a/opendaylight/topologymanager/integrationtest/pom.xml +++ b/opendaylight/topologymanager/integrationtest/pom.xml @@ -1,22 +1,21 @@ - + 4.0.0 org.opendaylight.controller commons.integrationtest - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ../../commons/integrationtest scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main + HEAD topologymanager.integrationtest - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT org.ops4j.pax.exam diff --git a/opendaylight/usermanager/api/pom.xml b/opendaylight/usermanager/api/pom.xml index 768ccba138..fa61602092 100644 --- a/opendaylight/usermanager/api/pom.xml +++ b/opendaylight/usermanager/api/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -14,7 +14,7 @@ usermanager - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/usermanager/implementation/pom.xml b/opendaylight/usermanager/implementation/pom.xml index 08f7dcb313..58bbec3dc8 100644 --- a/opendaylight/usermanager/implementation/pom.xml +++ b/opendaylight/usermanager/implementation/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -14,7 +14,7 @@ usermanager.implementation - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/web/devices/pom.xml b/opendaylight/web/devices/pom.xml index b0aef90699..617820b952 100644 --- a/opendaylight/web/devices/pom.xml +++ b/opendaylight/web/devices/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ devices.web - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/web/flows/pom.xml b/opendaylight/web/flows/pom.xml index ed31de81ef..c966f67da5 100644 --- a/opendaylight/web/flows/pom.xml +++ b/opendaylight/web/flows/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ flows.web - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/web/osgi-brandfragment/pom.xml b/opendaylight/web/osgi-brandfragment/pom.xml index a2dad7e286..22758860b4 100644 --- a/opendaylight/web/osgi-brandfragment/pom.xml +++ b/opendaylight/web/osgi-brandfragment/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight osgi-brandfragment.web - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT OSGi management web application brand fragment bundle diff --git a/opendaylight/web/root/pom.xml b/opendaylight/web/root/pom.xml index beee1df9d2..c2e62d6d41 100644 --- a/opendaylight/web/root/pom.xml +++ b/opendaylight/web/root/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ web - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java index e59379916a..974fdee1f6 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.web; import java.net.InetAddress; @@ -55,4 +62,4 @@ public class ClusterNodeBean { this.coordinator = builder.coordinator; this.numConnectedNodes = builder.numConnectedNodes; } -} \ No newline at end of file +} diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java index fb252bf95c..e889836301 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.web; import org.opendaylight.controller.containermanager.IContainerAuthorization; @@ -130,4 +137,4 @@ public class DaylightWebUtil { + getNodeDesc(nodeConnector.getNode(), switchManager); return nodeConnectorName.substring(0, nodeConnectorName.length()); } -} \ No newline at end of file +} diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java index 21d931051b..6ef1efc407 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.web; import org.opendaylight.controller.sal.core.Node; diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/UserBean.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/UserBean.java index 4d30ed34e9..b4e4cd694f 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/UserBean.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/UserBean.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.web; import java.util.List; @@ -24,4 +31,4 @@ public class UserBean { public List getRoles() { return roles; } -} \ No newline at end of file +} diff --git a/opendaylight/web/root/src/main/resources/js/lib.js b/opendaylight/web/root/src/main/resources/js/lib.js index d32f60e68b..c265760b97 100644 --- a/opendaylight/web/root/src/main/resources/js/lib.js +++ b/opendaylight/web/root/src/main/resources/js/lib.js @@ -27,15 +27,15 @@ one.lib.dashlet = { return $h4; }, label : function(name, type) { - var $span = $(document.createElement('span')); - $span.addClass('label'); - if (type !== undefined) { - $span.addClass(type); - } else if (type !== null) { - $span.addClass('label-info'); - } - $span.append(name); - return $span; + var $span = $(document.createElement('span')); + $span.addClass('label'); + if (type !== undefined) { + $span.addClass(type); + } else if (type !== null) { + $span.addClass('label-info'); + } + $span.append(name); + return $span; }, list : function(list) { var $ul = $(document.createElement('ul')); @@ -371,6 +371,18 @@ one.lib.nav = { } } +one.lib.helper = { + parseInt : function(value) { + return (value != null && value.trim() !== '') ? + parseInt(value) : '' + }, + parseFloat : function(value) { + return (value != null && value.trim() !== '') ? + parseFloat(value) : '' + } +} + + /** ALERT */ one.lib.alert = function(alert) { $("#alert p").text(alert); diff --git a/opendaylight/web/topology/pom.xml b/opendaylight/web/topology/pom.xml index 6fc98d9f06..7193ef3182 100644 --- a/opendaylight/web/topology/pom.xml +++ b/opendaylight/web/topology/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ topology.web - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/web/troubleshoot/pom.xml b/opendaylight/web/troubleshoot/pom.xml index 69a8b9983e..bc65e699a0 100644 --- a/opendaylight/web/troubleshoot/pom.xml +++ b/opendaylight/web/troubleshoot/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ../../commons/opendaylight @@ -15,7 +15,7 @@ troubleshoot.web - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java index e46b89ac2a..36b5043dd9 100644 --- a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java +++ b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java @@ -62,7 +62,7 @@ import org.springframework.web.bind.annotation.ResponseBody; public class Troubleshoot implements IDaylightWeb { private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER; private static final List flowStatsColumnNames = Arrays.asList("Node", "In Port", - "DL Src", "DL Dst", "DL Type", "DL Vlan", "NW Src", "NW Dst", + "DL Src", "DL Dst", "DL Type", "DL Vlan","Vlan Priority", "NW Src", "NW Dst","ToS Bits", "NW Proto", "TP Src", "TP Dst", "Actions", "Bytes", "Packets", "Time (s)", "Timeout (s)", "Priority"); @@ -229,6 +229,7 @@ public class Troubleshoot implements IDaylightWeb { private Map convertPortsStatistics( NodeConnectorStatistics ncStats, String containerName) { + Map row = new HashMap(); ISwitchManager switchManager = (ISwitchManager) ServiceHelper @@ -313,6 +314,19 @@ public class Troubleshoot implements IDaylightWeb { } else { row.put(MatchType.DL_VLAN.id(), "*"); } + //Vlan Priority + if (match.isPresent(MatchType.DL_VLAN_PR)) { + if (((Byte) flow.getMatch().getField(MatchType.DL_VLAN_PR).getValue()) + .shortValue() < 0) { + row.put(MatchType.DL_VLAN_PR.id(), "0"); + } else { + row.put(MatchType.DL_VLAN_PR.id(), ((Byte) flow.getMatch() + .getField(MatchType.DL_VLAN_PR).getValue()).toString()); + } + } else { + row.put(MatchType.DL_VLAN_PR.id(), "*"); + } + if (match.isPresent(MatchType.NW_SRC)) { row.put(MatchType.NW_SRC.id(), ((InetAddress) flow.getMatch() .getField(MatchType.NW_SRC).getValue()).getHostAddress()); @@ -325,6 +339,12 @@ public class Troubleshoot implements IDaylightWeb { } else { row.put(MatchType.NW_DST.id(), "*"); } + if (match.isPresent(MatchType.NW_TOS)) { + row.put(MatchType.NW_TOS.id(), ((Byte) flow.getMatch() + .getField(MatchType.NW_TOS).getValue()).toString()); + } else { + row.put(MatchType.NW_TOS.id(), "*"); + } if (match.isPresent(MatchType.NW_PROTO)) { row.put(MatchType.NW_PROTO.id(), IPProtocols.getProtocolName(((Byte) flow.getMatch() @@ -400,7 +420,7 @@ public class Troubleshoot implements IDaylightWeb { row.put("durationSeconds", ((Integer) flowOnNode.getDurationSeconds()).toString()); row.put("idleTimeout", ((Short) flow.getIdleTimeout()).toString()); - row.put("priority", String.valueOf(flow.getPriority())); + row.put("priority", String.valueOf(NetUtils.getUnsignedShort(flow.getPriority()))); return row; } diff --git a/opendaylight/web/troubleshoot/src/main/resources/js/page.js b/opendaylight/web/troubleshoot/src/main/resources/js/page.js index 3ccec224ee..4bc4c76fc4 100644 --- a/opendaylight/web/troubleshoot/src/main/resources/js/page.js +++ b/opendaylight/web/troubleshoot/src/main/resources/js/page.js @@ -207,13 +207,26 @@ one.f.troubleshooting.existingNodes = { item["statistics"] = "Flows" + " Ports"; }); - }, delay: 0 }); return source; }, portsGrid: function(data) { + $.each(data.nodeData, function(index, item) { + item.rxPkts = one.lib.helper.parseInt(item.rxPkts); + item.txPkts = one.lib.helper.parseInt(item.txPkts); + item.rxBytes = one.lib.helper.parseInt(item.rxBytes); + item.txBytes = one.lib.helper.parseInt(item.txBytes); + item.rxDrops = one.lib.helper.parseInt(item.rxDrops); + item.txDrops = one.lib.helper.parseInt(item.txDrops); + item.rxErrors = one.lib.helper.parseInt(item.rxErrors); + item.txErrors = one.lib.helper.parseInt(item.txErrors); + item.rxFrameErrors = one.lib.helper.parseInt(item.rxFrameErrors); + item.rxOverRunErrors = one.lib.helper.parseInt(item.rxOverRunErrors); + item.rxCRCErrors = one.lib.helper.parseInt(item.rxCRCErrors); + item.collisions = one.lib.helper.parseInt(item.collisions); + }); var source = new StaticDataSource({ columns: [ { @@ -311,6 +324,13 @@ one.f.troubleshooting.existingNodes = { return result; }, flowsGrid: function(data) { + $.each(data.nodeData, function(index, item) { + item.byteCount = one.lib.helper.parseInt(item.byteCount); + item.packetCount = one.lib.helper.parseInt(item.packetCount); + item.durationSeconds = one.lib.helper.parseInt(item.durationSeconds); + item.idleTimeout = one.lib.helper.parseInt(item.idleTimeout); + item.priority = one.lib.helper.parseInt(item.priority); + }); var source = new StaticDataSource({ columns: [ { @@ -343,6 +363,11 @@ one.f.troubleshooting.existingNodes = { label: 'DL Vlan', sortable: true }, + { + property: 'dlVlanPriority', + label: 'Vlan PCP', + sortable: true + }, { property: 'nwSrc', label: 'NW Src', @@ -353,6 +378,11 @@ one.f.troubleshooting.existingNodes = { label: 'NW Dst', sortable: true }, + { + property: 'nwTOS', + label: 'ToS Bits', + sortable: true + }, { property: 'nwProto', label: 'NW Proto', @@ -417,6 +447,7 @@ one.f.troubleshooting.existingNodes = { entry.push(value["dlVlan"]); entry.push(value["nwSrc"]); entry.push(value["nwDst"]); + entry.push(value["nwTOS"]); entry.push(value["nwProto"]); entry.push(value["tpSrc"]); entry.push(value["tpDst"]); diff --git a/pom.xml b/pom.xml index 372f2a9d12..446c90048e 100644 --- a/pom.xml +++ b/pom.xml @@ -13,11 +13,11 @@ org.opendaylight.controller commons.parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT opendaylight/commons/parent releasepom - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT pom opendaylight/distribution/opendaylight diff --git a/third-party/commons/thirdparty/pom.xml b/third-party/commons/thirdparty/pom.xml index 70f3b27873..ccd07865a8 100644 --- a/third-party/commons/thirdparty/pom.xml +++ b/third-party/commons/thirdparty/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller commons.thirdparty - 1.1.1-SNAPSHOT + 1.1.2-SNAPSHOT pom scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/third-party/ganymed/pom.xml b/third-party/ganymed/pom.xml index eae97aaeb3..b601eef4b5 100644 --- a/third-party/ganymed/pom.xml +++ b/third-party/ganymed/pom.xml @@ -1,19 +1,17 @@ - + 4.0.0 org.opendaylight.controller commons.thirdparty - 1.1.1-SNAPSHOT + 1.1.2-SNAPSHOT ../commons/thirdparty org.opendaylight.controller.thirdparty ganymed - 1.0-SNAPSHOT + 1.1-SNAPSHOT bundle