Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | /** |
| 60 | * Register a listener for OF msg events. |
| 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 | /** |
| 74 | * Send a message to a particular pcc client. |
| 75 | * |
| 76 | * @param pccId the id of the client to send message. |
| 77 | * @param msg the message to send |
| 78 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 79 | void writeMessage(PccId pccId, PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * Process a message and notify the appropriate listeners. |
| 83 | * |
| 84 | * @param pccId id of the client the message arrived on |
| 85 | * @param msg the message to process. |
| 86 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 87 | void processClientMessage(PccId pccId, PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Close all connected PCC clients. |
| 91 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 92 | void closeConnectedClients(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 93 | } |