From: Tony Tkacik Date: Wed, 12 Mar 2014 10:13:30 +0000 (+0000) Subject: Merge "Fix clustering versions" X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~332 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=d9de6c2ddfb30eb2eee782c229f6e03cef352bbd;hp=28731f6aaec2b41b247a7c88bdd5c1bbd3c454e5 Merge "Fix clustering versions" --- diff --git a/.gitignore b/.gitignore index b079cba0a1..175ab5f0a0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ opendaylight/northbound/integrationtest/logs/* xtend-gen classes out/ +.externalToolBuilders +maven-eclipse.xml diff --git a/opendaylight/arphandler/src/main/java/org/opendaylight/controller/arphandler/internal/ArpHandler.java b/opendaylight/arphandler/src/main/java/org/opendaylight/controller/arphandler/internal/ArpHandler.java index 8ae038c30f..fa883829cc 100644 --- a/opendaylight/arphandler/src/main/java/org/opendaylight/controller/arphandler/internal/ArpHandler.java +++ b/opendaylight/arphandler/src/main/java/org/opendaylight/controller/arphandler/internal/ArpHandler.java @@ -172,6 +172,12 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA byte[] targetIP = tIP.getAddress(); ARP arp = createARP(ARP.REPLY, sMAC, senderIP, tMAC, targetIP); + if(log.isTraceEnabled()) { + log.trace("Sending Arp Reply with srcMac {} - srcIp {} - dstMac {} - dstIp {} - outport {}", + HexEncode.bytesToHexString(sMAC), + sIP, HexEncode.bytesToHexString(tMAC), tIP, p); + } + Ethernet ethernet = createEthernet(sMAC, tMAC, arp); RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet); @@ -180,8 +186,28 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA this.dataPacketService.transmitDataPacket(destPkt); } + private void logArpPacket(ARP pkt, NodeConnector p) { + try { + if (pkt.getOpCode() == ARP.REQUEST) { + log.trace("Received Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - inport {}", HexEncode.bytesToHexString(pkt.getSenderHardwareAddress()), + InetAddress.getByAddress(pkt.getSenderProtocolAddress()), HexEncode.bytesToHexString(pkt.getTargetHardwareAddress()), + InetAddress.getByAddress(pkt.getTargetProtocolAddress()), p); + } else if(pkt.getOpCode() == ARP.REPLY) { + log.trace("Received Arp Reply with srcMac {} - srcIp {} - dstMac {} - dstIp {} - inport {}", HexEncode.bytesToHexString(pkt.getSenderHardwareAddress()), + InetAddress.getByAddress(pkt.getSenderProtocolAddress()), HexEncode.bytesToHexString(pkt.getTargetHardwareAddress()), + InetAddress.getByAddress(pkt.getTargetProtocolAddress()), p); + } + } catch(UnknownHostException e) { + log.warn("Illegal Ip Address in the ARP packet", e); + } + } + protected void handleARPPacket(Ethernet eHeader, ARP pkt, NodeConnector p) { + if(log.isTraceEnabled()) { + logArpPacket(pkt, p); + } + byte[] sourceMAC = eHeader.getSourceMACAddress(); byte[] targetMAC = eHeader.getDestinationMACAddress(); /* @@ -357,6 +383,11 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA byte[] targetIPByte = targetIP.getAddress(); ARP arp = createARP(ARP.REQUEST, getControllerMAC(), senderIP, targetHardwareAddress, targetIPByte); + if(log.isTraceEnabled()) { + log.trace("Sending Broadcast Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - outport {}", HexEncode.bytesToHexString(getControllerMAC()), + subnet.getNetworkAddress(), HexEncode.bytesToHexString(targetHardwareAddress), targetIP, p); + } + byte[] destMACAddress = NetUtils.getBroadcastMACAddr(); Ethernet ethernet = createEthernet(getControllerMAC(), destMACAddress, arp); @@ -387,6 +418,13 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA byte[] targetMAC = host.getDataLayerAddressBytes(); ARP arp = createARP(ARP.REQUEST, getControllerMAC(), senderIP, targetMAC, targetIP); + if(log.isTraceEnabled()) { + log.trace("Sending Unicast Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - outport {}", + HexEncode.bytesToHexString(getControllerMAC()), + subnet.getNetworkAddress(), HexEncode.bytesToHexString(targetMAC), host.getNetworkAddress(), + outPort); + } + Ethernet ethernet = createEthernet(getControllerMAC(), targetMAC, arp); RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet); diff --git a/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterGlobalManager.java b/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterGlobalManager.java index 34ddb7a207..e05f9dfe16 100644 --- a/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterGlobalManager.java +++ b/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterGlobalManager.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.clustering.services_implementation.internal; import java.util.Map; + import org.opendaylight.controller.clustering.services.ICacheUpdateAware; import org.opendaylight.controller.clustering.services.IClusterGlobalServices; import org.slf4j.Logger; @@ -22,7 +23,7 @@ public class ClusterGlobalManager @Override void setCacheUpdateAware(Map props, ICacheUpdateAware s) { - logger.trace("setCacheUpdateAware"); + logger.trace("setCacheUpdateAware: {}",s); if (props.get("containerName") != null) { // If we got a reference with the containerName property // that is not what we are looking for, so filter it out. @@ -33,7 +34,7 @@ public class ClusterGlobalManager @Override void unsetCacheUpdateAware(Map props, ICacheUpdateAware s) { - logger.trace("unsetCacheUpdateAware"); + logger.trace("unsetCacheUpdateAware: {}",s); if (props.get("containerName") != null) { // If we got a reference with the containerName property // that is not what we are looking for, so filter it out. diff --git a/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCommon.java b/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCommon.java index 97d9ded6c8..06e5bc5b61 100644 --- a/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCommon.java +++ b/opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCommon.java @@ -58,6 +58,7 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon { * export the interface ICoordinatorChangeAware */ class ListenCoordinatorChange implements IListenRoleChange { + @Override public void newActiveAvailable() { if (coordinatorChangeAware != null) { // Make sure to look the set while walking it @@ -93,13 +94,9 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon { logger.trace("cachenames provided below:"); for (String cache : caches) { if (this.cacheUpdateAware.get(cache) != null) { - logger.error("cachename:{} on container:{} has " + - "already a listener", cache, - this.containerName); + logger.error("cachename:{} on container:{} has already a listener", cache, this.containerName); } else { - GetUpdatesContainer up = - new GetUpdatesContainer(s, this.containerName, - cache); + GetUpdatesContainer up = new GetUpdatesContainer(s, this.containerName, cache); if (up != null) { try { this.clusterService.addListener(this.containerName, @@ -109,6 +106,7 @@ public abstract class ClusterManagerCommon implements IClusterServicesCommon { "been registered", cache, this.containerName); } catch (CacheListenerAddException exc) { + logger.debug("Cache {} didn't exist when {} tried to register to its updates", cache, s); // Do nothing, the important is that // we don't register the listener in // the shadow, and we are not doing diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ConfigManagerActivator.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ConfigManagerActivator.java index 90131fee98..c075b09df7 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ConfigManagerActivator.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ConfigManagerActivator.java @@ -18,7 +18,7 @@ import org.opendaylight.controller.config.manager.impl.jmx.ConfigRegistryJMXRegi import org.opendaylight.controller.config.manager.impl.osgi.mapping.ModuleInfoBundleTracker; import org.opendaylight.controller.config.manager.impl.osgi.mapping.RuntimeGeneratedMappingServiceActivator; import org.opendaylight.controller.config.spi.ModuleFactory; -import org.opendaylight.yangtools.concepts.Registration; +import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.yang.binding.YangModuleInfo; import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry; import org.osgi.framework.BundleActivator; @@ -31,13 +31,11 @@ import org.slf4j.LoggerFactory; public class ConfigManagerActivator implements BundleActivator { private static final Logger logger = LoggerFactory.getLogger(ConfigManagerActivator.class); - private ExtensibleBundleTracker>> bundleTracker; + private final MBeanServer configMBeanServer = ManagementFactory.getPlatformMBeanServer(); + private ExtensibleBundleTracker>> bundleTracker; private ConfigRegistryImpl configRegistry; private ConfigRegistryJMXRegistrator configRegistryJMXRegistrator; private ServiceRegistration configRegistryServiceRegistration; - - private final MBeanServer configMBeanServer = ManagementFactory.getPlatformMBeanServer(); - private RuntimeGeneratedMappingServiceActivator mappingServiceActivator; @Override diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/ModuleInfoBundleTracker.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/ModuleInfoBundleTracker.java index a8fdfda7d7..7680f72612 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/ModuleInfoBundleTracker.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/ModuleInfoBundleTracker.java @@ -7,8 +7,16 @@ */ package org.opendaylight.controller.config.manager.impl.osgi.mapping; +import static java.lang.String.format; + +import java.io.InputStream; +import java.net.URL; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + import org.apache.commons.io.IOUtils; -import org.opendaylight.yangtools.concepts.Registration; +import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy; import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; @@ -19,39 +27,31 @@ import org.osgi.util.tracker.BundleTrackerCustomizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.InputStream; -import java.net.URL; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -import static java.lang.String.format; - /** * Tracks bundles and attempts to retrieve YangModuleInfo. */ -public final class ModuleInfoBundleTracker implements BundleTrackerCustomizer>> { +public final class ModuleInfoBundleTracker implements BundleTrackerCustomizer>> { private static final Logger logger = LoggerFactory.getLogger(ModuleInfoBundleTracker.class); public static final String GET_MODULE_INFO_METHOD = "getModuleInfo"; public static final String MODULE_INFO_PROVIDER_PATH_PREFIX = "META-INF/services/"; - private ModuleInfoBackedContext moduleInfoLoadingStrategy = ModuleInfoBackedContext.create(); + private final ModuleInfoBackedContext moduleInfoLoadingStrategy = ModuleInfoBackedContext.create(); public GeneratedClassLoadingStrategy getModuleInfoLoadingStrategy() { return moduleInfoLoadingStrategy; } @Override - public Collection> addingBundle(Bundle bundle, BundleEvent event) { + public Collection> addingBundle(Bundle bundle, BundleEvent event) { URL resource = bundle.getEntry(MODULE_INFO_PROVIDER_PATH_PREFIX + YangModelBindingProvider.class.getName()); if(resource==null) { return null; } - List> registrations = new LinkedList<>(); + List> registrations = new LinkedList<>(); try (InputStream inputStream = resource.openStream()) { List lines = IOUtils.readLines(inputStream); @@ -70,17 +70,17 @@ public final class ModuleInfoBundleTracker implements BundleTrackerCustomizer> object) { + public void modifiedBundle(Bundle bundle, BundleEvent event, Collection> object) { // NOOP } @Override - public void removedBundle(Bundle bundle, BundleEvent event, Collection> regs) { + public void removedBundle(Bundle bundle, BundleEvent event, Collection> regs) { if(regs == null) { return; } - for (Registration reg : regs) { + for (ObjectRegistration reg : regs) { try { reg.close(); } catch (Exception e) { diff --git a/opendaylight/config/config-persister-directory-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/DirectoryStorageAdapterTest.java b/opendaylight/config/config-persister-directory-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/DirectoryStorageAdapterTest.java index 3ae29062ed..278d0d2456 100644 --- a/opendaylight/config/config-persister-directory-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/DirectoryStorageAdapterTest.java +++ b/opendaylight/config/config-persister-directory-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/DirectoryStorageAdapterTest.java @@ -91,8 +91,11 @@ public class DirectoryStorageAdapterTest { private void assertSnapshot(ConfigSnapshotHolder result, String directory) throws Exception { SortedSet expectedCapabilities = new TreeSet<>(IOUtils.readLines(getClass().getResourceAsStream("/" + directory + "/expectedCapabilities.txt"))); String expectedSnapshot = IOUtils.toString(getClass().getResourceAsStream("/" + directory + "/expectedSnapshot.xml")); + expectedSnapshot = expectedSnapshot.replaceAll("\r",""); + String _snapshot = result.getConfigSnapshot(); + _snapshot = _snapshot.replaceAll("\r",""); assertEquals(expectedCapabilities, result.getCapabilities()); - assertEquals(expectedSnapshot, result.getConfigSnapshot()); + assertEquals(expectedSnapshot, _snapshot); } } diff --git a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java index 773c6cac50..ebc56928a2 100644 --- a/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java +++ b/opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java @@ -127,17 +127,6 @@ public class ConnectionManager implements IConnectionManager, } public void started() { - String schemeStr = System.getProperty("connection.scheme"); - for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) { - AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme, - clusterServices); - if (schemeImpl != null) { - schemes.put(scheme, schemeImpl); - if (scheme.name().equalsIgnoreCase(schemeStr)) { - activeScheme = scheme; - } - } - } connectionEventThread.start(); @@ -152,6 +141,17 @@ public class ConnectionManager implements IConnectionManager, "ConnectionEvent Thread"); this.connectionEvents = new LinkedBlockingQueue(); schemes = new ConcurrentHashMap(); + + String schemeStr = System.getProperty("connection.scheme"); + for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) { + AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme, clusterServices); + if (schemeImpl != null) { + schemes.put(scheme, schemeImpl); + if (scheme.name().equalsIgnoreCase(schemeStr)) { + activeScheme = scheme; + } + } + } } public void stopping() { @@ -290,7 +290,7 @@ public class ConnectionManager implements IConnectionManager, } /* - * Clustering Services' doesnt provide the existing states in the cache + * Clustering Services doesn't provide the existing states in the cache * update callbacks. Hence, using a scratch local cache to maintain the * existing state. */ @@ -303,21 +303,17 @@ public class ConnectionManager implements IConnectionManager, return; Set existingControllers = existingConnections.get(node); if (existingControllers != null) { - logger.debug( - "Processing Update for : {} NewControllers : {} existingControllers : {}", - node, newControllers.toString(), - existingControllers.toString()); + logger.debug("Processing Update for : {} NewControllers : {} existingControllers : {}", node, + newControllers.toString(), existingControllers.toString()); if (newControllers.size() < existingControllers.size()) { - Set removed = new HashSet( - existingControllers); + Set removed = new HashSet(existingControllers); if (removed.removeAll(newControllers)) { logger.debug("notifyNodeDisconnectFromMaster({})", node); notifyNodeDisconnectedEvent(node); } } } else { - logger.debug("Ignoring the Update for : {} NewControllers : {}", - node, newControllers.toString()); + logger.debug("Ignoring the Update for : {} NewControllers : {}", node, newControllers.toString()); } existingConnections.put(node, newControllers); } @@ -326,7 +322,7 @@ public class ConnectionManager implements IConnectionManager, public void entryDeleted(Node key, String cacheName, boolean originLocal) { if (originLocal) return; - logger.debug("Deleted : {} cache : {}", key, cacheName); + logger.debug("Deleted entry {} from cache : {}", key, cacheName); notifyNodeDisconnectedEvent(key); } 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 1d0e86ecd1..68d1b233b2 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 @@ -54,7 +54,7 @@ public abstract class AbstractScheme { allocateCaches(); retrieveCaches(); } else { - log.error("Couldn't retrieve caches for scheme %s. Clustering service unavailable", name); + log.error("Couldn't retrieve caches for scheme {}. Clustering service unavailable", name); } } @@ -335,4 +335,56 @@ public abstract class AbstractScheme { log.error("An error occured",e); } } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((nodeConnections == null) ? 0 : nodeConnections.hashCode()); + result = prime * result + ((nodeConnectionsCacheName == null) ? 0 : nodeConnectionsCacheName.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof AbstractScheme)) { + return false; + } + AbstractScheme other = (AbstractScheme) obj; + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (nodeConnections == null) { + if (other.nodeConnections != null) { + return false; + } + } else if (!nodeConnections.equals(other.nodeConnections)) { + return false; + } + if (nodeConnectionsCacheName == null) { + if (other.nodeConnectionsCacheName != null) { + return false; + } + } else if (!nodeConnectionsCacheName.equals(other.nodeConnectionsCacheName)) { + return false; + } + return true; + } } diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini index 99f8df358e..7d45c82935 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini @@ -8,7 +8,7 @@ osgi.bundles=\ reference\:file\:../lib/slf4j-api-1.7.2.jar@1:start,\ reference\:file\:../lib/logback-classic-1.0.9.jar@1:start,\ reference\:file\:../lib/logback-core-1.0.9.jar@1:start,\ - reference\:file\:../lib/logging.bridge-0.4.1-SNAPSHOT@1:start,\ + reference\:file\:../lib/logging.bridge-0.4.2-SNAPSHOT@1:start,\ reference\:file\:../lib/jersey-core-1.17.jar@2:start,\ reference\:file\:../lib/jersey-server-1.17.jar@2:start diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java index db20a13991..db0d674e63 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java @@ -27,7 +27,7 @@ import org.osgi.framework.BundleContext; * removes direct dependencies between providers and consumers. * * The Binding-aware broker is also responsible for translation from Java - * classes modeling the functionality and data to binding-indpenedent form which + * classes modeling the functionality and data to binding-independent form which * is used in SAL Core. * * 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 08029dc52f..b94695b83d 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 @@ -15,24 +15,6 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.Notification; public interface NotificationProviderService extends NotificationService, NotificationPublishService { - - - /** - * Deprecated. Use {@link #publish(Notification)}. - * - * @param notification - */ - @Deprecated - void notify(Notification notification); - - /** - * Deprecated. Use {@link #publish(Notification,ExecutorService)}. - * - * @param notification - */ - @Deprecated - void notify(Notification notification, ExecutorService service); - /** * Publishes a notification. * diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java index 24ca2a3de7..6e8bda56d8 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java @@ -11,39 +11,6 @@ import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.Notification; public interface NotificationService extends BindingAwareService { - /** - * - * Deprecated: use {@link #addNotificationListener(Class, NotificationListener)} istead. - * - * @param listener - */ - @Deprecated - void addNotificationListener(Class notificationType, NotificationListener listener); - - /** - * - * Deprecated: use {@link #addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener)} istead. - * - * @param listener - */ - @Deprecated - void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener); - - /** - * Deprecated: use {@link Registration#close()} istead. - * @param listener - */ - @Deprecated - void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener); - - /** - * Deprecated: use {@link Registration#close()} istead. - * @param listener - */ - @Deprecated - void removeNotificationListener(Class notificationType, NotificationListener listener); - - /** * Register a generic listener for specified notification type only. * @@ -54,7 +21,6 @@ public interface NotificationService extends BindingAwareService { Registration> registerNotificationListener( Class notificationType, NotificationListener listener); - /** * Register a listener which implements generated notification interfaces derived from * {@link org.opendaylight.yangtools.yang.binding.NotificationListener}. 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 69a2108065..f71d69b860 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 @@ -17,7 +17,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService; public interface RpcConsumerRegistry extends BindingAwareService { /** * Returns a session specific instance (implementation) of requested - * YANG module implentation / service provided by consumer. + * YANG module implementation / service provided by consumer. * * @return Session specific implementation of service */ 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 c64e24c9c2..cdf55844b3 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 @@ -25,7 +25,7 @@ public interface RpcProviderRegistry extends // RpcConsumerRegistry, // RouteChangePublisher> { /** - * Registers an global RpcService implementation. + * Registers a global RpcService implementation. * * @param type * @param implementation @@ -36,16 +36,15 @@ public interface RpcProviderRegistry extends // /** * - * Register an Routed RpcService where routing is determined on annotated + * Register a Routed RpcService where routing is determined on annotated * (in YANG model) context-reference and value of annotated leaf. * * @param type * Type of RpcService, use generated interface class, not your - * implementation clas + * implementation class * @param implementation * Implementation of RpcService - * @return Registration object for routed Rpc which could be used to close - * an + * @return Registration object for routed Rpc which could be used to unregister * * @throws IllegalStateException */ 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 index d7cb926775..da6d46d499 100644 --- 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 @@ -22,21 +22,21 @@ 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. */ @@ -73,11 +73,6 @@ public final class SynchronizedTransaction implements DataModificationTransactio return delegate.getUpdatedOperationalData(); } - @Deprecated - public synchronized void putRuntimeData(InstanceIdentifier path, DataObject data) { - delegate.putRuntimeData(path, data); - } - @Override public synchronized Object getIdentifier() { return delegate.getIdentifier(); @@ -108,11 +103,6 @@ public final class SynchronizedTransaction implements DataModificationTransactio return delegate.getUpdatedConfigurationData(); } - @Deprecated - public synchronized void removeRuntimeData(InstanceIdentifier path) { - delegate.removeRuntimeData(path); - } - @Override public synchronized void removeOperationalData(InstanceIdentifier path) { delegate.removeOperationalData(path); diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java index 81fe39c62e..0042998cd1 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java @@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService; /** * RpcRouter is responsible for selecting RpcService based on provided routing * context identifier {@link RpcRoutingTable#getContextIdentifier()} and path in - * overal data tree (@link {@link InstanceIdentifier}. + * overall data tree (@link {@link InstanceIdentifier}. * * * @author Tony Tkacik diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend index bf82302e54..fe2681f1f7 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend @@ -49,43 +49,10 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab this.executor = executor; } - @Deprecated - override addNotificationListener(Class notificationType, - NotificationListener listener) { - listeners.put(notificationType, listener) - } - - @Deprecated - override removeNotificationListener(Class notificationType, - NotificationListener listener) { - listeners.remove(notificationType, listener) - } - - override notify(Notification notification) { - publish(notification) - } - def getNotificationTypes(Notification notification) { notification.class.interfaces.filter[it != Notification && Notification.isAssignableFrom(it)] } - @Deprecated - override addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - throw new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead."); - - } - - @Deprecated - override removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - throw new UnsupportedOperationException( - "Deprecated method. Use RegisterNotificationListener returned value to close registration.") - } - - @Deprecated - override notify(Notification notification, ExecutorService service) { - publish(notification, service) - } - override publish(Notification notification) { publish(notification, executor) } diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java index e98d5b9942..e0c7d260b5 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java @@ -7,15 +7,6 @@ */ package org.opendaylight.controller.sal.binding.impl; -import static com.google.common.base.Preconditions.checkState; - -import java.util.EventListener; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.WeakHashMap; - 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; @@ -37,12 +28,22 @@ import org.opendaylight.yangtools.yang.binding.RpcService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.EventListener; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.WeakHashMap; + +import static com.google.common.base.Preconditions.checkState; + public class RpcProviderRegistryImpl implements // RpcProviderRegistry, // RouteChangePublisher> { private RuntimeCodeGenerator rpcFactory = SingletonHolder.RPC_GENERATOR_IMPL; + // publicProxies is a cache of proxy objects where each value in the map corresponds to a specific RpcService private final Map, RpcService> publicProxies = new WeakHashMap<>(); private final Map, RpcRouter> rpcRouters = new WeakHashMap<>(); private final ListenerRegistry>> routeChangeListeners = ListenerRegistry 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 64c1ad3ab4..7d7e56dae0 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 @@ -71,32 +71,6 @@ public abstract class AbstractBindingSalConsumerInstance void addNotificationListener(Class notificationType, - NotificationListener listener) { - getNotificationBrokerChecked().addNotificationListener(notificationType, listener); - } - - @Override - @Deprecated - public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - getNotificationBrokerChecked().addNotificationListener(listener); - } - - @Override - @Deprecated - public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - getNotificationBrokerChecked().removeNotificationListener(listener); - } - - @Override - @Deprecated - public void removeNotificationListener(Class notificationType, - NotificationListener listener) { - getNotificationBrokerChecked().removeNotificationListener(notificationType, listener); - } - @Override public Registration> registerNotificationListener( Class notificationType, NotificationListener listener) { 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 efa02e0b30..8f367de6c8 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 @@ -71,18 +71,6 @@ public abstract class AbstractBindingSalProviderInstance, D> extends DataChange, DataReader { - /** * Returns transaction identifier * @@ -24,16 +23,6 @@ public interface DataModification

, D> extends DataChange TransactionStatus getStatus(); - /** - * - * @deprecated Use {@link #putOperationalData(Object, Object)} instead. - * - * @param path - * @param data - */ - @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 @@ -76,14 +65,6 @@ public interface DataModification

, D> extends DataChange */ void putConfigurationData(P path, D data); - /** - * @deprecated Use {@link #removeOperationalData(Object)} - * - * @param path - */ - @Deprecated - void removeRuntimeData(P path); - void removeOperationalData(P path); void removeConfigurationData(P path); @@ -112,5 +93,4 @@ public interface DataModification

, D> extends DataChange * {@link TransactionStatus#FAILED} is reached. */ Future> commit(); - } 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 4b6a0185ab..3ceeb7e44d 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 @@ -41,7 +41,7 @@ public abstract class AbstractDataModification

, D> implements private final Map unmodifiable_operationalUpdate; private final Set

unmodifiable_configurationRemove; private final Set

unmodifiable_OperationalRemove; - private DataReader reader; + private final DataReader reader; public AbstractDataModification(DataReader reader) { this.reader = reader; @@ -87,11 +87,6 @@ public abstract class AbstractDataModification

, D> implements operationalUpdate.put(path, mergeOperationalData(path,original,data)); } - @Override - public final void putRuntimeData(P path, D data) { - putOperationalData(path, data); - } - @Override public final void removeOperationalData(P path) { checkMutable(); @@ -100,11 +95,6 @@ public abstract class AbstractDataModification

, D> implements operationalRemove.put(path, path); } - @Override - public final void removeRuntimeData(P path) { - removeOperationalData(path); - } - @Override public final void removeConfigurationData(P path) { checkMutable(); @@ -194,11 +184,11 @@ public abstract class AbstractDataModification

, D> implements } return null; } - + protected D mergeOperationalData(P path,D stored, D modified) { return modified; } - + protected D mergeConfigurationData(P path,D stored, D modified) { return modified; } diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java index 652eab10a7..aa22b90f65 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java @@ -11,7 +11,6 @@ import org.opendaylight.controller.sal.core.api.Broker; import org.opendaylight.controller.sal.core.api.Provider; import org.opendaylight.yangtools.yang.data.api.CompositeNode; - /** * Notification Publishing Service * @@ -25,12 +24,8 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode; *

  • For each subscriber {@link Broker} invokes * {@link NotificationListener#onNotification(CompositeNode)} * - * - * - * */ public interface NotificationPublishService extends NotificationService { - /** * Publishes a notification. * @@ -41,8 +36,5 @@ public interface NotificationPublishService extends NotificationService { * @param notification * Notification to publish */ - @Deprecated - void sendNotification(CompositeNode notification); - void publish(CompositeNode notification); } diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java index 5d93f4ee4d..dc554a0727 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java @@ -47,8 +47,8 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv private final DataBrokerImpl dataReader; private final NotificationRouter notificationRouter; private final DataReader readWrapper; - - + + private final InstanceIdentifier mountPath; private SchemaContext schemaContext; @@ -89,11 +89,13 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv return dataReader.readOperationalData(path); } + @Override public Registration> registerOperationalReader( InstanceIdentifier path, DataReader reader) { return dataReader.registerOperationalReader(path, reader); } + @Override public Registration> registerConfigurationReader( InstanceIdentifier path, DataReader reader) { return dataReader.registerConfigurationReader(path, reader); @@ -115,15 +117,18 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv return rpcs.addRpcImplementation(rpcType, implementation); } + @Override public Set getSupportedRpcs() { return rpcs.getSupportedRpcs(); } - + + @Override public RpcResult invokeRpc(QName rpc, CompositeNode input) { return rpcs.invokeRpc(rpc, input); } + @Override public ListenerRegistration addRpcRegistrationListener(RpcRegistrationListener listener) { return rpcs.addRpcRegistrationListener(listener); } @@ -145,27 +150,22 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv return dataReader.registerDataChangeListener(path, listener); } - @Override - public void sendNotification(CompositeNode notification) { - publish(notification); - } - @Override public Registration> registerCommitHandler( InstanceIdentifier path, DataCommitHandler commitHandler) { return dataReader.registerCommitHandler(path, commitHandler); } - + @Override public void removeRefresher(DataStoreIdentifier store, DataRefresher refresher) { // NOOP } - + @Override public void addRefresher(DataStoreIdentifier store, DataRefresher refresher) { // NOOP } - + @Override public void addValidator(DataStoreIdentifier store, DataValidator validator) { // NOOP @@ -174,18 +174,20 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv public void removeValidator(DataStoreIdentifier store, DataValidator validator) { // NOOP } - + + @Override public SchemaContext getSchemaContext() { return schemaContext; } + @Override public void setSchemaContext(SchemaContext schemaContext) { this.schemaContext = schemaContext; } class ReadWrapper implements DataReader { - - + + private InstanceIdentifier shortenPath(InstanceIdentifier path) { InstanceIdentifier ret = null; if(mountPath.contains(path)) { @@ -194,7 +196,7 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv } return ret; } - + @Override public CompositeNode readConfigurationData(InstanceIdentifier path) { InstanceIdentifier newPath = shortenPath(path); @@ -203,7 +205,7 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv } return MountPointImpl.this.readConfigurationData(newPath); } - + @Override public CompositeNode readOperationalData(InstanceIdentifier path) { InstanceIdentifier newPath = shortenPath(path); diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java index bbe017f009..b298a02a63 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java @@ -171,18 +171,13 @@ public class NotificationModule implements BrokerModule { NotificationPublishService { @Override - public void sendNotification(CompositeNode notification) { + public void publish(CompositeNode notification) { checkSessionState(); if (notification == null) throw new IllegalArgumentException( "Notification must not be null."); NotificationModule.this.sendNotification(notification); } - - @Override - public void publish(CompositeNode notification) { - sendNotification(notification); - } } @Override 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 8a15d84f99..cd26c4ea5c 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 @@ -21,15 +21,13 @@ public class NotificationPublishServiceProxy extends AbstractBrokerServiceProxy< super(ref, delegate); } - public void sendNotification(CompositeNode notification) { - getDelegate().sendNotification(notification); - } - + @Override public Registration addNotificationListener(QName notification, NotificationListener listener) { return addRegistration(getDelegate().addNotificationListener(notification, listener)); } + @Override public void publish(CompositeNode notification) { getDelegate().publish(notification); } diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java index 3272ce5670..c08f329f0d 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java @@ -10,7 +10,6 @@ package org.opendaylight.controller.sal.restconf.broker.impl; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutorService; import org.opendaylight.controller.sal.binding.api.NotificationListener; import org.opendaylight.controller.sal.binding.api.NotificationService; @@ -18,101 +17,46 @@ import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteNotificat import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; +import org.opendaylight.yangtools.concepts.AbstractListenerRegistration; import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; import org.opendaylight.yangtools.yang.binding.Notification; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.Multimaps; -import com.google.common.collect.SetMultimap; - public class NotificationServiceImpl implements NotificationService { private final SalRemoteService salRemoteService; private final RestconfClientContext restconfClientContext; - private final Multimap,NotificationListener> listeners; - private ExecutorService _executor; - public NotificationServiceImpl(RestconfClientContext restconfClienetContext){ this.restconfClientContext = restconfClienetContext; this.salRemoteService = this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService(); - - HashMultimap,NotificationListener> _create = HashMultimap., NotificationListener>create(); - SetMultimap,NotificationListener> _synchronizedSetMultimap = Multimaps., NotificationListener>synchronizedSetMultimap(_create); - this.listeners = _synchronizedSetMultimap; - - } - public ExecutorService getExecutor() { - return this._executor; - } - - public void setExecutor(final ExecutorService executor) { - this._executor = executor; - } - - @Override - public void addNotificationListener(Class notificationType, NotificationListener listener) { - this.listeners.put(notificationType, listener); - } - - @Override - public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead."); - throw _unsupportedOperationException; - } - - @Override - public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException( - "Deprecated method. Use RegisterNotificationListener returned value to close registration."); - throw _unsupportedOperationException; } @Override - public void removeNotificationListener(Class notificationType, NotificationListener listener) { - this.listeners.remove(notificationType, listener); - } - - @Override - public Registration> registerNotificationListener(Class notificationType, NotificationListener listener) { + public ListenerRegistration> registerNotificationListener(Class notificationType, NotificationListener listener) { //TODO implementation using sal-remote List notifications = new ArrayList(); notifications.add(new QName(notificationType.toString())); String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications); final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener); - ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(remoteNotificationListener); - return new SalNotificationRegistration(listenerRegistration); + + final ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))) + .registerNotificationListener(remoteNotificationListener); + + return new AbstractListenerRegistration>(listener) { + @Override + protected void removeRegistration() { + listenerRegistration.close(); + } + }; } @Override - public Registration registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { + public ListenerRegistration registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { //TODO implementation using sal-remote String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, null); final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); return restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener); } - - private class SalNotificationRegistration implements Registration>{ - private final Registration registration; - - public SalNotificationRegistration(ListenerRegistration listenerRegistration){ - this.registration = listenerRegistration; - } - - @Override - public NotificationListener getInstance() { - return this.getInstance(); - } - - @Override - public void close() throws Exception { - this.registration.close(); - } - } - - } diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java index 7f9cc8f6c4..c2ff3b8cf6 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.sal.restconf.broker.transactions; 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.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.yangtools.concepts.ListenerRegistration; @@ -30,11 +31,6 @@ public class RemoteDataModificationTransaction implements DataModificationTransa return null; } - @Override - public void putRuntimeData(InstanceIdentifier path, DataObject data) { - - } - @Override public void putOperationalData(InstanceIdentifier path, DataObject data) { @@ -45,11 +41,6 @@ public class RemoteDataModificationTransaction implements DataModificationTransa } - @Override - public void removeRuntimeData(InstanceIdentifier path) { - - } - @Override public void removeOperationalData(InstanceIdentifier path) { 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 a484154edf..e1d69800ca 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 @@ -8,7 +8,6 @@ package org.opendaylight.controller.sample.toaster.provider; import java.util.Collections; - import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -17,7 +16,6 @@ import java.util.concurrent.atomic.AtomicLong; import org.opendaylight.controller.config.yang.config.toaster_provider.impl.ToasterProviderRuntimeMXBean; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; -import org.opendaylight.controller.sal.common.util.Futures; import org.opendaylight.controller.sal.common.util.Rpcs; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.DisplayString; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput; @@ -33,13 +31,15 @@ import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.util.concurrent.Futures; + public class OpendaylightToaster implements ToasterData, ToasterService, ToasterProviderRuntimeMXBean { private static final Logger log = LoggerFactory.getLogger(OpendaylightToaster.class); private static final DisplayString toasterManufacturer = new DisplayString("Opendaylight"); private static final DisplayString toasterModelNumber = new DisplayString("Model 1 - Binding Aware"); - private ToasterStatus toasterStatus; + private final ToasterStatus toasterStatus; private NotificationProviderService notificationProvider; private final ExecutorService executor; @@ -91,7 +91,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService, Toaster currentTask.cancel(true); ToastDoneBuilder toastDone = new ToastDoneBuilder(); toastDone.setToastStatus(ToastStatus.Cancelled); - notificationProvider.notify(toastDone.build()); + notificationProvider.publish(toastDone.build()); } public void setNotificationProvider(NotificationProviderService salService) { @@ -125,7 +125,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService, Toaster ToastDoneBuilder notifyBuilder = new ToastDoneBuilder(); notifyBuilder.setToastStatus(ToastStatus.Done); - notificationProvider.notify(notifyBuilder.build()); + notificationProvider.publish(notifyBuilder.build()); log.trace("Toast Done"); logToastInput(toastRequest); currentTask = null; diff --git a/opendaylight/northbound/archetype-app-northbound/pom.xml b/opendaylight/northbound/archetype-app-northbound/pom.xml new file mode 100644 index 0000000000..558bf41915 --- /dev/null +++ b/opendaylight/northbound/archetype-app-northbound/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.opendaylight.controller + app-northbound + 0.0.1-SNAPSHOT + maven-archetype + + app-northbound + + + + + org.apache.maven.archetype + archetype-packaging + 2.2 + + + + + + + maven-archetype-plugin + 2.2 + + + + + diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 0000000000..3c9223d3c7 --- /dev/null +++ b/opendaylight/northbound/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,32 @@ + + + + + src/main/java + + **/*.java + + + + src/main/resources + + **/*.xml + + + + .settings + + **/*.prefs + + + + + + .classpath + .project + + + + diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000000..da1bd41192 --- /dev/null +++ b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,63 @@ +#set( $dollar = '$' ) + + + 4.0.0 + + org.opendaylight.controller + commons.opendaylight + 1.4.1-SNAPSHOT + ../../commons/opendaylight + + + ${artifactId} + + ${groupId} + bundle + + + + + org.apache.felix + maven-bundle-plugin + ${bundle.plugin.version} + true + + + + org.opendaylight.controller.northbound.commons, + com.sun.jersey.spi.container.servlet, + com.fasterxml.jackson.annotation, + javax.ws.rs, + javax.ws.rs.core, + javax.xml.bind, + javax.xml.bind.annotation, + org.slf4j, + org.apache.catalina.filters, + com.fasterxml.jackson.jaxrs.base, + com.fasterxml.jackson.jaxrs.json, + !org.codehaus.enunciate.jaxrs + /northbound/${artifactId} + ,${dollar}{classes;ANNOTATION;javax.ws.rs.Path} + + ${project.basedir}/src/main/resources/META-INF + + + + + + ${version} + + + org.codehaus.enunciate + enunciate-core-annotations + + + org.opendaylight.controller + commons.northbound + + + junit + junit + + + diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java new file mode 100644 index 0000000000..788dec855f --- /dev/null +++ b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java @@ -0,0 +1,70 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.SecurityContext; + +import org.codehaus.enunciate.jaxrs.StatusCodes; +import org.codehaus.enunciate.jaxrs.TypeHint; + +/** + * Northbound REST API + * + *
    + *
    + * Authentication scheme : HTTP Basic
    + * Authentication realm : opendaylight
    + * Transport : HTTP and HTTPS
    + *
    + * HTTPS Authentication is disabled by default. + */ + +@Path("/") +public class Northbound { + + private String username; + + @Context + public void setSecurityContext(SecurityContext context) { + if (context != null && context.getUserPrincipal() != null) { + username = context.getUserPrincipal().getName(); + } + } + + /** + * + * Sample REST API call + * + * @return A response string + * + *
    +     * Example:
    +     *
    +     * Request URL:
    +     * http://localhost:8080/northbound/${artifactId}/api
    +     *
    +     * Response body in XML:
    +     * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    +     * Sample Northbound API
    +     *
    +     * Response body in JSON:
    +     * Sample Northbound API
    +     * 
    + */ + @Path("/api") + @GET + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + @TypeHint(String.class) + @StatusCodes() + public String getWidget() { + String result = "Sample Northbound API - ${artifactId}"; + return result; + } + +} diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml new file mode 100644 index 0000000000..a1d837610c --- /dev/null +++ b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml @@ -0,0 +1,92 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + JAXRS${artifactId} + com.sun.jersey.spi.container.servlet.ServletContainer + + javax.ws.rs.Application + org.opendaylight.controller.northbound.commons.NorthboundApplication + + 1 + + + + JAXRS${artifactId} + /* + + + + CorsFilter + org.apache.catalina.filters.CorsFilter + + cors.allowed.origins + * + + + cors.allowed.methods + GET,POST,HEAD,OPTIONS,PUT,DELETE + + + cors.allowed.headers + Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers + + + cors.exposed.headers + Access-Control-Allow-Origin,Access-Control-Allow-Credentials + + + cors.support.credentials + true + + + cors.preflight.maxage + 10 + + + + CorsFilter + /* + + + + + ${artifactId} + /* + POST + GET + PUT + PATCH + DELETE + HEAD + + + System-Admin + Network-Admin + Network-Operator + Container-User + + + + + System-Admin + + + Network-Admin + + + Network-Operator + + + Container-User + + + + BASIC + opendaylight + + diff --git a/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties b/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties new file mode 100644 index 0000000000..40d9d656ac --- /dev/null +++ b/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties @@ -0,0 +1,5 @@ +#Fri Mar 07 21:17:20 CST 2014 +package=it.pkg +version=0.1-SNAPSHOT +groupId=archetype.it +artifactId=basic diff --git a/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/goal.txt b/opendaylight/northbound/archetype-app-northbound/src/test/resources/projects/basic/goal.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java index b29ce15f56..548bfb1f9f 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java @@ -836,8 +836,10 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa moveToReadyListHi(dst); } + //checking only OF map, since production edge discovery always overwrites any existing edge + UpdateType ut = edgeMap.containsKey(dst) ? UpdateType.CHANGED : UpdateType.ADDED; // notify - updateEdge(edge, UpdateType.ADDED, props); + updateEdge(edge, ut, props); logger.trace("Add edge {}", edge); } @@ -936,6 +938,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa return; } + this.discoveryListener.notifyEdge(edge, type, props); NodeConnector src = edge.getTailNodeConnector(), dst = edge.getHeadNodeConnector(); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java index 0208cc7cda..f972ae6a66 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java @@ -16,6 +16,7 @@ import org.opendaylight.controller.sal.core.UpdateType; /** * The class represents an Edge, the Edge's Property Set and its UpdateType. + * If update is on new properties added to an existing edge, appropriate type is CHANGED. */ public class TopoEdgeUpdate { private Edge edge; diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java index dc341625af..6b303f09f1 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java @@ -355,9 +355,7 @@ public abstract class NetUtils { */ public static boolean isMulticastMACAddr(byte[] MACAddress) { if (MACAddress.length == MACAddrLengthInBytes && !isBroadcastMACAddr(MACAddress)) { - if (MACAddress[0] % 2 == 1) { - return true; - } + return (MACAddress[0] & 1) != 0; } return false; } diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java index a2b12782ac..e5e0a0941b 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java @@ -468,4 +468,35 @@ public class NetUtilsTest { Assert.assertEquals(32768, NetUtils.getUnsignedShort((short) 0x8000)); Assert.assertEquals(65535, NetUtils.getUnsignedShort((short) 0xffff)); } + + @Test + public void testMulticastMACAddr() { + byte[] empty = new byte[0]; + Assert.assertFalse(NetUtils.isUnicastMACAddr(empty)); + Assert.assertFalse(NetUtils.isMulticastMACAddr(empty)); + + byte[] bcast = { + (byte)0xff, (byte)0xff, (byte)0xff, + (byte)0xff, (byte)0xff, (byte)0xff, + }; + Assert.assertFalse(NetUtils.isUnicastMACAddr(bcast)); + Assert.assertFalse(NetUtils.isMulticastMACAddr(bcast)); + + byte[] firstOctet = { + (byte)0x00, (byte)0x20, (byte)0x80, (byte)0xfe, + }; + for (int len = 1; len <= 10; len++) { + byte[] ba = new byte[len]; + boolean valid = (len == 6); + for (byte first: firstOctet) { + ba[0] = first; + Assert.assertFalse(NetUtils.isMulticastMACAddr(ba)); + Assert.assertEquals(valid, NetUtils.isUnicastMACAddr(ba)); + + ba[0] |= (byte)0x01; + Assert.assertEquals(valid, NetUtils.isMulticastMACAddr(ba)); + Assert.assertFalse(NetUtils.isUnicastMACAddr(ba)); + } + } + } } 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 cc1a8b868d..ff1c026a34 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 @@ -573,6 +573,13 @@ public class TopologyManagerImpl implements switch (type) { case ADDED: + + if (this.edgesDB.containsKey(e)) { + // Avoid redundant updates (e.g. cluster switch-over) as notifications trigger expensive tasks + log.trace("Skipping redundant edge addition: {}", e); + return null; + } + // Make sure the props are non-null or create a copy if (props == null) { props = new HashSet(); @@ -580,19 +587,6 @@ public class TopologyManagerImpl implements props = new HashSet(props); } - Set currentProps = this.edgesDB.get(e); - if (currentProps != null) { - - if (currentProps.equals(props)) { - // Avoid redundant updates as notifications trigger expensive tasks - log.trace("Skipping redundant edge addition: {}", e); - return null; - } - - // In case of node switch-over to a different cluster controller, - // let's retain edge props (e.g. creation time) - props.addAll(currentProps); - } // Ensure that head node connector exists if (!headNodeConnectorExist(e)) { @@ -654,10 +648,9 @@ public class TopologyManagerImpl implements case CHANGED: Set oldProps = this.edgesDB.get(e); - // When property changes lets make sure we can change it + // When property(s) changes lets make sure we can change it // all except the creation time stamp because that should - // be changed only when the edge is destroyed and created - // again + // be set only when the edge is created TimeStamp timeStamp = null; for (Property prop : oldProps) { if (prop instanceof TimeStamp) { diff --git a/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java b/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java index a118ccfbba..e4bb790676 100644 --- a/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java +++ b/opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java @@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.fasterxml.jackson.databind.ObjectMapper; import org.opendaylight.controller.connectionmanager.IConnectionManager; import org.opendaylight.controller.forwarding.staticrouting.IForwardingStaticRouting; import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig; @@ -60,6 +59,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -145,21 +145,21 @@ public class Devices implements IDaylightWeb { for (NodeConnector nodeConnector : nodeConnectorSet) { String nodeConnectorNumberToStr = nodeConnector.getID().toString(); Name ncName = ((Name) switchManager.getNodeConnectorProp(nodeConnector, Name.NamePropName)); - Config portStatus = ((Config) switchManager.getNodeConnectorProp(nodeConnector, + Config portConfig = ((Config) switchManager.getNodeConnectorProp(nodeConnector, Config.ConfigPropName)); State portState = ((State) switchManager.getNodeConnectorProp(nodeConnector, State.StatePropName)); String nodeConnectorName = (ncName != null) ? ncName.getValue() : ""; nodeConnectorName += " (" + nodeConnector.getID() + ")"; - if (portStatus != null) { - if (portStatus.getValue() == Config.ADMIN_UP) { - if (portState.getValue() == State.EDGE_UP) { + if (portConfig != null) { + if (portConfig.getValue() == Config.ADMIN_UP) { + if (portState != null && portState.getValue() == State.EDGE_UP) { nodeConnectorName = "" + nodeConnectorName + ""; - } else if (portState.getValue() == State.EDGE_DOWN) { + } else if (portState == null || portState.getValue() == State.EDGE_DOWN) { nodeConnectorName = "" + nodeConnectorName + ""; } - } else if (portStatus.getValue() == Config.ADMIN_DOWN) { + } else if (portConfig.getValue() == Config.ADMIN_DOWN) { nodeConnectorName = "" + nodeConnectorName + ""; } }