Yi Tseng
Committed by Gerrit Code Review

Refactor bindMacAddr function from VPLS app.

Change-Id: I4f484bbc02dae756e60c9fb5e1d2ef8a0f722b85
...@@ -177,15 +177,14 @@ public class Vpls { ...@@ -177,15 +177,14 @@ public class Vpls {
177 VlanId vlanId = e.getKey(); 177 VlanId vlanId = e.getKey();
178 ConnectPoint cp = e.getValue(); 178 ConnectPoint cp = e.getValue();
179 Set<Host> connectedHosts = hostService.getConnectedHosts(cp); 179 Set<Host> connectedHosts = hostService.getConnectedHosts(cp);
180 - if (!connectedHosts.isEmpty()) { 180 + connectedHosts.forEach(host -> {
181 - connectedHosts.forEach(host -> { 181 + if (host.vlan().equals(vlanId)) {
182 - if (host.vlan().equals(vlanId)) { 182 + confHostPresentCPoint.put(vlanId, Pair.of(cp, host.mac()));
183 - confHostPresentCPoint.put(vlanId, Pair.of(cp, host.mac())); 183 + } else {
184 - } else { 184 + confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
185 - confHostPresentCPoint.put(vlanId, Pair.of(cp, null)); 185 + }
186 - } 186 + });
187 - }); 187 + if (connectedHosts.isEmpty()) {
188 - } else {
189 confHostPresentCPoint.put(vlanId, Pair.of(cp, null)); 188 confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
190 } 189 }
191 } 190 }
......