NodeConnector outport, String outname) {
Node nd = inport.getNode();
if (!nd.equals(outport.getNode())) {
- throw new NullPointerException
+ throw new IllegalArgumentException
("Input and output port must belong to the same switch: " +
inport + ", " + outport);
}
import org.opendaylight.vtn.manager.VTNException;
+import org.opendaylight.controller.sal.utils.Status;
+
/**
* An exception which indicates the cluster cache operation should be
* retried.
public CacheRetryException() {
super(null);
}
+
+ /**
+ * Construct a new instance.
+ *
+ * @param cause The {@link Throwable} object which indicates the cause of
+ * an error.
+ */
+ public CacheRetryException(Throwable cause) {
+ super((Status)null, cause);
+ }
}
File file = getPath(type, key);
ObjectReader rdr = new ObjectReader();
Object obj = rdr.read(this, file.getPath());
- if (obj == null) {
- if (delete(file)) {
- LOG.warn("Delete broken configuration file: {}", file);
- }
+ if (obj == null && delete(file)) {
+ LOG.warn("Delete broken configuration file: {}", file);
}
return obj;
}
}
}
- if (port != null && indexType != INDEX_PORT) {
- // Check whether the VTN flow depends on the specified switch port
- // or not.
- if (!vflow.getFlowPorts().contains(port)) {
- // Switch port does not match.
- return false;
- }
+ // Check whether the VTN flow depends on the specified switch port
+ // or not.
+ if (port != null && indexType != INDEX_PORT &&
+ !vflow.getFlowPorts().contains(port)) {
+ // Switch port does not match.
+ return false;
}
- if (node != null && indexType != INDEX_SWITCH) {
- // Check whether the VTN flow depends on the specified switch
- // or not.
- if (!vflow.getFlowNodes().contains(node)) {
- // Switch does not match.
- return false;
- }
+ // Check whether the VTN flow depends on the specified switch or not.
+ if (node != null && indexType != INDEX_SWITCH &&
+ !vflow.getFlowNodes().contains(node)) {
+ // Switch does not match.
+ return false;
}
return true;
throw e;
}
- throw new CacheRetryException();
+ throw new CacheRetryException(e);
}
if (changed) {
* @param ref A reference to the virtual mapping.
*/
private void purge(VTNManagerImpl mgr, MapReference ref) {
- String container = mgr.getContainerName();
VBridgePath path = ref.getPath();
PathMapCleaner cleaner = new PathMapCleaner(path);
cleaner.purge(mgr, null);
* VLAN network on a switch port.
*/
private void purge(VTNManagerImpl mgr, VBridgePath path, PortVlan pvlan) {
- String container = mgr.getContainerName();
NodeConnector port = pvlan.getNodeConnector();
short vlan = pvlan.getVlan();
protected void remove(Set<? extends DataLinkHost> dlhosts)
throws VTNException {
Set<MacVlan> removed = getRemovedSet();
- HashSet<Long> macSet = new HashSet<Long>();
for (DataLinkHost dlhost: dlhosts) {
MacVlan mvlan = new MacVlan(dlhost);
if (allowedHosts.contains(mvlan)) {
MacVlan host = e.getHost();
MapReference ref = e.getMapReference();
assert ref.getMapType() == MapType.MAC;
- throw new VTNException(alreadyMapped(host, ref.getAbsolutePath()));
+ throw new VTNException
+ (alreadyMapped(host, ref.getAbsolutePath()), e);
}
return removing;
append(",vlan=").append((int)vlan).
append(",ipaddr={");
- char sep = 0;
+ String sep = "";
synchronized (this) {
for (InetAddress ipaddr: ipAddresses) {
- if (sep == 0) {
- sep = ',';
- } else {
- builder.append(sep);
- }
- builder.append(ipaddr.getHostAddress());
+ builder.append(sep).append(ipaddr.getHostAddress());
+ sep = ",";
}
}
public final String toString() {
StringBuilder builder = new StringBuilder(getClass().getSimpleName());
builder.append('[');
- String sep = ",";
+ String sep = "";
if (sourcePort != null) {
builder.append("src=").append(sourcePort.toString());
sep = ",";
}
if (destinationPort != null) {
- builder.append("dst=").append(destinationPort.toString());
+ builder.append(sep).append("dst=").
+ append(destinationPort.toString());
}
builder.append(']');
import org.opendaylight.vtn.manager.VlanMapConfig;
import org.opendaylight.vtn.manager.internal.ActionList;
import org.opendaylight.vtn.manager.internal.EdgeUpdateState;
-import org.opendaylight.vtn.manager.internal.IVTNResourceManager;
import org.opendaylight.vtn.manager.internal.MacAddressTable;
import org.opendaylight.vtn.manager.internal.MiscUtils;
import org.opendaylight.vtn.manager.internal.NodeUtils;
// Create a VLAN mapping instance.
VlanMapImpl vmap = new VlanMapImpl(bridgePath, id, vlconf);
-
- VlanMapPath path = vmap.getPath();
NodeVlan nvlan = new NodeVlan(node, vlan);
Lock wrlock = rwLock.writeLock();
Lock wrlock = rwLock.writeLock();
wrlock.lock();
try {
- MacMapImpl mmap = prepareMacMap(op);
+ MacMapImpl mmap = prepareMacMap();
MacMapConfig newconf = mmap.setMacMap(mgr, op, mcconf);
return commitMacMap(mgr, mmap, newconf);
} finally {
Lock wrlock = rwLock.writeLock();
wrlock.lock();
try {
- MacMapImpl mmap = prepareMacMap(op);
+ MacMapImpl mmap = prepareMacMap();
MacMapConfig newconf = mmap.setMacMap(mgr, op, aclType, dlhosts);
return commitMacMap(mgr, mmap, newconf);
} finally {
*/
void destroy(VTNManagerImpl mgr, boolean retain) {
VBridge vbridge = getVBridge(mgr);
- IVTNResourceManager resMgr = mgr.getResourceManager();
Lock wrlock = rwLock.writeLock();
wrlock.lock();
* lock.
* </p>
*
- * @param op A {@link UpdateOperation} instance which indicates
- * how to change the MAC mapping configuration.
* @return A {@link MacMapImpl} instance.
- * @throws VTNException An error occurred.
*/
- private MacMapImpl prepareMacMap(UpdateOperation op)
- throws VTNException {
+ private MacMapImpl prepareMacMap() {
MacMapImpl mmap = macMap;
if (mmap == null) {
mmap = new MacMapImpl(bridgePath);