Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [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.controller; |
| 17 | |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 18 | import java.util.Collection; |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 19 | |
| 20 | import org.onosproject.pcepio.protocol.PcepMessage; |
| 21 | |
| 22 | /** |
Phanendra Manda | 51fb9c2 | 2015-09-01 16:17:41 +0530 | [diff] [blame] | 23 | * Abstraction of an Pcep client controller. Serves as a one stop |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 24 | * shop for obtaining Pcep devices and (un)register listeners |
| 25 | * on pcep events |
| 26 | */ |
| 27 | public interface PcepClientController { |
| 28 | |
| 29 | /** |
| 30 | * Returns list of pcc clients connected to this Pcep controller. |
| 31 | * |
| 32 | * @return list of PcepClient elements |
| 33 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 34 | Collection<PcepClient> getClients(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Returns the actual pcc client for the given ip address. |
| 38 | * |
| 39 | * @param pccId the id of the pcc client to fetch |
| 40 | * @return the interface to this pcc client |
| 41 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 42 | PcepClient getClient(PccId pccId); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Register a listener for meta events that occur to pcep |
| 46 | * devices. |
| 47 | * |
| 48 | * @param listener the listener to notify |
| 49 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 50 | void addListener(PcepClientListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Unregister a listener. |
| 54 | * |
| 55 | * @param listener the listener to unregister |
| 56 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 57 | void removeListener(PcepClientListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 58 | |
| 59 | /** |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 60 | * Register a listener for PCEP msg events. |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 61 | * |
| 62 | * @param listener the listener to notify |
| 63 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 64 | void addEventListener(PcepEventListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * Unregister a listener. |
| 68 | * |
| 69 | * @param listener the listener to unregister |
| 70 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 71 | void removeEventListener(PcepEventListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 72 | |
| 73 | /** |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 74 | * Register a listener for PCEP msg events[carrying node descriptor details]. |
| 75 | * |
| 76 | * @param listener the listener to notify |
| 77 | */ |
| 78 | void addNodeListener(PcepNodeListener listener); |
| 79 | |
| 80 | /** |
| 81 | * Unregister a listener. |
| 82 | * |
| 83 | * @param listener the listener to be unregistered |
| 84 | */ |
| 85 | void removeNodeListener(PcepNodeListener listener); |
| 86 | |
| 87 | /** |
Avantika-Huawei | d1e36bd | 2016-05-26 12:47:16 +0530 | [diff] [blame] | 88 | * Register a listener for packet events. |
| 89 | * |
| 90 | * @param listener the listener to notify |
| 91 | */ |
| 92 | void addPacketListener(PcepPacketListener listener); |
| 93 | |
| 94 | /** |
| 95 | * Unregister a packet listener. |
| 96 | * |
| 97 | * @param listener the listener to unregister |
| 98 | */ |
| 99 | void removePacketListener(PcepPacketListener listener); |
| 100 | |
| 101 | /** |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 102 | * Send a message to a particular pcc client. |
| 103 | * |
| 104 | * @param pccId the id of the client to send message. |
| 105 | * @param msg the message to send |
| 106 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 107 | void writeMessage(PccId pccId, PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Process a message and notify the appropriate listeners. |
| 111 | * |
| 112 | * @param pccId id of the client the message arrived on |
| 113 | * @param msg the message to process. |
| 114 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 115 | void processClientMessage(PccId pccId, PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 116 | |
| 117 | /** |
| 118 | * Close all connected PCC clients. |
| 119 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 120 | void closeConnectedClients(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 121 | } |