Implement CLI and REST API for Xconnect
Deprecate the old way of configuring Xconnect via network config
Change-Id: I5b9ac7852517c25805bcbfc0e7b3bec3a52eed9f
diff --git a/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectKey.java b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectKey.java
new file mode 100644
index 0000000..1f2d446
--- /dev/null
+++ b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectKey.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.segmentrouting.xconnect.api;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.packet.VlanId;
+import org.onosproject.net.DeviceId;
+
+import java.util.Objects;
+
+/**
+ * Xconnect key.
+ */
+public class XconnectKey {
+ private DeviceId deviceId;
+ private VlanId vlanId;
+
+ /**
+ * Constructs new XconnectKey with given device ID and VLAN ID.
+ *
+ * @param deviceId device ID
+ * @param vlanId vlan ID
+ */
+ public XconnectKey(DeviceId deviceId, VlanId vlanId) {
+ this.deviceId = deviceId;
+ this.vlanId = vlanId;
+ }
+
+ /**
+ * Gets device ID.
+ *
+ * @return device ID of the Xconnect key
+ */
+ public DeviceId deviceId() {
+ return deviceId;
+ }
+
+ /**
+ * Gets VLAN ID.
+ *
+ * @return VLAN ID of the Xconnect key
+ */
+ public VlanId vlanId() {
+ return vlanId;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof XconnectKey)) {
+ return false;
+ }
+ final XconnectKey other = (XconnectKey) obj;
+ return Objects.equals(this.deviceId, other.deviceId) &&
+ Objects.equals(this.vlanId, other.vlanId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(deviceId, vlanId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("deviceId", deviceId)
+ .add("vlanId", vlanId)
+ .toString();
+ }
+}