Search in sources :

Example 16 with CfmConfigException

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;
    }
}
Also used : DeviceId(org.onosproject.net.DeviceId) CfmMepProgrammable(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMepProgrammable) Mep(org.onosproject.incubator.net.l2monitoring.cfm.Mep) CfmConfigException(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException) MepKeyId(org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepKeyId)

Example 17 with CfmConfigException

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);
}
Also used : SoamDmProgrammable(org.onosproject.incubator.net.l2monitoring.soam.SoamDmProgrammable) MepEntry(org.onosproject.incubator.net.l2monitoring.cfm.MepEntry) CfmConfigException(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)

Example 18 with CfmConfigException

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);
}
Also used : SoamDmProgrammable(org.onosproject.incubator.net.l2monitoring.soam.SoamDmProgrammable) MepEntry(org.onosproject.incubator.net.l2monitoring.cfm.MepEntry) CfmConfigException(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)

Example 19 with CfmConfigException

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);
}
Also used : SoamDmProgrammable(org.onosproject.incubator.net.l2monitoring.soam.SoamDmProgrammable) MepEntry(org.onosproject.incubator.net.l2monitoring.cfm.MepEntry) CfmConfigException(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)

Example 20 with CfmConfigException

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);
}
Also used : SoamDmProgrammable(org.onosproject.incubator.net.l2monitoring.soam.SoamDmProgrammable) DeviceId(org.onosproject.net.DeviceId) CfmConfigException(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)

Aggregations

CfmConfigException (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)50 MdId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId)27 MaIdShort (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort)23 Consumes (javax.ws.rs.Consumes)22 Produces (javax.ws.rs.Produces)22 MepId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId)17 Path (javax.ws.rs.Path)14 Mep (org.onosproject.incubator.net.l2monitoring.cfm.Mep)14 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)13 CfmMepService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMepService)12 DeviceId (org.onosproject.net.DeviceId)11 JsonNode (com.fasterxml.jackson.databind.JsonNode)10 SoamService (org.onosproject.incubator.net.l2monitoring.soam.SoamService)10 MepEntry (org.onosproject.incubator.net.l2monitoring.cfm.MepEntry)9 CfmMepProgrammable (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMepProgrammable)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 GET (javax.ws.rs.GET)7 MaintenanceDomain (org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain)7 MepKeyId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepKeyId)7 MaintenanceAssociation (org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation)6