Address comments in gerrit 20328

Create a new class XconnecEndpoint to cover both physical port and load balancer
Also change the CLI load balancer identifier to "LB:"

Change-Id: I0b4cd6e474d8b21468d87fcadd9280fdf7d6aafa
diff --git a/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectLoadBalancerEndpoint.java b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectLoadBalancerEndpoint.java
new file mode 100644
index 0000000..4172292
--- /dev/null
+++ b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectLoadBalancerEndpoint.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2019-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 java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * Represents a cross connect endpoint specified by load balancer.
+ */
+public final class XconnectLoadBalancerEndpoint extends XconnectEndpoint {
+    private final int key;
+
+    private XconnectLoadBalancerEndpoint(int key) {
+        this.key = key;
+    }
+
+    /**
+     * Returns load balancer key.
+     *
+     * @return load balancer key.
+     */
+    public int key() {
+        return key;
+    }
+
+    /**
+     * Returns an instance of XconnectLoadBalancerEndpoint with given load balancer key.
+     *
+     * @param key load balancer key
+     * @return an instance of XconnectLoadBalancerEndpoint
+     */
+    public static XconnectLoadBalancerEndpoint of(int key) {
+        return new XconnectLoadBalancerEndpoint(key);
+    }
+
+    /**
+     * Gets XconnectLoadBalancerEndpoint from string.
+     *
+     * @param s string
+     * @return XconnectLoadBalancerEndpoint
+     */
+    public static XconnectLoadBalancerEndpoint fromString(String s) {
+        checkArgument(s.matches(LOAD_BALANCER_PATTERN), "String {} does not match {} format", s, LOAD_BALANCER_PATTERN);
+        return new XconnectLoadBalancerEndpoint(Integer.valueOf(s.replaceFirst(LB_KEYWORD, "")));
+    }
+
+    @Override
+    public Type type() {
+        return Type.LOAD_BALANCER;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(key);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof XconnectLoadBalancerEndpoint) {
+            final XconnectLoadBalancerEndpoint other = (XconnectLoadBalancerEndpoint) obj;
+            return Objects.equals(this.key, other.key);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return LB_KEYWORD + String.valueOf(key);
+    }
+}