Search in sources :

Example 66 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.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);
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Example 67 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.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);
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Example 68 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.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")));
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 69 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.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());
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) FlowAndStatisticsMapList(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Example 70 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.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();
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Optional(com.google.common.base.Optional) TransactionChainListener(org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) TransactionChainManager(org.opendaylight.openflowplugin.common.txchain.TransactionChainManager) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Aggregations

NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)98 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)64 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)63 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)55 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)47 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)42 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)33 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)31 Test (org.junit.Test)26 NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)19 Before (org.junit.Before)18 NetworkTopology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology)18 TopologyKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey)18 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)16 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)15 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)14 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)14 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)14 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)12 ArrayList (java.util.ArrayList)11