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/XconnectDesc.java b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectDesc.java
new file mode 100644
index 0000000..0eead31
--- /dev/null
+++ b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectDesc.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.onosproject.net.PortNumber;
+
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * Xconnect description.
+ */
+public class XconnectDesc {
+ private XconnectKey key;
+ private Set<PortNumber> ports;
+
+ /**
+ * Constructs new Xconnect description with given device ID and VLAN ID.
+ *
+ * @param key Xconnect key
+ * @param ports set of ports
+ */
+ public XconnectDesc(XconnectKey key, Set<PortNumber> ports) {
+ this.key = key;
+ this.ports = ports;
+ }
+
+ /**
+ * Gets Xconnect key.
+ *
+ * @return Xconnect key
+ */
+ public XconnectKey key() {
+ return key;
+ }
+
+ /**
+ * Gets ports.
+ *
+ * @return set of ports
+ */
+ public Set<PortNumber> ports() {
+ return ports;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof XconnectDesc)) {
+ return false;
+ }
+ final XconnectDesc other = (XconnectDesc) obj;
+ return Objects.equals(this.key, other.key) &&
+ Objects.equals(this.ports, other.ports);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(key, ports);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("key", key)
+ .add("ports", ports)
+ .toString();
+ }
+}