blob: c5cf003b1cf78594c103e5f4cfeeb80b5167f536 [file] [log] [blame]
Phaneendra Manda1c0061d2015-08-06 12:29:38 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Phaneendra Manda1c0061d2015-08-06 12:29:38 +05303 *
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 */
16package org.onosproject.pcep.controller;
17
18import java.util.List;
19
20import org.onosproject.pcepio.protocol.PcepFactory;
21import org.onosproject.pcepio.protocol.PcepMessage;
Avantika-Huaweid1e36bd2016-05-26 12:47:16 +053022import org.onosproject.pcepio.protocol.PcepStateReport;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053023
24/**
25 * Represents to provider facing side of a path computation client(pcc).
26 */
27public interface PcepClient {
28
29 /**
30 * Writes the message to the driver.
31 *
32 * @param msg the message to write
33 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070034 void sendMessage(PcepMessage msg);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053035
36 /**
37 * Writes the PcepMessage list to the driver.
38 *
39 * @param msgs the messages to be written
40 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070041 void sendMessage(List<PcepMessage> msgs);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053042
43 /**
44 * Handle a message from the pcc.
45 *
46 * @param fromClient the message to handle
47 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070048 void handleMessage(PcepMessage fromClient);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053049
50 /**
51 * Provides the factory for this PCEP version.
52 *
53 * @return PCEP version specific factory.
54 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070055 PcepFactory factory();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053056
57 /**
58 * Gets a string version of the ID for this pcc.
59 *
60 * @return string version of the ID
61 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070062 String getStringId();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053063
64 /**
65 * Gets the ipAddress of the client.
66 *
67 * @return the client pccId in IPAddress format
68 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070069 PccId getPccId();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053070
71 /**
72 * Checks if the pcc is still connected.
73 *
74 * @return true if client is connected, false otherwise
75 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070076 boolean isConnected();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053077
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 SHIMIZU5fe04e02015-09-04 15:06:33 -070082 void disconnectClient();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053083
84 /**
85 * Indicates if this pcc is optical.
86 *
87 * @return true if optical
88 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070089 boolean isOptical();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053090
91 /**
92 * Identifies the channel used to communicate with the pcc.
93 *
94 * @return string representation of the connection to the client
95 */
Sho SHIMIZU5fe04e02015-09-04 15:06:33 -070096 String channelId();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053097
98 /**
Avantika-Huawei7f7376a2016-05-11 17:07:50 +053099 * Sets the status of LSP state synchronization.
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530100 *
Avantika-Huawei7f7376a2016-05-11 17:07:50 +0530101 * @param syncStatus LSP synchronization status to be set
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530102 */
Avantika-Huawei7f7376a2016-05-11 17:07:50 +0530103 void setLspDbSyncStatus(PcepSyncStatus syncStatus);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530104
105 /**
Avantika-Huawei7f7376a2016-05-11 17:07:50 +0530106 * Indicates the LSP state synchronization status of this pcc.
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530107 *
Avantika-Huawei7f7376a2016-05-11 17:07:50 +0530108 * @return LSP state synchronization status.
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530109 */
Avantika-Huawei7f7376a2016-05-11 17:07:50 +0530110 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 Bd2b28882016-04-04 16:57:04 +0530125
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 B94395bf2016-05-21 18:39:46 +0530139
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 B413fbe82016-05-26 11:44:45 +0530153
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-Huaweid1e36bd2016-05-26 12:47:16 +0530169
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 Manda1c0061d2015-08-06 12:29:38 +0530199}