blob: 8cbcae0894c464a75560b0f9e96b419af512fa31 [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 */
Yi Tseng4027cac2020-10-13 19:15:12 -070044 TRANSIT,
45 /**
46 * Postcard functionality.
47 */
48 POSTCARD
Carmelo Casconefa421582018-09-13 10:05:57 -070049 }
50
51 /**
52 * Initializes the pipeline, by installing required flow rules not relevant
53 * to specific watchlist, report and event. Returns true if the operation
54 * was successful, false otherwise.
55 *
56 * @return true if successful, false otherwise
57 */
58 boolean init();
59
60 /**
61 * Configures the given port as an INT source port. Packets received via
Carmelo Casconedefc74e2020-07-17 15:27:02 -070062 * this port can be modified to add the INT header, if a corresponding INT
Carmelo Casconefa421582018-09-13 10:05:57 -070063 * objective is matched. Returns true if the operation was successful, false
64 * otherwise.
65 *
66 * @param port port
67 * @return true if successful, false otherwise
68 */
69 boolean setSourcePort(PortNumber port);
70
71 /**
72 * Configures the given port as an INT sink port. Packets forwarded via this
73 * port will be stripped of the INT header and a corresponding INT report
74 * will be generated. Returns true if the operation was successful, false
75 * otherwise.
76 *
77 * @param port port
78 * @return true if successful, false otherwise
79 */
80 boolean setSinkPort(PortNumber port);
Jonghwan Hyun722275f2018-05-14 15:44:56 -070081
82 /**
83 * Adds a given IntObjective to the device.
84 *
85 * @param obj an IntObjective
Carmelo Casconedefc74e2020-07-17 15:27:02 -070086 * @return true if the objective was successfully added; false otherwise.
Jonghwan Hyun722275f2018-05-14 15:44:56 -070087 */
Carmelo Casconefa421582018-09-13 10:05:57 -070088 boolean addIntObjective(IntObjective obj);
Jonghwan Hyun722275f2018-05-14 15:44:56 -070089
90 /**
91 * Removes a given IntObjective entry from the device.
92 *
93 * @param obj an IntObjective
Carmelo Casconedefc74e2020-07-17 15:27:02 -070094 * @return true if the objective was successfully removed; false otherwise.
Jonghwan Hyun722275f2018-05-14 15:44:56 -070095 */
Carmelo Casconefa421582018-09-13 10:05:57 -070096 boolean removeIntObjective(IntObjective obj);
Jonghwan Hyun722275f2018-05-14 15:44:56 -070097
98 /**
99 * Set up report-related configuration.
100 *
101 * @param config a configuration regarding to the collector
102 * @return true if the objective is successfully added; false otherwise.
103 */
Carmelo Casconedefc74e2020-07-17 15:27:02 -0700104 boolean setupIntConfig(IntDeviceConfig config);
Carmelo Casconefa421582018-09-13 10:05:57 -0700105
106 /**
107 * Clean up any INT-related configuration from the device.
108 */
109 void cleanup();
110
111 /**
112 * Returns true if this device supports the given INT functionality.
113 *
114 * @param functionality INt functionality
115 * @return true if functionality is supported, false otherwise
116 */
117 boolean supportsFunctionality(IntFunctionality functionality);
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700118
119 //TODO: [ONOS-7616] Design IntEvent and related APIs
120}