- throw exception and abort PCEP Topology Provider instantiation if stateful capability is not configured but stateful plugin is
Change-Id: Ie066cc4661f07877e133ce666819b242aa783c85
Signed-off-by: Ajay <ajayl.bro@gmail.com>
*/
void setCapabilityProposal(InetSocketAddress address, TlvsBuilder builder);
+ boolean isStateful();
}
* @return instance of PCEPServer
*/
ChannelFuture createServer(InetSocketAddress address, Optional<KeyMapping> keys, PCEPSessionListenerFactory listenerFactory, PCEPPeerProposal peerProposal);
-}
\ No newline at end of file
+
+ PCEPSessionNegotiatorFactory getPCEPSessionNegotiatorFactory();
+}
* @return PCEPSessionNegotiator instance
*/
SessionNegotiator getSessionNegotiator(PCEPSessionListenerFactory sessionListenerFactory, Channel channel, Promise<S> promise, final PCEPPeerProposal peerProposal);
+
+ PCEPSessionProposalFactory getPCEPSessionProposalFactory();
}
package org.opendaylight.protocol.pcep;
import java.net.InetSocketAddress;
+import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
/**
* @return specific session proposal
*/
Open getSessionProposal(InetSocketAddress address, int sessionId, PCEPPeerProposal peerProposal);
+
+ List<PCEPCapability> getCapabilities();
}
}
}
+ @Override
public boolean isStateful() {
return this.stateful;
}
return this.deadTimer;
}
+ @Override
+ public List<PCEPCapability> getCapabilities() {
+ return this.capabilities;
+ }
}
return new DefaultPCEPSessionNegotiator(promise, channel, listener, sessionId, this.maxUnknownMessages,
this.spf.getSessionProposal((InetSocketAddress)channel.remoteAddress(), sessionId, peerProposal), this.tlsConfiguration);
}
+
+ @Override
+ public PCEPSessionProposalFactory getPCEPSessionProposalFactory() {
+ return this.spf;
+ }
}
protected interface ChannelPipelineInitializer {
void initializeChannel(SocketChannel socketChannel, Promise<PCEPSessionImpl> promise);
}
-}
\ No newline at end of file
+
+ @Override
+ public PCEPSessionNegotiatorFactory getPCEPSessionNegotiatorFactory() {
+ return this.snf;
+ }
+}
public boolean isSegmentRoutingCapable() {
return this.isSegmentRoutingCapable;
}
+
+ @Override
+ public boolean isStateful() {
+ return false;
+ }
}
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import java.net.InetSocketAddress;
+import java.util.List;
import java.util.concurrent.ExecutionException;
import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.PCEPCapability;
import org.opendaylight.protocol.pcep.PCEPDispatcher;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev131106.NetworkTopologyPcepProgrammingService;
final InstanceIdentifier<Topology> topology, final TopologySessionListenerFactory listenerFactory,
final Optional<PCEPTopologyProviderRuntimeRegistrator> runtimeRootRegistrator, final int rpcTimeout) throws InterruptedException,
ExecutionException, ReadFailedException, TransactionCommitFailedException {
+ List<PCEPCapability> capabilities = dispatcher.getPCEPSessionNegotiatorFactory().getPCEPSessionProposalFactory().getCapabilities();
+ boolean statefulCapability = false;
+ for (final PCEPCapability capability : capabilities) {
+ if (capability.isStateful()) {
+ statefulCapability = true;
+ break;
+ }
+ }
+ if (!statefulCapability && listenerFactory != null) {
+ throw new IllegalStateException("Stateful capability not defined, aborting PCEP Topology Provider instantiation");
+ }
final ServerSessionManager manager = new ServerSessionManager(dataBroker, topology, listenerFactory, rpcTimeout);
if (runtimeRootRegistrator.isPresent()) {
LOG.error("Failed to shutdown session manager", e);
}
}
-}
\ No newline at end of file
+}
import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
import org.opendaylight.protocol.pcep.PCEPDispatcher;
import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
+import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
SimplePCEPExtensionProviderContext extContext = new SimplePCEPExtensionProviderContext();
setupMockService(PCEPExtensionProviderContext.class, extContext);
BasePCEPSessionProposalFactory proposalFactory = new BasePCEPSessionProposalFactory(120, 30,
- Collections.emptyList());
+ Arrays.asList(new PCEPStatefulCapability(true, true, true, true, true, true, true)));
setupMockService(PCEPSessionProposalFactory.class, proposalFactory);
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
setupMockService(PCEPDispatcher.class, new PCEPDispatcherImpl(extContext.getMessageHandlerRegistry(),
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import io.netty.channel.nio.NioEventLoopGroup;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.management.ObjectName;
import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
import org.opendaylight.protocol.pcep.PCEPDispatcher;
import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
+import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
SimplePCEPExtensionProviderContext extContext = new SimplePCEPExtensionProviderContext();
setupMockService(PCEPExtensionProviderContext.class, extContext);
BasePCEPSessionProposalFactory proposalFactory = new BasePCEPSessionProposalFactory(120, 30,
- Collections.emptyList());
+ Arrays.asList(new PCEPStatefulCapability(true, true, true, true, true, true, true)));
setupMockService(PCEPSessionProposalFactory.class, proposalFactory);
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
setupMockService(PCEPDispatcher.class, new PCEPDispatcherImpl(extContext.getMessageHandlerRegistry(),