</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <failOnError>true</failOnError>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder;
/**
- * Stores usability for available capabilities
+ * Stores usability for available capabilities.
*/
public interface PCEPCapability {
/**
- * Sets stateful capabilities tlv in incoming builder
+ * Sets stateful capabilities tlv in incoming builder.
*
- * @param address
+ * @param address peer address to assign capability proposal
* @param builder for TLVs included in PCEPOpenObject
*/
void setCapabilityProposal(InetSocketAddress address, TlvsBuilder builder);
+ /**
+ * Returs stateful capability state.
+ *
+ * @return true if capability is present
+ */
boolean isStateful();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder;
/**
- * Proposal from peer for establishment of PCEP session
+ * Proposal from peer for establishment of PCEP session.
*/
public interface PCEPPeerProposal {
-
/**
- * Sets specific TLVs into incoming builder
+ * Sets specific TLVs into incoming builder.
*
- * @param address of the pcep speaker to be assigned given tlvs
- * @param tlvs builder, to attach tl's with more information to be sent under Open message
+ * @param address pcep speaker address
+ * @param openBuilder to assign specific proposal
*/
- void setPeerSpecificProposal(@Nonnull InetSocketAddress address, @Nonnull TlvsBuilder tlvs);
+ void setPeerSpecificProposal(@Nonnull InetSocketAddress address, @Nonnull TlvsBuilder openBuilder);
}
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.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs;
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
+ * 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
*/
- Tlvs localSessionCharacteristics();
+ @Deprecated
+ default Tlvs localSessionCharacteristics() {
+ return getLocalTlvs();
+ }
}
package org.opendaylight.protocol.pcep;
import java.util.EventListener;
+import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
/**
*
* @param session Peer address families which we accepted
*/
- void onSessionUp(PCEPSession session);
+ void onSessionUp(@Nonnull PCEPSession session);
/**
* Fired when the session went down because of an IO error. Implementation should take care of closing underlying
* session.
*
- * @param session that went down
- * @param e Exception that was thrown as the cause of session being down
+ * @param session that went down
+ * @param exception Exception that was thrown as the cause of session being down
*/
- void onSessionDown(PCEPSession session, Exception e);
+ void onSessionDown(@Nonnull PCEPSession session, @Nonnull Exception exception);
/**
* Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
*
* @param reason the cause why the session went down
*/
- void onSessionTerminated(PCEPSession session, PCEPTerminationReason reason);
+ void onSessionTerminated(@Nonnull PCEPSession session, @Nonnull PCEPTerminationReason reason);
/**
* Fired when a normal protocol message is received.
*
* @param message Protocol message
*/
- void onMessage(PCEPSession session, Message message);
+ void onMessage(@Nonnull PCEPSession session, @Nonnull Message message);
}
*/
package org.opendaylight.protocol.pcep;
+import javax.annotation.Nonnull;
+
/**
* Factory for generating PCEP Session Listeners. Used by a server.
*/
public interface PCEPSessionListenerFactory {
/**
- * Returns one session listener
+ * Returns one session listener.
*
* @return specific session listener
*/
+ @Nonnull
PCEPSessionListener getSessionListener();
}
/**
* Factory for creating PCEP session negotiator.
*
- * @param <S>
+ * @param <S> PCEPSession implementation
*/
public interface PCEPSessionNegotiatorFactory<S extends PCEPSession> {
@Nonnull Promise<S> promise);
/**
- * Returns a PCEPSessionProposalFactory
+ * Returns a PCEPSessionProposalFactory.
*
* @return session factory
*/
import javax.annotation.Nullable;
/**
- * Contains required dependencies for create SessionNegotiator
+ * Contains required dependencies for create SessionNegotiator.
*/
public interface PCEPSessionNegotiatorFactoryDependencies {
/**
PCEPSessionListenerFactory getListenerFactory();
/**
- * Returns a non mandatory PeerProposal information used in our Open message.
+ * PeerProposal information used in our Open message.
*
- * @return by default null or peerProposal if implemented.
+ * @return peerProposal null by default since its not mandatory. Otherwise method should be override it.
*/
@Nullable
default PCEPPeerProposal getPeerProposal() {
*/
public interface PCEPSessionProposalFactory {
/**
+ * Creates Open with session proposal.
+ *
* @param address serves as constraint, so that factory is able to return different proposals for different
* addresses
* @param sessionId is used for creation of PCEPOpenObject
Open getSessionProposal(@Nonnull InetSocketAddress address, int sessionId, @Nullable PCEPPeerProposal peerProposal);
/**
- * Returns list containing PCEP Capabilities
+ * Returns list containing PCEP Capabilities.
*
* @return PCEPCapabilities
*/
import java.util.Map;
public enum TerminationReason {
- UNKNOWN((short) 1), EXP_DEADTIMER((short) 2), MALFORMED_MSG((short) 3), TOO_MANY_UNKNWN_REQS((short) 4), TOO_MANY_UNKNOWN_MSGS((short) 5);
+ UNKNOWN((short) 1),
+ EXP_DEADTIMER((short) 2),
+ MALFORMED_MSG((short) 3),
+ TOO_MANY_UNKNWN_REQS((short) 4),
+ TOO_MANY_UNKNOWN_MSGS((short) 5);
- private short value;
private static final Map<Short, TerminationReason> VALUE_MAP;
static {
}
}
+ private short value;
+
TerminationReason(final short value) {
this.value = value;
}
/**
- * Gets value of termination reason.
+ * Gets termination reason for specific short value.
*
- * @return short value
+ * @param valueArg corresponding to Termination reason
+ * @return corresponding TerminationReason item
*/
- public short getShortValue() {
- return this.value;
+ public static TerminationReason forValue(final short valueArg) {
+ return VALUE_MAP.get(valueArg);
}
/**
- * Gets termination reason for specific short value.
+ * Gets value of termination reason.
*
- * @param valueArg
- * @return corresponding TerminationReason item
+ * @return short value
*/
- public static TerminationReason forValue(final short valueArg) {
- return VALUE_MAP.get(valueArg);
+ public short getShortValue() {
+ return this.value;
}
}
}
@Override
- public Tlvs localSessionCharacteristics() {
+ public Tlvs getLocalTlvs() {
return this.localOpen.getTlvs();
}
}
@Override
- public void onSessionDown(final PCEPSession session, final Exception e) {
- LOG.debug("Session down.", e);
+ public void onSessionDown(final PCEPSession session, final Exception exception) {
+ LOG.debug("Session down.", exception);
this.up = false;
// this.notifyAll();
}
}
@Override
- public void onSessionDown(final PCEPSession session, final Exception e) {
- LOG.info("Session down with cause : {} or exception: {}", e.getCause(), e, e);
+ public void onSessionDown(final PCEPSession session, final Exception exception) {
+ LOG.info("Session down with cause : {} or exception: {}", exception.getCause(), exception, exception);
this.tunnelManager.onSessionDown(this);
try {
session.close();
}
@Override
- public void onSessionDown(final PCEPSession session, final Exception e) {
- LOG.debug("Session down. Cause : {} ", e, e);
+ public void onSessionDown(final PCEPSession session, final Exception exception) {
+ LOG.debug("Session down. Cause : {} ", exception, exception);
this.up = false;
this.session = null;
}
}
@Override
- public void onSessionDown(final PCEPSession session, final Exception e) {
- LOG.debug("Session down. Cause : {} ", e, e);
+ public void onSessionDown(final PCEPSession session, final Exception exception) {
+ LOG.debug("Session down. Cause : {} ", exception, exception);
this.up = false;
}
}
@Override
- public void onSessionDown(final PCEPSession session, final Exception e) {
- LOG.debug("Session down with cause : {} or exception: {}", e.getCause(), e, e);
+ public void onSessionDown(final PCEPSession session, final Exception exception) {
+ LOG.debug("Session down with cause : {} or exception: {}", exception.getCause(), exception, exception);
try {
session.close();
} catch (Exception ie) {
}
@Override
- public final synchronized void onSessionDown(final PCEPSession session, final Exception e) {
- LOG.warn("Session {} went down unexpectedly", session, e);
+ public final synchronized void onSessionDown(final PCEPSession session, final Exception exception) {
+ LOG.warn("Session {} went down unexpectedly", session, exception);
tearDown(session);
}