@Test public void testCreateMatch_getMatchItem() throws Exception{ Class<FlowUtils> class1 = FlowUtils.class; Method method = class1.getDeclaredMethod("createMatch", new Class[]{UserId.class, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow.class, PhysicalPort.class}); method.setAccessible(true); UserId userId = mock(UserId.class); Match result; MatchItemValue matchItemValue = mock(MatchItemValue.class); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow nemoFlow = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow.class); PhysicalPort physicalPort = mock(PhysicalPort.class); MatchItem matchItem = mock(MatchItem.class); PhysicalPortId physicalPortId = mock(PhysicalPortId.class); List<MatchItem> matchItems = new ArrayList<MatchItem>(); matchItems.add(matchItem); when(nemoFlow.getMatchItem()).thenReturn(matchItems); when(matchItem.getMatchItemName()) .thenReturn(new MatchItemName("src-ip")) .thenReturn(new MatchItemName("dst-ip")); when(matchItem.getMatchItemValue()).thenReturn(matchItemValue); when(matchItemValue.getStringValue()).thenReturn(new String("192.168.1.1/24")); when(physicalPort.getPortId()).thenReturn(physicalPortId); when(physicalPortId.getValue()).thenReturn(new String("test")); result = (Match)method.invoke(flowUtils,null,nemoFlow,physicalPort); Assert.assertTrue(result != null); }
private MatchItem getMatchItem(List<MatchItem> matchItems, MatchItemName matchItemName) { for ( MatchItem matchItem : matchItems ) { if ( matchItem.getMatchItemName().equals(matchItemName) ) { return matchItem; } } return null; }
FlowUtils implements AutoCloseable { private MatchItem getMatchItem(List<MatchItem> matchItems, MatchItemName matchItemName) { for ( MatchItem matchItem : matchItems ) { if ( matchItem.getMatchItemName().equals(matchItemName) ) { return matchItem; } } return null; } }
FlowUtils implements AutoCloseable { private MatchItem getMatchItem(List<MatchItem> matchItems, MatchItemName matchItemName) { for ( MatchItem matchItem : matchItems ) { if ( matchItem.getMatchItemName().equals(matchItemName) ) { return matchItem; } } return null; } FlowUtils(DataBroker dataBroker,
                     PacketProcessingService packetProcessingService,
                     PhyConfigLoader phyConfigLoader); }
FlowUtils implements AutoCloseable { private MatchItem getMatchItem(List<MatchItem> matchItems, MatchItemName matchItemName) { for ( MatchItem matchItem : matchItems ) { if ( matchItem.getMatchItemName().equals(matchItemName) ) { return matchItem; } } return null; } FlowUtils(DataBroker dataBroker,
                     PacketProcessingService packetProcessingService,
                     PhyConfigLoader phyConfigLoader); void init(List<PhysicalNode> physicalNodes); void handleArp(PacketReceived packetReceived, NodeConnectorRef ingress); @Override void close(); void assignMPLSLabelForPPath(PhysicalPath physicalPath,
                  List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink> physicalLinksList); }
FlowUtils implements AutoCloseable { private MatchItem getMatchItem(List<MatchItem> matchItems, MatchItemName matchItemName) { for ( MatchItem matchItem : matchItems ) { if ( matchItem.getMatchItemName().equals(matchItemName) ) { return matchItem; } } return null; } FlowUtils(DataBroker dataBroker,
                     PacketProcessingService packetProcessingService,
                     PhyConfigLoader phyConfigLoader); void init(List<PhysicalNode> physicalNodes); void handleArp(PacketReceived packetReceived, NodeConnectorRef ingress); @Override void close(); void assignMPLSLabelForPPath(PhysicalPath physicalPath,
                  List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink> physicalLinksList);  }