use of org.openkilda.wfm.topology.switchmanager.service.ValidationService in project open-kilda by telstra.
the class ValidationServiceImplTest method validateMetersMissingAndExcessMeters.
@Test
public void validateMetersMissingAndExcessMeters() {
ValidationService validationService = new ValidationServiceImpl(persistenceManager().build());
MeterSpeakerData actualMeter = MeterSpeakerData.builder().meterId(new MeterId(33)).rate(10000).burst(10500).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.KBPS, MeterFlag.BURST, MeterFlag.STATS)).build();
MeterSpeakerData expectedMeter = MeterSpeakerData.builder().meterId(new MeterId(32)).rate(10000).burst(10500).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.KBPS, MeterFlag.BURST, MeterFlag.STATS)).build();
ValidateMetersResult response = validationService.validateMeters(SWITCH_ID_B, singletonList(actualMeter), singletonList(expectedMeter));
assertFalse(response.getMissingMeters().isEmpty());
assertMeter(response.getMissingMeters().get(0), 32, 10000, 10500, new String[] { "KBPS", "BURST", "STATS" });
assertTrue(response.getMisconfiguredMeters().isEmpty());
assertTrue(response.getProperMeters().isEmpty());
assertFalse(response.getExcessMeters().isEmpty());
assertMeter(response.getExcessMeters().get(0), 33, 10000, 10500, new String[] { "KBPS", "BURST", "STATS" });
}
use of org.openkilda.wfm.topology.switchmanager.service.ValidationService in project open-kilda by telstra.
the class ValidationServiceImplTest method validateMetersMisconfiguredMeters.
@Test
public void validateMetersMisconfiguredMeters() {
ValidationService validationService = new ValidationServiceImpl(persistenceManager().build());
MeterSpeakerData actualMeter = MeterSpeakerData.builder().meterId(new MeterId(32)).rate(10002).burst(10498).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.PKTPS, MeterFlag.BURST, MeterFlag.STATS)).build();
String[] actualFlags = new String[] { "PKTPS", "BURST", "STATS" };
MeterSpeakerData expectedMeter = MeterSpeakerData.builder().meterId(new MeterId(32)).rate(10000).burst(10500).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.KBPS, MeterFlag.BURST, MeterFlag.STATS)).build();
ValidateMetersResult response = validationService.validateMeters(SWITCH_ID_B, singletonList(actualMeter), singletonList(expectedMeter));
assertTrue(response.getMissingMeters().isEmpty());
assertFalse(response.getMisconfiguredMeters().isEmpty());
assertEquals(10002, (long) response.getMisconfiguredMeters().get(0).getActual().getRate());
assertEquals(10000, (long) response.getMisconfiguredMeters().get(0).getExpected().getRate());
assertEquals(10498L, (long) response.getMisconfiguredMeters().get(0).getActual().getBurstSize());
assertEquals(10500L, (long) response.getMisconfiguredMeters().get(0).getExpected().getBurstSize());
assertTrue(Sets.newHashSet(actualFlags).containsAll(Sets.newHashSet(response.getMisconfiguredMeters().get(0).getActual().getFlags())));
assertTrue(Sets.newHashSet("KBPS", "BURST", "STATS").containsAll(Sets.newHashSet(response.getMisconfiguredMeters().get(0).getExpected().getFlags())));
assertTrue(response.getProperMeters().isEmpty());
assertTrue(response.getExcessMeters().isEmpty());
}
use of org.openkilda.wfm.topology.switchmanager.service.ValidationService in project open-kilda by telstra.
the class ValidationServiceImplTest method validateMetersEmpty.
@Test
public void validateMetersEmpty() {
ValidationService validationService = new ValidationServiceImpl(persistenceManager().build());
ValidateMetersResult response = validationService.validateMeters(SWITCH_ID_A, emptyList(), emptyList());
assertTrue(response.getMissingMeters().isEmpty());
assertTrue(response.getMisconfiguredMeters().isEmpty());
assertTrue(response.getProperMeters().isEmpty());
assertTrue(response.getExcessMeters().isEmpty());
}
use of org.openkilda.wfm.topology.switchmanager.service.ValidationService in project open-kilda by telstra.
the class ValidationServiceImplTest method validateMetersMisconfiguredMetersESwitch.
@Test
public void validateMetersMisconfiguredMetersESwitch() {
ValidationService validationService = new ValidationServiceImpl(persistenceManager().build());
long rateESwitch = FLOW_E_BANDWIDTH + (long) (FLOW_E_BANDWIDTH * 0.01) + 1;
long burstSize = (long) (FLOW_E_BANDWIDTH * 1.05);
long burstSizeESwitch = burstSize + (long) (burstSize * 0.01) + 1;
MeterSpeakerData actualMeter = MeterSpeakerData.builder().meterId(new MeterId(32)).rate(rateESwitch).burst(burstSizeESwitch).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.PKTPS, MeterFlag.BURST, MeterFlag.STATS)).build();
MeterSpeakerData expectedMeter = MeterSpeakerData.builder().meterId(new MeterId(32)).rate(rateESwitch).burst(burstSize).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.PKTPS, MeterFlag.BURST, MeterFlag.STATS)).build();
ValidateMetersResult response = validationService.validateMeters(SWITCH_ID_E, singletonList(actualMeter), singletonList(expectedMeter));
assertTrue(response.getMissingMeters().isEmpty());
assertFalse(response.getMisconfiguredMeters().isEmpty());
assertEquals(10606L, (long) response.getMisconfiguredMeters().get(0).getActual().getBurstSize());
assertEquals(10500L, (long) response.getMisconfiguredMeters().get(0).getExpected().getBurstSize());
assertTrue(response.getProperMeters().isEmpty());
assertTrue(response.getExcessMeters().isEmpty());
}
Aggregations