Refactor bindMacAddr function from VPLS app.

Change-Id: I4f484bbc02dae756e60c9fb5e1d2ef8a0f722b85
This commit is contained in:
Yi Tseng 2016-09-01 15:02:11 +08:00 committed by Gerrit Code Review
parent 3bbca2a643
commit bf8b67ea9b

View File

@ -177,15 +177,14 @@ public class Vpls {
VlanId vlanId = e.getKey();
ConnectPoint cp = e.getValue();
Set<Host> connectedHosts = hostService.getConnectedHosts(cp);
if (!connectedHosts.isEmpty()) {
connectedHosts.forEach(host -> {
if (host.vlan().equals(vlanId)) {
confHostPresentCPoint.put(vlanId, Pair.of(cp, host.mac()));
} else {
confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
}
});
} else {
connectedHosts.forEach(host -> {
if (host.vlan().equals(vlanId)) {
confHostPresentCPoint.put(vlanId, Pair.of(cp, host.mac()));
} else {
confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
}
});
if (connectedHosts.isEmpty()) {
confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
}
}