Add new revision for pcep types model
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPSession.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.pcep;
9
10 import io.netty.util.concurrent.Future;
11 import java.net.InetAddress;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
15
16 /**
17  * PCEP Session represents the finite state machine in PCEP, including timers and its purpose is to create a PCEP
18  * connection between PCE/PCC. Session is automatically started, when TCP connection is created, but can be stopped
19  * manually. If the session is up, it has to redirect messages to/from user. Handles also malformed messages and unknown
20  * requests.
21  */
22 public interface PCEPSession extends PCEPSessionState, AutoCloseable {
23
24     /**
25      * Sends message from user to PCE/PCC. If the user sends an Open Message, the session returns an error (open message
26      * is only allowed, when a PCEP handshake is in progress). Close message will close the session and free all the
27      * resources.
28      *
29      * @param message message to be sent
30      * @return Future promise which will be succeed when the message is enqueued in the socket.
31      */
32     Future<Void> sendMessage(Message message);
33
34     void close(TerminationReason reason);
35
36     /**
37      * Returns session characteristics of the remote PCEP Speaker.
38      *
39      * @return Open message TLVs
40      */
41     Tlvs getRemoteTlvs();
42
43     /**
44      * Returns remote address.
45      *
46      * @return inet address
47      */
48     @Nonnull
49     InetAddress getRemoteAddress();
50
51     /**
52      * Returns session characteristics of the local PCEP Speaker.
53      *
54      * @return Open message TLVs
55      */
56     Tlvs getLocalTlvs();
57
58     /**
59      * Returns session characteristics of the local PCEP Speaker.
60      *
61      * @return Open message TLVs
62      */
63     @Deprecated
64     default Tlvs localSessionCharacteristics() {
65         return getLocalTlvs();
66     }
67 }