Search in sources :

Example 1 with TopologyTypes1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1 in project bgpcep by opendaylight.

the class ServerSessionManager method instantiateServiceInstance.

/**
 * Create Base Topology.
 */
synchronized void instantiateServiceInstance() {
    final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
    final TopologyId topologyId = key.getTopologyId();
    final WriteTransaction tx = this.dependenciesProvider.getDataBroker().newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().setKey(key).setTopologyId(topologyId).setTopologyTypes(new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(new TopologyPcepBuilder().build()).build()).build()).setNode(new ArrayList<>()).build(), true);
    try {
        tx.submit().get();
        LOG.info("PCEP Topology {} created successfully.", topologyId.getValue());
        ServerSessionManager.this.isClosed.set(false);
    } catch (final ExecutionException | InterruptedException throwable) {
        LOG.error("Failed to create PCEP Topology {}.", topologyId.getValue(), throwable);
        ServerSessionManager.this.isClosed.set(true);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TopologyTypesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypesBuilder) TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1) TopologyTypes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1Builder) TopologyPcepBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.topology.pcep.type.TopologyPcepBuilder) ExecutionException(java.util.concurrent.ExecutionException) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 2 with TopologyTypes1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1 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());
}
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)

Example 3 with TopologyTypes1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1 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)

Example 4 with TopologyTypes1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1 in project bgpcep by opendaylight.

the class PCEPTunnelTopologyProvider method init.

synchronized void init() {
    final WriteTransaction tx = this.dataBroker.newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, getTopologyReference().getInstanceIdentifier(), new TopologyBuilder().setTopologyId(this.tunneltopologyId).setTopologyTypes(new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyTunnelPcep(new TopologyTunnelPcepBuilder().build()).build()).build()).setNode(new ArrayList<>()).build(), true);
    try {
        tx.submit().get();
    } catch (final InterruptedException | ExecutionException e) {
        LOG.error("Failed to create Tunnel Topology root", e);
    }
    this.reg = this.ncl.getDataProvider().registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, this.src), this.ncl);
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TopologyTunnelPcepBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.topology.tunnel.pcep.type.TopologyTunnelPcepBuilder) TopologyTypesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypesBuilder) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.TopologyTypes1) TopologyTypes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.TopologyTypes1Builder) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 ExecutionException (java.util.concurrent.ExecutionException)2 Test (org.junit.Test)2 TopologyTypes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.topology.types.rev160524.TopologyTypes1)2 TopologyBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder)2 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)2 TopologyTypesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypesBuilder)2 Node1 (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.Node1)2 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)1 TopologyTypes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1)1 TopologyTypes1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1Builder)1 TopologyPcepBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.topology.pcep.type.TopologyPcepBuilder)1 TopologyTypes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.TopologyTypes1)1 TopologyTypes1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.TopologyTypes1Builder)1 TopologyTunnelPcepBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.topology.tunnel.pcep.type.TopologyTunnelPcepBuilder)1 TopologyId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)1 TopologyKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey)1