From: Maros Marsalek Date: Wed, 16 Oct 2013 13:31:47 +0000 (+0200) Subject: Additional methods added to PCEPSession. X-Git-Tag: jenkins-bgpcep-bulk-release-prepare-only-1~237^2~139 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=482d2f6e6207116fa92730c5b3b0bbf8ef8af2db;p=bgpcep.git Additional methods added to PCEPSession. Added getters for remote address and remote PCEPTlvs in order for session listener to access this information. + Fixed bundle configuration issues for pcep-impl Change-Id: Ibc59378de7b99912d4e3d5e54881e59e84514146 Signed-off-by: Maros Marsalek Signed-off-by: Robert Varga --- diff --git a/pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPSession.java b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPSession.java index 74c1107529..caaa044d57 100644 --- a/pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPSession.java +++ b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPSession.java @@ -7,8 +7,11 @@ */ package org.opendaylight.protocol.pcep; +import java.net.InetAddress; + import org.opendaylight.protocol.framework.ProtocolSession; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Tlvs; /** * PCEP Session represents the finite state machine in PCEP, including timers and its purpose is to create a PCEP @@ -22,10 +25,14 @@ public interface PCEPSession extends ProtocolSession { * 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(TerminationReason reason); + + public Tlvs getRemoteTlvs(); + + public InetAddress getRemoteAddress(); } diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java index 47cc916f8b..bade1702dc 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java @@ -13,6 +13,7 @@ import io.netty.util.Timer; import io.netty.util.TimerTask; import java.io.IOException; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Date; import java.util.LinkedList; @@ -34,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.message.CCloseMessageBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.message.c.close.message.CCloseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Tlvs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -182,7 +184,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession implements /** * Sends message to serialization. - * + * * @param msg to be sent */ @Override @@ -222,6 +224,16 @@ public class PCEPSessionImpl extends AbstractProtocolSession implements this.channel.close(); } + @Override + public Tlvs getRemoteTlvs() { + return remoteOpen.getTlvs(); + } + + @Override + public InetAddress getRemoteAddress() { + return ((InetSocketAddress) this.channel.remoteAddress()).getAddress(); + } + private synchronized void terminate(final TerminationReason reason) { this.listener.onSessionTerminated(this, new PCEPCloseTermination(reason)); this.closed = true; @@ -244,7 +256,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession implements /** * Sends PCEP Error Message with one PCEPError and Open Object. - * + * * @param value * @param open */ @@ -257,7 +269,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession implements * sent (CAPABILITY_NOT_SUPPORTED) and the method checks if the MAX_UNKNOWN_MSG per minute wasn't overstepped. * Second, any other error occurred that is specified by rfc. In this case, the an error message is generated and * sent. - * + * * @param error documented error in RFC5440 or draft */ @VisibleForTesting @@ -278,7 +290,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession implements /** * Handles incoming message. If the session is up, it notifies the user. The user is notified about every message * except KeepAlive. - * + * * @param msg incoming message */ @Override @@ -362,10 +374,11 @@ public class PCEPSessionImpl extends AbstractProtocolSession implements @Override public String getNodeIdentifier() { - if (this.remoteOpen.getTlvs() == null) + if (this.remoteOpen.getTlvs() == null) { if (this.remoteOpen.getTlvs().getPredundancyGroupId() != null) { return new String(this.remoteOpen.getTlvs().getPredundancyGroupId().getIdentifier()); } + } return ""; }