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();
}
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));
}
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());
}
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());
}
}
Aggregations