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 SoamManager method getDm.
@Override
public DelayMeasurementEntry getDm(MdId mdName, MaIdShort maName, MepId mepId, SoamId dmId) throws CfmConfigException, SoamConfigException {
MepEntry mep = cfmMepService.getMep(mdName, maName, mepId);
if (mep == null || mep.deviceId() == null) {
throw new CfmConfigException("MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (deviceService.getDevice(mep.deviceId()) == null) {
throw new CfmConfigException("Device " + mep.deviceId() + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (!deviceService.getDevice(mep.deviceId()).is(SoamDmProgrammable.class)) {
throw new CfmConfigException("Device " + mep.deviceId() + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not implement SoamDmProgrammable");
}
log.debug("Retrieving DM for DM {} in MD {}, MA {}, MEP {} on Device {}", dmId, mdName, maName, mepId, mep.deviceId());
return deviceService.getDevice(mep.deviceId()).as(SoamDmProgrammable.class).getDm(mdName, maName, mepId, dmId);
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class SoamManager method getDmHistoricalStats.
@Override
public Collection<DelayMeasurementStatHistory> getDmHistoricalStats(MdId mdName, MaIdShort maName, MepId mepId, SoamId dmId) throws SoamConfigException, CfmConfigException {
MepEntry mep = cfmMepService.getMep(mdName, maName, mepId);
if (mep == null || mep.deviceId() == null) {
throw new CfmConfigException("MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (deviceService.getDevice(mep.deviceId()) == null) {
throw new CfmConfigException("Device " + mep.deviceId() + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (!deviceService.getDevice(mep.deviceId()).is(SoamDmProgrammable.class)) {
throw new CfmConfigException("Device " + mep.deviceId() + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not implement SoamDmProgrammable");
}
log.debug("Retrieving History Stats for DM {} in MD {}, MA {}, MEP {} " + "on Device {}", dmId, mdName, maName, mepId, mep.deviceId());
return deviceService.getDevice(mep.deviceId()).as(SoamDmProgrammable.class).getDmHistoricalStats(mdName, maName, mepId, dmId);
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class SoamManager method getDmCurrentStat.
@Override
public DelayMeasurementStatCurrent getDmCurrentStat(MdId mdName, MaIdShort maName, MepId mepId, SoamId dmId) throws CfmConfigException, SoamConfigException {
MepEntry mep = cfmMepService.getMep(mdName, maName, mepId);
if (mep == null || mep.deviceId() == null) {
throw new CfmConfigException("MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (deviceService.getDevice(mep.deviceId()) == null) {
throw new CfmConfigException("Device " + mep.deviceId() + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (!deviceService.getDevice(mep.deviceId()).is(SoamDmProgrammable.class)) {
throw new CfmConfigException("Device " + mep.deviceId() + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not implement SoamDmProgrammable");
}
log.debug("Retrieving Current Stats for DM {} in MD {}, MA {}, MEP {} " + "on Device {}", dmId, mdName, maName, mepId, mep.deviceId());
return deviceService.getDevice(mep.deviceId()).as(SoamDmProgrammable.class).getDmCurrentStat(mdName, maName, mepId, dmId);
}
use of org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException in project onos by opennetworkinglab.
the class SoamManager method createDm.
@Override
public Optional<SoamId> createDm(MdId mdName, MaIdShort maName, MepId mepId, DelayMeasurementCreate dmNew) throws CfmConfigException, SoamConfigException {
DeviceId mepDeviceId = cfmMepService.getMep(mdName, maName, mepId).deviceId();
if (mepDeviceId == null) {
throw new CfmConfigException("Unable to create DM. MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (deviceService.getDevice(mepDeviceId) == null) {
throw new CfmConfigException("Device " + mepDeviceId + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not exist");
} else if (!deviceService.getDevice(mepDeviceId).is(SoamDmProgrammable.class)) {
throw new CfmConfigException("Device " + mepDeviceId + " from MEP :" + mdName + "/" + maName + "/" + mepId + " does not implement SoamDmProgrammable");
}
log.debug("Creating new DM in MD {}, MA {}, MEP {} on Device {}", mdName, maName, mepId, mepDeviceId);
return deviceService.getDevice(mepDeviceId).as(SoamDmProgrammable.class).createDm(mdName, maName, mepId, dmNew);
}
Aggregations