Adding BGP provider code to support EVPN
Change-Id: Ic5508749b64a47a70f1aabd9324e9f89e85fa39f
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java
new file mode 100755
index 0000000..b6816e8
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017-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.bgpio.types;
+
+import java.util.Objects;
+import org.jboss.netty.buffer.ChannelBuffer;
+import com.google.common.base.MoreObjects;
+
+/**
+ * Implementation of EthernetSegmentidentifier.
+ */
+public class BgpEvpnEsi
+ implements Comparable<BgpEvpnEsi> {
+
+ public static final int ESI_LENGTH = 10;
+ private byte[] ethernetSegmentidentifier;
+
+ /**
+ * Resets fields.
+ */
+ public BgpEvpnEsi() {
+ this.ethernetSegmentidentifier = null;
+ }
+
+ /**
+ * Constructor to initialize parameters.
+ *
+ * @param ethernetSegmentidentifier Ethernet Segment identifier
+ */
+ public BgpEvpnEsi(byte[] ethernetSegmentidentifier) {
+ this.ethernetSegmentidentifier = ethernetSegmentidentifier;
+ }
+
+ /**
+ * Reads Ethernet Segment identifier from channelBuffer.
+ *
+ * @param cb channelBuffer
+ * @return object of EthernetSegmentidentifier
+ */
+ public static BgpEvpnEsi read(ChannelBuffer cb) {
+ return new BgpEvpnEsi(cb.readBytes(10).array());
+ }
+
+ /**
+ * writes Ethernet Segment identifier into channelBuffer.
+ *
+ * @param cb channelBuffer
+ * @return length length of written data
+ */
+ public int write(ChannelBuffer cb) {
+ int iLenStartIndex = cb.writerIndex();
+ cb.writeBytes(ethernetSegmentidentifier);
+ return cb.writerIndex() - iLenStartIndex;
+ }
+
+ /**
+ * Returns Ethernet Segment identifier.
+ *
+ * @return Ethernet Segment identifier.
+ */
+ public byte[] getEthernetSegmentidentifier() {
+ return this.ethernetSegmentidentifier;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(ethernetSegmentidentifier);
+ };
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj instanceof BgpEvpnEsi) {
+ BgpEvpnEsi that = (BgpEvpnEsi) obj;
+ if (this.ethernetSegmentidentifier == that.ethernetSegmentidentifier) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("ethernetSegmentidentifier", ethernetSegmentidentifier)
+ .toString();
+ }
+
+ @Override
+ public int compareTo(BgpEvpnEsi rd) {
+ return 0;
+ }
+}