From: Ed Warnicke Date: Mon, 28 Apr 2014 12:18:40 +0000 (+0000) Subject: Merge "Bug 460 - Fix warning throughout netconf subsystem" X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~170 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=1ded3b4311dc761d39c132f9f38fcceb761ea997;hp=3e20a64a21d5b7bced26b03108aedcd025dd8be6 Merge "Bug 460 - Fix warning throughout netconf subsystem" --- diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 4a7a395693..f30d4b005a 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -15,25 +15,40 @@ + 1.0.0 + 0.4.2-SNAPSHOT + 0.5.2-SNAPSHOT + + 1.50 2.3.7 0.4.2-SNAPSHOT 2.10 0.5.1-SNAPSHOT 0.4.3-SNAPSHOT 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + + 1.7 + 1.2.2 0.1.2-SNAPSHOT 2.4 3.1 + 3.0.1 2.3.2 0.5.2-SNAPSHOT 0.2.5-SNAPSHOT + 0.4.3-SNAPSHOT 0.4.3-SNAPSHOT 0.1.2-SNAPSHOT 0.5.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.5.2-SNAPSHOT - + 0.0.2-SNAPSHOT 7.0.42 + 0.4.2-SNAPSHOT + 2.5.0 1.3.1 1.26.2 @@ -42,12 +57,22 @@ 0000.0002.0038.0-SNAPSHOT 2.15 + 3.0.1 + 3.1.0 + 3.1.6 + 4.2.0 + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.5.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.6.0-SNAPSHOT 2.2.0.RELEASE + 2.2.4 14.0.1 0.5.2-SNAPSHOT 0.5.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT 2010.09.24.4-SNAPSHOT 2013.10.21.2-SNAPSHOT @@ -61,8 +86,11 @@ 1.17 1.17 + 1.3.3 src/main/yang-gen-config 1.1.4 + 2.0.1 + 1.1.1 4.8.1 1.0.9 0.4.2-SNAPSHOT @@ -75,24 +103,34 @@ 0.2.5-SNAPSHOT 4.0.17.Final 0.0.3-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT http://nexus.opendaylight.org/content 2013.08.27.4-SNAPSHOT + 0.0.2-SNAPSHOT + 5.0.0 5.0.0 UTF-8 UTF-8 2.6 - 1.0-alpha-2 0.5.0-SNAPSHOT - 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 2.3.2 + 0.4.2-SNAPSHOT 0.1.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.0.3-SNAPSHOT 0.8.1-SNAPSHOT src/main/yang-gen-sal 0.5.2-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT dav:http://nexus.opendaylight.org/content/sites/site 3.2 1.7.2 @@ -105,14 +143,25 @@ 1.2.1 3.1.3.RELEASE 3.1.3.RELEASE + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.5.1-SNAPSHOT + 0.4.2-SNAPSHOT 2.15 0.7.1-SNAPSHOT + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT -Xmx1024m -XX:MaxPermSize=256m + 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT + 0.4.2-SNAPSHOT 1.5.0 + 0.4.2-SNAPSHOT + 0.0.2-SNAPSHOT 0.4.2-SNAPSHOT 3.6.0.RELEASE + 0.4.2-SNAPSHOT src/main/xtend-gen 2.4.3 2013.09.07.4-SNAPSHOT @@ -142,37 +191,31 @@ logback-core ${logback.version} - com.fasterxml.jackson.core jackson-annotations ${jackson.version} - com.fasterxml.jackson.core jackson-core ${jackson.version} - com.fasterxml.jackson.core jackson-databind ${jackson.version} - com.fasterxml.jackson.jaxrs jackson-jaxrs-base ${jackson.version} - com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider ${jackson.version} - com.fasterxml.jackson.module jackson-module-jaxb-annotations @@ -181,12 +224,12 @@ com.google.code.findbugs jsr305 - 2.0.1 + ${jsr305.api.version} com.google.code.gson gson - 2.2.4 + ${gson.version} com.google.guava @@ -204,6 +247,11 @@ jersey-core ${jersey.version} + + javax.ws.rs + jsr311-api + ${jsr311.api.version} + com.sun.jersey jersey-server @@ -212,12 +260,12 @@ commons-codec commons-codec - 1.7 + ${commons.codec.version} commons-fileupload commons-fileupload - 1.2.2 + ${commons.fileupload.version} commons-io @@ -227,7 +275,7 @@ commons-net commons-net - 3.0.1 + ${commons.net.version} eclipselink @@ -370,8 +418,7 @@ netty-common ${netty.version} - - + io.netty netty-handler @@ -470,7 +517,7 @@ org.aopalliance com.springsource.org.aopalliance - 1.0.0 + ${aopalliance.version} org.apache.commons @@ -480,46 +527,45 @@ org.apache.felix org.apache.felix.dependencymanager - 3.1.0 + ${felix.dependencymanager.version} org.apache.felix org.apache.felix.dependencymanager.shell - 3.0.1 + ${felix.dependencymanager.shell.version} org.apache.felix org.apache.felix.fileinstall - 3.1.6 + ${felix.fileinstall.version} org.apache.felix org.apache.felix.webconsole - 4.2.0 + ${felix.webconsole.version} all org.bouncycastle bcpkix-jdk15on - 1.50 + ${bouncycastle.version} org.bouncycastle bcprov-jdk15on - 1.50 + ${bouncycastle.version} org.codehaus.enunciate enunciate-core-annotations ${enunciate.version} - org.codehaus.jettison jettison - 1.3.3 + ${jettison.version} @@ -531,17 +577,17 @@ org.eclipse.persistence org.eclipse.persistence.antlr - 2.5.0 + ${eclipse.persistence.version} org.eclipse.persistence org.eclipse.persistence.core - 2.5.0 + ${eclipse.persistence.version} org.eclipse.persistence org.eclipse.persistence.moxy - 2.5.0 + ${eclipse.persistence.version} @@ -568,7 +614,7 @@ org.opendaylight.controller appauth - 0.4.2-SNAPSHOT + ${appauth.version} org.opendaylight.controller @@ -605,7 +651,7 @@ org.opendaylight.controller clustering.test - 0.4.2-SNAPSHOT + ${clustering.test.version} org.opendaylight.controller @@ -617,7 +663,7 @@ org.opendaylight.controller commons.northbound - 0.4.2-SNAPSHOT + ${commmons.northbound.version} org.opendaylight.controller @@ -693,7 +739,7 @@ org.opendaylight.controller configuration.implementation - 0.4.3-SNAPSHOT + ${configuration.implementation.version} org.opendaylight.controller @@ -728,27 +774,27 @@ org.opendaylight.controller containermanager.northbound - 0.4.2-SNAPSHOT + ${containermanager.northbound.version} org.opendaylight.controller controllermanager.northbound - 0.0.2-SNAPSHOT + ${controllermanager.northbound.version} org.opendaylight.controller devices.web - 0.4.2-SNAPSHOT + ${devices.web.version} org.opendaylight.controller flowprogrammer.northbound - 0.4.2-SNAPSHOT + ${flowprogrammer.northbound.version} org.opendaylight.controller flows.web - 0.4.2-SNAPSHOT + ${flows.web.version} org.opendaylight.controller @@ -758,7 +804,7 @@ org.opendaylight.controller forwarding.staticrouting.northbound - 0.4.2-SNAPSHOT + ${forwarding.staticrouting.northbound.version} org.opendaylight.controller @@ -768,7 +814,7 @@ org.opendaylight.controller forwardingrulesmanager.implementation - 0.4.2-SNAPSHOT + ${forwardingrulesmanager.implementation.version} @@ -784,7 +830,7 @@ org.opendaylight.controller hosttracker.northbound - 0.4.2-SNAPSHOT + ${hosttracker.northbound.version} org.opendaylight.controller @@ -897,22 +943,22 @@ org.opendaylight.controller networkconfig.neutron - 0.4.2-SNAPSHOT + ${networkconfig.neutron.version} org.opendaylight.controller networkconfig.neutron.implementation - 0.4.2-SNAPSHOT + ${networkconfig.neutron.implementation.version} org.opendaylight.controller networkconfig.neutron.northbound - 0.4.2-SNAPSHOT + ${networkconfig.neutron.northbound.version} org.opendaylight.controller osgi-brandfragment.web - 0.0.2-SNAPSHOT + ${osgi-brandfragment.web.version} @@ -925,17 +971,17 @@ org.opendaylight.controller protocol_plugins.openflow - 0.4.2-SNAPSHOT + ${protocol_plugins.openflow.version} org.opendaylight.controller protocol_plugins.stub - ${protocol_plugin.stub.version} + ${protocol_plugins.stub.version} org.opendaylight.controller routing.dijkstra_implementation - 0.4.2-SNAPSHOT + ${routing.dijkstra_implementation.version} @@ -1049,7 +1095,7 @@ org.opendaylight.controller sal.implementation - 0.4.2-SNAPSHOT + ${sal.implementation.version} org.opendaylight.controller @@ -1071,12 +1117,12 @@ org.opendaylight.controller samples.loadbalancer.northbound - 0.4.2-SNAPSHOT + ${samples.loadbalancer.northbound.version} org.opendaylight.controller samples.simpleforwarding - 0.4.2-SNAPSHOT + ${samples.simpleforwarding.version} org.opendaylight.controller @@ -1086,7 +1132,7 @@ org.opendaylight.controller security - 0.4.2-SNAPSHOT + ${security.version} @@ -1102,7 +1148,7 @@ org.opendaylight.controller statistics.northbound - 0.4.2-SNAPSHOT + ${statistics.northbound.version} org.opendaylight.controller @@ -1112,12 +1158,12 @@ org.opendaylight.controller statisticsmanager.implementation - 0.4.2-SNAPSHOT + ${statisticsmanager.implementation.version} org.opendaylight.controller subnets.northbound - 0.4.2-SNAPSHOT + ${subnets.northbound.version} org.opendaylight.controller @@ -1127,12 +1173,12 @@ org.opendaylight.controller switchmanager.implementation - 0.4.2-SNAPSHOT + ${switchmanager.implementation.version} org.opendaylight.controller switchmanager.northbound - 0.4.2-SNAPSHOT + ${switchmanager.northbound.version} @@ -1149,12 +1195,12 @@ org.opendaylight.controller topology.northbound - 0.4.2-SNAPSHOT + ${topology.northbound.version} org.opendaylight.controller topology.web - 0.4.2-SNAPSHOT + ${topology.web.version} org.opendaylight.controller @@ -1164,7 +1210,7 @@ org.opendaylight.controller troubleshoot.web - 0.4.2-SNAPSHOT + ${troubleshoot.web.version} org.opendaylight.controller @@ -1174,19 +1220,19 @@ org.opendaylight.controller usermanager.implementation - ${usermanager.version} + ${usermanager.implementation.version} org.opendaylight.controller usermanager.northbound - 0.0.2-SNAPSHOT + ${usermanager.northbound.version} org.opendaylight.controller web - 0.4.2-SNAPSHOT + ${web.version} org.opendaylight.controller @@ -1406,7 +1452,7 @@ org.osgi org.osgi.compendium - ${osgi.core.version} + ${osgi.compendium.version} org.osgi diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java index 8d52950a29..aa5c6f40a9 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java @@ -289,7 +289,7 @@ public class NetconfDevice implements Provider, // @Override public ListenableFuture> invokeRpc(QName rpc, CompositeNode input) { - return listener.sendRequest(toRpcMessage(rpc, input, getSchemaContext())); + return listener.sendRequest(toRpcMessage(rpc, input, getSchemaContext()), rpc); } @Override 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 94f5e166a1..1dfc3b44d3 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 @@ -25,6 +25,7 @@ import org.opendaylight.controller.netconf.client.NetconfClientSession; import org.opendaylight.controller.netconf.client.NetconfClientSessionListener; import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; +import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.opendaylight.controller.sal.common.util.Rpcs; import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance; import org.opendaylight.yangtools.yang.common.QName; @@ -45,10 +46,12 @@ class NetconfDeviceListener implements NetconfClientSessionListener { private static final class Request { final UncancellableFuture> future; final NetconfMessage request; + final QName rpc; - private Request(UncancellableFuture> future, NetconfMessage request) { + private Request(UncancellableFuture> future, NetconfMessage request, final QName rpc) { this.future = future; this.request = request; + this.rpc = rpc; } } @@ -163,14 +166,13 @@ class NetconfDeviceListener implements NetconfClientSessionListener { return; } - r.future.set(Rpcs.getRpcResult(true, NetconfMapping.toNotificationNode(message, device.getSchemaContext()), - Collections.emptyList())); + r.future.set(NetconfMapping.toRpcResult(message, r.rpc, device.getSchemaContext())); } else { LOG.warn("Ignoring unsolicited message", message); } } - synchronized ListenableFuture> sendRequest(final NetconfMessage message) { + synchronized ListenableFuture> sendRequest(final NetconfMessage message, final QName rpc) { if (session == null) { LOG.debug("Session to {} is disconnected, failing RPC request {}", device.getName(), message); return Futures.>immediateFuture(new RpcResult() { @@ -192,7 +194,7 @@ class NetconfDeviceListener implements NetconfClientSessionListener { }); } - final Request req = new Request(new UncancellableFuture>(true), message); + final Request req = new Request(new UncancellableFuture>(true), message, rpc); requests.add(req); session.sendMessage(req.request).addListener(new FutureListener() { @@ -200,7 +202,7 @@ class NetconfDeviceListener implements NetconfClientSessionListener { public void operationComplete(final Future future) throws Exception { if (!future.isSuccess()) { // We expect that a session down will occur at this point - LOG.debug("Failed to send request {}", req.request, future.cause()); + LOG.debug("Failed to send request {}", XmlUtil.toString(req.request.getDocument()), future.cause()); req.future.setException(future.cause()); } else { LOG.trace("Finished sending request {}", req.request); diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java index a6e6b3dfdf..f0b711d368 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java @@ -192,12 +192,6 @@ public class NetconfMapping { rawRpc = it.toInstance(); // sys(xmlData) } else { - RpcDefinition rpcSchema = Iterables.find(context.get().getOperations(), new Predicate() { - @Override - public boolean apply(final RpcDefinition input) { - return rpc == input.getQName(); - } - }); rawRpc = (CompositeNode) toCompositeNode(message.getDocument()); } else { 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 c734e80d9a..abd935dd63 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 @@ -20,6 +20,8 @@ import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider; import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider { @@ -30,8 +32,11 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider private final NetconfDevice device; + private final Logger logger; + public NetconfRemoteSchemaSourceProvider(NetconfDevice device) { this.device = Preconditions.checkNotNull(device); + logger = LoggerFactory.getLogger(NetconfDevice.class + "#" + device.getName()); } @Override @@ -44,7 +49,7 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider request.addLeaf("version", revision.get()); } - device.logger.trace("Loading YANG schema source for {}:{}", moduleName, revision); + logger.trace("Loading YANG schema source for {}:{}", moduleName, revision); try { RpcResult schemaReply = device.invokeRpc(GET_SCHEMA_QNAME, request.toInstance()).get(); if (schemaReply.isSuccessful()) { @@ -54,9 +59,9 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider return Optional.of(schemaBody); } } - device.logger.warn("YANG shcema was not successfully retrieved."); + logger.warn("YANG shcema was not successfully retrieved."); } catch (InterruptedException | ExecutionException e) { - device.logger.warn("YANG shcema was not successfully retrieved.", e); + logger.warn("YANG shcema was not successfully retrieved.", e); } return Optional.absent(); } diff --git a/opendaylight/md-sal/topology-lldp-discovery/pom.xml b/opendaylight/md-sal/topology-lldp-discovery/pom.xml index 2d003f8079..a51f6c2f9f 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/pom.xml +++ b/opendaylight/md-sal/topology-lldp-discovery/pom.xml @@ -34,10 +34,6 @@ equinoxSDK381 org.eclipse.osgi - - org.eclipse.xtend - org.eclipse.xtend.lib - org.opendaylight.controller sal @@ -82,10 +78,6 @@ ${project.basedir}/META-INF - - org.eclipse.xtend - xtend-maven-plugin - diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.java new file mode 100644 index 0000000000..0e003dbe7f --- /dev/null +++ b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.java @@ -0,0 +1,30 @@ +/** + * 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.md.controller.topology.lldp; + +import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.controller.sal.binding.api.data.DataProviderService; +import org.osgi.framework.BundleContext; + +public class LLDPActivator extends AbstractBindingAwareProvider { + private static LLDPDiscoveryProvider provider = new LLDPDiscoveryProvider(); + + public void onSessionInitiated(final ProviderContext session) { + DataProviderService dataService = session.getSALService(DataProviderService.class); + provider.setDataService(dataService); + NotificationProviderService notificationService = session.getSALService(NotificationProviderService.class); + provider.setNotificationService(notificationService); + provider.start(); + } + + protected void stopImpl(final BundleContext context) { + provider.close(); + } +} diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend deleted file mode 100644 index 674e919cd7..0000000000 --- a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend +++ /dev/null @@ -1,30 +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.md.controller.topology.lldp - -import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.controller.sal.binding.api.data.DataProviderService -import org.osgi.framework.BundleContext - -class LLDPActivator extends AbstractBindingAwareProvider { - - static var LLDPDiscoveryProvider provider = new LLDPDiscoveryProvider(); - - override onSessionInitiated(ProviderContext session) { - provider.dataService = session.getSALService(DataProviderService) - provider.notificationService = session.getSALService(NotificationProviderService) - provider.start(); - } - - override protected stopImpl(BundleContext context) { - provider.close(); - } - -} diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java new file mode 100644 index 0000000000..b219722ba8 --- /dev/null +++ b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java @@ -0,0 +1,58 @@ +/** + * 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.md.controller.topology.lldp; + +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.controller.sal.binding.api.data.DataProviderService; +import org.opendaylight.yangtools.concepts.Registration; +import org.opendaylight.yangtools.yang.binding.NotificationListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LLDPDiscoveryProvider implements AutoCloseable { + private final static Logger LOG = LoggerFactory.getLogger(LLDPDiscoveryProvider.class); + private DataProviderService dataService; + private NotificationProviderService notificationService; + private final LLDPDiscoveryListener commiter = new LLDPDiscoveryListener(LLDPDiscoveryProvider.this); + private Registration listenerRegistration; + + public DataProviderService getDataService() { + return this.dataService; + } + + public void setDataService(final DataProviderService dataService) { + this.dataService = dataService; + } + + public NotificationProviderService getNotificationService() { + return this.notificationService; + } + + public void setNotificationService(final NotificationProviderService notificationService) { + this.notificationService = notificationService; + } + + public void start() { + Registration registerNotificationListener = this.getNotificationService().registerNotificationListener(this.commiter); + this.listenerRegistration = registerNotificationListener; + LLDPLinkAger.getInstance().setManager(this); + LOG.info("LLDPDiscoveryListener Started."); + } + + public void close() { + try { + LOG.info("LLDPDiscoveryListener stopped."); + if (this.listenerRegistration!=null) { + this.listenerRegistration.close(); + } + LLDPLinkAger.getInstance().close(); + } catch (Exception e) { + throw new Error(e); + } + } +} diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend deleted file mode 100644 index fc724ac680..0000000000 --- a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend +++ /dev/null @@ -1,46 +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.md.controller.topology.lldp - -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.controller.sal.binding.api.data.DataProviderService -import org.opendaylight.yangtools.concepts.Registration -import org.opendaylight.yangtools.yang.binding.NotificationListener -import org.slf4j.LoggerFactory - -class LLDPDiscoveryProvider implements AutoCloseable { - - - static val LOG = LoggerFactory.getLogger(LLDPDiscoveryProvider); - - @Property - DataProviderService dataService; - - @Property - NotificationProviderService notificationService; - - val LLDPDiscoveryListener commiter = new LLDPDiscoveryListener(this); - - Registration listenerRegistration - - def void start() { - listenerRegistration = notificationService.registerNotificationListener(commiter); - LLDPLinkAger.instance.manager = this; - LOG.info("LLDPDiscoveryListener Started."); - - } - - override close() { - LOG.info("LLDPDiscoveryListener stopped."); - listenerRegistration?.close(); - LLDPLinkAger.instance.close(); - } - -} - - 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 9e15b49a84..7af1f01a08 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 @@ -33,8 +33,8 @@ import org.slf4j.LoggerFactory; public class NetconfClientSessionNegotiatorFactory implements SessionNegotiatorFactory { public static final java.util.Set CLIENT_CAPABILITIES = Sets.newHashSet( - XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, - XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_1, + XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_0, + XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1, XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_CAPABILITY_EXI_1_0); private static final String START_EXI_MESSAGE_ID = "default-start-exi"; 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 9d95866061..c5f8e99f22 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 @@ -8,10 +8,11 @@ package org.opendaylight.controller.netconf.impl; -import com.google.common.collect.Sets; -import io.netty.channel.Channel; -import io.netty.util.Timer; -import io.netty.util.concurrent.Promise; +import static org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider.NetconfOperationProviderUtil.getNetconfSessionIdForReporting; + +import com.google.common.collect.ImmutableSet; +import java.util.Set; + import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfServerSessionPreferences; import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider; @@ -23,18 +24,24 @@ import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.opendaylight.protocol.framework.SessionListenerFactory; import org.opendaylight.protocol.framework.SessionNegotiator; import org.opendaylight.protocol.framework.SessionNegotiatorFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.util.Set; +import com.google.common.collect.Sets; -import static org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider.NetconfOperationProviderUtil.getNetconfSessionIdForReporting; +import io.netty.channel.Channel; +import io.netty.util.Timer; +import io.netty.util.concurrent.Promise; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorFactory { - private static final Set DEFAULT_CAPABILITIES = Sets.newHashSet( - XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, - XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_CAPABILITY_EXI_1_0); + private static final Set DEFAULT_BASE_CAPABILITIES = ImmutableSet.of( + XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_0 + // FIXME, Chunk framing causes ConcurrentClientsTest to fail, investigate +// XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1, + // FIXME, EXI causing issues with sal-netconf-connector, investigate +// XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_CAPABILITY_EXI_1_0 + ); private final Timer timer; @@ -45,9 +52,11 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF private final SessionMonitoringService monitoringService; private static final Logger logger = LoggerFactory.getLogger(NetconfServerSessionNegotiatorFactory.class); + // TODO too many params, refactor public NetconfServerSessionNegotiatorFactory(Timer timer, NetconfOperationProvider netconfOperationProvider, SessionIdProvider idProvider, long connectionTimeoutMillis, - DefaultCommitNotificationProducer commitNot, SessionMonitoringService monitoringService) { + DefaultCommitNotificationProducer commitNot, + SessionMonitoringService monitoringService) { this.timer = timer; this.netconfOperationProvider = netconfOperationProvider; this.idProvider = idProvider; @@ -91,7 +100,7 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF } private NetconfHelloMessage createHelloMessage(long sessionId, CapabilityProvider capabilityProvider) throws NetconfDocumentedException { - return NetconfHelloMessage.createServerHello(Sets.union(capabilityProvider.getCapabilities(), DEFAULT_CAPABILITIES), sessionId); + return NetconfHelloMessage.createServerHello(Sets.union(capabilityProvider.getCapabilities(), DEFAULT_BASE_CAPABILITIES), sessionId); } } 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 db5a359d7a..02889b62a5 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,20 +8,31 @@ package org.opendaylight.controller.netconf.impl; -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 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.mock; + +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 org.apache.commons.io.IOUtils; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.client.test.TestingNetconfClient; import org.opendaylight.controller.netconf.client.NetconfClientDispatcher; +import org.opendaylight.controller.netconf.client.test.TestingNetconfClient; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService; import org.opendaylight.controller.netconf.mapping.api.Capability; @@ -31,28 +42,20 @@ import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedEx import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory; import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader; +import org.opendaylight.controller.netconf.util.messages.NetconfStartExiMessage; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; -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 com.google.common.base.Optional; +import com.google.common.collect.Sets; -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.mock; +import io.netty.channel.ChannelFuture; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.util.HashedWheelTimer; public class ConcurrentClientsTest { @@ -90,13 +93,12 @@ public class ConcurrentClientsTest { SessionIdProvider idProvider = new SessionIdProvider(); hashedWheelTimer = new HashedWheelTimer(); + NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory( hashedWheelTimer, factoriesListener, idProvider, 5000, commitNot, createMockedMonitoringService()); commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer()); - - NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(serverNegotiatorFactory); dispatch = new NetconfServerDispatcher(serverChannelInitializer, nettyGroup, nettyGroup); @@ -125,7 +127,9 @@ public class ConcurrentClientsTest { return Sets. newHashSet(new NetconfOperation() { @Override public HandlingPriority canHandle(Document message) { - return HandlingPriority.getHandlingPriority(Integer.MAX_VALUE); + return XmlUtil.toString(message).contains(NetconfStartExiMessage.START_EXI) ? + HandlingPriority.CANNOT_HANDLE : + HandlingPriority.HANDLE_WITH_MAX_PRIORITY; } @Override @@ -152,7 +156,7 @@ public class ConcurrentClientsTest { commitNot.close(); } - @Test + @Test(timeout = 30 * 1000) public void multipleClients() throws Exception { List threads = new ArrayList<>(); @@ -173,12 +177,12 @@ public class ConcurrentClientsTest { } } - @Test + @Test(timeout = 30 * 1000) public void synchronizationTest() throws Exception { new BlockingThread("foo").run2(); } - @Test + @Test(timeout = 30 * 1000) public void multipleBlockingClients() throws Exception { List threads = new ArrayList<>(); for (int i = 0; i < CONCURRENCY; i++) { diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSession.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSession.java index 270af3505f..aa1afc025d 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSession.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSession.java @@ -61,7 +61,7 @@ public abstract class AbstractNetconfSession