Search in sources :

Example 1 with SwitchAvailabilityData

use of org.openkilda.messaging.model.SwitchAvailabilityData in project open-kilda by telstra.

the class SwitchMonitorServiceTest method matchAvailabilityData.

private boolean matchAvailabilityData(SwitchAvailabilityData expect, SwitchAvailabilityData actual) {
    SwitchAvailabilityData expectSorted = sortSwitchAvailabilityData(expect);
    SwitchAvailabilityData actualSorted = sortSwitchAvailabilityData(actual);
    return Objects.equals(expectSorted, actualSorted);
}
Also used : SwitchAvailabilityData(org.openkilda.messaging.model.SwitchAvailabilityData)

Example 2 with SwitchAvailabilityData

use of org.openkilda.messaging.model.SwitchAvailabilityData in project open-kilda by telstra.

the class SwitchMonitor method makeDump.

private SwitchAvailabilityData makeDump() {
    SwitchAvailabilityData.SwitchAvailabilityDataBuilder builder = SwitchAvailabilityData.builder();
    Set<String> readWriteRegions = new HashSet<>();
    for (SwitchAvailabilityEntry entry : readWriteConnects.dump()) {
        readWriteRegions.add(entry.getRegionName());
        builder.connection(entry);
    }
    for (SwitchAvailabilityEntry entry : readOnlyConnects.dump()) {
        if (readWriteRegions.contains(entry.getRegionName())) {
            continue;
        }
        builder.connection(entry);
    }
    return builder.build();
}
Also used : SwitchAvailabilityData(org.openkilda.messaging.model.SwitchAvailabilityData) SwitchAvailabilityEntry(org.openkilda.messaging.model.SwitchAvailabilityEntry) HashSet(java.util.HashSet)

Aggregations

SwitchAvailabilityData (org.openkilda.messaging.model.SwitchAvailabilityData)2 HashSet (java.util.HashSet)1 SwitchAvailabilityEntry (org.openkilda.messaging.model.SwitchAvailabilityEntry)1