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