ONOS-7251 - Initial implementation of fabric.p4 L2 broadcast feature.
Thrift client cherry-picked from the commit dd5792ac9ee38a702c3128a34224852b5c284687
Change-Id: I989f2b2074485a892195889a7c976b518510da88
diff --git a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/api/runtime/Bmv2PreGroupHandle.java b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/api/runtime/Bmv2PreGroupHandle.java
new file mode 100644
index 0000000..7e886bc
--- /dev/null
+++ b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/api/runtime/Bmv2PreGroupHandle.java
@@ -0,0 +1,73 @@
+/*
+ * 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.drivers.bmv2.api.runtime;
+
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.net.DeviceId;
+
+/**
+ * Global identifier of a BMv2 PRE group applied to a device, uniquely defined
+ * by a device ID and group ID.
+ */
+public final class Bmv2PreGroupHandle extends Bmv2Handle<Bmv2PreGroup> {
+
+ private Bmv2PreGroupHandle(DeviceId deviceId, Bmv2PreGroup group) {
+ super(deviceId, group);
+ }
+
+ /**
+ * Creates a new handle for the given device ID and BMv2 PRE group.
+ *
+ * @param deviceId device ID
+ * @param group BMv2 PRE group
+ * @return BMv2 PRE group handle
+ */
+ public static Bmv2PreGroupHandle of(DeviceId deviceId,
+ Bmv2PreGroup group) {
+ return new Bmv2PreGroupHandle(deviceId, group);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(deviceId(),
+ bmv2Entity().groupId());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Bmv2PreGroupHandle that = (Bmv2PreGroupHandle) o;
+ return Objects.equal(deviceId(), that.deviceId()) &&
+ Objects.equal(bmv2Entity().groupId(), that.bmv2Entity().groupId());
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("deviceId", deviceId())
+ .add("groupId", bmv2Entity().groupId())
+ .toString();
+ }
+}