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.List;
import javax.management.ObjectName;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.api.jmx.CommitStatus;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
import org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.impl.PCEPSessionProposalFactoryImplModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.stateful02.cfg.Stateful02PCEPSessionProposalFactoryModuleFactory;
import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleFactory;
import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleMXBean;
import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleTest;
-import org.opendaylight.controller.config.yang.pcep.topology.provider.Stateful02TopologySessionListenerModuleFactory;
+import org.opendaylight.controller.config.yang.pcep.topology.provider.Stateful07TopologySessionListenerModuleFactory;
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;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSchedulerTest {
private static final TopologyId TOPOLOGY_ID = new TopologyId("pcep-topology");
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ SimplePCEPExtensionProviderContext extContext = new SimplePCEPExtensionProviderContext();
+ setupMockService(PCEPExtensionProviderContext.class, extContext);
+ BasePCEPSessionProposalFactory proposalFactory = new BasePCEPSessionProposalFactory(120, 30,
+ 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(),
+ new DefaultPCEPSessionNegotiatorFactory(proposalFactory, 5), eventLoopGroup, eventLoopGroup));
+ }
+
@Test
public void testValidationExceptionTopologyIdNotSet() throws Exception {
try {
public void testCreateBean() throws Exception {
final CommitStatus status = createInstance();
assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 19, 0, 0);
+ assertStatus(status, 14, 0, 0);
}
@Test
assertBeanCount(1, FACTORY_NAME);
final CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 19);
+ assertStatus(status, 0, 0, 14);
}
@Test
mxBean.setTopologyId(new TopologyId("new-pcep-topology"));
final CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 1, 18);
+ assertStatus(status, 0, 1, 13);
}
private CommitStatus createInstance(final TopologyId topologyId) throws Exception {
throws Exception {
final ObjectName objectName = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
final ObjectName asyncDataBrokerON = createAsyncDataBrokerInstance(transaction);
+ final ObjectName dataBrokerON = createCompatibleDataBrokerInstance(transaction);
final ObjectName notificationBrokerON = createNotificationBrokerInstance(transaction);
- final ObjectName bindingBrokerON = createBindingBrokerImpl(transaction, createCompatibleDataBrokerInstance(transaction), notificationBrokerON);
+ final ObjectName bindingBrokerON = createBindingBrokerImpl(transaction, dataBrokerON, notificationBrokerON);
final ObjectName schedulerON = createInstructionSchedulerModuleInstance(transaction, asyncDataBrokerON, bindingBrokerON,
notificationBrokerON);
final ObjectName sourceTopology = PCEPTopologyProviderModuleTest.createPCEPTopologyProviderModuleInstance(transaction,
final PCEPTunnelTopologyProviderModuleMXBean mxBean = transaction.newMXBeanProxy(objectName,
PCEPTunnelTopologyProviderModuleMXBean.class);
- mxBean.setDataProvider(createDataBrokerInstance(transaction));
+ mxBean.setDataProvider(asyncDataBrokerON);
mxBean.setRpcRegistry(bindingBrokerON);
mxBean.setScheduler(schedulerON);
mxBean.setTopologyId(topologyId);
moduleFactories.add(new PCEPTunnelTopologyProviderModuleFactory());
moduleFactories.add(new PCEPTopologyProviderModuleFactory());
moduleFactories.add(new PCEPDispatcherImplModuleFactory());
- moduleFactories.add(new PCEPSessionProposalFactoryImplModuleFactory());
moduleFactories.add(new NettyThreadgroupModuleFactory());
- moduleFactories.add(new SimplePCEPExtensionProviderContextModuleFactory());
- moduleFactories.add(new Stateful02TopologySessionListenerModuleFactory());
- moduleFactories.add(new Stateful02PCEPSessionProposalFactoryModuleFactory());
+ moduleFactories.add(new Stateful07TopologySessionListenerModuleFactory());
return moduleFactories;
}
final List<String> paths = super.getYangModelsPaths();
paths.add("/META-INF/yang/network-topology@2013-10-21.yang");
paths.add("/META-INF/yang/network-topology-pcep.yang");
+ paths.add("/META-INF/yang/network-topology-pcep-programming.yang");
+ paths.add("/META-INF/yang/network-topology-programming.yang");
+ paths.add("/META-INF/yang/topology-tunnel.yang");
+ paths.add("/META-INF/yang/topology-tunnel-pcep.yang");
+ paths.add("/META-INF/yang/topology-tunnel-pcep-programming.yang");
+ paths.add("/META-INF/yang/topology-tunnel-p2p.yang");
+ paths.add("/META-INF/yang/topology-tunnel-programming.yang");
paths.add("/META-INF/yang/odl-network-topology.yang");
paths.add("/META-INF/yang/yang-ext.yang");
paths.add("/META-INF/yang/pcep-types.yang");