use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey in project openflowplugin by opendaylight.
the class OF13DeviceInitializerTest method setUp.
@Before
public void setUp() throws Exception {
final KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier = DeviceStateUtil.createNodeInstanceIdentifier(new NodeId("openflow:1"));
deviceInitializer = new OF13DeviceInitializer();
when(multipartWriterProvider.lookup(any())).thenReturn(Optional.of(abstractMultipartWriter));
when(featuresReply.getCapabilities()).thenReturn(capabilities);
when(connectionContext.getFeatures()).thenReturn(featuresReply);
when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(translatorLibrary.lookupTranslator(any())).thenReturn(messageTranslator);
when(deviceContext.oook()).thenReturn(translatorLibrary);
when(requestContext.getXid()).thenReturn(new Xid(42L));
when(deviceContext.createRequestContext()).thenReturn(requestContext);
when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey in project openflowplugin by opendaylight.
the class RpcContextImplTest method setup.
@Before
public void setup() {
final NodeId nodeId = new NodeId("openflow:1");
nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId));
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
rpcContext = new RpcContextImpl(rpcProviderRegistry, MAX_REQUESTS, deviceContext, extensionConverterProvider, convertorExecutor, notificationPublishService, true);
when(rpcProviderRegistry.addRoutedRpcImplementation(TestRpcService.class, serviceInstance)).thenReturn(routedRpcReg);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey in project openflowplugin by opendaylight.
the class PacketProcessingServiceImplTest method setup.
@Override
protected void setup() {
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
packetProcessingService = new PacketProcessingServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
pathToNodeconnector = KeyedInstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("ofp-ut:123"))).child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("ofp-ut:123:1")));
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey in project openflowplugin by opendaylight.
the class DeviceFlowRegistryImplTest method setUp.
@Before
public void setUp() throws Exception {
nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
deviceFlowRegistry = new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodeInstanceIdentifier);
final FlowAndStatisticsMapList flowStats = TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flowStats);
descriptor = FlowDescriptorFactory.create(key.getTableId(), new FlowId("ut:1"));
Assert.assertEquals(0, deviceFlowRegistry.getAllFlowDescriptors().size());
deviceFlowRegistry.storeDescriptor(key, descriptor);
Assert.assertEquals(1, deviceFlowRegistry.getAllFlowDescriptors().size());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey in project openflowplugin by opendaylight.
the class TransactionChainManagerTest method setUp.
@Before
public void setUp() throws Exception {
final ReadOnlyTransaction readOnlyTx = Mockito.mock(ReadOnlyTransaction.class);
final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture = Futures.immediateCheckedFuture(Optional.<Node>absent());
Mockito.when(readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture);
Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTx);
Mockito.when(dataBroker.createTransactionChain(Matchers.any(TransactionChainListener.class))).thenReturn(txChain);
nodeId = new NodeId("h2g2:42");
nodeKeyIdent = DeviceStateUtil.createNodeInstanceIdentifier(nodeId);
Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeKeyIdent);
Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId);
txChainManager = new TransactionChainManager(dataBroker, nodeId.getValue());
Mockito.when(txChain.newReadWriteTransaction()).thenReturn(writeTx);
path = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId));
Mockito.when(writeTx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateCheckedFuture(null));
txChainManager.activateTransactionManager();
}
Aggregations