Search in sources :

Example 1 with NetworkTopologyBuilder

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.get.topologies.output.NetworkTopologyBuilder in project bgpcep by opendaylight.

the class AbstractTopologyBuilderTest method createEmptyTopology.

private void createEmptyTopology() {
    final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
    wTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(), new NetworkTopologyBuilder().setTopology(Map.of()).build());
    wTx.commit();
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder)

Example 2 with NetworkTopologyBuilder

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.get.topologies.output.NetworkTopologyBuilder in project bgpcep by opendaylight.

the class TopologyStatsRpcServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    rpcService = new TopologyStatsRpcServiceImpl(getDataBroker());
    rpcService.init();
    // PCEP topology with one PCC node
    final Topology t1 = createTopology(TOPOLOGY_ID1, BindingMap.of(createPcepNode(NODE_ID1)));
    // PCEP topology with two PCC node
    final Topology t2 = createTopology(TOPOLOGY_ID2, BindingMap.of(createPcepNode(NODE_ID2), createPcepNode(NODE_ID3)));
    // Non-PCEP topology with one non-PCC node
    final Topology t3 = createTopology(NONPCEP_TOPOLOGY, BindingMap.of(new NodeBuilder().setNodeId(new NodeId(NONPCEP_NODE)).build()));
    final WriteTransaction wtx = getDataBroker().newWriteOnlyTransaction();
    final NetworkTopologyBuilder ntb = new NetworkTopologyBuilder();
    ntb.setTopology(BindingMap.of(t1, t2, t3));
    wtx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(), ntb.build());
    wtx.commit().get();
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) NodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder) Before(org.junit.Before)

Example 3 with NetworkTopologyBuilder

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.get.topologies.output.NetworkTopologyBuilder in project netconf by opendaylight.

the class NetconfTopologyManager method initTopology.

private void initTopology(final WriteTransaction wtx, final LogicalDatastoreType datastoreType) {
    final NetworkTopology networkTopology = new NetworkTopologyBuilder().build();
    final InstanceIdentifier<NetworkTopology> networkTopologyId = InstanceIdentifier.builder(NetworkTopology.class).build();
    wtx.merge(datastoreType, networkTopologyId, networkTopology);
    final Topology topology = new TopologyBuilder().setTopologyId(new TopologyId(topologyId)).build();
    wtx.merge(datastoreType, networkTopologyId.child(Topology.class, new TopologyKey(new TopologyId(topologyId))), topology);
}
Also used : TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 4 with NetworkTopologyBuilder

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.get.topologies.output.NetworkTopologyBuilder in project netconf by opendaylight.

the class NetconfTopologyImpl method initTopology.

private void initTopology(final WriteTransaction wtx, final LogicalDatastoreType datastoreType) {
    final NetworkTopology networkTopology = new NetworkTopologyBuilder().build();
    final InstanceIdentifier<NetworkTopology> networkTopologyId = InstanceIdentifier.builder(NetworkTopology.class).build();
    wtx.merge(datastoreType, networkTopologyId, networkTopology);
    final Topology topology = new TopologyBuilder().setTopologyId(new TopologyId(topologyId)).build();
    wtx.merge(datastoreType, networkTopologyId.child(Topology.class, new TopologyKey(new TopologyId(topologyId))), topology);
}
Also used : 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) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) AbstractNetconfTopology(org.opendaylight.netconf.topology.spi.AbstractNetconfTopology) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 5 with NetworkTopologyBuilder

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.get.topologies.output.NetworkTopologyBuilder in project netconf by opendaylight.

the class NetconfTopologyImplTest method testInit.

@Test
public void testInit() {
    final WriteTransaction wtx = mock(WriteTransaction.class);
    when(dataBroker.newWriteOnlyTransaction()).thenReturn(wtx);
    doNothing().when(wtx).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(DataObject.class));
    doReturn(emptyFluentFuture()).when(wtx).commit();
    topology.init();
    // verify initialization of topology
    final InstanceIdentifier<NetworkTopology> networkTopologyId = InstanceIdentifier.builder(NetworkTopology.class).build();
    final Topology topo = new TopologyBuilder().setTopologyId(new TopologyId(TOPOLOGY_ID)).build();
    final NetworkTopology networkTopology = new NetworkTopologyBuilder().build();
    verify(wtx).merge(LogicalDatastoreType.CONFIGURATION, networkTopologyId, networkTopology);
    verify(wtx).merge(LogicalDatastoreType.OPERATIONAL, networkTopologyId, networkTopology);
    verify(wtx).merge(LogicalDatastoreType.CONFIGURATION, networkTopologyId.child(Topology.class, new TopologyKey(new TopologyId(TOPOLOGY_ID))), topo);
    verify(wtx).merge(LogicalDatastoreType.OPERATIONAL, networkTopologyId.child(Topology.class, new TopologyKey(new TopologyId(TOPOLOGY_ID))), topo);
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) NetworkTopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) AbstractNetconfTopology(org.opendaylight.netconf.topology.spi.AbstractNetconfTopology) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId) Test(org.junit.Test)

Aggregations

NetworkTopology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology)6 NetworkTopologyBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder)6 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)6 TopologyBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder)5 TopologyId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)4 WriteTransaction (org.opendaylight.mdsal.binding.api.WriteTransaction)3 TopologyKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey)3 AbstractNetconfTopology (org.opendaylight.netconf.topology.spi.AbstractNetconfTopology)2 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)2 Preconditions (com.google.common.base.Preconditions)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Before (org.junit.Before)1 Test (org.junit.Test)1 ReadTransaction (org.opendaylight.mdsal.binding.api.ReadTransaction)1