String controller = ci.nextArgument();
if (controller == null) {
ci.println("Nodes connected to this controller : ");
- if (this.getLocalNodes() == null) ci.println("None");
- else ci.println(this.getLocalNodes().toString());
+ if (this.getLocalNodes() == null) {
+ ci.println("None");
+ } else {
+ ci.println(this.getLocalNodes().toString());
+ }
return;
}
try {
InetAddress address = InetAddress.getByName(controller);
ci.println("Nodes connected to controller "+controller);
- if (this.getNodes(address) == null) ci.println("None");
- else ci.println(this.getNodes(address).toString());
- return;
+ if (this.getNodes(address) == null) {
+ ci.println("None");
+ } else {
+ ci.println(this.getNodes(address).toString());
+ }
} catch (UnknownHostException e) {
e.printStackTrace();
}
@Override
public int compareTo(Entity o) {
int r;
- if (port == null)
+ if (port == null) {
r = o.port == null ? 0 : -1;
- else if (o.port == null)
+ }
+ else if (o.port == null) {
r = 1;
+ }
else {
// XXX - the node id is only defined as an object rather
// than something useful. We're just going to have to
* @param newEntity
* the entity to add. newEntity must be have the same entity
* class as device
- * @param if positive indicates the index in the entities array were the new
+ * @param insertionpoint
+ * if positive indicates the index in the entities array were the new
* entity should be inserted. If negative we will compute the correct
* insertion point
*/
TreeSet<Short> vals = new TreeSet<Short>();
for (Entity e : entities) {
- if (e.getVlan() == null)
+ if (e.getVlan() == null) {
vals.add((short) -1);
- else
+ } else {
vals.add(e.getVlan());
+ }
}
return vals.toArray(new Short[vals.size()]);
}
return false;
for (AttachmentPoint ap : apList) {
- if (ap.getLastSeen() + AttachmentPoint.INACTIVITY_INTERVAL < System
- .currentTimeMillis())
- expiredAPs.add(ap);
+ if (ap.getLastSeen() + AttachmentPoint.INACTIVITY_INTERVAL < System.currentTimeMillis()) {
+ expiredAPs.add(ap);
+ }
}
if (expiredAPs.size() > 0) {
apList.removeAll(expiredAPs);
return true;
- } else
+ } else {
return false;
+ }
}
/**
* any change to the list of attachment points for the device -- which
* indicates a device move.
*
- * @param sw
* @param port
* @param lastSeen
* @return
/**
* Delete (sw,port) from the list of list of attachment points and oldAPs.
*
- * @param sw
* @param port
* @return
*/
TreeSet<Short> vals = new TreeSet<Short>();
for (Entity e : entities) {
if (e.getPort().equals(swp.getPort())) {
- if (e.getVlan() == null)
+ if (e.getVlan() == null) {
vals.add(VLAN_UNTAGGED);
- else
+ }
+ else {
vals.add(e.getVlan());
+ }
}
}
return vals.toArray(new Short[vals.size()]);
long newDomain = 0;
boolean newBD = false;
- if (oldDomain < newDomain)
- return -1;
- else if (oldDomain > newDomain)
+ if (oldDomain < newDomain) {
+ return -1;
+ } else if (oldDomain > newDomain) {
return 1;
-
+ }
// Give preference to OFPP_LOCAL always
if (!oldAP.getPort().getType().equals(NodeConnectorIDType.SWSTACK)
&& newAP.getPort().getType()
}
public boolean isSubnetOf(InetAddress ip) {
- if (ip == null)
+ if (ip == null) {
return false;
+ }
InetAddress thisPrefix = getPrefixForAddress(this.networkAddress);
InetAddress otherPrefix = getPrefixForAddress(ip);
- if ((thisPrefix == null) || (otherPrefix == null))
+ if ((thisPrefix == null) || (otherPrefix == null)) {
return false;
- if (thisPrefix.equals(otherPrefix))
+ }
+ if (thisPrefix.equals(otherPrefix)) {
return true;
- else
+ }
+ else {
return false;
+ }
}
public short getVlan() {
// OVS apparently sends partial messages in errors
// need to be careful of that AND can't use data.limit() as
// a packet boundary because there could be more data queued
- if (messages.size() > 0)
+ if (messages.size() > 0) {
return messages.get(0);
- else
+ } else {
return null;
+ }
}
/**
public void setNextHop(InetAddress address) {
short actionLen;
- if (address instanceof Inet4Address)
- actionLen = (short)ONHLength.ONH_LEN_IPV4.getValue();
- else
- actionLen = (short)ONHLength.ONH_LEN_IPV6.getValue();
- super.setLength(actionLen);
+ if (address instanceof Inet4Address) {
+ actionLen = (short)ONHLength.ONH_LEN_IPV4.getValue();
+ } else {
+ actionLen = (short)ONHLength.ONH_LEN_IPV6.getValue();
+ }
+ super.setLength(actionLen);
this.address = address;
}
public InetAddress getNextHop() {