Search in sources :

Example 11 with NodeRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef in project openflowplugin by opendaylight.

the class LLDPSpeakerTest method setUp.

@Before
public void setUp() throws NoSuchAlgorithmException, PacketException {
    byte[] lldpFrame = LLDPUtil.buildLldpFrame(new NodeId("openflow:1"), new NodeConnectorId("openflow:1:1"), MAC_ADDRESS, 1L);
    packetInput = new TransmitPacketInputBuilder().setEgress(new NodeConnectorRef(ID)).setNode(new NodeRef(ID.firstIdentifierOf(Node.class))).setPayload(lldpFrame).build();
    when(scheduledExecutorService.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))).thenReturn(scheduledSpeakerTask);
    lldpSpeaker = new LLDPSpeaker(packetProcessingService, scheduledExecutorService, null, entityOwnershipService);
    when(entityOwnershipService.getOwnershipState(any())).thenReturn(Optional.of(EntityOwnershipState.IS_OWNER));
    lldpSpeaker.setOperationalStatus(OperStatus.RUN);
    doReturn(RpcResultBuilder.success().buildFuture()).when(packetProcessingService).transmitPacket(any());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) TransmitPacketInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) TimeUnit(java.util.concurrent.TimeUnit) Before(org.junit.Before)

Example 12 with NodeRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef in project openflowplugin by opendaylight.

the class NodeNotificationSupplierImpl method deleteNotification.

@Override
public NodeRemoved deleteNotification(final InstanceIdentifier<FlowCapableNode> path) {
    Preconditions.checkArgument(path != null);
    final NodeRemovedBuilder delNodeNotifBuilder = new NodeRemovedBuilder();
    delNodeNotifBuilder.setNodeRef(new NodeRef(path));
    return delNodeNotifBuilder.build();
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemovedBuilder)

Example 13 with NodeRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef in project openflowplugin by opendaylight.

the class DeviceManagerImpl method sendNodeAddedNotification.

@Override
public void sendNodeAddedNotification(@Nonnull final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier) {
    if (!notificationCreateNodeSend.contains(instanceIdentifier)) {
        notificationCreateNodeSend.add(instanceIdentifier);
        final NodeId id = instanceIdentifier.firstKeyOf(Node.class).getId();
        NodeUpdatedBuilder builder = new NodeUpdatedBuilder();
        builder.setId(id);
        builder.setNodeRef(new NodeRef(instanceIdentifier));
        LOG.info("Publishing node added notification for {}", id);
        notificationPublishService.offerNotification(builder.build());
    }
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdatedBuilder) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)

Example 14 with NodeRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef in project openflowplugin by opendaylight.

the class DropTestRpcSender method processPacket.

@Override
protected void processPacket(final InstanceIdentifier<Node> node, final Match match, final Instructions instructions) {
    final AddFlowInputBuilder fb = BUILDER.get();
    // Finally build our flow
    fb.setMatch(match);
    fb.setInstructions(instructions);
    // Construct the flow instance id
    fb.setNode(new NodeRef(node));
    // Add flow
    final AddFlowInput flow = fb.build();
    if (LOG.isDebugEnabled()) {
        LOG.debug("onPacketReceived - About to write flow (via SalFlowService) {}", flow);
    }
    ListenableFuture<RpcResult<AddFlowOutput>> result = JdkFutureAdapters.listenInPoolThread(flowService.addFlow(flow));
    Futures.addCallback(result, new FutureCallback<RpcResult<AddFlowOutput>>() {

        @Override
        public void onSuccess(final RpcResult<AddFlowOutput> result) {
            countFutureSuccess();
        }

        @Override
        public void onFailure(final Throwable throwable) {
            countFutureError();
        }
    }, MoreExecutors.directExecutor());
}
Also used : AddFlowOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput) NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) AddFlowInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) AddFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder)

Example 15 with NodeRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef in project openflowplugin by opendaylight.

the class OpenflowPluginBulkGroupTransactionProvider method createUserNode.

private void createUserNode(String nodeRef) {
    NodeBuilder builder = new NodeBuilder();
    builder.setId(new NodeId(nodeRef));
    builder.setKey(new NodeKey(builder.getId()));
    testNode12 = builder.build();
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Aggregations

NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)69 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)30 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)29 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)27 ArrayList (java.util.ArrayList)23 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)18 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)17 Test (org.junit.Test)16 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)14 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)14 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)12 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)12 TransmitPacketInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder)12 BigInteger (java.math.BigInteger)11 TransmitPacketInput (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput)11 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)10 FlowRef (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef)8 GroupRef (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef)8 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)8 AddFlowInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder)7