import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.LinkedBlockingQueue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
import org.opendaylight.controller.sal.utils.StatusCode;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ConnectionManager implements IConnectionManager, IConnectionListener,
ICoordinatorChangeAware, IListenInventoryUpdates,
}
}
- public void started() {
- connectionEventThread = new Thread(new EventHandler(), "ConnectionEvent Thread");
+
+ 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();
registerWithOSGIConsole();
}
public void init() {
- String schemeStr = System.getProperty("connection.scheme");
+ connectionEventThread = new Thread(new EventHandler(), "ConnectionEvent Thread");
this.connectionEvents = new LinkedBlockingQueue<ConnectionMgmtEvent>();
schemes = new ConcurrentHashMap<ConnectionMgmtScheme, AbstractScheme>();
- 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 stop() {
+ public void stopping() {
connectionEventThread.interrupt();
Set<Node> localNodes = getLocalNodes();
if (localNodes != null) {
*/
protected ConcurrentMap <Node, Set<InetAddress>> nodeConnections;
protected abstract boolean isConnectionAllowedInternal(Node node);
- private String name;
+ private final String name;
+ private final String nodeConnectionsCacheName;
protected AbstractScheme(IClusterGlobalServices clusterServices, ConnectionMgmtScheme type) {
this.clusterServices = clusterServices;
- if (type != null) name = type.name();
- else name = "UNKNOWN";
+ name = (type != null ? type.name() : "UNKNOWN");
+ nodeConnectionsCacheName = "connectionmanager."+name+".nodeconnections";
if (clusterServices != null) {
allocateCaches();
retrieveCaches();
+ } else {
+ log.error("Couldn't retrieve caches for scheme %s. Clustering service unavailable", name);
}
}
return isConnectionAllowedInternal(node);
}
- @SuppressWarnings("deprecation")
public void handleClusterViewChanged() {
log.debug("Handling Cluster View changed notification");
List<InetAddress> controllers = clusterServices.getClusteredControllers();
}
public Set<Node> getNodes(InetAddress controller) {
- if (nodeConnections == null) return null;
ConcurrentMap <InetAddress, Set<Node>> controllerNodesMap = getControllerToNodesMap();
return controllerNodesMap.get(controller);
}
protected Status removeNodeFromController (Node node, InetAddress controller) {
if (node == null || controller == null) {
- return new Status(StatusCode.BADREQUEST);
+ return new Status(StatusCode.BADREQUEST, "Invalid Node or Controller Address Specified.");
}
if (clusterServices == null || nodeConnections == null) {
}
clusterServices.tcommit();
} catch (Exception e) {
- log.error("Excepion in removing Controller from a Node", e);
+ log.error("Exception in removing Controller from a Node", e);
try {
clusterServices.trollback();
} catch (Exception e1) {
*/
private Status putNodeToController (Node node, InetAddress controller) {
if (clusterServices == null || nodeConnections == null) {
- return new Status(StatusCode.SUCCESS);
+ return new Status(StatusCode.INTERNALERROR, "Cluster service unavailable, or node connections info missing.");
}
log.debug("Trying to Put {} to {}", controller.getHostAddress(), node.toString());
if (node == null || controller == null) {
return new Status(StatusCode.BADREQUEST);
}
- if (isLocal(node)) return new Status(StatusCode.SUCCESS);
+ if (isLocal(node)) {
+ return new Status(StatusCode.SUCCESS);
+ }
if (isConnectionAllowed(node)) {
return putNodeToController(node, controller);
} else {
}
}
- @SuppressWarnings("deprecation")
public Status addNode (Node node) {
return addNode(node, clusterServices.getMyAddress());
}
- @SuppressWarnings({ "unchecked", "deprecation" })
+ @SuppressWarnings({ "unchecked" })
private void retrieveCaches() {
if (this.clusterServices == null) {
- log.error("un-initialized clusterServices, can't retrieve cache");
+ log.error("Un-initialized Cluster Services, can't retrieve caches for scheme: {}", name);
return;
}
- nodeConnections = (ConcurrentMap<Node, Set<InetAddress>>) clusterServices.getCache("connectionmanager."+name+".nodeconnections");
+ nodeConnections = (ConcurrentMap<Node, Set<InetAddress>>) clusterServices.getCache(nodeConnectionsCacheName);
if (nodeConnections == null) {
- log.error("\nFailed to get caches");
+ log.error("\nFailed to get cache: {}", nodeConnectionsCacheName);
}
}
- @SuppressWarnings("deprecation")
private void allocateCaches() {
if (this.clusterServices == null) {
- log.error("un-initialized clusterServices, can't create cache");
+ log.error("Un-initialized clusterServices, can't create cache");
return;
}
try {
- clusterServices.createCache("connectionmanager."+name+".nodeconnections", EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+ clusterServices.createCache(nodeConnectionsCacheName, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
} catch (CacheExistException cee) {
- log.error("\nCache already exists - destroy and recreate if needed");
+ log.debug("\nCache already exists: {}", nodeConnectionsCacheName);
} catch (CacheConfigException cce) {
log.error("\nCache configuration invalid - check cache mode");
} catch (Exception e) {
import java.net.InetAddress;
import java.util.Set;
+
import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
import org.opendaylight.controller.sal.core.Node;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
class AnyControllerScheme extends AbstractScheme {
- private static final Logger logger = LoggerFactory.getLogger(AnyControllerScheme.class);
private static AbstractScheme myScheme= null;
protected AnyControllerScheme(IClusterGlobalServices clusterServices) {
return myScheme;
}
- @SuppressWarnings("deprecation")
@Override
public boolean isConnectionAllowedInternal(Node node) {
- if (nodeConnections == null) return true;
Set <InetAddress> controllers = nodeConnections.get(node);
if (controllers == null || controllers.size() == 0) return true;
return (controllers.size() == 1 && controllers.contains(clusterServices.getMyAddress()));
class SingleControllerScheme extends AbstractScheme {
- private static AbstractScheme myScheme= null;
+ private static AbstractScheme myScheme = null;
protected SingleControllerScheme(IClusterGlobalServices clusterServices) {
super(clusterServices, ConnectionMgmtScheme.SINGLE_CONTROLLER);
return myScheme;
}
- @SuppressWarnings("deprecation")
@Override
public boolean isConnectionAllowedInternal(Node node) {
- if (nodeConnections == null) return true;
// Lets make it simple. The Cluster Coordinator is the master
- if (clusterServices.amICoordinator()) return true;
- return false;
+ return clusterServices.amICoordinator();
}
}
\ No newline at end of file
</activation>
<modules>
<!-- MD-SAL bundles -->
- <module>../../sal/yang-prototype</module>
+ <module>../../md-sal</module>
</modules>
</profile>
</profiles>
<modules>
<module>sal-common</module>
<module>sal-common-util</module>
- <module>sal-data-api</module>
+ <!-- Binding Independent -->
+ <module>sal-dom-api</module>
+ <module>sal-dom-broker</module>
+ <module>sal-dom-spi</module>
+ <!-- Binding Aware -->
<module>sal-binding-api</module>
- <module>sal-binding-broker-impl</module>
+ <module>sal-binding-broker</module>
+ <!-- Samples -->
<module>samples</module>
+ <!-- Base Models -->
<module>model</module>
</modules>
<name>opendaylight.snapshot</name>
<url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
</pluginRepository>
+ <pluginRepository>
+ <id>opendaylight.release</id>
+ <name>opendaylight.release</name>
+ <url>${nexusproxy}/repositories/opendaylight.release/</url>
+ </pluginRepository>
</pluginRepositories>
<repositories>
- <repository>
+
+ <repository>
+ <id>opendaylight-release</id>
+ <name>opendaylight-release</name>
+ <url>${nexusproxy}/repositories/opendaylight.release/</url>
+ </repository>
+ <!-- OpenDayLight Snapshot artifact -->
+ <repository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+ </repository>
+ <repository>
<id>central</id>
<name>central</name>
<url>http://repo1.maven.org/maven2</url>
<url>${nexusproxy}/repositories/jboss.releases/</url>
</repository>
<!-- OpenDayLight Released artifact -->
- <repository>
- <id>opendaylight-release</id>
- <name>opendaylight-release</name>
- <url>${nexusproxy}/repositories/opendaylight.release/</url>
- </repository>
- <!-- OpenDayLight Snapshot artifact -->
- <repository>
- <id>opendaylight-snapshot</id>
- <name>opendaylight-snapshot</name>
- <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
- </repository>
+
</repositories>
<distributionManagement>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${maven.bundle.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
</instructions>
</configuration>
</plugin>
-
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-model-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>5.0.0</version>
+ </dependency>
</dependencies>
</project>
--- /dev/null
+package org.opendaylight.controller.sal.core.api;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public abstract class AbstractConsumer implements Consumer, BundleActivator {
+
+ Broker broker;
+ ServiceReference<Broker> brokerRef;
+ @Override
+ public final void start(BundleContext context) throws Exception {
+ brokerRef = context.getServiceReference(Broker.class);
+ broker = context.getService(brokerRef);
+
+ this.startImpl(context);
+
+ broker.registerConsumer(this,context);
+ }
+
+ public abstract void startImpl(BundleContext context);
+
+ @Override
+ public final void stop(BundleContext context) throws Exception {
+ broker = null;
+ if(brokerRef != null) {
+ context.ungetService(brokerRef);
+ }
+ }
+
+
+ @Override
+ public Collection<ConsumerFunctionality> getConsumerFunctionality() {
+ return Collections.emptySet();
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.sal.core.api;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public abstract class AbstractProvider implements BundleActivator, Provider {
+
+ private ServiceReference<Broker> brokerRef;
+ private Broker broker;
+
+ @Override
+ public Collection<ProviderFunctionality> getProviderFunctionality() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public final void start(BundleContext context) throws Exception {
+ brokerRef = context.getServiceReference(Broker.class);
+ broker = context.getService(brokerRef);
+
+ this.startImpl(context);
+
+ broker.registerProvider(this,context);
+ }
+
+ public abstract void startImpl(BundleContext context);
+
+ @Override
+ public final void stop(BundleContext context) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.osgi.framework.BundleContext;
/**
*
* @param cons
* Consumer to be registered.
+ * @param context
* @return a session specific to consumer registration
* @throws IllegalArgumentException
* If the consumer is <code>null</code>.
* @throws IllegalStateException
* If the consumer is already registered.
*/
- ConsumerSession registerConsumer(Consumer cons);
+ ConsumerSession registerConsumer(Consumer cons, BundleContext context);
/**
* Registers the {@link Provider}, which will use the SAL layer.
*
* @param prov
* Provider to be registered.
+ * @param context
* @return a session unique to the provider registration.
* @throws IllegalArgumentException
* If the provider is <code>null</code>.
* @throws IllegalStateException
* If the consumer is already registered.
*/
- ProviderSession registerProvider(Provider prov);
+ ProviderSession registerProvider(Provider prov, BundleContext context);
/**
* {@link Consumer} specific access to the SAL functionality.
</parent>\r
<artifactId>sal-broker-impl</artifactId>\r
<scm>\r
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
+ <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
+ <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
</scm>\r
\r
<dependencies>\r
<artifactId>guava</artifactId>\r
</dependency>\r
</dependencies>\r
+\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.felix</groupId>\r
+ <artifactId>maven-bundle-plugin</artifactId>\r
+ <extensions>true</extensions>\r
+ <configuration>\r
+ <instructions>\r
+ <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>\r
+ <Bundle-Activator>org.opendaylight.controller.sal.dom.broker.BrokerActivator</Bundle-Activator>\r
+ </instructions>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
</project>\r
--- /dev/null
+package org.opendaylight.controller.sal.dom.broker;
+
+import java.util.Hashtable;
+
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class BrokerActivator implements BundleActivator {
+
+ BrokerImpl broker;
+ private ServiceRegistration<Broker> brokerReg;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ broker = new BrokerImpl();
+ broker.setBundleContext(context);
+ brokerReg = context.registerService(Broker.class, broker, new Hashtable<String,String>());
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if(brokerReg != null) {
+ brokerReg.unregister();
+ }
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.sal.core.impl;
+package org.opendaylight.controller.sal.dom.broker;
import java.util.Collection;
import java.util.Collections;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// Implementation specific
private ExecutorService executor;
+ private BundleContext bundleContext;
+
@Override
- public ConsumerSession registerConsumer(Consumer consumer) {
+ public ConsumerSession registerConsumer(Consumer consumer,BundleContext ctx) {
checkPredicates(consumer);
log.info("Registering consumer " + consumer);
- ConsumerSessionImpl session = newSessionFor(consumer);
+ ConsumerSessionImpl session = newSessionFor(consumer,ctx);
consumer.onSessionInitiated(session);
sessions.add(session);
return session;
}
@Override
- public ProviderSession registerProvider(Provider provider) {
+ public ProviderSession registerProvider(Provider provider,BundleContext ctx) {
checkPredicates(provider);
- ProviderSessionImpl session = newSessionFor(provider);
+ ProviderSessionImpl session = newSessionFor(provider,ctx);
provider.onSessionInitiated(session);
providerSessions.add(session);
return session;
// Private Factory methods
- private ConsumerSessionImpl newSessionFor(Consumer cons) {
- return new ConsumerSessionImpl(cons);
+ private ConsumerSessionImpl newSessionFor(Consumer provider, BundleContext ctx) {
+ return new ConsumerSessionImpl(provider,ctx);
}
- private ProviderSessionImpl newSessionFor(Provider provider) {
- return new ProviderSessionImpl(provider);
+ private ProviderSessionImpl newSessionFor(Provider provider, BundleContext ctx) {
+ return new ProviderSessionImpl(provider,ctx);
}
private void consumerSessionClosed(ConsumerSessionImpl consumerSessionImpl) {
.synchronizedMap(new HashMap<Class<? extends BrokerService>, BrokerService>());
private boolean closed = false;
+ private BundleContext context;
+
public Consumer getConsumer() {
return consumer;
}
- public ConsumerSessionImpl(Consumer consumer) {
+ public ConsumerSessionImpl(Consumer consumer, BundleContext ctx) {
this.consumer = consumer;
+ this.context = ctx;
}
@Override
private Provider provider;
private Map<QName, RpcImplementation> sessionRpcImpls = Collections.synchronizedMap(new HashMap<QName, RpcImplementation>());
- public ProviderSessionImpl(Provider provider) {
- super(null);
+ public ProviderSessionImpl(Provider provider, BundleContext ctx) {
+ super(null,ctx);
this.provider = provider;
}
}
}
+
+ public void setBundleContext(BundleContext context) {
+ this.bundleContext = context;
+ }
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.sal.core.impl;
+package org.opendaylight.controller.sal.dom.broker;
import java.util.ArrayList;
import java.util.Collections;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.sal.core.impl;
+package org.opendaylight.controller.sal.dom.broker;
import java.util.Collection;
import java.util.Collections;
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.sal.core.impl;
\ No newline at end of file
+package org.opendaylight.controller.sal.dom.broker;
\ No newline at end of file
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <parent>\r
+ <groupId>org.opendaylight.controller</groupId>\r
+ <artifactId>sal-parent</artifactId>\r
+ <version>1.0-SNAPSHOT</version>\r
+ </parent>\r
+ <artifactId>sal-core-demo</artifactId>\r
+ <scm>\r
+ <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
+ <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
+ </scm>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.opendaylight.controller</groupId>\r
+ <artifactId>sal-broker-impl</artifactId>\r
+ <version>1.0-SNAPSHOT</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.opendaylight.controller</groupId>\r
+ <artifactId>yang-data-util</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-simple</artifactId>\r
+ <version>1.7.2</version>\r
+ <scope>runtime</scope>\r
+ </dependency>\r
+ </dependencies>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <artifactId>maven-assembly-plugin</artifactId>\r
+ <version>2.4</version>\r
+ <configuration>\r
+ <descriptorRefs>\r
+ <descriptorRef>jar-with-dependencies</descriptorRef>\r
+ </descriptorRefs>\r
+ <archive>\r
+ <manifest>\r
+ <mainClass>org.opendaylight.controller.sal.demo.SALDemo</mainClass>\r
+ </manifest>\r
+ </archive>\r
+ </configuration>\r
+ <executions>\r
+ <execution>\r
+ <id>make-assembly</id>\r
+ <phase>package</phase>\r
+ <goals>\r
+ <goal>single</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+\r
+ </plugins>\r
+\r
+ </build>\r
+</project>\r
props.addAll(prop);
}
nodeConnectorProps.put(entry.getKey(), props);
- notifyInventoryShimListener(entry.getKey(), UpdateType.ADDED,
- entry.getValue());
+ notifyInventoryShimListener(entry.getKey(), UpdateType.ADDED, entry.getValue());
}
// Add this node
}
}
- private void notifyInventoryShimExternalListener(Node node,
- UpdateType type, Set<Property> props) {
+ private void notifyInventoryShimExternalListener(Node node, UpdateType type, Set<Property> props) {
for (IInventoryShimExternalListener s : this.inventoryShimExternalListeners) {
s.updateNode(node, type, props);
}
}
- private void notifyInventoryShimExternalListener(
- NodeConnector nodeConnector, UpdateType type, Set<Property> props) {
+ private void notifyInventoryShimExternalListener(NodeConnector nodeConnector, UpdateType type, Set<Property> props) {
for (IInventoryShimExternalListener s : this.inventoryShimExternalListeners) {
s.updateNodeConnector(nodeConnector, type, props);
}
private void notifyInventoryShimInternalListener(String container,
NodeConnector nodeConnector, UpdateType type, Set<Property> props) {
- IInventoryShimInternalListener inventoryShimInternalListener = inventoryShimInternalListeners
- .get(container);
+ IInventoryShimInternalListener inventoryShimInternalListener = inventoryShimInternalListeners.get(container);
if (inventoryShimInternalListener != null) {
- inventoryShimInternalListener.updateNodeConnector(nodeConnector,
- type, props);
- logger.trace(
- "notifyInventoryShimInternalListener {} type {} for container {}",
- new Object[] { nodeConnector, type, container });
+ inventoryShimInternalListener.updateNodeConnector(nodeConnector, type, props);
+ logger.trace("notifyInventoryShimInternalListener {} type {} for container {}", new Object[] {
+ nodeConnector, type, container });
}
}
notifyInventoryShimInternalListener(container, nodeConnector, type, props);
}
- // Notify DiscoveryService
+ // Notify plugin listeners (Discovery, DataPacket, OFstats etc.)
notifyInventoryShimExternalListener(nodeConnector, type, props);
logger.debug("Connection service accepted the inventory notification for {} {}", nodeConnector, type);
if (isNodeLocal) {
// Now notify other containers
- Set<String> containers = (nodeContainerMap.get(node) == null) ? new HashSet<String>() : new HashSet<String>(
- nodeContainerMap.get(node));
+ Set<String> containers = (nodeContainerMap.get(node) == null) ? new HashSet<String>()
+ : new HashSet<String>(nodeContainerMap.get(node));
containers.add(GlobalConstants.DEFAULT.toString());
for (String container : containers) {
notifyInventoryShimInternalListener(container, node, type, props);
}
- // Notify external listener
+
+ // Notify plugin listeners (Discovery, DataPacket, OFstats etc.)
notifyInventoryShimExternalListener(node, type, props);
logger.debug("Connection service accepted the inventory notification for {} {}", node, type);
private void notifyGlobalInventoryShimInternalListener(Node node, UpdateType type, Set<Property> props) {
for (IInventoryShimInternalListener globalListener : globalInventoryShimInternalListeners) {
globalListener.updateNode(node, type, props);
- logger.trace(
- "notifyGlobalInventoryShimInternalListener {} type {}",
- new Object[] { node, type });
+ logger.trace("notifyGlobalInventoryShimInternalListener {} type {}", new Object[] { node, type });
}
}
import org.slf4j.LoggerFactory;
/**
- * It periodically polls the different OF statistics from the OF switches and
- * caches them for quick retrieval for the above layers' modules It also
- * provides an API to directly query the switch about the statistics
+ * Periodically polls the different OF statistics from the OF switches, caches
+ * them, and publishes results towards SAL. It also provides an API to directly
+ * query the switch for any specific statistics.
*/
-public class OFStatisticsManager implements IOFStatisticsManager,
-IInventoryShimExternalListener, CommandProvider {
+public class OFStatisticsManager implements IOFStatisticsManager, IInventoryShimExternalListener, CommandProvider {
private static final Logger log = LoggerFactory.getLogger(OFStatisticsManager.class);
private static final int INITIAL_SIZE = 64;
private static final long FLOW_STATS_PERIOD = 10000;
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-prototype</artifactId>
- <version>0.5-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>${project.artifactId}</name>
- <description>
- yang-prototype
- </description>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
- </scm>
-
- <modules>
- <module>sal</module>
- <module>concepts-lang</module>
- </modules>
-
- <properties>
- <yangtools.version>0.5.5-SNAPSHOT</yangtools.version>
- <sonar.host.url>https://sonar.opendaylight.org/</sonar.host.url>
- <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
- <sitedeploy>dav:http://nexus.opendaylight.org/content/sites/site</sitedeploy>
- <siteplugin>3.2</siteplugin>
- <defaultStylesheet>${project.basedir}/src/site/resources/stylesheet.css</defaultStylesheet>
- <projectinfo>2.6</projectinfo>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <compiler.version>2.3.2</compiler.version>
- <surefire.version>2.13</surefire.version>
- <exam.version>3.0.0</exam.version>
- <url.version>1.5.0</url.version>
- <enunciate.version>1.26.2</enunciate.version>
- <sonar.branch>${user.name}-private-view</sonar.branch>
- <sonar.skippedModules>org.openflow.openflowj,net.sf.jung2</sonar.skippedModules>
- <logback.version>1.0.9</logback.version>
- <slf4j.version>1.7.2</slf4j.version>
- </properties>
-
- <pluginRepositories>
- <pluginRepository>
- <id>central</id>
- <name>maven repo1</name>
- <url>http://repo1.maven.org/maven2</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </pluginRepository>
- <pluginRepository>
- <id>opendaylight.snapshot</id>
- <name>opendaylight.snapshot</name>
- <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
- </pluginRepository>
- </pluginRepositories>
-
-
- <repositories>
- <!-- EBR release -->
- <!-- http://repository.springsource.com/maven/bundles/release -->
- <repository>
- <id>ebr-bundles-release</id>
- <name>ebr-bundles-release</name>
- <url>${nexusproxy}/repositories/ebr-bundles-release/</url>
- </repository>
- <!-- EBR external -->
- <!-- http://repository.springsource.com/maven/bundles/external -->
- <repository>
- <id>ebr-bundles-external</id>
- <name>ebr-bundles-external</name>
- <url>${nexusproxy}/repositories/ebr-bundles-external/</url>
- </repository>
- <repository>
- <id>central</id>
- <name>central</name>
- <url>http://repo1.maven.org/maven2</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- <!-- Pax mirror -->
- <!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->
- <repository>
- <id>ops4j-releases</id>
- <name>ops4j-releases</name>
- <url>${nexusproxy}/repositories/ops4j-releases/</url>
- </repository>
- <!-- Third Packages hosted in local maven because not available in
- other places -->
- <repository>
- <id>thirdparty</id>
- <name>thirdparty</name>
- <url>${nexusproxy}/repositories/thirdparty/</url>
- </repository>
- <!-- Jboss mirror -->
- <!-- https://repository.jboss.org/nexus/content/repositories/releases -->
- <repository>
- <id>jboss.releases</id>
- <name>jboss.releases</name>
- <url>${nexusproxy}/repositories/jboss.releases/</url>
- </repository>
- <!-- OpenDayLight Released artifact -->
- <repository>
- <id>opendaylight-release</id>
- <name>opendaylight-release</name>
- <url>${nexusproxy}/repositories/opendaylight.release/</url>
- </repository>
- <!-- OpenDayLight Snapshot artifact -->
- <repository>
- <id>opendaylight-snapshot</id>
- <name>opendaylight-snapshot</name>
- <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
- </repository>
- </repositories>
-
- <distributionManagement>
- <!-- OpenDayLight Released artifact -->
- <repository>
- <id>opendaylight-release</id>
- <url>${nexusproxy}/repositories/opendaylight.release/</url>
- </repository>
- <!-- OpenDayLight Snapshot artifact -->
- <snapshotRepository>
- <id>opendaylight-snapshot</id>
- <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
- </snapshotRepository>
- <site>
- <id>${project.artifactId}-site</id>
- <url>./</url>
- </site>
- </distributionManagement>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- <scope>test</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.2</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${compiler.version}</version>
- <inherited>true</inherited>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>deploy</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- explicitly define maven-deploy-plugin after other to
- force exec order -->
- <artifactId>maven-deploy-plugin</artifactId>
- <executions>
- <execution>
- <id>deploy</id>
- <phase>deploy</phase>
- <goals>
- <goal>deploy</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <stylesheetfile>${defaultStylesheet}</stylesheetfile>
- <excludePackageNames>
- *.opendaylight.controller.antlrv4.code.gen
- </excludePackageNames>
- </configuration>
- <executions>
- <execution>
- <id>aggregate</id>
- <goals>
- <goal>aggregate</goal>
- </goals>
- <phase>site</phase>
- </execution>
- <execution>
- <id>attach-javadocs</id>
- <phase>deploy</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>${siteplugin}</version>
- <inherited>false</inherited>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-markdown</artifactId>
- <version>1.3</version>
- </dependency>
- </dependencies>
- <configuration>
- <siteDirectory>${project.basedir}/src/site</siteDirectory>
- <inputEncoding>UTF-8</inputEncoding>
- <outputEncoding>UTF-8</outputEncoding>
- </configuration>
- </plugin>
- </plugins>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.2.1</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.7</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.15</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>${siteplugin}</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-markdown</artifactId>
- <version>1.3</version>
- </dependency>
- </dependencies>
- <configuration>
- <siteDirectory>${project.parent.basedir}/src/site</siteDirectory>
- <inputEncoding>UTF-8</inputEncoding>
- <outputEncoding>UTF-8</outputEncoding>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
- <configuration>
- <stylesheetfile>${defaultStylesheet}</stylesheetfile>
- </configuration>
- <executions>
- <execution>
- <id>aggregate</id>
- <goals>
- <goal>aggregate</goal>
- </goals>
- <phase>site</phase>
- </execution>
- <execution>
- <id>attach-javadocs</id>
- <phase>deploy</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
-
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
- <reportSets>
- <reportSet>
- <reports>
- <report>javadoc</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>2.4.0</version>
- <configuration>
- <effort>Max</effort>
- <threshold>Low</threshold>
- <goal>site</goal>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jdepend-maven-plugin</artifactId>
- <version>2.0-beta-2</version>
- </plugin>
- </plugins>
- </reporting>
-
- <profiles>
- <profile>
- <id>viewbuild</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <build.suffix>${project.version}</build.suffix>
- </properties>
- </profile>
- <profile>
- <id>jenkins</id>
- <activation>
- <property>
- <name>BUILDSUFFIX</name>
- </property>
- </activation>
- <properties>
- <build.suffix>${BUILDSUFFIX}</build.suffix>
- </properties>
- </profile>
- </profiles>
-
-</project>
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
- <modelVersion>4.0.0</modelVersion>\r
- <parent>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-parent</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </parent>\r
- <artifactId>sal-core-demo</artifactId>\r
- <scm>\r
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
- </scm>\r
-\r
- <dependencies>\r
- <dependency>\r
-\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-broker-impl</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>yang-data-util</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.slf4j</groupId>\r
- <artifactId>slf4j-simple</artifactId>\r
- <version>1.7.2</version>\r
- <scope>runtime</scope>\r
- </dependency>\r
- </dependencies>\r
- <build>\r
- <plugins>\r
- <plugin>\r
- <artifactId>maven-assembly-plugin</artifactId>\r
- <version>2.4</version>\r
- <configuration>\r
- <descriptorRefs>\r
- <descriptorRef>jar-with-dependencies</descriptorRef>\r
- </descriptorRefs>\r
- <archive>\r
- <manifest>\r
- <mainClass>org.opendaylight.controller.sal.demo.SALDemo</mainClass>\r
- </manifest>\r
- </archive>\r
- </configuration>\r
- <executions>\r
- <execution>\r
- <id>make-assembly</id>\r
- <phase>package</phase>\r
- <goals>\r
- <goal>single</goal>\r
- </goals>\r
- </execution>\r
- </executions>\r
- </plugin>\r
-\r
- </plugins>\r
-\r
- </build>\r
-</project>\r
}
for (InetAddress i : IPs) {
Subnet existingSubnet = subnets.get(i);
- if ((existingSubnet != null)
- && !existingSubnet.isMutualExclusive(newSubnet)) {
- return new Status(StatusCode.CONFLICT);
+ if ((existingSubnet != null) && !existingSubnet.isMutualExclusive(newSubnet)) {
+ return new Status(StatusCode.CONFLICT, "This subnet conflicts with an existing one.");
}
}
return new Status(StatusCode.SUCCESS);
// Presence check
if (subnetsConfigList.containsKey(conf.getName())) {
return new Status(StatusCode.CONFLICT,
- "Subnet with the specified name already configured.");
+ "Subnet with the specified name already exists.");
}
// Semantic check
status = semanticCheck(conf);
}
@RequestMapping(value = "logout")
- public String login(Map<String, Object> model,
- final HttpServletRequest request) {
+ public String logout(Map<String, Object> model, final HttpServletRequest request) {
IUserManager userManager = (IUserManager) ServiceHelper
.getGlobalInstance(IUserManager.class, this);