Add new revision for pcep types model
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPSession.java
index 301354e1a8166215518be9a77b63fcb09c7369f5..21815071b466567d8f2d7c20a9be3b13bca6a2bf 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.protocol.pcep;
 
-import org.opendaylight.protocol.framework.ProtocolSession;
-import org.opendaylight.protocol.pcep.object.PCEPCloseObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import io.netty.util.concurrent.Future;
+import java.net.InetAddress;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
 
 /**
  * PCEP Session represents the finite state machine in PCEP, including timers and its purpose is to create a PCEP
@@ -17,16 +19,49 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
  * manually. If the session is up, it has to redirect messages to/from user. Handles also malformed messages and unknown
  * requests.
  */
-public interface PCEPSession extends ProtocolSession<Message> {
-
-       /**
-        * Sends message from user to PCE/PCC. If the user sends an Open Message, the session returns an error (open message
-        * is only allowed, when a PCEP handshake is in progress). Close message will close the session and free all the
-        * resources.
-        * 
-        * @param message message to be sent
-        */
-       public void sendMessage(Message message);
-
-       public void close(PCEPCloseObject.Reason reason);
+public interface PCEPSession extends PCEPSessionState, AutoCloseable {
+
+    /**
+     * Sends message from user to PCE/PCC. If the user sends an Open Message, the session returns an error (open message
+     * is only allowed, when a PCEP handshake is in progress). Close message will close the session and free all the
+     * resources.
+     *
+     * @param message message to be sent
+     * @return Future promise which will be succeed when the message is enqueued in the socket.
+     */
+    Future<Void> sendMessage(Message message);
+
+    void close(TerminationReason reason);
+
+    /**
+     * Returns session characteristics of the remote PCEP Speaker.
+     *
+     * @return Open message TLVs
+     */
+    Tlvs getRemoteTlvs();
+
+    /**
+     * Returns remote address.
+     *
+     * @return inet address
+     */
+    @Nonnull
+    InetAddress getRemoteAddress();
+
+    /**
+     * Returns session characteristics of the local PCEP Speaker.
+     *
+     * @return Open message TLVs
+     */
+    Tlvs getLocalTlvs();
+
+    /**
+     * Returns session characteristics of the local PCEP Speaker.
+     *
+     * @return Open message TLVs
+     */
+    @Deprecated
+    default Tlvs localSessionCharacteristics() {
+        return getLocalTlvs();
+    }
 }