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 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | import org.onosproject.pcepio.protocol.PcepFactory; |
| 21 | import org.onosproject.pcepio.protocol.PcepMessage; |
Avantika-Huawei | d1e36bd | 2016-05-26 12:47:16 +0530 | [diff] [blame] | 22 | import org.onosproject.pcepio.protocol.PcepStateReport; |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Represents to provider facing side of a path computation client(pcc). |
| 26 | */ |
| 27 | public interface PcepClient { |
| 28 | |
| 29 | /** |
| 30 | * Writes the message to the driver. |
| 31 | * |
| 32 | * @param msg the message to write |
| 33 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 34 | void sendMessage(PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Writes the PcepMessage list to the driver. |
| 38 | * |
| 39 | * @param msgs the messages to be written |
| 40 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 41 | void sendMessage(List<PcepMessage> msgs); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * Handle a message from the pcc. |
| 45 | * |
| 46 | * @param fromClient the message to handle |
| 47 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 48 | void handleMessage(PcepMessage fromClient); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Provides the factory for this PCEP version. |
| 52 | * |
| 53 | * @return PCEP version specific factory. |
| 54 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 55 | PcepFactory factory(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Gets a string version of the ID for this pcc. |
| 59 | * |
| 60 | * @return string version of the ID |
| 61 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 62 | String getStringId(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 63 | |
| 64 | /** |
| 65 | * Gets the ipAddress of the client. |
| 66 | * |
| 67 | * @return the client pccId in IPAddress format |
| 68 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 69 | PccId getPccId(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * Checks if the pcc is still connected. |
| 73 | * |
| 74 | * @return true if client is connected, false otherwise |
| 75 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 76 | boolean isConnected(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * Disconnects the pcc by closing the TCP connection. Results in a call |
| 80 | * to the channel handler's channelDisconnected method for cleanup. |
| 81 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 82 | void disconnectClient(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * Indicates if this pcc is optical. |
| 86 | * |
| 87 | * @return true if optical |
| 88 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 89 | boolean isOptical(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 90 | |
| 91 | /** |
| 92 | * Identifies the channel used to communicate with the pcc. |
| 93 | * |
| 94 | * @return string representation of the connection to the client |
| 95 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 96 | String channelId(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 97 | |
| 98 | /** |
Avantika-Huawei | 7f7376a | 2016-05-11 17:07:50 +0530 | [diff] [blame] | 99 | * Sets the status of LSP state synchronization. |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 100 | * |
Avantika-Huawei | 7f7376a | 2016-05-11 17:07:50 +0530 | [diff] [blame] | 101 | * @param syncStatus LSP synchronization status to be set |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 102 | */ |
Avantika-Huawei | 7f7376a | 2016-05-11 17:07:50 +0530 | [diff] [blame] | 103 | void setLspDbSyncStatus(PcepSyncStatus syncStatus); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 104 | |
| 105 | /** |
Avantika-Huawei | 7f7376a | 2016-05-11 17:07:50 +0530 | [diff] [blame] | 106 | * Indicates the LSP state synchronization status of this pcc. |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 107 | * |
Avantika-Huawei | 7f7376a | 2016-05-11 17:07:50 +0530 | [diff] [blame] | 108 | * @return LSP state synchronization status. |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 109 | */ |
Avantika-Huawei | 7f7376a | 2016-05-11 17:07:50 +0530 | [diff] [blame] | 110 | PcepSyncStatus lspDbSyncStatus(); |
| 111 | |
| 112 | /** |
| 113 | * Sets the status of label DB synchronization. |
| 114 | * |
| 115 | * @param syncStatus label DB synchronization status to be set |
| 116 | */ |
| 117 | void setLabelDbSyncStatus(PcepSyncStatus syncStatus); |
| 118 | |
| 119 | /** |
| 120 | * Indicates the label DB synchronization status of this pcc. |
| 121 | * |
| 122 | * @return label DB synchronization status. |
| 123 | */ |
| 124 | PcepSyncStatus labelDbSyncStatus(); |
Priyanka B | d2b2888 | 2016-04-04 16:57:04 +0530 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * Sets capability negotiated during open message exchange. |
| 128 | * |
| 129 | * @param capability supported by client |
| 130 | */ |
| 131 | void setCapability(ClientCapability capability); |
| 132 | |
| 133 | /** |
| 134 | * Obtains capability supported by client. |
| 135 | * |
| 136 | * @return capability supported by client |
| 137 | */ |
| 138 | ClientCapability capability(); |
Priyanka B | 94395bf | 2016-05-21 18:39:46 +0530 | [diff] [blame] | 139 | |
| 140 | /** |
| 141 | * Adds PCEP device when session is successfully established. |
| 142 | * |
| 143 | * @param pc PCEP client details |
| 144 | */ |
| 145 | void addNode(PcepClient pc); |
| 146 | |
| 147 | /** |
| 148 | * Removes PCEP device when session is disconnected. |
| 149 | * |
| 150 | * @param pccId PCEP client ID |
| 151 | */ |
| 152 | void deleteNode(PccId pccId); |
Priyanka B | 413fbe8 | 2016-05-26 11:44:45 +0530 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * Sets D flag for the given LSP and its LSP info. |
| 156 | * |
| 157 | * @param lspKey contains LSP info |
| 158 | * @param dFlag delegation flag in LSP object |
| 159 | */ |
| 160 | void setLspAndDelegationInfo(LspKey lspKey, boolean dFlag); |
| 161 | |
| 162 | /** |
| 163 | * Returns delegation flag for the given LSP info. |
| 164 | * |
| 165 | * @param lspKey contains LSP info |
| 166 | * @return delegation flag |
| 167 | */ |
| 168 | Boolean delegationInfo(LspKey lspKey); |
Avantika-Huawei | d1e36bd | 2016-05-26 12:47:16 +0530 | [diff] [blame] | 169 | |
| 170 | /** |
| 171 | * Creates a temporary cache to hold report messages received during LSPDB sync. |
| 172 | * |
| 173 | * @param pccId PCC id which is the key to store report messages |
| 174 | */ |
| 175 | void initializeSyncMsgList(PccId pccId); |
| 176 | |
| 177 | /** |
| 178 | * Returns the list of report messages received during LSPDB sync. |
| 179 | * |
| 180 | * @param pccId PCC id which is the key for all the report messages |
| 181 | * @return list of report messages received during LSPDB sync |
| 182 | */ |
| 183 | List<PcepStateReport> getSyncMsgList(PccId pccId); |
| 184 | |
| 185 | /** |
| 186 | * Removes the list of report messages received during LSPDB sync. |
| 187 | * |
| 188 | * @param pccId PCC id which is the key for all the report messages |
| 189 | */ |
| 190 | void removeSyncMsgList(PccId pccId); |
| 191 | |
| 192 | /** |
| 193 | * Adds report message received during LSPDB sync into temporary cache. |
| 194 | * |
| 195 | * @param pccId PCC id which is the key to store report messages |
| 196 | * @param rptMsg the report message to be stored |
| 197 | */ |
| 198 | void addSyncMsgToList(PccId pccId, PcepStateReport rptMsg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 199 | } |