blob: ef2e1adb3e5e469ef607304763235fa2c5a3fd19 [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;
19import org.onosproject.net.DeviceId;
20
Jonghwan Hyun722275f2018-05-14 15:44:56 -070021import java.util.Map;
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070022import java.util.Set;
23
24/**
25 * Service for controlling INT-capable pipelines.
26 */
27@Beta
28public interface IntService {
29 /**
30 * Represents the role of INT-capable devices.
31 */
32 enum IntDeviceRole {
33 /**
34 * Intermediate device to add its own INT metadata to an INT packet by
35 * following the INT instruction in the INT header.
36 */
37 TRANSIT,
38 /**
39 * A device that creates, inserts INT headers into the packet, and
40 * extracts the INT headers.
41 */
42 SOURCE_SINK
43 }
44
45 /**
46 * Starts the INT functionalities in all INT-capable devices.
47 * This will include populating tables to process INT packets.
48 */
49 void startInt();
50
51 /**
52 * Starts the INT functionalities in specified set of INT transit devices.
53 * <p>
54 * Note: this is an experimental API, which can be either changed or removed.
55 *
56 * @param transitDevices set of devices to start INT functionalities
57 */
58 void startInt(Set<DeviceId> transitDevices);
59
60 /**
61 * Stops the INT functionalities in all INT-capable devices.
62 */
63 void stopInt();
64
65 /**
66 * Stops the INT functionalities in specified set of INT transit devices.
67 * <p>
68 * Note: this is an experimental API, which can be either changed or removed.
69 *
70 * @param transitDevices set of devices to stop INT functionalities
71 */
72 void stopInt(Set<DeviceId> transitDevices);
73
74 /**
75 * Configures all INT-capable devices with given configuration.
76 *
77 * @param cfg configuration to set up
78 */
79 void setConfig(IntConfig cfg);
80
81 /**
82 * Retrieves the INT configuration.
83 *
84 * @return configuration
85 */
86 IntConfig getConfig();
87
88 /**
89 * Installs an IntIntent to devices.
90 *
91 * @param intIntent an IntIntent
Jonghwan Hyun722275f2018-05-14 15:44:56 -070092 * @return an IntIntent ID corresponding to given intIntent
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070093 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -070094 IntIntentId installIntIntent(IntIntent intIntent);
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -070095
96 /**
97 * Removes an IntIntent from devices.
98 *
99 * @param intentId ID of the intIntent to remove
100 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700101 void removeIntIntent(IntIntentId intentId);
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700102
103 /**
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700104 * Returns an IntIntent for given intent ID.
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700105 *
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700106 * @param intentId ID of the intIntent to retrieve
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700107 * @return an IntIntent
108 */
Jonghwan Hyun722275f2018-05-14 15:44:56 -0700109 IntIntent getIntIntent(IntIntentId intentId);
110
111 /**
112 * Returns all IntIntents installed in the network.
113 *
114 * @return an IntIntent
115 */
116 Map<IntIntentId, IntIntent> getIntIntents();
Jonghwan Hyun71d42cd2018-03-13 13:23:01 -0700117
118 //TODO: [ONOS-7616] Design IntEvent and related APIs
119}