Bgprouter implements BindingAwareConsumer, AutoCloseable { public void processNodeAdd(NodeId dpnId) { try { Thread.sleep(3000); } catch(InterruptedException e) { e.printStackTrace(); } if (dpnId.equals(ctrlDeviceId)) { connectivityManager.notifySwitchAvailable(); addIcmpFlowToController(dpnId); } if (dpnId.equals(deviceId)) { processIntfFilters(true, configService.getInterfaces()); } addArpFlowToController(dpnId); } Bgprouter(TunnellingConnectivityManager connectivityManager, DataBroker dataBroker,
			RoutingConfigService routingConfigService, RoutingService routingService,
			PacketProcessingService packetService, AtriumFlowObjectiveService flowObjectives); @Override void onSessionInitialized(ConsumerContext ctxt); void start(); @Override void close(); void processNodeAdd(NodeId dpnId); void addArpFlowToController(NodeId dpnId); void addIcmpFlowToController(NodeId dpnId); static final EthernetType IPV4_ETH_TYPE; static final EthernetType ARP_ETH_TYPE; }
@Test public void testProcessControlSwitchAdd() { NodeId dpnId = NodeId.getDefaultInstance("20"); bgpRouter.processNodeAdd(dpnId); verify(flowObjectives, atLeast(1)).forward(any(ForwardInput.class)); }
@Test public void testProcessDeviceAdd() { NodeId dpnId = NodeId.getDefaultInstance("openflow:20"); bgpRouter.processNodeAdd(dpnId); verify(flowObjectives, times(1)).filter(any(FilterInput.class)); verify(flowObjectives, times(1)).forward(any(ForwardInput.class)); }