blob: 071ec4361120fab6691007c0883bdcc3e215ab35 [file] [log] [blame]
Carmelo Cascone36d5e7a2019-09-25 01:02:53 -07001/*
2 * Copyright 2019-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.pipelines.fabric;
18
19import com.google.common.annotations.Beta;
20import org.onosproject.net.pi.model.DefaultPiPipeconf;
21import org.onosproject.net.pi.model.PiPipeconf;
22
23import java.net.URL;
24
25/**
26 * A service to build fabric.p4-related pipeconfs.
27 * <p>
28 * This service is provided such that third-party apps can build vendor-specific
29 * versions of the fabric.p4 pipeconf, without needing to depend on fabric.p4
30 * behaviour implementations at compile time.
31 */
32@Beta
33public interface FabricPipeconfService {
34
35 /**
36 * Builds a pipeconf for fabric.p4.
37 * <p>
38 * This method expects as input a pipeconf builder already populated with
39 * the pipeconf ID (i.e., {@link DefaultPiPipeconf.Builder#withId}) and
40 * target-specific extensions (i.e., {@link DefaultPiPipeconf.Builder#addExtension}.
41 * The implementation takes care of adding all the necessary behavior
42 * implementations specific to fabric.p4, depending on the profile name,
43 * e.g., adding INT-related behaviors for fabric-int profile).
44 * <p>
45 * Finally, the implementation takes care of parsing the given P4Info file
46 * (in text format) as pipeconf pipeline model, and setting the pipeconf CPU
47 * port to the one contained in the given file URL.
48 *
49 * @param builder pipeconf builder already populated with ID and
50 * target-specific extensions
51 * @param profile fabric.p4 profile name
52 * @param p4InfoUrl URL to P4Info file in text format
53 * @param cpuPortUrl URL to txt file containing the CPU port
54 * @return pipeconf instance
55 */
56 PiPipeconf buildFabricPipeconf(DefaultPiPipeconf.Builder builder, String profile,
57 URL p4InfoUrl, URL cpuPortUrl);
58}