use of org.openkilda.northbound.dto.v1.switches.SwitchSyncResult in project open-kilda by telstra.
the class JsonSerializationTest method switchSyncResultTest.
@Test
public void switchSyncResultTest() throws IOException {
RulesSyncDto rules = new RulesSyncDto(singletonList(0L), singletonList(1L), singletonList(2L), singletonList(3L), singletonList(4L), singletonList(5L));
MetersSyncDto meters = new MetersSyncDto(emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
GroupsSyncDto groups = new GroupsSyncDto(emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
LogicalPortsSyncDto logicalPorts = new LogicalPortsSyncDto(emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), emptyList());
SwitchSyncResult dto = new SwitchSyncResult(rules, meters, groups, logicalPorts);
assertEquals(dto, pass(dto, SwitchSyncResult.class));
}
use of org.openkilda.northbound.dto.v1.switches.SwitchSyncResult in project open-kilda by telstra.
the class SwitchServiceTest method shouldSynchronizeSwitch.
@Test
public void shouldSynchronizeSwitch() throws ExecutionException, InterruptedException {
String correlationId = "not-sync-rules";
RequestCorrelationId.create(correlationId);
Long missingRule = 100L;
Long misconfiguredRule = 11L;
Long excessRule = 101L;
Long properRule = 10L;
SwitchId switchId = new SwitchId(1L);
RulesSyncEntry rulesEntry = new RulesSyncEntry(singletonList(missingRule), singletonList(misconfiguredRule), singletonList(properRule), singletonList(excessRule), singletonList(missingRule), singletonList(excessRule));
InfoData validationResult = new SwitchSyncResponse(switchId, rulesEntry, MetersSyncEntry.builder().proper(singletonList(getMeterInfo(properRule))).build(), GroupSyncEntry.builder().build(), LogicalPortsSyncEntry.builder().build());
messageExchanger.mockResponse(correlationId, validationResult);
SwitchSyncResult result = switchService.syncSwitch(switchId, true).get();
RulesSyncDto rules = result.getRules();
assertThat(rules.getMissing(), is(singletonList(missingRule)));
assertThat(rules.getMisconfigured(), is(singletonList(misconfiguredRule)));
assertThat(rules.getInstalled(), is(singletonList(missingRule)));
assertThat(rules.getExcess(), is(singletonList(excessRule)));
assertThat(rules.getInstalled(), is(singletonList(missingRule)));
assertThat(rules.getRemoved(), is(singletonList(excessRule)));
}
Aggregations