@Test public void testAssignMPLSLabelForPPath() throws Exception { PhysicalPath physicalPath = mock(PhysicalPath.class); PhysicalPathId physicalPathId = mock(PhysicalPathId.class); PhysicalLinkId physicalLinkId = mock(PhysicalLinkId.class); PhysicalNodeId physicalDestNodeId = mock(PhysicalNodeId.class); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink physicalLink = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink.class); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink physicalLink_path = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink.class); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink> physicalLinksList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink> physicalLinksInPath = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink>(); when(physicalPath.getPhysicalLink()).thenReturn(physicalLinksInPath); when(physicalPath.getPathId()).thenReturn(physicalPathId); flowUtils.assignMPLSLabelForPPath(physicalPath, physicalLinksList); verify(physicalPath).getPhysicalLink(); verify(physicalPath).getPathId(); physicalLinksList.add(physicalLink); physicalLinksInPath.add(physicalLink_path); when(physicalLink_path.getLinkId()).thenReturn(physicalLinkId); when(physicalLink.getLinkId()).thenReturn(physicalLinkId); when(physicalLinkId.getValue()) .thenReturn(new String("1")) .thenReturn(new String("2")) .thenReturn(new String("1")) .thenReturn(new String("1")); flowUtils.assignMPLSLabelForPPath(physicalPath, physicalLinksList); verify(physicalPath,times(2)).getPathId(); verify(physicalLink).getLinkId(); verify(physicalLink_path).getLinkId(); verify(physicalLinkId,times(2)).getValue(); when(physicalLink.getDestNodeId()).thenReturn(physicalDestNodeId); flowUtils.assignMPLSLabelForPPath(physicalPath, physicalLinksList); verify(physicalLinkId,times(4)).getValue(); verify(physicalPath,times(3)).getPathId(); }
public 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){ LOG.debug("nemo: for(1)"); List<Integer> mplsLabels = new ArrayList<Integer>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink> physicalLinksInPath = physicalPath.getPhysicalLink(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink physicalLinkinPath : physicalLinksInPath) { LOG.debug("nemo: for(2)"); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink physicalLink : physicalLinksList) { LOG.debug("nemo: for(3)"); if (physicalLinkinPath.getLinkId().getValue().equals(physicalLink.getLinkId().getValue())) { LOG.debug("nemo: physicalLinkinPath.getLinkId() == physicalLink.getLinkId()"); PhysicalNodeId physicalDestNodeId = physicalLink.getDestNodeId(); if(mplsGenerators.containsKey(physicalDestNodeId) == true){ mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } else{ MplsLabelGenerator mplsLabelGenerator = new MplsLabelGenerator(); mplsGenerators.put(physicalDestNodeId, mplsLabelGenerator); mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } } } } mplsLabelsOfPhysicalPaths.put(physicalPath.getPathId(), mplsLabels); }
FlowUtils implements AutoCloseable { public 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){ LOG.debug("nemo: for(1)"); List<Integer> mplsLabels = new ArrayList<Integer>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink> physicalLinksInPath = physicalPath.getPhysicalLink(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink physicalLinkinPath : physicalLinksInPath) { LOG.debug("nemo: for(2)"); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink physicalLink : physicalLinksList) { LOG.debug("nemo: for(3)"); if (physicalLinkinPath.getLinkId().getValue().equals(physicalLink.getLinkId().getValue())) { LOG.debug("nemo: physicalLinkinPath.getLinkId() == physicalLink.getLinkId()"); PhysicalNodeId physicalDestNodeId = physicalLink.getDestNodeId(); if(mplsGenerators.containsKey(physicalDestNodeId) == true){ mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } else{ MplsLabelGenerator mplsLabelGenerator = new MplsLabelGenerator(); mplsGenerators.put(physicalDestNodeId, mplsLabelGenerator); mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } } } } mplsLabelsOfPhysicalPaths.put(physicalPath.getPathId(), mplsLabels); } }
FlowUtils implements AutoCloseable { public 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){ LOG.debug("nemo: for(1)"); List<Integer> mplsLabels = new ArrayList<Integer>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink> physicalLinksInPath = physicalPath.getPhysicalLink(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink physicalLinkinPath : physicalLinksInPath) { LOG.debug("nemo: for(2)"); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink physicalLink : physicalLinksList) { LOG.debug("nemo: for(3)"); if (physicalLinkinPath.getLinkId().getValue().equals(physicalLink.getLinkId().getValue())) { LOG.debug("nemo: physicalLinkinPath.getLinkId() == physicalLink.getLinkId()"); PhysicalNodeId physicalDestNodeId = physicalLink.getDestNodeId(); if(mplsGenerators.containsKey(physicalDestNodeId) == true){ mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } else{ MplsLabelGenerator mplsLabelGenerator = new MplsLabelGenerator(); mplsGenerators.put(physicalDestNodeId, mplsLabelGenerator); mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } } } } mplsLabelsOfPhysicalPaths.put(physicalPath.getPathId(), mplsLabels); } FlowUtils(DataBroker dataBroker,
                     PacketProcessingService packetProcessingService,
                     PhyConfigLoader phyConfigLoader); }
FlowUtils implements AutoCloseable { public 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){ LOG.debug("nemo: for(1)"); List<Integer> mplsLabels = new ArrayList<Integer>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink> physicalLinksInPath = physicalPath.getPhysicalLink(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink physicalLinkinPath : physicalLinksInPath) { LOG.debug("nemo: for(2)"); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink physicalLink : physicalLinksList) { LOG.debug("nemo: for(3)"); if (physicalLinkinPath.getLinkId().getValue().equals(physicalLink.getLinkId().getValue())) { LOG.debug("nemo: physicalLinkinPath.getLinkId() == physicalLink.getLinkId()"); PhysicalNodeId physicalDestNodeId = physicalLink.getDestNodeId(); if(mplsGenerators.containsKey(physicalDestNodeId) == true){ mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } else{ MplsLabelGenerator mplsLabelGenerator = new MplsLabelGenerator(); mplsGenerators.put(physicalDestNodeId, mplsLabelGenerator); mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } } } } mplsLabelsOfPhysicalPaths.put(physicalPath.getPathId(), mplsLabels); } 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 { public 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){ LOG.debug("nemo: for(1)"); List<Integer> mplsLabels = new ArrayList<Integer>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink> physicalLinksInPath = physicalPath.getPhysicalLink(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.path.instance.PhysicalLink physicalLinkinPath : physicalLinksInPath) { LOG.debug("nemo: for(2)"); for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.network.physical.links.PhysicalLink physicalLink : physicalLinksList) { LOG.debug("nemo: for(3)"); if (physicalLinkinPath.getLinkId().getValue().equals(physicalLink.getLinkId().getValue())) { LOG.debug("nemo: physicalLinkinPath.getLinkId() == physicalLink.getLinkId()"); PhysicalNodeId physicalDestNodeId = physicalLink.getDestNodeId(); if(mplsGenerators.containsKey(physicalDestNodeId) == true){ mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } else{ MplsLabelGenerator mplsLabelGenerator = new MplsLabelGenerator(); mplsGenerators.put(physicalDestNodeId, mplsLabelGenerator); mplsLabels.add(mplsGenerators.get(physicalDestNodeId).generateMplsLabel()); } } } } mplsLabelsOfPhysicalPaths.put(physicalPath.getPathId(), mplsLabels); } 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);  }