Davide Sanvito | 05983ba | 2017-12-01 11:46:44 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-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 | |
| 17 | package org.onosproject.imr; |
| 18 | |
| 19 | import org.apache.commons.lang3.tuple.Pair; |
| 20 | import org.onosproject.core.ApplicationId; |
| 21 | import org.onosproject.imr.data.Route; |
| 22 | import org.onosproject.net.ElementId; |
| 23 | import org.onosproject.net.flow.FlowEntry; |
| 24 | import org.onosproject.net.intent.Key; |
| 25 | |
| 26 | import java.util.List; |
| 27 | import java.util.Map; |
| 28 | import java.util.Set; |
| 29 | |
| 30 | /** |
| 31 | * Intent Monitor and Reroute ONOS service. |
| 32 | */ |
| 33 | public interface IntentMonitorAndRerouteService { |
| 34 | |
| 35 | /** |
| 36 | * Starts to monitor an intent. |
| 37 | * If the intent is not already submitted to the intent subsystem |
| 38 | * it memorizes the key and it will start to monitor it as soon as it will be installed |
| 39 | * @param intentKey Key of the intent to monitor |
| 40 | * @return true, false only if the intent is of one of the not currently supported type |
| 41 | */ |
| 42 | boolean startMonitorIntent(Key intentKey); |
| 43 | |
| 44 | /** |
| 45 | * Stops to monitor an intent. |
| 46 | * @param intentKey Key of the intent you want to stop the monitoring. |
| 47 | * @return false if the intent key passed is not one of the tracked intent, true otherwise. |
| 48 | */ |
| 49 | boolean stopMonitorIntent(Key intentKey); |
| 50 | |
| 51 | /** |
| 52 | * Applies a new route to a monitored intent. |
| 53 | * @param route Route you want to apply. |
| 54 | * @return False in case Application ID or Intent Key are not tracked by IMR |
| 55 | */ |
| 56 | boolean applyPath(Route route); |
| 57 | |
| 58 | /** |
| 59 | * Returns the statistics of all the monitored intents. |
| 60 | * @return Statistics (in terms of flow entries) of all the monitored intents. |
| 61 | */ |
| 62 | Map<ApplicationId, Map<Key, List<FlowEntry>>> getStats(); |
| 63 | |
| 64 | /** |
| 65 | * Returns the statistics of all the monitored intents submitted by a specific application. |
| 66 | * @param appId Application id of the monitored intent. |
| 67 | * @return Statistics (in terms of flow entries) of the requested intents. |
| 68 | */ |
| 69 | Map<ApplicationId, Map<Key, List<FlowEntry>>> getStats(ApplicationId appId); |
| 70 | |
| 71 | /** |
| 72 | * Returns the statistics of a specific monitored intent. |
| 73 | * @param appId Application id of the monitored intent. |
| 74 | * @param intentKey key of the monitored intent. |
| 75 | * @return Statistics (in terms of flow entries) of the requested intent. |
| 76 | */ |
| 77 | Map<ApplicationId, Map<Key, List<FlowEntry>>> getStats(ApplicationId appId, Key intentKey); |
| 78 | |
| 79 | /** |
| 80 | * Returns the monitored intents in terms of key and connect points. |
| 81 | * @return Intents monitored identified by the application id and |
| 82 | * the intent key, plus the endpoints of that intent. |
| 83 | */ |
| 84 | Map<ApplicationId, Map<Key, Pair<Set<ElementId>, Set<ElementId>>>> getMonitoredIntents(); |
| 85 | |
| 86 | /** |
| 87 | * Returns the monitored intents submitted by a specific application. |
| 88 | * @param appId Application id of the application to extract the monitored intents. |
| 89 | * @return Intents monitored identified by the application id and |
| 90 | * the intent key, plus the endpoints of that intent. |
| 91 | */ |
| 92 | Map<ApplicationId, Map<Key, Pair<Set<ElementId>, Set<ElementId>>>> getMonitoredIntents(ApplicationId appId); |
| 93 | } |