Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.inbandtelemetry.api; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
Carmelo Cascone | defc74e | 2020-07-17 15:27:02 -0700 | [diff] [blame^] | 19 | import org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig; |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 20 | import org.onosproject.net.DeviceId; |
| 21 | |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 22 | import java.util.Map; |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Service for controlling INT-capable pipelines. |
| 27 | */ |
| 28 | @Beta |
| 29 | public 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 Cascone | fa42158 | 2018-09-13 10:05:57 -0700 | [diff] [blame] | 47 | * Starts the INT functionality in all INT-capable devices. |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 48 | * This will include populating tables to process INT packets. |
| 49 | */ |
| 50 | void startInt(); |
| 51 | |
| 52 | /** |
Carmelo Cascone | fa42158 | 2018-09-13 10:05:57 -0700 | [diff] [blame] | 53 | * Starts the INT functionality in specified set of INT transit devices. |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 54 | * <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 Cascone | defc74e | 2020-07-17 15:27:02 -0700 | [diff] [blame^] | 80 | void setConfig(IntDeviceConfig cfg); |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * Retrieves the INT configuration. |
| 84 | * |
| 85 | * @return configuration |
| 86 | */ |
Carmelo Cascone | defc74e | 2020-07-17 15:27:02 -0700 | [diff] [blame^] | 87 | IntDeviceConfig getConfig(); |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Installs an IntIntent to devices. |
| 91 | * |
| 92 | * @param intIntent an IntIntent |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 93 | * @return an IntIntent ID corresponding to given intIntent |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 94 | */ |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 95 | IntIntentId installIntIntent(IntIntent intIntent); |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * Removes an IntIntent from devices. |
| 99 | * |
| 100 | * @param intentId ID of the intIntent to remove |
| 101 | */ |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 102 | void removeIntIntent(IntIntentId intentId); |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 103 | |
| 104 | /** |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 105 | * Returns an IntIntent for given intent ID. |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 106 | * |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 107 | * @param intentId ID of the intIntent to retrieve |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 108 | * @return an IntIntent |
| 109 | */ |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 110 | 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 Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 118 | |
| 119 | //TODO: [ONOS-7616] Design IntEvent and related APIs |
Carmelo Cascone | fa42158 | 2018-09-13 10:05:57 -0700 | [diff] [blame] | 120 | } |