Exposes PiTranslators implementation through the adapter pattern

PiTranslators can be used by external apps by adding pom dependency:

        <dependency>
            <groupId>org.onosproject</groupId>
            <artifactId>onos-core-net</artifactId>
            <version>${onos.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.onosproject</groupId>
            <artifactId>onos-core-net</artifactId>
            <version>${onos.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>

These deps are used to access the adapters and the impl classes

Change-Id: If526a2600d1b2d6d7db906d61c41b3b0d0e5b951
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorAdapter.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorAdapter.java
new file mode 100644
index 0000000..07f47b1
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorAdapter.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2020-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.net.pi.impl;
+
+import com.google.common.collect.Maps;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.runtime.PiHandle;
+import org.onosproject.net.pi.runtime.PiTableEntry;
+import org.onosproject.net.pi.service.PiFlowRuleTranslator;
+import org.onosproject.net.pi.service.PiTranslatedEntity;
+import org.onosproject.net.pi.service.PiTranslationException;
+
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Adapter implementation of PiFlowRuleTranslator.
+ */
+public class PiFlowRuleTranslatorAdapter implements PiFlowRuleTranslator {
+
+    private final Map<PiHandle, PiTranslatedEntity<FlowRule, PiTableEntry>> store = Maps.newHashMap();
+
+    @Override
+    public PiTableEntry translate(FlowRule original, PiPipeconf pipeconf) throws PiTranslationException {
+        // NOTE Passing device equals to null is meant only for testing purposes
+        return PiFlowRuleTranslatorImpl.translate(original, pipeconf, null);
+    }
+
+    @Override
+    public void learn(PiHandle handle, PiTranslatedEntity<FlowRule, PiTableEntry> entity) {
+        store.put(handle, entity);
+    }
+
+    @Override
+    public Optional<PiTranslatedEntity<FlowRule, PiTableEntry>> lookup(PiHandle handle) {
+        return Optional.ofNullable(store.get(handle));
+    }
+
+    @Override
+    public void forget(PiHandle handle) {
+        store.remove(handle);
+    }
+}
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiGroupTranslatorAdapter.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiGroupTranslatorAdapter.java
new file mode 100644
index 0000000..66383b3
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiGroupTranslatorAdapter.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2020-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.net.pi.impl;
+
+import com.google.common.collect.Maps;
+import org.onosproject.net.group.Group;
+import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.runtime.PiActionProfileGroup;
+import org.onosproject.net.pi.runtime.PiHandle;
+import org.onosproject.net.pi.service.PiGroupTranslator;
+import org.onosproject.net.pi.service.PiTranslatedEntity;
+import org.onosproject.net.pi.service.PiTranslationException;
+
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Adapter implementation of PiGroupTranslator.
+ */
+public class PiGroupTranslatorAdapter implements PiGroupTranslator {
+
+    private final Map<PiHandle, PiTranslatedEntity<Group, PiActionProfileGroup>> store = Maps.newHashMap();
+
+    @Override
+    public PiActionProfileGroup translate(Group original, PiPipeconf pipeconf) throws PiTranslationException {
+        // NOTE Passing device equals to null is meant only for testing purposes
+        return PiGroupTranslatorImpl.translate(original, pipeconf, null);
+    }
+
+    @Override
+    public void learn(PiHandle handle, PiTranslatedEntity<Group, PiActionProfileGroup> entity) {
+        store.put(handle, entity);
+    }
+
+    @Override
+    public Optional<PiTranslatedEntity<Group, PiActionProfileGroup>> lookup(PiHandle handle) {
+        return Optional.ofNullable(store.get(handle));
+    }
+
+    @Override
+    public void forget(PiHandle handle) {
+        store.remove(handle);
+    }
+}
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorAdapter.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorAdapter.java
new file mode 100644
index 0000000..8f6f486
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorAdapter.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2020-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.net.pi.impl;
+
+import com.google.common.collect.Maps;
+import org.onosproject.net.group.Group;
+import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.runtime.PiHandle;
+import org.onosproject.net.pi.runtime.PiPreEntry;
+import org.onosproject.net.pi.service.PiReplicationGroupTranslator;
+import org.onosproject.net.pi.service.PiTranslatedEntity;
+import org.onosproject.net.pi.service.PiTranslationException;
+
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Adapter implementation of PiGroupTranslator.
+ */
+public class PiReplicationGroupTranslatorAdapter implements PiReplicationGroupTranslator {
+
+    private final Map<PiHandle, PiTranslatedEntity<Group, PiPreEntry>> store = Maps.newHashMap();
+
+    @Override
+    public PiPreEntry translate(Group original, PiPipeconf pipeconf) throws PiTranslationException {
+        // NOTE Passing device equals to null is meant only for testing purposes
+        return PiReplicationGroupTranslatorImpl.translate(original, pipeconf, null);
+    }
+
+    @Override
+    public void learn(PiHandle handle, PiTranslatedEntity<Group, PiPreEntry> entity) {
+        store.put(handle, entity);
+    }
+
+    @Override
+    public Optional<PiTranslatedEntity<Group, PiPreEntry>> lookup(PiHandle handle) {
+        return Optional.ofNullable(store.get(handle));
+    }
+
+    @Override
+    public void forget(PiHandle handle) {
+        store.remove(handle);
+    }
+}