Search in sources :

Example 1 with NodeRemovedBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemovedBuilder 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 2 with NodeRemovedBuilder

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

the class DeviceMastershipManagerTest method testOnDeviceConnectedAndDisconnected.

@Test
public void testOnDeviceConnectedAndDisconnected() throws Exception {
    // no context
    Assert.assertNull(deviceMastershipManager.getDeviceMasterships().get(NODE_ID));
    NodeUpdatedBuilder nodeUpdatedBuilder = new NodeUpdatedBuilder();
    nodeUpdatedBuilder.setId(NODE_ID);
    deviceMastershipManager.onNodeUpdated(nodeUpdatedBuilder.build());
    DeviceMastership serviceInstance = deviceMastershipManager.getDeviceMasterships().get(NODE_ID);
    Assert.assertNotNull(serviceInstance);
    // destroy context - unregister
    Assert.assertNotNull(deviceMastershipManager.getDeviceMasterships().get(NODE_ID));
    NodeRemovedBuilder nodeRemovedBuilder = new NodeRemovedBuilder();
    InstanceIdentifier<Node> nodeIId = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID));
    nodeRemovedBuilder.setNodeRef(new NodeRef(nodeIId));
    deviceMastershipManager.onNodeRemoved(nodeRemovedBuilder.build());
    Assert.assertNull(deviceMastershipManager.getDeviceMasterships().get(NODE_ID));
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdatedBuilder) NodeRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemovedBuilder) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Test(org.junit.Test)

Example 3 with NodeRemovedBuilder

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

the class DeviceManagerImplTest method sendNodeRemovedNotification.

@Test
public void sendNodeRemovedNotification() throws Exception {
    deviceManager.sendNodeAddedNotification(DUMMY_IDENTIFIER);
    deviceManager.sendNodeRemovedNotification(DUMMY_IDENTIFIER);
    deviceManager.sendNodeRemovedNotification(DUMMY_IDENTIFIER);
    verify(notificationPublishService).offerNotification(new NodeRemovedBuilder().setNodeRef(new NodeRef(DUMMY_IDENTIFIER)).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) Test(org.junit.Test)

Example 4 with NodeRemovedBuilder

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

the class DeviceManagerImpl method sendNodeRemovedNotification.

@Override
public void sendNodeRemovedNotification(@Nonnull final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier) {
    if (notificationCreateNodeSend.remove(instanceIdentifier)) {
        NodeRemovedBuilder builder = new NodeRemovedBuilder();
        builder.setNodeRef(new NodeRef(instanceIdentifier));
        LOG.info("Publishing node removed notification for {}", instanceIdentifier.firstKeyOf(Node.class).getId());
        notificationPublishService.offerNotification(builder.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)

Aggregations

NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)4 NodeRemovedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemovedBuilder)4 Test (org.junit.Test)2 NodeUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdatedBuilder)1 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)1 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1