blob: 5560e8c23723addf54d155d6832215a6bd58918d [file] [log] [blame]
Jonghwan Hyun722275f2018-05-14 15:44:56 -07001/*
2 * Copyright 2018-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 */
Carmelo Casconedefc74e2020-07-17 15:27:02 -070016package org.onosproject.net.behaviour.inbandtelemetry;
Jonghwan Hyun722275f2018-05-14 15:44:56 -070017
18import com.google.common.annotations.Beta;
Carmelo Casconefa421582018-09-13 10:05:57 -070019import org.onosproject.net.PortNumber;
Jonghwan Hyun722275f2018-05-14 15:44:56 -070020import org.onosproject.net.driver.HandlerBehaviour;
21
Carmelo Casconefa421582018-09-13 10:05:57 -070022/**
23 * Abstraction of a device implementing In-band Network Telemetry (INT)
24 * capabilities.
25 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -070026@Beta
27public interface IntProgrammable extends HandlerBehaviour {
28
29 /**
Carmelo Casconefa421582018-09-13 10:05:57 -070030 * INT functionalities that a device can implement.
Jonghwan Hyun722275f2018-05-14 15:44:56 -070031 */
Carmelo Casconefa421582018-09-13 10:05:57 -070032 enum IntFunctionality {
33 /**
34 * Source functionality.
35 */
36 SOURCE,
37 /**
38 * Sink functionality.
39 */
40 SINK,
41 /**
42 * Transit functionality.
43 */
44 TRANSIT
45 }
46
47 /**
48 * Initializes the pipeline, by installing required flow rules not relevant
49 * to specific watchlist, report and event. Returns true if the operation
50 * was successful, false otherwise.
51 *
52 * @return true if successful, false otherwise
53 */
54 boolean init();
55
56 /**
57 * Configures the given port as an INT source port. Packets received via
Carmelo Casconedefc74e2020-07-17 15:27:02 -070058 * this port can be modified to add the INT header, if a corresponding INT
Carmelo Casconefa421582018-09-13 10:05:57 -070059 * objective is matched. Returns true if the operation was successful, false
60 * otherwise.
61 *
62 * @param port port
63 * @return true if successful, false otherwise
64 */
65 boolean setSourcePort(PortNumber port);
66
67 /**
68 * Configures the given port as an INT sink port. Packets forwarded via this
69 * port will be stripped of the INT header and a corresponding INT report
70 * will be generated. Returns true if the operation was successful, false
71 * otherwise.
72 *
73 * @param port port
74 * @return true if successful, false otherwise
75 */
76 boolean setSinkPort(PortNumber port);
Jonghwan Hyun722275f2018-05-14 15:44:56 -070077
78 /**
79 * Adds a given IntObjective to the device.
80 *
81 * @param obj an IntObjective
Carmelo Casconedefc74e2020-07-17 15:27:02 -070082 * @return true if the objective was successfully added; false otherwise.
Jonghwan Hyun722275f2018-05-14 15:44:56 -070083 */
Carmelo Casconefa421582018-09-13 10:05:57 -070084 boolean addIntObjective(IntObjective obj);
Jonghwan Hyun722275f2018-05-14 15:44:56 -070085
86 /**
87 * Removes a given IntObjective entry from the device.
88 *
89 * @param obj an IntObjective
Carmelo Casconedefc74e2020-07-17 15:27:02 -070090 * @return true if the objective was successfully removed; false otherwise.
Jonghwan Hyun722275f2018-05-14 15:44:56 -070091 */
Carmelo Casconefa421582018-09-13 10:05:57 -070092 boolean removeIntObjective(IntObjective obj);
Jonghwan Hyun722275f2018-05-14 15:44:56 -070093
94 /**
95 * Set up report-related configuration.
96 *
97 * @param config a configuration regarding to the collector
98 * @return true if the objective is successfully added; false otherwise.
99 */
Carmelo Casconedefc74e2020-07-17 15:27:02 -0700100 boolean setupIntConfig(IntDeviceConfig config);
Carmelo Casconefa421582018-09-13 10:05:57 -0700101
102 /**
103 * Clean up any INT-related configuration from the device.
104 */
105 void cleanup();
106
107 /**
108 * Returns true if this device supports the given INT functionality.
109 *
110 * @param functionality INt functionality
111 * @return true if functionality is supported, false otherwise
112 */
113 boolean supportsFunctionality(IntFunctionality functionality);
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700114
115 //TODO: [ONOS-7616] Design IntEvent and related APIs
116}