blob: ba236bb57b8d955c6b33d5945d5ef0fa614c3e67 [file] [log] [blame]
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -07001/*
2 * Copyright 2015-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 */
16package org.onosproject.inbandtelemetry.api;
17
18import com.google.common.annotations.Beta;
Carmelo Casconedefc74e2020-07-17 15:27:02 -070019import org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig;
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070020import org.onosproject.net.DeviceId;
21
Jonghwan Hyun722275f2018-05-14 15:44:56 -070022import java.util.Map;
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070023import java.util.Set;
24
25/**
26 * Service for controlling INT-capable pipelines.
27 */
28@Beta
29public interface IntService {
30 /**
31 * Represents the role of INT-capable devices.
32 */
33 enum IntDeviceRole {
34 /**
35 * Intermediate device to add its own INT metadata to an INT packet by
36 * following the INT instruction in the INT header.
37 */
38 TRANSIT,
39 /**
40 * A device that creates, inserts INT headers into the packet, and
41 * extracts the INT headers.
42 */
43 SOURCE_SINK
44 }
45
46 /**
Carmelo Casconefa421582018-09-13 10:05:57 -070047 * Starts the INT functionality in all INT-capable devices.
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070048 * This will include populating tables to process INT packets.
49 */
50 void startInt();
51
52 /**
Carmelo Casconefa421582018-09-13 10:05:57 -070053 * Starts the INT functionality in specified set of INT transit devices.
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070054 * <p>
55 * Note: this is an experimental API, which can be either changed or removed.
56 *
57 * @param transitDevices set of devices to start INT functionalities
58 */
59 void startInt(Set<DeviceId> transitDevices);
60
61 /**
62 * Stops the INT functionalities in all INT-capable devices.
63 */
64 void stopInt();
65
66 /**
67 * Stops the INT functionalities in specified set of INT transit devices.
68 * <p>
69 * Note: this is an experimental API, which can be either changed or removed.
70 *
71 * @param transitDevices set of devices to stop INT functionalities
72 */
73 void stopInt(Set<DeviceId> transitDevices);
74
75 /**
76 * Configures all INT-capable devices with given configuration.
77 *
78 * @param cfg configuration to set up
79 */
Carmelo Casconedefc74e2020-07-17 15:27:02 -070080 void setConfig(IntDeviceConfig cfg);
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070081
82 /**
83 * Retrieves the INT configuration.
84 *
85 * @return configuration
86 */
Carmelo Casconedefc74e2020-07-17 15:27:02 -070087 IntDeviceConfig getConfig();
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070088
89 /**
90 * Installs an IntIntent to devices.
91 *
92 * @param intIntent an IntIntent
Jonghwan Hyun722275f2018-05-14 15:44:56 -070093 * @return an IntIntent ID corresponding to given intIntent
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070094 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -070095 IntIntentId installIntIntent(IntIntent intIntent);
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070096
97 /**
98 * Removes an IntIntent from devices.
99 *
100 * @param intentId ID of the intIntent to remove
101 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700102 void removeIntIntent(IntIntentId intentId);
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700103
104 /**
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700105 * Returns an IntIntent for given intent ID.
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700106 *
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700107 * @param intentId ID of the intIntent to retrieve
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700108 * @return an IntIntent
109 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700110 IntIntent getIntIntent(IntIntentId intentId);
111
112 /**
113 * Returns all IntIntents installed in the network.
114 *
115 * @return an IntIntent
116 */
117 Map<IntIntentId, IntIntent> getIntIntents();
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700118
119 //TODO: [ONOS-7616] Design IntEvent and related APIs
Carmelo Casconefa421582018-09-13 10:05:57 -0700120}