FlowWriterServiceImpl implements FlowWriterService { @Override public void addMacToMacFlow(MacAddress sourceMac, MacAddress destMac, NodeConnectorRef destNodeConnectorRef) { Preconditions.checkNotNull(destMac, "Destination mac address should not be null."); Preconditions.checkNotNull(destNodeConnectorRef, "Destination port should not be null."); if (sourceMac != null && destMac.equals(sourceMac)) { LOG.info("In addMacToMacFlow: No flows added. Source and Destination mac are same."); return; } TableKey flowTableKey = new TableKey(flowTableId); InstanceIdentifier<Flow> flowPath = buildFlowPath(destNodeConnectorRef, flowTableKey); Flow flowBody = createMacToMacFlow(flowTableKey.getId(), flowPriority, sourceMac, destMac, destNodeConnectorRef); writeFlowToConfigData(flowPath, flowBody); } FlowWriterServiceImpl(SalFlowService salFlowService); void setFlowTableId(short flowTableId); void setFlowPriority(int flowPriority); void setFlowIdleTimeout(int flowIdleTimeout); void setFlowHardTimeout(int flowHardTimeout); @Override void addMacToMacFlow(MacAddress sourceMac, MacAddress destMac, NodeConnectorRef destNodeConnectorRef); @Override void addBidirectionalMacToMacFlows(MacAddress sourceMac, NodeConnectorRef sourceNodeConnectorRef,
            MacAddress destMac, NodeConnectorRef destNodeConnectorRef);  }
@Test public void addMacToMacFlowTest() { nodeConnectorInstanceIdentifier = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId("node-id"))) .child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("nodeconnector-id"))).build(); nodeConnectorRef = new NodeConnectorRef(nodeConnectorInstanceIdentifier); MacAddress sourceMac = new MacAddress("00:00:ac:f0:01:01"); MacAddress destMac = new MacAddress("00:00:ac:f0:02:02"); flowWriterService.addMacToMacFlow(sourceMac, destMac, nodeConnectorRef); verify(salFlowService, times(1)).addFlow(any(AddFlowInput.class)); }