blob: 226944e81a11116f0f7251fdea1de7de8befa2e0 [file] [log] [blame]
Phaneendra Manda1c0061d2015-08-06 12:29:38 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
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 */
harikrushna-Huawei6ecfc772017-04-10 18:22:00 +053016package org.onosproject.pcep.server;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053017
Avantika-Huawei9e848e82016-09-01 12:12:42 +053018import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
19import org.onosproject.incubator.net.tunnel.LabelStack;
20import org.onosproject.incubator.net.tunnel.Tunnel;
21import org.onosproject.net.Path;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053022import org.onosproject.pcepio.protocol.PcepMessage;
Avantika-Huawei9e848e82016-09-01 12:12:42 +053023import org.onosproject.pcepio.types.PcepValueType;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053024
mohamedrahil00f6f262016-11-24 20:20:41 +053025import java.util.Collection;
26import java.util.LinkedList;
27import java.util.List;
28import java.util.Map;
29
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053030/**
Phanendra Manda51fb9c22015-09-01 16:17:41 +053031 * Abstraction of an Pcep client controller. Serves as a one stop
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053032 * shop for obtaining Pcep devices and (un)register listeners
33 * on pcep events
34 */
35public interface PcepClientController {
36
37 /**
38 * Returns list of pcc clients connected to this Pcep controller.
39 *
40 * @return list of PcepClient elements
41 */
SureshBR25058b72015-08-13 13:05:06 +053042 Collection<PcepClient> getClients();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053043
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 */
SureshBR25058b72015-08-13 13:05:06 +053050 PcepClient getClient(PccId pccId);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053051
52 /**
53 * Register a listener for meta events that occur to pcep
54 * devices.
55 *
56 * @param listener the listener to notify
57 */
SureshBR25058b72015-08-13 13:05:06 +053058 void addListener(PcepClientListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053059
60 /**
61 * Unregister a listener.
62 *
63 * @param listener the listener to unregister
64 */
SureshBR25058b72015-08-13 13:05:06 +053065 void removeListener(PcepClientListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053066
67 /**
Priyanka B94395bf2016-05-21 18:39:46 +053068 * Register a listener for PCEP msg events.
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053069 *
70 * @param listener the listener to notify
71 */
SureshBR25058b72015-08-13 13:05:06 +053072 void addEventListener(PcepEventListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053073
74 /**
75 * Unregister a listener.
76 *
77 * @param listener the listener to unregister
78 */
SureshBR25058b72015-08-13 13:05:06 +053079 void removeEventListener(PcepEventListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053080
81 /**
Priyanka B94395bf2016-05-21 18:39:46 +053082 * 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 Manda1c0061d2015-08-06 12:29:38 +053096 * 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 */
SureshBR25058b72015-08-13 13:05:06 +0530101 void writeMessage(PccId pccId, PcepMessage msg);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530102
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 */
SureshBR25058b72015-08-13 13:05:06 +0530109 void processClientMessage(PccId pccId, PcepMessage msg);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530110
111 /**
112 * Close all connected PCC clients.
113 */
SureshBR25058b72015-08-13 13:05:06 +0530114 void closeConnectedClients();
Avantika-Huawei9e848e82016-09-01 12:12:42 +0530115
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 Milkeyef794342016-11-09 16:20:29 -0800135 * @param labelStack label stack
Avantika-Huawei9e848e82016-09-01 12:12:42 +0530136 * @param path (hop list)
137 * @return list of ERO sub-objects
138 */
139 public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path);
mohamedrahil00f6f262016-11-24 20:20:41 +0530140
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 Manda1c0061d2015-08-06 12:29:38 +0530177}