blob: 7b29a7241ede0048edcfc8b7976d4e696e94b51e [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
SureshBR25058b72015-08-13 13:05:06 +053018import java.util.Collection;
Avantika-Huawei9e848e82016-09-01 12:12:42 +053019import java.util.LinkedList;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053020
Avantika-Huawei9e848e82016-09-01 12:12:42 +053021import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
22import org.onosproject.incubator.net.tunnel.LabelStack;
23import org.onosproject.incubator.net.tunnel.Tunnel;
24import org.onosproject.net.Path;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053025import org.onosproject.pcepio.protocol.PcepMessage;
Avantika-Huawei9e848e82016-09-01 12:12:42 +053026import org.onosproject.pcepio.types.PcepValueType;
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053027
28/**
Phanendra Manda51fb9c22015-09-01 16:17:41 +053029 * Abstraction of an Pcep client controller. Serves as a one stop
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053030 * shop for obtaining Pcep devices and (un)register listeners
31 * on pcep events
32 */
33public interface PcepClientController {
34
35 /**
36 * Returns list of pcc clients connected to this Pcep controller.
37 *
38 * @return list of PcepClient elements
39 */
SureshBR25058b72015-08-13 13:05:06 +053040 Collection<PcepClient> getClients();
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053041
42 /**
43 * Returns the actual pcc client for the given ip address.
44 *
45 * @param pccId the id of the pcc client to fetch
46 * @return the interface to this pcc client
47 */
SureshBR25058b72015-08-13 13:05:06 +053048 PcepClient getClient(PccId pccId);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053049
50 /**
51 * Register a listener for meta events that occur to pcep
52 * devices.
53 *
54 * @param listener the listener to notify
55 */
SureshBR25058b72015-08-13 13:05:06 +053056 void addListener(PcepClientListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053057
58 /**
59 * Unregister a listener.
60 *
61 * @param listener the listener to unregister
62 */
SureshBR25058b72015-08-13 13:05:06 +053063 void removeListener(PcepClientListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053064
65 /**
Priyanka B94395bf2016-05-21 18:39:46 +053066 * Register a listener for PCEP msg events.
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053067 *
68 * @param listener the listener to notify
69 */
SureshBR25058b72015-08-13 13:05:06 +053070 void addEventListener(PcepEventListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053071
72 /**
73 * Unregister a listener.
74 *
75 * @param listener the listener to unregister
76 */
SureshBR25058b72015-08-13 13:05:06 +053077 void removeEventListener(PcepEventListener listener);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053078
79 /**
Priyanka B94395bf2016-05-21 18:39:46 +053080 * Register a listener for PCEP msg events[carrying node descriptor details].
81 *
82 * @param listener the listener to notify
83 */
84 void addNodeListener(PcepNodeListener listener);
85
86 /**
87 * Unregister a listener.
88 *
89 * @param listener the listener to be unregistered
90 */
91 void removeNodeListener(PcepNodeListener listener);
92
93 /**
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053094 * Send a message to a particular pcc client.
95 *
96 * @param pccId the id of the client to send message.
97 * @param msg the message to send
98 */
SureshBR25058b72015-08-13 13:05:06 +053099 void writeMessage(PccId pccId, PcepMessage msg);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530100
101 /**
102 * Process a message and notify the appropriate listeners.
103 *
104 * @param pccId id of the client the message arrived on
105 * @param msg the message to process.
106 */
SureshBR25058b72015-08-13 13:05:06 +0530107 void processClientMessage(PccId pccId, PcepMessage msg);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530108
109 /**
110 * Close all connected PCC clients.
111 */
SureshBR25058b72015-08-13 13:05:06 +0530112 void closeConnectedClients();
Avantika-Huawei9e848e82016-09-01 12:12:42 +0530113
114 /**
115 * Create label stack from the given path.
116 *
117 * @param path from which label stack is to be computed
118 * @return the label stack
119 */
120 public LabelStack computeLabelStack(Path path);
121
122 /**
123 * Allocates and downloads local labels for the given LSP.
124 *
125 * @param tunnel for which local labels have to be assigned and downloaded
126 * @return success or failure
127 */
128 public boolean allocateLocalLabel(Tunnel tunnel);
129
130 /**
131 * Creates label stack for ERO object from network resource.
132 *
133 * @param labelStack
134 * @param path (hop list)
135 * @return list of ERO sub-objects
136 */
137 public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530138}