package org.opendaylight.controller.protocol_plugin.openflow.core.internal;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
}
}
+ public void _controllerShowConnConfig(CommandInterpreter ci) {
+ String str = System.getProperty("secureChannelEnabled");
+ if ((str != null) && (str.trim().equalsIgnoreCase("true"))) {
+ ci.print("The Controller and Switch should communicate through TLS connetion.\n");
+
+ String keyStoreFile = System.getProperty("controllerKeyStore");
+ String trustStoreFile = System.getProperty("controllerTrustStore");
+ if ((keyStoreFile == null) || keyStoreFile.trim().isEmpty()) {
+ ci.print("controllerKeyStore not specified in ./configuration/config.ini\n");
+ } else {
+ ci.print("controllerKeyStore=" + keyStoreFile + "\n");
+ }
+ if ((trustStoreFile == null) || trustStoreFile.trim().isEmpty()) {
+ ci.print("controllerTrustStore not specified in ./configuration/config.ini\n");
+ } else {
+ ci.print("controllerTrustStore=" + trustStoreFile + "\n");
+ }
+ } else {
+ ci.print("The Controller and Switch should communicate through TCP connetion.\n");
+ }
+ }
+
private void registerWithOSGIConsole() {
BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass())
.getBundleContext();
help.append("--Open Flow Controller --\n");
help.append("\tcontrollerShowSwitches\n");
help.append("\tcontrollerReset\n");
+ help.append("\tcontrollerShowConnConfig\n");
return help.toString();
}
}
newBuffer.put(outBuffer);
outBuffer = newBuffer;
}
+ }
+ synchronized (outBuffer) {
msg.writeTo(outBuffer);
if (!socket.isOpen()) {
package org.opendaylight.controller.protocol_plugin.openflow.core.internal;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousCloseException;
* @throws Exception
*/
private void createSecureChannel(SocketChannel socket) throws Exception {
- String keyStoreFile = System.getProperty("controllerKeyStore").trim();
- String keyStorePassword = System.getProperty("controllerKeyStorePassword").trim();
- String trustStoreFile = System.getProperty("controllerTrustStore").trim();
- String trustStorePassword = System.getProperty("controllerTrustStorePassword").trim();
-
+ String keyStoreFile = System.getProperty("controllerKeyStore");
+ String keyStorePassword = System.getProperty("controllerKeyStorePassword");
+ String trustStoreFile = System.getProperty("controllerTrustStore");
+ String trustStorePassword = System.getProperty("controllerTrustStorePassword");
+
+ if (keyStoreFile != null) {
+ keyStoreFile = keyStoreFile.trim();
+ }
+ if ((keyStoreFile == null) || keyStoreFile.isEmpty()) {
+ throw new FileNotFoundException("controllerKeyStore not specified in ./configuration/config.ini");
+ }
+ if (keyStorePassword != null) {
+ keyStorePassword = keyStorePassword.trim();
+ }
+ if ((keyStorePassword == null) || keyStorePassword.isEmpty()) {
+ throw new FileNotFoundException("controllerKeyStorePassword not specified in ./configuration/config.ini");
+ }
+ if (trustStoreFile != null) {
+ trustStoreFile = trustStoreFile.trim();
+ }
+ if ((trustStoreFile == null) || trustStoreFile.isEmpty()) {
+ throw new FileNotFoundException("controllerTrustStore not specified in ./configuration/config.ini");
+ }
+ if (trustStorePassword != null) {
+ trustStorePassword = trustStorePassword.trim();
+ }
+ if ((trustStorePassword == null) || trustStorePassword.isEmpty()) {
+ throw new FileNotFoundException("controllerTrustStorePassword not specified in ./configuration/config.ini");
+ }
+
KeyStore ks = KeyStore.getInstance("JKS");
KeyStore ts = KeyStore.getInstance("JKS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
newBuffer.put(myAppData);
myAppData = newBuffer;
}
+ }
+ synchronized (myAppData) {
msg.writeTo(myAppData);
myAppData.flip();
sslEngineResult = sslEngine.wrap(myAppData, myNetData);
package org.opendaylight.controller.protocol_plugin.openflow.core.internal;
-import java.io.IOException;
+import java.net.SocketException;
import java.nio.channels.AsynchronousCloseException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
@Override
public Integer asyncSend(OFMessage msg, int xid) {
msg.setXid(xid);
- transmitQ.add(new PriorityMessage(msg, 0));
+ if (transmitQ != null) {
+ transmitQ.add(new PriorityMessage(msg, 0));
+ }
return xid;
}
@Override
public Integer asyncFastSend(OFMessage msg, int xid) {
msg.setXid(xid);
- transmitQ.add(new PriorityMessage(msg, 1));
+ if (transmitQ != null) {
+ transmitQ.add(new PriorityMessage(msg, 1));
+ }
return xid;
}
public void resumeSend() {
try {
- msgReadWriteService.resumeSend();
+ if (msgReadWriteService != null) {
+ msgReadWriteService.resumeSend();
+ }
} catch (Exception e) {
reportError(e);
}
}
private void reportError(Exception e) {
- if (e instanceof AsynchronousCloseException) {
+ if (e instanceof AsynchronousCloseException ||
+ e instanceof InterruptedException ||
+ e instanceof SocketException) {
logger.debug("Caught exception {}", e.getMessage());
} else {
logger.warn("Caught exception {}", e.getMessage());
logger.trace("Message sent: {}", pmsg.toString());
}
Thread.sleep(10);
+ } catch (InterruptedException ie) {
+ reportError(new InterruptedException("PriorityMessageTransmit thread interrupted"));
} catch (Exception e) {
reportError(e);
}
.getNodeConnectorProp(dstNC,
Bandwidth.BandwidthPropName);
- if ((bwSrc == null) || (bwDst == null)) {
- log.error("bwSrc:{} or bwDst:{} is null", bwSrc, bwDst);
- return (double) -1;
- }
-
- long srcLinkSpeed = bwSrc.getValue();
- if (srcLinkSpeed == 0) {
- log.trace("Edge {}: srcLinkSpeed is 0. Setting to {}!",
- e, DEFAULT_LINK_SPEED);
- srcLinkSpeed = DEFAULT_LINK_SPEED;
+ long srcLinkSpeed = 0, dstLinkSpeed = 0;
+ if ((bwSrc == null) || ((srcLinkSpeed = bwSrc.getValue()) == 0)) {
+ log.debug("srcNC: {} - Setting srcLinkSpeed to Default!",srcNC);
+ srcLinkSpeed = DEFAULT_LINK_SPEED;
}
-
- long dstLinkSpeed = bwDst.getValue();
- if (dstLinkSpeed == 0) {
- log.trace("Edge {}: dstLinkSpeed is 0. Setting to {}!",
- e, DEFAULT_LINK_SPEED);
+
+ if ((bwDst == null) || ((dstLinkSpeed = bwDst.getValue()) == 0)) {
+ log.debug("dstNC: {} - Setting dstLinkSpeed to Default!",dstNC);
dstLinkSpeed = DEFAULT_LINK_SPEED;
}
* @file Path.java
*
* @brief Describe a path as a sequence of Edge such that from
- * each of its Tail Node there is an link to the next Head Node in the sequence
+ * each of its Head Node there is an link to the next Tail Node in the sequence
*
*/
package org.opendaylight.controller.sal.core;
/**
* Describe a path as a sequence of Edge such that from
- * each of its Tail Node there is an link to the next Head Node in the
+ * each of its Head Node there is an link to the next Tail Node in the
* sequence
*
*/
/**
* Construct an object representing a path, the constructor will
* check if the passed list of edges is such that for every
- * consecutive edges the tailnode of the first edge coincide with
- * the head node of the subsequent in order for connectivity to be there.
+ * consecutive edges the head node of the first edge coincide with
+ * the tail node of the subsequent in order for connectivity to be there.
*
* @param edges Edges of the path
*
*/
public Path(List<Edge> edges) throws ConstructionException {
- // Lets check if the list of edges is such that the tail node
- // of an edge is also the head node of the subsequent one
+ // Lets check if the list of edges is such that the head node
+ // of an edge is also the tail node of the subsequent one
boolean sequential = true;
if (edges.size() >= 2) {
for (int i = 0; i < edges.size() - 1; i++) {
void setTopologyManagerAware(ITopologyManagerAware s) {
if (this.topologyManagerAware != null) {
- log.debug("Adding ITopologyManagerAware: " + s);
+ log.debug("Adding ITopologyManagerAware: {}", s);
this.topologyManagerAware.add(s);
}
}
void unsetTopologyManagerAware(ITopologyManagerAware s) {
if (this.topologyManagerAware != null) {
+ log.debug("Removing ITopologyManagerAware: {}", s);
this.topologyManagerAware.remove(s);
}
}
void setTopoService(ITopologyService s) {
+ log.debug("Adding ITopologyService: {}", s);
this.topoService = s;
}
void unsetTopoService(ITopologyService s) {
if (this.topoService == s) {
+ log.debug("Removing ITopologyService: {}", s);
this.topoService = null;
}
}
this.clusterContainerService
.destroyCache("topologymanager.nodeConnectorDB");
this.nodeConnectorsDB = null;
- log.debug("Topology Manager DB DE-allocated");
+ log.debug("Topology Manager DB Deallocated");
}
@SuppressWarnings("unchecked")
if (this.hostsDB == null) {
return;
}
-
+
switch (t) {
case ADDED:
case CHANGED:
new HashSet<Property>());
this.nodeConnectorsDB.put(e.getTailNodeConnector(),
new HashSet<Property>());
+ log.trace("Edge {} {}", e.toString(), type.name());
break;
case REMOVED:
// Now remove the edge from edgesDB
// should be safe to assume that won't happen.
this.nodeConnectorsDB.remove(e.getHeadNodeConnector());
this.nodeConnectorsDB.remove(e.getTailNodeConnector());
+ log.trace("Edge {} {}", e.toString(), type.name());
break;
case CHANGED:
Set<Property> old_props = this.edgesDB.get(e);
// Finally update
this.edgesDB.put(e, props);
+ log.trace("Edge {} {}", e.toString(), type.name());
break;
}
//oneTopology.deleteUserConfiguredLink(linkTuple);
} catch (Exception e) {
log
- .warn("Harmless : Exception while Deleting User Configured link "
- + link + " " + e.toString());
+ .warn("Harmless : Exception while Deleting User Configured link {} {}",
+ link, e.toString());
}
linkTuple = getReverseLinkTuple(link);
try {
//oneTopology.deleteUserConfiguredLink(linkTuple);
} catch (Exception e) {
log
- .error("Harmless : Exception while Deleting User Configured Reverse link "
- + link + " " + e.toString());
+ .warn("Harmless : Exception while Deleting User Configured Reverse link {} {}",
+ link, e.toString());
}
}
return new Status(StatusCode.SUCCESS, null);
@Override
public void edgeOverUtilized(Edge edge) {
- log.warn("Link Utilization above normal: " + edge);
+ log.warn("Link Utilization above normal: {}", edge);
}
@Override
public void edgeUtilBackToNormal(Edge edge) {
- log.warn("Link Utilization back to normal: " + edge);
+ log.warn("Link Utilization back to normal: {}", edge);
}
}