use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project genius by opendaylight.
the class TepCommandHelper method configureTunnelMonitorInterval.
public void configureTunnelMonitorInterval(int interval) {
InstanceIdentifier<TunnelMonitorInterval> path = InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
Optional<TunnelMonitorInterval> storedTunnelMonitor = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
if (!storedTunnelMonitor.isPresent() || storedTunnelMonitor.get().getInterval() != interval) {
TunnelMonitorInterval tunnelMonitor = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, tunnelMonitor, dataBroker, ItmUtils.DEFAULT_CALLBACK);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project genius by opendaylight.
the class DpnTepStateCache method added.
@Override
protected void added(InstanceIdentifier<DpnsTeps> path, DpnsTeps dpnsTeps) {
for (RemoteDpns remoteDpns : dpnsTeps.getRemoteDpns()) {
final String dpn = getDpnId(dpnsTeps.getSourceDpnId(), remoteDpns.getDestinationDpnId());
DpnTepInterfaceInfo value = new DpnTepInterfaceInfoBuilder().setTunnelName(remoteDpns.getTunnelName()).setGroupId(dpnsTeps.getGroupId()).setIsMonitoringEnabled(remoteDpns.isMonitoringEnabled()).setIsMonitoringEnabled(remoteDpns.isInternal()).setTunnelType(dpnsTeps.getTunnelType()).build();
dpnTepInterfaceMap.put(dpn, value);
addTunnelEndPointInfoToCache(remoteDpns.getTunnelName(), dpnsTeps.getSourceDpnId().toString(), remoteDpns.getDestinationDpnId().toString());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project genius by opendaylight.
the class TepCommandHelper method configureTunnelMonitorParams.
public void configureTunnelMonitorParams(boolean monitorEnabled, String monitorProtocol) {
InstanceIdentifier<TunnelMonitorParams> path = InstanceIdentifier.builder(TunnelMonitorParams.class).build();
Optional<TunnelMonitorParams> storedTunnelMonitor = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
Class<? extends TunnelMonitoringTypeBase> monitorType;
if (storedTunnelMonitor.isPresent() && storedTunnelMonitor.get().getMonitorProtocol() != null) {
monitorType = storedTunnelMonitor.get().getMonitorProtocol();
} else {
if (monitorProtocol != null && monitorProtocol.equalsIgnoreCase(ITMConstants.MONITOR_TYPE_LLDP)) {
monitorType = TunnelMonitoringTypeLldp.class;
} else {
monitorType = TunnelMonitoringTypeBfd.class;
}
}
if (!storedTunnelMonitor.isPresent() || storedTunnelMonitor.get().isEnabled() != monitorEnabled) {
TunnelMonitorParams tunnelMonitor = new TunnelMonitorParamsBuilder().setEnabled(monitorEnabled).setMonitorProtocol(monitorType).build();
ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, tunnelMonitor, dataBroker, ItmUtils.DEFAULT_CALLBACK);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project genius by opendaylight.
the class SrmRpcUtils method callSrmOp.
public static ReinstallOutput callSrmOp(DataBroker broker, ReinstallInput input) {
ReinstallOutputBuilder outputBuilder = new ReinstallOutputBuilder();
if (input.getEntityName() == null) {
outputBuilder.setSuccessful(REINSTALL_FAILED).setMessage("EntityName is null");
return outputBuilder.build();
}
if (input.getEntityType() == null) {
outputBuilder.setSuccessful(REINSTALL_FAILED).setMessage(String.format("EntityType for %s can't be null", input.getEntityName().getSimpleName()));
return outputBuilder.build();
}
if (!EntityTypeService.class.equals(input.getEntityType())) {
outputBuilder.setSuccessful(REINSTALL_FAILED).setMessage(String.format("EntityType is %s, Reinstall is only for EntityTypeService", input.getEntityType()));
return outputBuilder.build();
}
Class<? extends EntityNameBase> serviceName = NAME_TO_SERVICE_MAP.get(input.getEntityName());
if (serviceName == null) {
outputBuilder.setSuccessful(REINSTALL_FAILED).setMessage(String.format("EntityName %s has no matching service", input.getEntityName().getSimpleName()));
return outputBuilder.build();
}
Class<? extends EntityTypeBase> entityType = NAME_TO_TYPE_MAP.get(input.getEntityName());
if (entityType == null || !input.getEntityType().equals(entityType)) {
outputBuilder.setSuccessful(REINSTALL_FAILED).setMessage(String.format("EntityName %s doesn't match with EntityType %s", input.getEntityName().getSimpleName(), entityType));
return outputBuilder.build();
}
OperationsBuilder opsBuilder = new OperationsBuilder().setEntityName(input.getEntityName()).setEntityType(entityType).setTriggerOperation(ServiceOpReinstall.class);
Operations operation = opsBuilder.build();
InstanceIdentifier<Operations> opsIid = getInstanceIdentifier(operation, serviceName);
WriteTransaction tx = broker.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.OPERATIONAL, opsIid, operation, CREATE_MISSING_PARENT);
try {
tx.submit().get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error writing RecoveryOp to datastore. path:{}, data:{}", opsIid, operation);
outputBuilder.setSuccessful(REINSTALL_FAILED).setMessage(e.getMessage());
return outputBuilder.build();
}
outputBuilder.setSuccessful(REINSTALL_SUCCESS).setMessage("Recovery operation successfully triggered");
return outputBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project bgpcep by opendaylight.
the class BasePathSelectorTest method testBestPathSelectionOptions.
@Test
public void testBestPathSelectionOptions() {
AttributesBuilder dataContBuilder = createStateFromPrefMedOriginASPath();
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
BaseBestPath processedPath = this.selector.result();
assertEquals(1, processedPath.getState().getOrigin().getIntValue());
// prefer the path with the lowest origin type
addIgpOrigin(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(0, processedPath.getState().getOrigin().getIntValue());
addEgpOrigin(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(0, processedPath.getState().getOrigin().getIntValue());
// prefer the path with the lowest multi-exit discriminator (MED)
assertEquals(4321L, (long) processedPath.getState().getMultiExitDisc());
addIgpOrigin(dataContBuilder);
addLowerMultiExitDisc(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(1234L, (long) processedPath.getState().getMultiExitDisc());
addHigherMultiExitDisc(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(1234L, (long) processedPath.getState().getMultiExitDisc());
addLowerMultiExitDisc(dataContBuilder);
addAsPath(dataContBuilder, SEQ_SEGMENT2);
assertEquals(1L, processedPath.getState().getPeerAs());
assertEquals(3, processedPath.getState().getAsPathLength());
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(1L, processedPath.getState().getPeerAs());
assertEquals(3, processedPath.getState().getAsPathLength());
}
Aggregations