Renamed devicemanager, flowprogrammer, linkdiscovery and util packages
net.onrc.onos.ofcontroller.devicemanager.* => net.onrc.onos.core.devicemanager.*
net.onrc.onos.ofcontroller.flowprogrammer.* => net.onrc.onos.core.flowprogrammer.*
net.onrc.onos.ofcontroller.linkdiscovery.* => net.onrc.onos.core.linkdiscovery.*
net.onrc.onos.ofcontroller.util.* => net.onrc.onos.core.util.*
Change-Id: Iaa865af552e8fb3a589e73d006569ac79f5a0f08
diff --git a/src/main/java/net/onrc/onos/core/util/IPv6.java b/src/main/java/net/onrc/onos/core/util/IPv6.java
new file mode 100644
index 0000000..1648723
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/util/IPv6.java
@@ -0,0 +1,114 @@
+package net.onrc.onos.core.util;
+
+import net.onrc.onos.core.util.serializers.IPv6Deserializer;
+import net.onrc.onos.core.util.serializers.IPv6Serializer;
+
+import org.codehaus.jackson.map.annotate.JsonDeserialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.openflow.util.HexString;
+
+/**
+ * The class representing an IPv6 address.
+ */
+@JsonDeserialize(using=IPv6Deserializer.class)
+@JsonSerialize(using=IPv6Serializer.class)
+public class IPv6 {
+ private long valueHigh; // The higher (more significant) 64 bits
+ private long valueLow; // The lower (less significant) 64 bits
+
+ /**
+ * Default constructor.
+ */
+ public IPv6() {
+ this.valueHigh = 0;
+ this.valueLow = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public IPv6(IPv6 other) {
+ this.valueHigh = other.valueHigh;
+ this.valueLow = other.valueLow;
+ }
+
+ /**
+ * Constructor from integer values.
+ *
+ * @param valueHigh the higher (more significant) 64 bits of the address.
+ * @param valueLow the lower (less significant) 64 bits of the address.
+ */
+ public IPv6(long valueHigh, long valueLow) {
+ this.valueHigh = valueHigh;
+ this.valueLow = valueLow;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * @param value the value to use.
+ */
+ public IPv6(String value) {
+ // TODO: Implement it!
+ this.valueHigh = 0;
+ this.valueLow = 0;
+ }
+
+ /**
+ * Get the value of the higher (more significant) 64 bits of the address.
+ *
+ * @return the value of the higher (more significant) 64 bits of the
+ * address.
+ */
+ public long valueHigh() { return valueHigh; }
+
+ /**
+ * Set the value of the higher (more significant) 64 bits of the address.
+ *
+ * @param valueHigh the higher (more significant) 64 bits of the address.
+ */
+ public void setValueHigh(long valueHigh) {
+ this.valueHigh = valueHigh;
+ }
+
+ /**
+ * Get the value of the lower (less significant) 64 bits of the address.
+ *
+ * @return the value of the lower (less significant) 64 bits of the
+ * address.
+ */
+ public long valueLow() { return valueLow; }
+
+ /**
+ * Get the value of the lower (less significant) 64 bits of the address.
+ *
+ * @param valueLow the lower (less significant) 64 bits of the address.
+ */
+ public void setValueLow(long valueLow) {
+ this.valueLow = valueLow;
+ }
+
+ /**
+ * Set the value of the IPv6 address.
+ *
+ * @param valueHigh the higher (more significant) 64 bits of the address.
+ * @param valueLow the lower (less significant) 64 bits of the address.
+ */
+ public void setValue(long valueHigh, long valueLow) {
+ this.valueHigh = valueHigh;
+ this.valueLow = valueLow;
+ }
+
+ /**
+ * Convert the IPv6 value to a ':' separated string.
+ *
+ * @return the IPv6 value as a ':' separated string.
+ */
+ @Override
+ public String toString() {
+ return HexString.toHexString(this.valueHigh) + ":" +
+ HexString.toHexString(this.valueLow);
+ }
+}