use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class PCEPTopologyDeployerImpl method updateTopologyProvider.
private synchronized void updateTopologyProvider(final Topology topology) {
if (!filterPcepTopologies(topology.getTopologyTypes())) {
return;
}
final TopologyId topologyId = topology.getTopologyId();
LOG.info("Updating Topology {}", topologyId);
final PCEPTopologyProviderBean previous = this.pcepTopologyServices.remove(topology.getTopologyId());
closeTopology(previous, topologyId);
createTopologyProvider(topology);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class PCEPTopologyDeployerImpl method createTopologyProvider.
private synchronized void createTopologyProvider(final Topology topology) {
if (!filterPcepTopologies(topology.getTopologyTypes())) {
return;
}
final TopologyId topologyId = topology.getTopologyId();
if (this.pcepTopologyServices.containsKey(topology.getTopologyId())) {
LOG.warn("Topology Provider {} already exist. New instance won't be created", topologyId);
return;
}
LOG.info("Creating Topology {}", topologyId);
LOG.trace("Topology {}.", topology);
final SessionConfig config = topology.getAugmentation(PcepTopologyTypeConfig.class).getSessionConfig();
final InstructionScheduler instructionScheduler = this.instructionSchedulerFactory.createInstructionScheduler(topologyId.getValue());
final PCEPTopologyConfiguration dependencies = new PCEPTopologyConfiguration(config, topology);
final PCEPTopologyProviderBean pcepTopologyProviderBean = (PCEPTopologyProviderBean) this.container.getComponentInstance(PCEPTopologyProviderBean.class.getSimpleName());
this.pcepTopologyServices.put(topologyId, pcepTopologyProviderBean);
pcepTopologyProviderBean.start(dependencies, instructionScheduler);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class PCEPTopologyProviderUtil method contructSpeakersId.
static SpeakerIdMapping contructSpeakersId(final Topology topology) {
final SpeakerIdMapping ret = SpeakerIdMapping.getSpeakerIdMap();
topology.getNode().stream().filter(Objects::nonNull).filter(node -> node.getAugmentation(PcepNodeConfig.class) != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig() != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig().getAugmentation(PcepNodeSyncConfig.class) != null).forEach(node -> {
final PcepNodeConfig config = node.getAugmentation(PcepNodeConfig.class);
final PcepNodeSyncConfig nodeSyncConfig = config.getSessionConfig().getAugmentation(PcepNodeSyncConfig.class);
final InetAddress address = InetAddresses.forString(node.getNodeId().getValue());
ret.put(address, nodeSyncConfig.getSpeakerEntityIdValue());
});
return ret;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class AbstractTopologyBuilder method registerDataChangeListener.
/**
* Register to data tree change listener.
*/
private synchronized void registerDataChangeListener() {
Preconditions.checkState(this.listenerRegistration == null, "Topology Listener on topology %s has been registered before.", this.getInstanceIdentifier());
final InstanceIdentifier<Tables> tablesId = this.locRibReference.getInstanceIdentifier().child(LocRib.class).child(Tables.class, new TablesKey(this.afi, this.safi));
final DataTreeIdentifier<T> id = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, getRouteWildcard(tablesId));
this.listenerRegistration = this.dataProvider.registerDataTreeChangeListener(id, this);
LOG.debug("Registered listener {} on topology {}. Timestamp={}", this, this.getInstanceIdentifier(), this.listenerScheduledRestartTime);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology 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());
}
Aggregations