Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Add IfNewHostNotify to DeviceManager"
[controller.git]
/
opendaylight
/
switchmanager
/
api
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
switchmanager
/
Switch.java
diff --git
a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java
b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java
index 6ba78deaded8b817ee4fc382dc8560f1d3a74d10..a665096e8b529ee54e7b851c566a04aaddb51b7b 100644
(file)
--- a/
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java
+++ b/
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Switch.java
@@
-16,9
+16,9
@@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.List;
import java.util.Set;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.HexEncode;
/**
* The class describes switch related information including L2 address, ports,
/**
* The class describes switch related information including L2 address, ports,
@@
-28,7
+28,7
@@
public class Switch implements Serializable {
private static final long serialVersionUID = 1L;
private byte[] dataLayerAddress;
private Set<NodeConnector> nodeConnectors;
private static final long serialVersionUID = 1L;
private byte[] dataLayerAddress;
private Set<NodeConnector> nodeConnectors;
- private List<NodeConnector> spanPorts;
+ private
final
List<NodeConnector> spanPorts;
private Node node;
/*
private Node node;
/*
@@
-44,7
+44,7
@@
public class Switch implements Serializable {
this.node = node;
this.nodeConnectors = new HashSet<NodeConnector>();
this.spanPorts = new ArrayList<NodeConnector>(2);
this.node = node;
this.nodeConnectors = new HashSet<NodeConnector>();
this.spanPorts = new ArrayList<NodeConnector>(2);
- this.dataLayerAddress =
deriveMacAddress()
;
+ this.dataLayerAddress =
null
;
}
/**
}
/**
@@
-98,18
+98,6
@@
public class Switch implements Serializable {
this.node = node;
}
this.node = node;
}
- private byte[] deriveMacAddress() {
- long dpid = (Long) this.node.getID();
- byte[] mac = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
- for (short i = 0; i < 6; i++) {
- mac[5 - i] = (byte) dpid;
- dpid >>= 8;
- }
-
- return mac;
- }
-
public void addSpanPorts(List<NodeConnector> portList) {
for (NodeConnector port : portList) {
spanPorts.add(port);
public void addSpanPorts(List<NodeConnector> portList) {
for (NodeConnector port : portList) {
spanPorts.add(port);
@@
-137,35
+125,47
@@
public class Switch implements Serializable {
@Override
public boolean equals(Object obj) {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj)
{
return true;
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
return false;
+ }
Switch other = (Switch) obj;
Switch other = (Switch) obj;
- if (!Arrays.equals(dataLayerAddress, other.dataLayerAddress))
+ if (!Arrays.equals(dataLayerAddress, other.dataLayerAddress))
{
return false;
return false;
+ }
if (node == null) {
if (node == null) {
- if (other.node != null)
+ if (other.node != null)
{
return false;
return false;
- } else if (!node.equals(other.node))
+ }
+ } else if (!node.equals(other.node)) {
return false;
return false;
+ }
if (nodeConnectors == null) {
if (nodeConnectors == null) {
- if (other.nodeConnectors != null)
+ if (other.nodeConnectors != null)
{
return false;
return false;
- } else if (!nodeConnectors.equals(other.nodeConnectors))
+ }
+ } else if (!nodeConnectors.equals(other.nodeConnectors)) {
return false;
return false;
+ }
if (spanPorts == null) {
if (spanPorts == null) {
- if (other.spanPorts != null)
+ if (other.spanPorts != null)
{
return false;
return false;
- } else if (!spanPorts.equals(other.spanPorts))
+ }
+ } else if (!spanPorts.equals(other.spanPorts)) {
return false;
return false;
+ }
return true;
}
@Override
public String toString() {
return true;
}
@Override
public String toString() {
- return "Switch[" + ReflectionToStringBuilder.toString(this) + "]";
+ return "Switch [dataLayerAddress=" + HexEncode.bytesToHexStringFormat(dataLayerAddress)
+ + ", nodeConnectors=" + nodeConnectors + ", spanPorts="
+ + spanPorts + ", node=" + node + "]";
}
}
}
}