Search in sources :

Example 96 with NodeId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId in project openflowplugin by opendaylight.

the class PacketReceivedTranslatorTest method testTranslate.

@Test
public void testTranslate() throws Exception {
    final KeyedInstanceIdentifier<Node, NodeKey> nodePath = KeyedInstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:10")));
    final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager);
    final PacketInMessage packetInMessage = createPacketInMessage(DATA.getBytes(), PORT_NO);
    Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
    final PacketReceived packetReceived = packetReceivedTranslator.translate(packetInMessage, deviceInfo, null);
    Assert.assertArrayEquals(packetInMessage.getData(), packetReceived.getPayload());
    Assert.assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.SendToController", packetReceived.getPacketInReason().getName());
    Assert.assertEquals("openflow:10:" + PORT_NO, packetReceived.getIngress().getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue());
    Assert.assertEquals(0L, packetReceived.getFlowCookie().getValue().longValue());
    Assert.assertEquals(42L, packetReceived.getTableId().getValue().longValue());
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) PacketReceived(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived) PacketInMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage) 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) Test(org.junit.Test)

Example 97 with NodeId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestServiceProvider method register.

public ObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider> register(final ProviderContext ctx) {
    RoutedRpcRegistration<SalTableService> addRoutedRpcImplementation = ctx.<SalTableService>addRoutedRpcImplementation(SalTableService.class, this);
    setTableRegistration(addRoutedRpcImplementation);
    InstanceIdentifierBuilder<Nodes> builder1 = InstanceIdentifier.<Nodes>builder(Nodes.class);
    NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID);
    NodeKey nodeKey = new NodeKey(nodeId);
    InstanceIdentifierBuilder<Node> nodeIndentifier = builder1.<Node, NodeKey>child(Node.class, nodeKey);
    InstanceIdentifier<Node> instance = nodeIndentifier.build();
    tableRegistration.registerPath(NodeContext.class, instance);
    RoutedRpcRegistration<SalTableService> tableRegistration1 = this.getTableRegistration();
    return new AbstractObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider>(this) {

        @Override
        protected void removeRegistration() {
            tableRegistration1.close();
        }
    };
}
Also used : AbstractObjectRegistration(org.opendaylight.yangtools.concepts.AbstractObjectRegistration) SalTableService(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService) 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) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Example 98 with NodeId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId in project openflowplugin by opendaylight.

the class AbstractDirectStatisticsServiceTest method init.

@Before
public void init() throws Exception {
    nodeConnectorId = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(DATAPATH_ID, PORT_NO, OpenflowVersion.get(OF_VERSION));
    nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
    convertorManager = ConvertorManagerFactory.createDefaultManager();
    when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry);
    when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry);
    when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry);
    when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
    when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
    when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector);
    when(deviceContext.oook()).thenReturn(translatorLibrary);
    when(deviceContext.getDeviceState()).thenReturn(deviceState);
    when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
    when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
    when(deviceInfo.getNodeId()).thenReturn(new NodeId(NODE_ID));
    when(deviceInfo.getVersion()).thenReturn(OF_VERSION);
    when(deviceInfo.getDatapathId()).thenReturn(DATAPATH_ID);
    when(getFeaturesOutput.getVersion()).thenReturn(OF_VERSION);
    when(getFeaturesOutput.getDatapathId()).thenReturn(DATAPATH_ID);
    when(connectionContext.getFeatures()).thenReturn(features);
    when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
    when(features.getVersion()).thenReturn(OF_VERSION);
    when(features.getDatapathId()).thenReturn(DATAPATH_ID);
    multipartWriterProvider = MultipartWriterProviderFactory.createDefaultProvider(deviceContext);
    setUp();
}
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 99 with NodeId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId in project openflowplugin by opendaylight.

the class InventoryDataServiceUtilTest method testDataPathIdFromNodeId.

/**
 * Test method for {@link InventoryDataServiceUtil#dataPathIdFromNodeId(NodeId)}.
 */
@Test
public void testDataPathIdFromNodeId() {
    String string = "openflow:";
    NodeId[] nodeIds = new NodeId[] { // 0x00000000 000004d2
    new NodeId(string + "1234"), // 0x8db2089e 01391a86
    new NodeId(string + "10210232779920710278"), // 0xffffffff ffffffff
    new NodeId(string + "18446744073709551615") };
    long[] expectedDPIDs = new long[] { 1234L, -8236511293788841338L, -1L };
    for (int i = 0; i < nodeIds.length; i++) {
        BigInteger datapathId = InventoryDataServiceUtil.dataPathIdFromNodeId(nodeIds[i]);
        Assert.assertEquals(expectedDPIDs[i], datapathId.longValue());
    }
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Example 100 with NodeId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId in project openflowplugin by opendaylight.

the class RpcManagerImplTest method setUp.

@Before
public void setUp() {
    final NodeKey nodeKey = new NodeKey(nodeId);
    rpcManager = new RpcManagerImpl(new OpenflowProviderConfigBuilder().setRpcRequestsQuota(new NonZeroUint16Type(QUOTA_VALUE)).setIsStatisticsRpcEnabled(false).build(), rpcProviderRegistry, extensionConverterProvider, convertorExecutor, notificationPublishService);
    FeaturesReply features = new GetFeaturesOutputBuilder().setVersion(OFConstants.OFP_VERSION_1_3).build();
    Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeKey.getId());
    Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
    Mockito.when(connectionContext.getFeatures()).thenReturn(features);
    Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
    Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState);
    Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
    Mockito.when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
    Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(Matchers.any(), Matchers.any(RpcService.class))).thenReturn(routedRpcRegistration);
    Mockito.when(contexts.remove(deviceInfo)).thenReturn(removedContexts);
}
Also used : NonZeroUint16Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type) GetFeaturesOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder) OpenflowProviderConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder) FeaturesReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply) RpcService(org.opendaylight.yangtools.yang.binding.RpcService) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Aggregations

NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)105 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)95 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)73 ArrayList (java.util.ArrayList)68 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)68 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)65 Test (org.junit.Test)56 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)42 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)35 BigInteger (java.math.BigInteger)31 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)30 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)29 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)28 ExecutionException (java.util.concurrent.ExecutionException)25 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)25 NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)25 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)24 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)23 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)20 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)19