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; |
Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 19 | import java.util.LinkedList; |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 20 | |
Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 21 | import org.onosproject.incubator.net.tunnel.DefaultLabelStack; |
| 22 | import org.onosproject.incubator.net.tunnel.LabelStack; |
| 23 | import org.onosproject.incubator.net.tunnel.Tunnel; |
| 24 | import org.onosproject.net.Path; |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 25 | import org.onosproject.pcepio.protocol.PcepMessage; |
Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 26 | import org.onosproject.pcepio.types.PcepValueType; |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 27 | |
| 28 | /** |
Phanendra Manda | 51fb9c2 | 2015-09-01 16:17:41 +0530 | [diff] [blame] | 29 | * Abstraction of an Pcep client controller. Serves as a one stop |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 30 | * shop for obtaining Pcep devices and (un)register listeners |
| 31 | * on pcep events |
| 32 | */ |
| 33 | public interface PcepClientController { |
| 34 | |
| 35 | /** |
| 36 | * Returns list of pcc clients connected to this Pcep controller. |
| 37 | * |
| 38 | * @return list of PcepClient elements |
| 39 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 40 | Collection<PcepClient> getClients(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Returns the actual pcc client for the given ip address. |
| 44 | * |
| 45 | * @param pccId the id of the pcc client to fetch |
| 46 | * @return the interface to this pcc client |
| 47 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 48 | PcepClient getClient(PccId pccId); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Register a listener for meta events that occur to pcep |
| 52 | * devices. |
| 53 | * |
| 54 | * @param listener the listener to notify |
| 55 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 56 | void addListener(PcepClientListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * Unregister a listener. |
| 60 | * |
| 61 | * @param listener the listener to unregister |
| 62 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 63 | void removeListener(PcepClientListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 64 | |
| 65 | /** |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 66 | * Register a listener for PCEP msg events. |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 67 | * |
| 68 | * @param listener the listener to notify |
| 69 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 70 | void addEventListener(PcepEventListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Unregister a listener. |
| 74 | * |
| 75 | * @param listener the listener to unregister |
| 76 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 77 | void removeEventListener(PcepEventListener listener); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 78 | |
| 79 | /** |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 80 | * Register a listener for PCEP msg events[carrying node descriptor details]. |
| 81 | * |
| 82 | * @param listener the listener to notify |
| 83 | */ |
| 84 | void addNodeListener(PcepNodeListener listener); |
| 85 | |
| 86 | /** |
| 87 | * Unregister a listener. |
| 88 | * |
| 89 | * @param listener the listener to be unregistered |
| 90 | */ |
| 91 | void removeNodeListener(PcepNodeListener listener); |
| 92 | |
| 93 | /** |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 94 | * Send a message to a particular pcc client. |
| 95 | * |
| 96 | * @param pccId the id of the client to send message. |
| 97 | * @param msg the message to send |
| 98 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 99 | void writeMessage(PccId pccId, PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * Process a message and notify the appropriate listeners. |
| 103 | * |
| 104 | * @param pccId id of the client the message arrived on |
| 105 | * @param msg the message to process. |
| 106 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 107 | void processClientMessage(PccId pccId, PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Close all connected PCC clients. |
| 111 | */ |
SureshBR | 25058b7 | 2015-08-13 13:05:06 +0530 | [diff] [blame] | 112 | void closeConnectedClients(); |
Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * Create label stack from the given path. |
| 116 | * |
| 117 | * @param path from which label stack is to be computed |
| 118 | * @return the label stack |
| 119 | */ |
| 120 | public LabelStack computeLabelStack(Path path); |
| 121 | |
| 122 | /** |
| 123 | * Allocates and downloads local labels for the given LSP. |
| 124 | * |
| 125 | * @param tunnel for which local labels have to be assigned and downloaded |
| 126 | * @return success or failure |
| 127 | */ |
| 128 | public boolean allocateLocalLabel(Tunnel tunnel); |
| 129 | |
| 130 | /** |
| 131 | * Creates label stack for ERO object from network resource. |
| 132 | * |
Ray Milkey | ef79434 | 2016-11-09 16:20:29 -0800 | [diff] [blame] | 133 | * @param labelStack label stack |
Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 134 | * @param path (hop list) |
| 135 | * @return list of ERO sub-objects |
| 136 | */ |
| 137 | public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 138 | } |