use of org.onosproject.incubator.net.l2monitoring.cfm.MepEntry 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.MepEntry 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.MepEntry 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.MepEntry in project onos by opennetworkinglab.
the class SoamManagerTest method testCreateDmNoBehavior.
@Test
public void testCreateDmNoBehavior() throws CfmConfigException, SoamConfigException {
final DeviceId deviceId3 = DeviceId.deviceId("netconf:3.2.3.4:830");
final MepId mepId3 = MepId.valueOf((short) 3);
Map<Class<? extends Behaviour>, Class<? extends Behaviour>> behaviours = new HashMap<>();
behaviours.put(DeviceDescriptionDiscovery.class, TestDeviceDiscoveryBehavior.class);
Driver testDriver3 = new DefaultDriver(TEST_DRIVER_3, new ArrayList<Driver>(), TEST_MFR, TEST_HW_VERSION, TEST_SW_3, behaviours, new HashMap<>());
Device device3 = new DefaultDevice(ProviderId.NONE, deviceId3, Device.Type.SWITCH, TEST_MFR, TEST_HW_VERSION, TEST_SW_3, TEST_SN, new ChassisId(2), DefaultAnnotations.builder().set(AnnotationKeys.DRIVER, TEST_DRIVER_3).build());
expect(deviceService.getDevice(deviceId3)).andReturn(device3).anyTimes();
replay(deviceService);
MepEntry mep3 = DefaultMepEntry.builder(mepId3, deviceId3, PortNumber.P0, Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).buildEntry();
expect(mepService.getMep(MDNAME1, MANAME1, mepId3)).andReturn(mep3).anyTimes();
replay(mepService);
expect(driverService.getDriver(deviceId3)).andReturn(testDriver3).anyTimes();
replay(driverService);
DelayMeasurementCreate dmCreate1 = DefaultDelayMeasurementCreate.builder(DelayMeasurementCreate.DmType.DM1DMTX, DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 11), Mep.Priority.PRIO3).binsPerFdInterval((short) 4).binsPerFdrInterval((short) 5).binsPerIfdvInterval((short) 6).build();
try {
soamManager.createDm(MDNAME1, MANAME1, mepId3, dmCreate1);
fail("Expecting exception since device does not support behavior");
} catch (CfmConfigException e) {
assertEquals("Device netconf:3.2.3.4:830 from MEP :md-1/" + "ma-1-1/3 does not implement SoamDmProgrammable", e.getMessage());
}
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MepEntry in project onos by opennetworkinglab.
the class CfmMepManagerTest method testGetMep.
@Test
public void testGetMep() throws CfmConfigException {
expect(mdService.getMaintenanceAssociation(MDNAME1, MANAME1)).andReturn(Optional.ofNullable(ma1)).anyTimes();
replay(mdService);
expect(deviceService.getDevice(DEVICE_ID1)).andReturn(device1).anyTimes();
replay(deviceService);
expect(driverService.getDriver(DEVICE_ID1)).andReturn(testDriver).anyTimes();
replay(driverService);
MepEntry mepEntry = mepManager.getMep(MDNAME1, MANAME1, MEPID1);
assertEquals(MEPID1.value(), mepEntry.mepId().value());
}
Aggregations