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 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | import org.onosproject.pcepio.protocol.PcepFactory; |
| 21 | import org.onosproject.pcepio.protocol.PcepMessage; |
| 22 | |
| 23 | /** |
| 24 | * Represents to provider facing side of a path computation client(pcc). |
| 25 | */ |
| 26 | public interface PcepClient { |
| 27 | |
| 28 | /** |
| 29 | * Writes the message to the driver. |
| 30 | * |
| 31 | * @param msg the message to write |
| 32 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 33 | void sendMessage(PcepMessage msg); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Writes the PcepMessage list to the driver. |
| 37 | * |
| 38 | * @param msgs the messages to be written |
| 39 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 40 | void sendMessage(List<PcepMessage> msgs); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Handle a message from the pcc. |
| 44 | * |
| 45 | * @param fromClient the message to handle |
| 46 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 47 | void handleMessage(PcepMessage fromClient); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Provides the factory for this PCEP version. |
| 51 | * |
| 52 | * @return PCEP version specific factory. |
| 53 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 54 | PcepFactory factory(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Gets a string version of the ID for this pcc. |
| 58 | * |
| 59 | * @return string version of the ID |
| 60 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 61 | String getStringId(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * Gets the ipAddress of the client. |
| 65 | * |
| 66 | * @return the client pccId in IPAddress format |
| 67 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 68 | PccId getPccId(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * Checks if the pcc is still connected. |
| 72 | * |
| 73 | * @return true if client is connected, false otherwise |
| 74 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 75 | boolean isConnected(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Disconnects the pcc by closing the TCP connection. Results in a call |
| 79 | * to the channel handler's channelDisconnected method for cleanup. |
| 80 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 81 | void disconnectClient(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Indicates if this pcc is optical. |
| 85 | * |
| 86 | * @return true if optical |
| 87 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 88 | boolean isOptical(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Identifies the channel used to communicate with the pcc. |
| 92 | * |
| 93 | * @return string representation of the connection to the client |
| 94 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 95 | String channelId(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * To set the status of state synchronization. |
| 99 | * |
| 100 | * @param value to set the synchronization status |
| 101 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 102 | void setIsSyncComplete(boolean value); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Indicates the state synchronization status of this pcc. |
| 106 | * |
| 107 | * @return true/false if the synchronization is completed/not completed |
| 108 | */ |
Sho SHIMIZU | 5fe04e0 | 2015-09-04 15:06:33 -0700 | [diff] [blame] | 109 | boolean isSyncComplete(); |
Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 110 | } |