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 | |
| 21 | import java.util.Set; |
| 22 | |
| 23 | /** |
| 24 | * Service for controlling INT-capable pipelines. |
| 25 | */ |
| 26 | @Beta |
| 27 | public interface IntService { |
| 28 | /** |
| 29 | * Represents the role of INT-capable devices. |
| 30 | */ |
| 31 | enum IntDeviceRole { |
| 32 | /** |
| 33 | * Intermediate device to add its own INT metadata to an INT packet by |
| 34 | * following the INT instruction in the INT header. |
| 35 | */ |
| 36 | TRANSIT, |
| 37 | /** |
| 38 | * A device that creates, inserts INT headers into the packet, and |
| 39 | * extracts the INT headers. |
| 40 | */ |
| 41 | SOURCE_SINK |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Starts the INT functionalities in all INT-capable devices. |
| 46 | * This will include populating tables to process INT packets. |
| 47 | */ |
| 48 | void startInt(); |
| 49 | |
| 50 | /** |
| 51 | * Starts the INT functionalities in specified set of INT transit devices. |
| 52 | * <p> |
| 53 | * Note: this is an experimental API, which can be either changed or removed. |
| 54 | * |
| 55 | * @param transitDevices set of devices to start INT functionalities |
| 56 | */ |
| 57 | void startInt(Set<DeviceId> transitDevices); |
| 58 | |
| 59 | /** |
| 60 | * Stops the INT functionalities in all INT-capable devices. |
| 61 | */ |
| 62 | void stopInt(); |
| 63 | |
| 64 | /** |
| 65 | * Stops the INT functionalities in specified set of INT transit devices. |
| 66 | * <p> |
| 67 | * Note: this is an experimental API, which can be either changed or removed. |
| 68 | * |
| 69 | * @param transitDevices set of devices to stop INT functionalities |
| 70 | */ |
| 71 | void stopInt(Set<DeviceId> transitDevices); |
| 72 | |
| 73 | /** |
| 74 | * Configures all INT-capable devices with given configuration. |
| 75 | * |
| 76 | * @param cfg configuration to set up |
| 77 | */ |
| 78 | void setConfig(IntConfig cfg); |
| 79 | |
| 80 | /** |
| 81 | * Retrieves the INT configuration. |
| 82 | * |
| 83 | * @return configuration |
| 84 | */ |
| 85 | IntConfig getConfig(); |
| 86 | |
| 87 | /** |
| 88 | * Installs an IntIntent to devices. |
| 89 | * |
| 90 | * @param intIntent an IntIntent |
| 91 | * @return an ID corresponding to given intIntent |
| 92 | */ |
| 93 | int installIntIntent(IntIntent intIntent); |
| 94 | |
| 95 | /** |
| 96 | * Removes an IntIntent from devices. |
| 97 | * |
| 98 | * @param intentId ID of the intIntent to remove |
| 99 | */ |
| 100 | void removeIntIntent(int intentId); |
| 101 | |
| 102 | /** |
| 103 | * Returns an intIntent for given intent ID. |
| 104 | * |
| 105 | * @param intentId id of the intIntent to retrieve |
| 106 | * @return an IntIntent |
| 107 | */ |
| 108 | IntIntent getIntIntent(int intentId); |
| 109 | |
| 110 | //TODO: [ONOS-7616] Design IntEvent and related APIs |
| 111 | } |