use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId 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.TopologyId 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.TopologyId in project genius by opendaylight.
the class HwVtepTunnelsStateHandler method startMonitoringTask.
@Override
public void startMonitoringTask(MonitoringInfo monitorInfo) {
EndpointType source = monitorInfo.getSource().getEndpointType();
if (source instanceof Interface) {
Interface intf = (Interface) source;
intf.getInterfaceName();
} else {
LOG.warn("Invalid source endpoint. Could not retrieve source interface to configure BFD");
return;
}
MonitorProfile profile;
long profileId = monitorInfo.getProfileId();
Optional<MonitorProfile> optProfile = alivenessMonitor.getMonitorProfile(profileId);
if (optProfile.isPresent()) {
profile = optProfile.get();
} else {
LOG.warn("No monitor profile associated with id {}. " + "Could not send Monitor packet for monitor-id {}", profileId, monitorInfo);
return;
}
// TODO: get the corresponding hwvtep tunnel from the sourceInterface
// once InterfaceMgr
// Implements renderer for hwvtep VXLAN tunnels
String tunnelLocalMacAddress = "<TODO>";
String tunnelLocalIpAddress = "<TODO>";
String tunnelRemoteMacAddress = "<TODO>";
List<BfdParams> bfdParams = new ArrayList<>();
fillBfdParams(bfdParams, profile);
List<BfdLocalConfigs> bfdLocalConfigs = new ArrayList<>();
fillBfdLocalConfigs(bfdLocalConfigs, tunnelLocalMacAddress, tunnelLocalIpAddress);
List<BfdRemoteConfigs> bfdRemoteConfigs = new ArrayList<>();
fillBfdRemoteConfigs(bfdRemoteConfigs, tunnelRemoteMacAddress);
// tunnelKey is initialized to null and passed to setKey which FindBugs flags as a
// "Load of known null value" violation. Not sure sure what the intent is...
// TunnelsKey tunnelKey = null;
Tunnels tunnelWithBfd = new TunnelsBuilder().setKey(/*tunnelKey*/
null).setBfdParams(bfdParams).setBfdLocalConfigs(bfdLocalConfigs).setBfdRemoteConfigs(bfdRemoteConfigs).build();
// TODO: get the following parameters from the interface and use it to
// update hwvtep datastore
// and not sure sure tunnels are creating immediately once interface mgr
// writes termination point
// into hwvtep datastore. if tunnels are not created during that time,
// then start monitoring has to
// be done as part of tunnel add DCN handling.
String topologyId = "";
String nodeId = "";
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, getTunnelIdentifier(topologyId, nodeId, new TunnelsKey(/*localRef*/
null, /*remoteRef*/
null)), tunnelWithBfd);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.
the class NetworkTopologyConfigFileProcessorTest method configFileTest.
@Test
public void configFileTest() throws ReadFailedException, InterruptedException {
final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId("topology-test")));
checkNotPresentConfiguration(getDataBroker(), topologyIIdKeyed);
assertNotNull(ClassLoader.getSystemClassLoader().getResource("initial/network-topology-config.xml"));
final NetworkTopologyConfigFileProcessor processor = new NetworkTopologyConfigFileProcessor(this.configLoader, getDataBroker());
processor.init();
checkPresentConfiguration(getDataBroker(), topologyIIdKeyed);
assertEquals(SchemaPath.create(true, NetworkTopology.QNAME), processor.getSchemaPath());
processor.close();
}
Aggregations