use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated in project bgpcep by opendaylight.
the class Ipv6ReachabilityTopologyBuilderTest method testIpv6ReachabilityTopologyBuilder.
@Test
public void testIpv6ReachabilityTopologyBuilder() throws TransactionCommitFailedException, ReadFailedException {
// create route
updateIpv6Route(createIpv6Route(NEXT_HOP));
readDataOperational(getDataBroker(), this.ipv6TopoBuilder.getInstanceIdentifier(), topology -> {
final TopologyTypes1 topologyType = topology.getTopologyTypes().getAugmentation(TopologyTypes1.class);
assertNotNull(topologyType);
assertNotNull(topologyType.getBgpIpv6ReachabilityTopology());
assertEquals(1, topology.getNode().size());
final Node node = topology.getNode().get(0);
assertEquals(NEXT_HOP, node.getNodeId().getValue());
assertEquals(ROUTE_IP6PREFIX, node.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix().get(0).getPrefix().getIpv6Prefix().getValue());
return topology;
});
// update route
updateIpv6Route(createIpv6Route(NEW_NEXT_HOP));
readDataOperational(getDataBroker(), this.ipv6TopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(1, topology.getNode().size());
final Node nodeUpdated = topology.getNode().get(0);
assertEquals(NEW_NEXT_HOP, nodeUpdated.getNodeId().getValue());
assertEquals(ROUTE_IP6PREFIX, nodeUpdated.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix().get(0).getPrefix().getIpv6Prefix().getValue());
return topology;
});
// delete route
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, this.ipv6RouteIID);
wTx.submit();
readDataOperational(getDataBroker(), this.ipv6TopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(0, topology.getNode().size());
return topology;
});
this.ipv6TopoBuilder.close();
checkNotPresentOperational(getDataBroker(), this.ipv6TopoBuilder.getInstanceIdentifier());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated in project openflowplugin by opendaylight.
the class NodeNotificationSupplierImplTest method testCreate.
@Test
public void testCreate() {
final NodeUpdated notification = notifSupplierImpl.createNotification(createTestFlowCapableNode(), createTestFlowCapableNodePath());
assertNotNull(notification);
assertEquals(FLOW_NODE_ID, notification.getId().getValue());
assertEquals(FLOW_NODE_ID, notification.getNodeRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated in project bgpcep by opendaylight.
the class Ipv4ReachabilityTopologyBuilderTest method testIpv4ReachabilityTopologyBuilder.
@Test
public void testIpv4ReachabilityTopologyBuilder() throws TransactionCommitFailedException, ReadFailedException {
// create route
updateIpv4Route(createIpv4Route(NEXT_HOP));
readDataOperational(getDataBroker(), this.ipv4TopoBuilder.getInstanceIdentifier(), topology -> {
final TopologyTypes1 topologyTypes = topology.getTopologyTypes().getAugmentation(TopologyTypes1.class);
assertNotNull(topologyTypes);
assertNotNull(topologyTypes.getBgpIpv4ReachabilityTopology());
assertEquals(1, topology.getNode().size());
final Node node = topology.getNode().get(0);
assertEquals(NEXT_HOP, node.getNodeId().getValue());
assertEquals(ROUTE_IP4PREFIX, node.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix().get(0).getPrefix().getIpv4Prefix().getValue());
return topology;
});
// update route
updateIpv4Route(createIpv4Route(NEW_NEXT_HOP));
readDataOperational(getDataBroker(), this.ipv4TopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(1, topology.getNode().size());
final Node nodeUpdated = topology.getNode().get(0);
assertEquals(NEW_NEXT_HOP, nodeUpdated.getNodeId().getValue());
assertEquals(ROUTE_IP4PREFIX, nodeUpdated.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix().get(0).getPrefix().getIpv4Prefix().getValue());
return topology;
});
// delete route
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, this.ipv4RouteIID);
wTx.submit();
readDataOperational(getDataBroker(), this.ipv4TopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(0, topology.getNode().size());
return topology;
});
this.ipv4TopoBuilder.close();
checkNotPresentOperational(getDataBroker(), this.ipv4TopoBuilder.getInstanceIdentifier());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated in project openflowplugin by opendaylight.
the class NodeNotificationSupplierImpl method createNotification.
@Override
public NodeUpdated createNotification(final FlowCapableNode flowCapableNode, final InstanceIdentifier<FlowCapableNode> ii) {
Preconditions.checkArgument(flowCapableNode != null);
Preconditions.checkArgument(ii != null);
final FlowCapableNodeUpdatedBuilder flowNodeNotifBuilder = new FlowCapableNodeUpdatedBuilder(flowCapableNode);
final NodeUpdatedBuilder notifBuilder = new NodeUpdatedBuilder();
notifBuilder.setId(ii.firstKeyOf(Node.class, NodeKey.class).getId());
notifBuilder.setNodeRef(new NodeRef(getNodeII(ii)));
notifBuilder.addAugmentation(FlowCapableNodeUpdated.class, flowNodeNotifBuilder.build());
return notifBuilder.build();
}
Aggregations