Support creation of vendor-specific versions of the fabric pipeconf

We provide a new service to facilitate registration of vendor-specific
versions of the Fabric pipeconf (e.g., for Tofino) from third-party
apps. This service is designed such that third-party apps do not need to
depend on internal classes at compile time, such as the behaviour
implementations.

To make this possible, the package structure has been refactored to
separate APIs from implementation.

Change-Id: I487cb806541eb9e6877ebf398a94f057613df8cc
(cherry picked from commit 36d5e7a2337c242e45ee57beacd82bba07a0851d)
diff --git a/pipelines/fabric/api/BUILD b/pipelines/fabric/api/BUILD
new file mode 100644
index 0000000..bd39481
--- /dev/null
+++ b/pipelines/fabric/api/BUILD
@@ -0,0 +1,8 @@
+TEST_DEPS = TEST + [
+    "//core/api:onos-api-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = CORE_DEPS,
+)
diff --git a/pipelines/fabric/api/src/main/java/org/onosproject/pipelines/fabric/FabricPipeconfService.java b/pipelines/fabric/api/src/main/java/org/onosproject/pipelines/fabric/FabricPipeconfService.java
new file mode 100644
index 0000000..071ec43
--- /dev/null
+++ b/pipelines/fabric/api/src/main/java/org/onosproject/pipelines/fabric/FabricPipeconfService.java
@@ -0,0 +1,58 @@
+/*
+ * 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.pipelines.fabric;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.pi.model.DefaultPiPipeconf;
+import org.onosproject.net.pi.model.PiPipeconf;
+
+import java.net.URL;
+
+/**
+ * A service to build fabric.p4-related pipeconfs.
+ * <p>
+ * This service is provided such that third-party apps can build vendor-specific
+ * versions of the fabric.p4 pipeconf, without needing to depend on fabric.p4
+ * behaviour implementations at compile time.
+ */
+@Beta
+public interface FabricPipeconfService {
+
+    /**
+     * Builds a pipeconf for fabric.p4.
+     * <p>
+     * This method expects as input a pipeconf builder already populated with
+     * the pipeconf ID (i.e., {@link DefaultPiPipeconf.Builder#withId}) and
+     * target-specific extensions (i.e., {@link DefaultPiPipeconf.Builder#addExtension}.
+     * The implementation takes care of adding all the necessary behavior
+     * implementations specific to fabric.p4, depending on the profile name,
+     * e.g., adding INT-related behaviors for fabric-int profile).
+     * <p>
+     * Finally, the implementation takes care of parsing the given P4Info file
+     * (in text format) as pipeconf pipeline model, and setting the pipeconf CPU
+     * port to the one contained in the given file URL.
+     *
+     * @param builder    pipeconf builder already populated with ID and
+     *                   target-specific extensions
+     * @param profile    fabric.p4 profile name
+     * @param p4InfoUrl  URL to P4Info file in text format
+     * @param cpuPortUrl URL to txt file containing the CPU port
+     * @return pipeconf instance
+     */
+    PiPipeconf buildFabricPipeconf(DefaultPiPipeconf.Builder builder, String profile,
+                                   URL p4InfoUrl, URL cpuPortUrl);
+}
diff --git a/pipelines/fabric/api/src/main/java/org/onosproject/pipelines/fabric/package-info.java b/pipelines/fabric/api/src/main/java/org/onosproject/pipelines/fabric/package-info.java
new file mode 100644
index 0000000..6c3b0e8
--- /dev/null
+++ b/pipelines/fabric/api/src/main/java/org/onosproject/pipelines/fabric/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * API definitions for the fabric pipeconf.
+ */
+package org.onosproject.pipelines.fabric;