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