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; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 21 | import java.util.Map; |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 22 | import java.util.Set; |
| 23 | |
| 24 | /** |
| 25 | * Service for controlling INT-capable pipelines. |
| 26 | */ |
| 27 | @Beta |
| 28 | public 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 | /** |
Carmelo Cascone | fa42158 | 2018-09-13 10:05:57 -0700 | [diff] [blame] | 46 | * Starts the INT functionality in all INT-capable devices. |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 47 | * This will include populating tables to process INT packets. |
| 48 | */ |
| 49 | void startInt(); |
| 50 | |
| 51 | /** |
Carmelo Cascone | fa42158 | 2018-09-13 10:05:57 -0700 | [diff] [blame] | 52 | * Starts the INT functionality in specified set of INT transit devices. |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 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 Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 92 | * @return an IntIntent ID corresponding to given intIntent |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 93 | */ |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 94 | IntIntentId installIntIntent(IntIntent intIntent); |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 95 | |
| 96 | /** |
| 97 | * Removes an IntIntent from devices. |
| 98 | * |
| 99 | * @param intentId ID of the intIntent to remove |
| 100 | */ |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 101 | void removeIntIntent(IntIntentId intentId); |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 102 | |
| 103 | /** |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 104 | * Returns an IntIntent for given intent ID. |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 105 | * |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 106 | * @param intentId ID of the intIntent to retrieve |
Jonghwan Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 107 | * @return an IntIntent |
| 108 | */ |
Jonghwan Hyun | 722275f | 2018-05-14 15:44:56 -0700 | [diff] [blame] | 109 | 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 Hyun | 71d42cd | 2018-03-13 13:23:01 -0700 | [diff] [blame] | 117 | |
| 118 | //TODO: [ONOS-7616] Design IntEvent and related APIs |
Carmelo Cascone | fa42158 | 2018-09-13 10:05:57 -0700 | [diff] [blame] | 119 | } |