Committed by
Gerrit Code Review
changes for cord-488 and addressed comments
Change-Id: Ic51923f7d5860d9120acadc5ca3716cf5f143dcc
Showing
3 changed files
with
160 additions
and
59 deletions
| ... | @@ -47,6 +47,14 @@ | ... | @@ -47,6 +47,14 @@ |
| 47 | 47 | ||
| 48 | <dependency> | 48 | <dependency> |
| 49 | <groupId>org.onosproject</groupId> | 49 | <groupId>org.onosproject</groupId> |
| 50 | + <artifactId>onos-incubator-api</artifactId> | ||
| 51 | + <version>${project.version}</version> | ||
| 52 | + <scope>test</scope> | ||
| 53 | + <classifier>tests</classifier> | ||
| 54 | + </dependency> | ||
| 55 | + | ||
| 56 | + <dependency> | ||
| 57 | + <groupId>org.onosproject</groupId> | ||
| 50 | <artifactId>onos-cli</artifactId> | 58 | <artifactId>onos-cli</artifactId> |
| 51 | <version>${project.version}</version> | 59 | <version>${project.version}</version> |
| 52 | </dependency> | 60 | </dependency> | ... | ... |
| ... | @@ -37,6 +37,8 @@ import org.onosproject.cfg.ComponentConfigService; | ... | @@ -37,6 +37,8 @@ import org.onosproject.cfg.ComponentConfigService; |
| 37 | import org.onosproject.core.ApplicationId; | 37 | import org.onosproject.core.ApplicationId; |
| 38 | import org.onosproject.core.CoreService; | 38 | import org.onosproject.core.CoreService; |
| 39 | import org.onosproject.incubator.net.intf.Interface; | 39 | import org.onosproject.incubator.net.intf.Interface; |
| 40 | +import org.onosproject.incubator.net.intf.InterfaceEvent; | ||
| 41 | +import org.onosproject.incubator.net.intf.InterfaceListener; | ||
| 40 | import org.onosproject.incubator.net.intf.InterfaceService; | 42 | import org.onosproject.incubator.net.intf.InterfaceService; |
| 41 | import org.onosproject.net.ConnectPoint; | 43 | import org.onosproject.net.ConnectPoint; |
| 42 | import org.onosproject.net.DeviceId; | 44 | import org.onosproject.net.DeviceId; |
| ... | @@ -139,6 +141,8 @@ public class SingleSwitchFibInstaller { | ... | @@ -139,6 +141,8 @@ public class SingleSwitchFibInstaller { |
| 139 | // Stores FIB updates that are waiting for groups to be set up | 141 | // Stores FIB updates that are waiting for groups to be set up |
| 140 | private final Multimap<NextHopGroupKey, FibEntry> pendingUpdates = HashMultimap.create(); | 142 | private final Multimap<NextHopGroupKey, FibEntry> pendingUpdates = HashMultimap.create(); |
| 141 | 143 | ||
| 144 | + //interface object for event | ||
| 145 | + private InternalInterfaceListener internalInterfaceList = new InternalInterfaceListener(); | ||
| 142 | 146 | ||
| 143 | @Activate | 147 | @Activate |
| 144 | protected void activate(ComponentContext context) { | 148 | protected void activate(ComponentContext context) { |
| ... | @@ -150,6 +154,8 @@ public class SingleSwitchFibInstaller { | ... | @@ -150,6 +154,8 @@ public class SingleSwitchFibInstaller { |
| 150 | deviceListener = new InternalDeviceListener(); | 154 | deviceListener = new InternalDeviceListener(); |
| 151 | deviceService.addListener(deviceListener); | 155 | deviceService.addListener(deviceListener); |
| 152 | 156 | ||
| 157 | + interfaceService.addListener(internalInterfaceList); | ||
| 158 | + | ||
| 153 | routingService.addFibListener(new InternalFibListener()); | 159 | routingService.addFibListener(new InternalFibListener()); |
| 154 | routingService.start(); | 160 | routingService.start(); |
| 155 | 161 | ||
| ... | @@ -164,6 +170,8 @@ public class SingleSwitchFibInstaller { | ... | @@ -164,6 +170,8 @@ public class SingleSwitchFibInstaller { |
| 164 | 170 | ||
| 165 | deviceService.removeListener(deviceListener); | 171 | deviceService.removeListener(deviceListener); |
| 166 | 172 | ||
| 173 | + interfaceService.removeListener(internalInterfaceList); | ||
| 174 | + | ||
| 167 | //processIntfFilters(false, configService.getInterfaces()); //TODO necessary? | 175 | //processIntfFilters(false, configService.getInterfaces()); //TODO necessary? |
| 168 | 176 | ||
| 169 | componentConfigService.unregisterProperties(getClass(), false); | 177 | componentConfigService.unregisterProperties(getClass(), false); |
| ... | @@ -393,47 +401,84 @@ public class SingleSwitchFibInstaller { | ... | @@ -393,47 +401,84 @@ public class SingleSwitchFibInstaller { |
| 393 | continue; | 401 | continue; |
| 394 | } | 402 | } |
| 395 | 403 | ||
| 396 | - FilteringObjective.Builder fob = DefaultFilteringObjective.builder(); | 404 | + createFilteringObjective(install, intf); |
| 397 | - // first add filter for the interface | 405 | + } |
| 398 | - fob.withKey(Criteria.matchInPort(intf.connectPoint().port())) | 406 | + } |
| 399 | - .addCondition(Criteria.matchEthDst(intf.mac())) | ||
| 400 | - .addCondition(Criteria.matchVlanId(intf.vlan())); | ||
| 401 | - fob.withPriority(PRIORITY_OFFSET); | ||
| 402 | - if (intf.vlan() == VlanId.NONE) { | ||
| 403 | - TrafficTreatment tt = DefaultTrafficTreatment.builder() | ||
| 404 | - .pushVlan().setVlanId(VlanId.vlanId(ASSIGNED_VLAN)).build(); | ||
| 405 | - fob.withMeta(tt); | ||
| 406 | - } | ||
| 407 | 407 | ||
| 408 | - fob.permit().fromApp(routerAppId); | 408 | + //process filtering objective for interface add/remove. |
| 409 | + private void processIntfFilter(boolean install, Interface intf) { | ||
| 410 | + | ||
| 411 | + if (!intf.connectPoint().deviceId().equals(deviceId)) { | ||
| 412 | + // Ignore interfaces if they are not on the router switch | ||
| 413 | + return; | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + createFilteringObjective(install, intf); | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + //create filtering objective for interface | ||
| 420 | + private void createFilteringObjective(boolean install, Interface intf) { | ||
| 421 | + | ||
| 422 | + FilteringObjective.Builder fob = DefaultFilteringObjective.builder(); | ||
| 423 | + // first add filter for the interface | ||
| 424 | + fob.withKey(Criteria.matchInPort(intf.connectPoint().port())) | ||
| 425 | + .addCondition(Criteria.matchEthDst(intf.mac())) | ||
| 426 | + .addCondition(Criteria.matchVlanId(intf.vlan())); | ||
| 427 | + fob.withPriority(PRIORITY_OFFSET); | ||
| 428 | + if (intf.vlan() == VlanId.NONE) { | ||
| 429 | + TrafficTreatment tt = DefaultTrafficTreatment.builder() | ||
| 430 | + .pushVlan().setVlanId(VlanId.vlanId(ASSIGNED_VLAN)).build(); | ||
| 431 | + fob.withMeta(tt); | ||
| 432 | + } | ||
| 433 | + | ||
| 434 | + fob.permit().fromApp(routerAppId); | ||
| 435 | + sendFilteringObjective(install, fob, intf); | ||
| 436 | + if (controlPlaneConnectPoint != null) { | ||
| 437 | + // then add the same mac/vlan filters for control-plane connect point | ||
| 438 | + fob.withKey(Criteria.matchInPort(controlPlaneConnectPoint.port())); | ||
| 409 | sendFilteringObjective(install, fob, intf); | 439 | sendFilteringObjective(install, fob, intf); |
| 410 | - if (controlPlaneConnectPoint != null) { | ||
| 411 | - // then add the same mac/vlan filters for control-plane connect point | ||
| 412 | - fob.withKey(Criteria.matchInPort(controlPlaneConnectPoint.port())); | ||
| 413 | - sendFilteringObjective(install, fob, intf); | ||
| 414 | - } | ||
| 415 | } | 440 | } |
| 416 | } | 441 | } |
| 417 | 442 | ||
| 418 | private void sendFilteringObjective(boolean install, FilteringObjective.Builder fob, | 443 | private void sendFilteringObjective(boolean install, FilteringObjective.Builder fob, |
| 419 | Interface intf) { | 444 | Interface intf) { |
| 420 | - flowObjectiveService.filter( | 445 | + if (install) { |
| 421 | - deviceId, | 446 | + flowObjectiveService.filter( |
| 422 | - fob.add(new ObjectiveContext() { | 447 | + deviceId, |
| 423 | - @Override | 448 | + fob.add(new ObjectiveContext() { |
| 424 | - public void onSuccess(Objective objective) { | 449 | + @Override |
| 425 | - log.info("Successfully installed interface based " | 450 | + public void onSuccess(Objective objective) { |
| 426 | - + "filtering objectives for intf {}", intf); | 451 | + log.info("Successfully installed interface based " |
| 427 | - } | 452 | + + "filtering objectives for intf {}", intf); |
| 453 | + } | ||
| 428 | 454 | ||
| 429 | - @Override | 455 | + @Override |
| 430 | - public void onError(Objective objective, | 456 | + public void onError(Objective objective, |
| 431 | - ObjectiveError error) { | 457 | + ObjectiveError error) { |
| 432 | - log.error("Failed to install interface filters for intf {}: {}", | 458 | + log.error("Failed to install interface filters for intf {}: {}", |
| 433 | - intf, error); | 459 | + intf, error); |
| 434 | - // TODO something more than just logging | 460 | + // TODO something more than just logging |
| 435 | - } | 461 | + } |
| 462 | + })); | ||
| 463 | + } else { | ||
| 464 | + flowObjectiveService.filter( | ||
| 465 | + deviceId, | ||
| 466 | + fob.remove(new ObjectiveContext() { | ||
| 467 | + @Override | ||
| 468 | + public void onSuccess(Objective objective) { | ||
| 469 | + log.info("Successfully removed interface based " | ||
| 470 | + + "filtering objectives for intf {}", intf); | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + @Override | ||
| 474 | + public void onError(Objective objective, | ||
| 475 | + ObjectiveError error) { | ||
| 476 | + log.error("Failed to install interface filters for intf {}: {}", | ||
| 477 | + intf, error); | ||
| 478 | + // TODO something more than just logging | ||
| 479 | + } | ||
| 436 | })); | 480 | })); |
| 481 | + } | ||
| 437 | } | 482 | } |
| 438 | 483 | ||
| 439 | private class InternalFibListener implements FibListener { | 484 | private class InternalFibListener implements FibListener { |
| ... | @@ -497,4 +542,28 @@ public class SingleSwitchFibInstaller { | ... | @@ -497,4 +542,28 @@ public class SingleSwitchFibInstaller { |
| 497 | } | 542 | } |
| 498 | } | 543 | } |
| 499 | } | 544 | } |
| 545 | + | ||
| 546 | + private class InternalInterfaceListener implements InterfaceListener { | ||
| 547 | + | ||
| 548 | + @Override | ||
| 549 | + public void event(InterfaceEvent event) { | ||
| 550 | + Interface intf = event.subject(); | ||
| 551 | + switch (event.type()) { | ||
| 552 | + case INTERFACE_ADDED: | ||
| 553 | + if (intf != null) { | ||
| 554 | + processIntfFilter(true, intf); | ||
| 555 | + } | ||
| 556 | + break; | ||
| 557 | + case INTERFACE_UPDATED: | ||
| 558 | + break; | ||
| 559 | + case INTERFACE_REMOVED: | ||
| 560 | + if (intf != null) { | ||
| 561 | + processIntfFilter(false, intf); | ||
| 562 | + } | ||
| 563 | + break; | ||
| 564 | + default: | ||
| 565 | + break; | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + } | ||
| 500 | } | 569 | } | ... | ... |
| ... | @@ -25,6 +25,7 @@ import static org.easymock.EasyMock.verify; | ... | @@ -25,6 +25,7 @@ import static org.easymock.EasyMock.verify; |
| 25 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 26 | import java.util.Collections; | 26 | import java.util.Collections; |
| 27 | import java.util.Dictionary; | 27 | import java.util.Dictionary; |
| 28 | +import java.util.HashSet; | ||
| 28 | import java.util.List; | 29 | import java.util.List; |
| 29 | import java.util.Set; | 30 | import java.util.Set; |
| 30 | 31 | ||
| ... | @@ -45,7 +46,9 @@ import org.onosproject.core.CoreServiceAdapter; | ... | @@ -45,7 +46,9 @@ import org.onosproject.core.CoreServiceAdapter; |
| 45 | import org.osgi.service.component.ComponentContext; | 46 | import org.osgi.service.component.ComponentContext; |
| 46 | import org.onosproject.cfg.ComponentConfigService; | 47 | import org.onosproject.cfg.ComponentConfigService; |
| 47 | import org.onosproject.incubator.net.intf.Interface; | 48 | import org.onosproject.incubator.net.intf.Interface; |
| 49 | +import org.onosproject.incubator.net.intf.InterfaceListener; | ||
| 48 | import org.onosproject.incubator.net.intf.InterfaceService; | 50 | import org.onosproject.incubator.net.intf.InterfaceService; |
| 51 | +import org.onosproject.incubator.net.intf.InterfaceServiceAdapter; | ||
| 49 | import org.onosproject.net.ConnectPoint; | 52 | import org.onosproject.net.ConnectPoint; |
| 50 | import org.onosproject.net.DeviceId; | 53 | import org.onosproject.net.DeviceId; |
| 51 | import org.onosproject.net.PortNumber; | 54 | import org.onosproject.net.PortNumber; |
| ... | @@ -70,7 +73,6 @@ import org.onosproject.routing.FibUpdate; | ... | @@ -70,7 +73,6 @@ import org.onosproject.routing.FibUpdate; |
| 70 | import org.onosproject.routing.RoutingService; | 73 | import org.onosproject.routing.RoutingService; |
| 71 | import org.onosproject.routing.RoutingServiceAdapter; | 74 | import org.onosproject.routing.RoutingServiceAdapter; |
| 72 | import org.onosproject.routing.config.RouterConfig; | 75 | import org.onosproject.routing.config.RouterConfig; |
| 73 | - | ||
| 74 | import com.google.common.collect.ImmutableSet; | 76 | import com.google.common.collect.ImmutableSet; |
| 75 | import com.google.common.collect.Sets; | 77 | import com.google.common.collect.Sets; |
| 76 | 78 | ||
| ... | @@ -108,7 +110,8 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { | ... | @@ -108,7 +110,8 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { |
| 108 | private CoreService coreService; | 110 | private CoreService coreService; |
| 109 | private RouterConfig routerConfig; | 111 | private RouterConfig routerConfig; |
| 110 | private RoutingService routingService; | 112 | private RoutingService routingService; |
| 111 | - SingleSwitchFibInstaller sSfibInstaller; | 113 | + private SingleSwitchFibInstaller sSfibInstaller; |
| 114 | + private InterfaceListener interfaceListener; | ||
| 112 | 115 | ||
| 113 | @Before | 116 | @Before |
| 114 | public void setUp() throws Exception { | 117 | public void setUp() throws Exception { |
| ... | @@ -135,7 +138,8 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { | ... | @@ -135,7 +138,8 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { |
| 135 | coreService = new TestCoreService(); | 138 | coreService = new TestCoreService(); |
| 136 | routingService = new TestRoutingService(); | 139 | routingService = new TestRoutingService(); |
| 137 | routerConfig = new TestRouterConfig(); | 140 | routerConfig = new TestRouterConfig(); |
| 138 | - interfaceService = createMock(InterfaceService.class); | 141 | + //interfaceService = createMock(InterfaceService.class); |
| 142 | + interfaceService = new TestInterfaceService(); | ||
| 139 | networkConfigService = createMock(NetworkConfigService.class); | 143 | networkConfigService = createMock(NetworkConfigService.class); |
| 140 | flowObjectiveService = createMock(FlowObjectiveService.class); | 144 | flowObjectiveService = createMock(FlowObjectiveService.class); |
| 141 | deviceService = new TestDeviceService(); | 145 | deviceService = new TestDeviceService(); |
| ... | @@ -158,7 +162,7 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { | ... | @@ -158,7 +162,7 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { |
| 158 | private void setUpInterfaceService() { | 162 | private void setUpInterfaceService() { |
| 159 | Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet(); | 163 | Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet(); |
| 160 | interfaceIpAddresses1.add(new InterfaceIpAddress( | 164 | interfaceIpAddresses1.add(new InterfaceIpAddress( |
| 161 | - IpAddress.valueOf("192.168.10.101"), | 165 | + IpAddress.valueOf("192.168.10.1"), |
| 162 | IpPrefix.valueOf("192.168.10.0/24"))); | 166 | IpPrefix.valueOf("192.168.10.0/24"))); |
| 163 | Interface sw1Eth1 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH1, | 167 | Interface sw1Eth1 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH1, |
| 164 | interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"), | 168 | interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"), |
| ... | @@ -166,7 +170,7 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { | ... | @@ -166,7 +170,7 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { |
| 166 | interfaces.add(sw1Eth1); | 170 | interfaces.add(sw1Eth1); |
| 167 | 171 | ||
| 168 | Set<InterfaceIpAddress> interfaceIpAddresses2 = Sets.newHashSet(); | 172 | Set<InterfaceIpAddress> interfaceIpAddresses2 = Sets.newHashSet(); |
| 169 | - interfaceIpAddresses2.add(new InterfaceIpAddress(IpAddress.valueOf("192.168.20.101"), | 173 | + interfaceIpAddresses2.add(new InterfaceIpAddress(IpAddress.valueOf("192.168.20.1"), |
| 170 | IpPrefix.valueOf("192.168.20.0/24"))); | 174 | IpPrefix.valueOf("192.168.20.0/24"))); |
| 171 | Interface sw2Eth1 = new Interface(SW2_ETH1.deviceId().toString(), SW2_ETH1, | 175 | Interface sw2Eth1 = new Interface(SW2_ETH1.deviceId().toString(), SW2_ETH1, |
| 172 | interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"), | 176 | interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"), |
| ... | @@ -182,35 +186,14 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { | ... | @@ -182,35 +186,14 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { |
| 182 | interfaces.add(sw3Eth1); | 186 | interfaces.add(sw3Eth1); |
| 183 | 187 | ||
| 184 | InterfaceIpAddress interfaceIpAddress4 = | 188 | InterfaceIpAddress interfaceIpAddress4 = |
| 185 | - new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), | 189 | + new InterfaceIpAddress(IpAddress.valueOf("192.168.40.1"), |
| 186 | IpPrefix.valueOf("192.168.40.0/24")); | 190 | IpPrefix.valueOf("192.168.40.0/24")); |
| 187 | 191 | ||
| 188 | Interface sw4Eth1 = new Interface(SW4_ETH1.deviceId().toString(), SW4_ETH1, | 192 | Interface sw4Eth1 = new Interface(SW4_ETH1.deviceId().toString(), SW4_ETH1, |
| 189 | Sets.newHashSet(interfaceIpAddress4), | 193 | Sets.newHashSet(interfaceIpAddress4), |
| 190 | MacAddress.valueOf("00:00:00:00:00:04"), | 194 | MacAddress.valueOf("00:00:00:00:00:04"), |
| 191 | VlanId.vlanId((short) 1)); | 195 | VlanId.vlanId((short) 1)); |
| 192 | - | ||
| 193 | - expect(interfaceService.getInterfacesByPort(SW4_ETH1)).andReturn( | ||
| 194 | - Collections.singleton(sw4Eth1)).anyTimes(); | ||
| 195 | - expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.40.1"))) | ||
| 196 | - .andReturn(sw4Eth1).anyTimes(); | ||
| 197 | - | ||
| 198 | interfaces.add(sw4Eth1); | 196 | interfaces.add(sw4Eth1); |
| 199 | - | ||
| 200 | - expect(interfaceService.getInterfacesByPort(SW1_ETH1)).andReturn( | ||
| 201 | - Collections.singleton(sw1Eth1)).anyTimes(); | ||
| 202 | - expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.10.1"))) | ||
| 203 | - .andReturn(sw1Eth1).anyTimes(); | ||
| 204 | - expect(interfaceService.getInterfacesByPort(SW2_ETH1)).andReturn( | ||
| 205 | - Collections.singleton(sw2Eth1)).anyTimes(); | ||
| 206 | - expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.20.1"))) | ||
| 207 | - .andReturn(sw2Eth1).anyTimes(); | ||
| 208 | - expect(interfaceService.getInterfacesByPort(SW3_ETH1)).andReturn( | ||
| 209 | - Collections.singleton(sw3Eth1)).anyTimes(); | ||
| 210 | - expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.30.1"))) | ||
| 211 | - .andReturn(sw3Eth1).anyTimes(); | ||
| 212 | - expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes(); | ||
| 213 | - replay(interfaceService); | ||
| 214 | } | 197 | } |
| 215 | 198 | ||
| 216 | /* | 199 | /* |
| ... | @@ -482,6 +465,47 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { | ... | @@ -482,6 +465,47 @@ public class SingleSwitchFibInstallerTest extends AbstractIntentTest { |
| 482 | verify(flowObjectiveService); | 465 | verify(flowObjectiveService); |
| 483 | } | 466 | } |
| 484 | 467 | ||
| 468 | + private class TestInterfaceService extends InterfaceServiceAdapter { | ||
| 469 | + | ||
| 470 | + @Override | ||
| 471 | + public void addListener(InterfaceListener listener) { | ||
| 472 | + SingleSwitchFibInstallerTest.this.interfaceListener = listener; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + @Override | ||
| 476 | + public Set<Interface> getInterfaces() { | ||
| 477 | + return interfaces; | ||
| 478 | + } | ||
| 479 | + | ||
| 480 | + @Override | ||
| 481 | + public Set<Interface> getInterfacesByPort(ConnectPoint port) { | ||
| 482 | + | ||
| 483 | + Set<Interface> setIntf = new HashSet<Interface>(); | ||
| 484 | + for (Interface intf : interfaces) { | ||
| 485 | + if (intf.connectPoint().equals(port)) { | ||
| 486 | + setIntf.add(intf); | ||
| 487 | + | ||
| 488 | + } | ||
| 489 | + } | ||
| 490 | + return setIntf; | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + @Override | ||
| 494 | + public Interface getMatchingInterface(IpAddress ip) { | ||
| 495 | + Interface intff = null; | ||
| 496 | + for (Interface intf : interfaces) { | ||
| 497 | + for (InterfaceIpAddress address : intf.ipAddresses()) { | ||
| 498 | + if (address.ipAddress().equals(ip)) { | ||
| 499 | + intff = intf; | ||
| 500 | + break; | ||
| 501 | + } | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + return intff; | ||
| 506 | + } | ||
| 507 | + } | ||
| 508 | + | ||
| 485 | private class TestCoreService extends CoreServiceAdapter { | 509 | private class TestCoreService extends CoreServiceAdapter { |
| 486 | 510 | ||
| 487 | @Override | 511 | @Override | ... | ... |
-
Please register or login to post a comment