use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class MaintenanceAssociationTest method setUp.
@Before
public void setUp() throws Exception {
try {
ma1 = DefaultMaintenanceAssociation.builder(MaIdCharStr.asMaId("ma-1"), 10).ccmInterval(CcmInterval.INTERVAL_1MIN).maNumericId((short) 1).build();
ma2 = DefaultMaintenanceAssociation.builder(MaIdPrimaryVid.asMaId("1024"), 10).build();
ma3 = DefaultMaintenanceAssociation.builder(MaId2Octet.asMaId("33333"), 10).build();
ma4 = DefaultMaintenanceAssociation.builder(MaIdRfc2685VpnId.asMaIdHex("0A:0B:0C:0D:0E:0F:00"), 10).build();
} catch (CfmConfigException e) {
throw new Exception(e);
}
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class DelayMeasurementCreateTest method setUp.
@Before
public void setUp() throws Exception, CfmConfigException, SoamConfigException {
DelayMeasurementThreshold dmT1 = DefaultDelayMeasurementThreshold.builder(SoamId.valueOf(1)).averageFrameDelayBackward(Duration.ofMillis(123)).averageInterFrameDelayVariationForward(Duration.ofMillis(321)).build();
DelayMeasurementThreshold dmT2 = DefaultDelayMeasurementThreshold.builder(SoamId.valueOf(2)).averageFrameDelayBackward(Duration.ofMillis(456)).averageInterFrameDelayVariationForward(Duration.ofMillis(654)).build();
try {
DefaultDmCreateBuilder builder = (DefaultDmCreateBuilder) DefaultDelayMeasurementCreate.builder(DmType.DMDMM, Version.Y17312011, MepId.valueOf((short) 12), Priority.PRIO6).addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_FORWARD_MIN).addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_FORWARD_AVERAGE).addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_FORWARD_MAX).addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_FORWARD_BINS).binsPerFdInterval((short) 8).binsPerIfdvInterval((short) 9).ifdvSelectionOffset((short) 10).binsPerFdrInterval((short) 12).addToThresholds(dmT1).addToThresholds(dmT2).messagePeriod(Duration.ofMillis(100L)).frameSize((short) 64).dataPattern(DataPattern.ONES).testTlvIncluded(true).testTlvPattern(TestTlvPattern.NULL_SIGNAL_WITHOUT_CRC_32).measurementInterval(Duration.ofMinutes(15)).numberIntervalsStored((short) 32).alignMeasurementIntervals(true).alignMeasurementOffset(Duration.ofMinutes(4)).sessionType(SessionType.ONDEMAND).startTime(StartTime.relative(Duration.ofMinutes(7))).stopTime(StopTime.relative(Duration.ofMinutes(8)));
dm1 = builder.build();
} catch (SoamConfigException e) {
throw new Exception(e);
}
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class CfmMepManager method processDeviceRemoved.
/**
* This removes a MEP from the internal list of Meps, and updates remote meps list on other Meps.
* Note: This does not call the device's CfmMepProgrammable, because there
* would be no point as the device has already been removed from ONOS.
* The configuration for this MEP may still be present on the actual device, and
* any future config would have to be careful to wipe the Mep from the device
* before applying a Mep again
* @param removedDevice The device that has been removed
*/
protected void processDeviceRemoved(Device removedDevice) {
log.warn("Remove Mep(s) associated with Device: " + removedDevice.id());
Collection<Mep> mepListForDevice = mepStore.getMepsByDeviceId(removedDevice.id());
for (Mep mep : mepStore.getAllMeps()) {
for (Mep mepForDevice : mepListForDevice) {
if (mep.mdId().equals(mepForDevice.mdId()) && mep.maId().equals(mepForDevice.maId())) {
Device mepDevice = deviceService.getDevice(mep.deviceId());
log.info("Removing Remote Mep {} from MA{} on device {}", mepForDevice.mepId(), mep.mdId().mdName() + "/" + mep.maId().maName(), mepDevice.id());
try {
mepDevice.as(CfmMepProgrammable.class).deleteMaRemoteMepOnDevice(mep.mdId(), mep.maId(), mepForDevice.mepId());
} catch (CfmConfigException e) {
log.error("Error when removing Remote Mep {} from MA {}. Continuing.", mep.mdId().mdName() + "/" + mep.maId().maName(), mepForDevice.mepId());
}
}
}
}
for (Iterator<Mep> iter = mepListForDevice.iterator(); iter.hasNext(); ) {
mepStore.deleteMep(new MepKeyId(iter.next()));
}
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class CfmMepManager method getMep.
@Override
public MepEntry getMep(MdId mdName, MaIdShort maName, MepId mepId) throws CfmConfigException {
MepKeyId key = new MepKeyId(mdName, maName, mepId);
// Will throw IllegalArgumentException if ma does not exist
cfmMdService.getMaintenanceAssociation(mdName, maName);
Optional<Mep> mepOptional = mepStore.getMep(key);
if (mepOptional.isPresent()) {
Mep mep = mepOptional.get();
DeviceId mepDeviceId = mep.deviceId();
if (deviceService.getDevice(mepDeviceId) == null) {
throw new CfmConfigException("Device not found " + mepDeviceId);
} else if (!deviceService.getDevice(mepDeviceId).is(CfmMepProgrammable.class)) {
throw new CfmConfigException("Device " + mepDeviceId + " does not support CfmMepProgrammable behaviour.");
}
log.debug("Retrieving MEP reults for Mep {} in MD {}, MA {} on Device {}", mep.mepId(), mdName, maName, mepDeviceId);
return deviceService.getDevice(mepDeviceId).as(CfmMepProgrammable.class).getMep(mdName, maName, mepId);
} else {
return null;
}
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class CfmMepManager method processMaRemoved.
protected void processMaRemoved(MdId mdId, MaIdShort maId, MaintenanceDomain oldMd) {
Set<DeviceId> deviceIdsRemoved = new HashSet<>();
for (Iterator<Mep> iter = mepStore.getMepsByMdMa(mdId, maId).iterator(); iter.hasNext(); ) {
Mep mepForMdMa = iter.next();
DeviceId mepDeviceId = mepForMdMa.deviceId();
try {
deviceService.getDevice(mepDeviceId).as(CfmMepProgrammable.class).deleteMep(mdId, maId, mepForMdMa.mepId(), Optional.of(oldMd));
deviceIdsRemoved.add(mepDeviceId);
} catch (CfmConfigException e) {
log.warn("Could not delete MEP {} from Device {}", mepForMdMa.mepId(), mepDeviceId, e);
}
iter.remove();
log.info("Removed MEP {} from Device {} because MA {} was deleted", mepForMdMa.mepId(), mepDeviceId, mdId.mdName() + "/" + maId.maName());
}
deviceIdsRemoved.forEach(deviceId -> {
try {
deviceService.getDevice(deviceId).as(CfmMepProgrammable.class).deleteMaOnDevice(mdId, maId, Optional.of(oldMd));
} catch (CfmConfigException e) {
log.warn("Could not delete MA {} from Device {}", mdId.mdName() + "/" + maId.maName(), deviceId, e);
}
});
}
Aggregations