Refactor bindMacAddr function from VPLS app.
Change-Id: I4f484bbc02dae756e60c9fb5e1d2ef8a0f722b85
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java b/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
index 4f1e3fa..5551435 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
@@ -177,15 +177,14 @@
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));
}
}