Search in sources :

Example 1 with TopologyTypes

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes 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());
}
Also used : Node1(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.Node1) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.topology.types.rev160524.TopologyTypes1) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 TopologyTypes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.topology.types.rev160524.TopologyTypes1)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1 Node1 (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.Node1)1