cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | ce2a03d | 2017-08-03 19:21:03 -0700 | [diff] [blame^] | 2 | * Copyright 2015-present Open Networking Foundation |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 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.pcep.api; |
| 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | |
| 20 | /** |
| 21 | * Abstraction of an PCEP controller. Serves as a one stop shop for obtaining |
| 22 | * PCEP devices and (un)register listeners on PCEP events |
| 23 | */ |
| 24 | public interface PcepController { |
| 25 | |
| 26 | /** |
| 27 | * Returns all switches known to this PCEP controller. |
| 28 | * |
| 29 | * @return Iterable of did elements |
| 30 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 31 | Iterable<PcepSwitch> getSwitches(); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Return a switch with a specified did. |
| 35 | * |
| 36 | * @param did of a device |
| 37 | * @return a pcep device |
| 38 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 39 | PcepSwitch getSwitch(PcepDpid did); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Register a listener for meta events that occur to PCEP devices. |
| 43 | * |
| 44 | * @param listener the listener to notify |
| 45 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 46 | void addListener(PcepSwitchListener listener); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Unregister a listener. |
| 50 | * |
| 51 | * @param listener the listener to unregister |
| 52 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 53 | void removeListener(PcepSwitchListener listener); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 54 | |
| 55 | /** |
| 56 | * Register a listener for meta events that occur to PCEP links. |
| 57 | * |
| 58 | * @param listener the listener to notify |
| 59 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 60 | void addLinkListener(PcepLinkListener listener); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Unregister a link listener. |
| 64 | * |
| 65 | * @param listener the listener to unregister |
| 66 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 67 | void removeLinkListener(PcepLinkListener listener); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Register a listener for meta events that occur to PCEP tunnel. |
| 71 | * |
| 72 | * @param listener the listener to notify |
| 73 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 74 | void addTunnelListener(PcepTunnelListener listener); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Unregister a tunnel listener. |
| 78 | * |
| 79 | * @param listener the listener to unregister |
| 80 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 81 | void removeTunnelListener(PcepTunnelListener listener); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Setup a tunnel through pcep controller. |
| 85 | * |
| 86 | * @param srcDid src deviceId of tunnel |
| 87 | * @param dstDid dst deviceId of tunnel |
| 88 | * @param srcPort src port |
| 89 | * @param dstPort dst port |
| 90 | * @param bandwidth andwidth of tunnel |
| 91 | * @param name tunnel name |
| 92 | * @return pcep tunnel |
| 93 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 94 | PcepTunnel applyTunnel(DeviceId srcDid, DeviceId dstDid, |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 95 | long srcPort, long dstPort, long bandwidth, |
| 96 | String name); |
| 97 | |
| 98 | /** |
| 99 | * Delete tunnel by id. |
| 100 | * |
| 101 | * @param id pcep tunnel id. |
| 102 | * @return true or false |
| 103 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 104 | Boolean deleteTunnel(String id); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 105 | |
| 106 | /** |
| 107 | * Update tunnel bandwidth by tunnel id. |
| 108 | * |
| 109 | * @param id tunnel id |
| 110 | * @param bandwidth bandwidth of a tunnel |
| 111 | * @return true or false |
| 112 | */ |
chengfan | 373aac5 | 2015-08-17 15:36:44 -0500 | [diff] [blame] | 113 | Boolean updateTunnelBandwidth(String id, long bandwidth); |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 114 | |
chengfan | 2fff70f | 2015-08-24 18:20:19 -0500 | [diff] [blame] | 115 | /** |
| 116 | * Send statistic request by tunnel id. |
| 117 | * |
| 118 | * @param pcepTunnelId PCEP tunnel id |
| 119 | */ |
| 120 | void getTunnelStatistics(String pcepTunnelId); |
| 121 | |
cheng fan | 48e832c | 2015-05-29 01:54:47 +0800 | [diff] [blame] | 122 | } |