@Test public void testCheckPhysicalPortSatisfied() throws Exception{ method = class1.getDeclaredMethod("checkPhysicalNodeSatisfied",new Class[]{ PhysicalNode.class, List.class, }); method.setAccessible(true); PhysicalNode physicalNode = mock(PhysicalNode.class); AttributeName attributeName = mock(AttributeName.class); AttributeName attributeName1 = mock(AttributeName.class); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.virtual.network.rev151010.virtual.node.instance.PhysicalResourceRequirement physicalResourceRequirement = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.virtual.network.rev151010.virtual.node.instance.PhysicalResourceRequirement.class); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.node.instance.Attribute attribute = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.node.instance.Attribute.class); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.virtual.network.rev151010.virtual.node.instance.PhysicalResourceRequirement> physicalResourceRequirements = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.virtual.network.rev151010.virtual.node.instance.PhysicalResourceRequirement>(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.node.instance.Attribute> attributes = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.generic.physical.network.rev151010.physical.node.instance.Attribute>(); attributes.add(attribute); physicalResourceRequirements.add(physicalResourceRequirement); Assert.assertTrue(attributeName != attributeName1); when(physicalNode.getAttribute()).thenReturn(attributes); when(physicalResourceRequirement.getAttributeName()).thenReturn(attributeName); when(attribute.getAttributeName()) .thenReturn(attributeName1) .thenReturn(attributeName); Assert.assertTrue((boolean) method.invoke(vnMappingUnit, physicalNode, physicalResourceRequirements) == false); }
private boolean checkPhysicalPortSatisfied(PhysicalPort physicalPort, List<PhysicalResourceRequirement> physicalResourceRequirements) throws VNMappingException { List<Attribute> attributes = physicalPort.getAttribute(); Attribute attribute; for ( PhysicalResourceRequirement physicalResourceRequirement : physicalResourceRequirements ) { attribute = getPhysicalPortAttribute(attributes, physicalResourceRequirement.getAttributeName()); if ( null == attribute ) { return false; } if ( !checkPhysicalPortAttributeSatisfied(attribute, physicalResourceRequirement) ) { return false; } } return true; }
VNMappingUnit implements AutoCloseable { private boolean checkPhysicalPortSatisfied(PhysicalPort physicalPort, List<PhysicalResourceRequirement> physicalResourceRequirements) throws VNMappingException { List<Attribute> attributes = physicalPort.getAttribute(); Attribute attribute; for ( PhysicalResourceRequirement physicalResourceRequirement : physicalResourceRequirements ) { attribute = getPhysicalPortAttribute(attributes, physicalResourceRequirement.getAttributeName()); if ( null == attribute ) { return false; } if ( !checkPhysicalPortAttributeSatisfied(attribute, physicalResourceRequirement) ) { return false; } } return true; } }
VNMappingUnit implements AutoCloseable { private boolean checkPhysicalPortSatisfied(PhysicalPort physicalPort, List<PhysicalResourceRequirement> physicalResourceRequirements) throws VNMappingException { List<Attribute> attributes = physicalPort.getAttribute(); Attribute attribute; for ( PhysicalResourceRequirement physicalResourceRequirement : physicalResourceRequirements ) { attribute = getPhysicalPortAttribute(attributes, physicalResourceRequirement.getAttributeName()); if ( null == attribute ) { return false; } if ( !checkPhysicalPortAttributeSatisfied(attribute, physicalResourceRequirement) ) { return false; } } return true; } VNMappingUnit(DataBroker dataBroker,
                         PNComputationUnit pnComputationUnit,
                         PNResourcesTracker pnResourcesTracker); }
VNMappingUnit implements AutoCloseable { private boolean checkPhysicalPortSatisfied(PhysicalPort physicalPort, List<PhysicalResourceRequirement> physicalResourceRequirements) throws VNMappingException { List<Attribute> attributes = physicalPort.getAttribute(); Attribute attribute; for ( PhysicalResourceRequirement physicalResourceRequirement : physicalResourceRequirements ) { attribute = getPhysicalPortAttribute(attributes, physicalResourceRequirement.getAttributeName()); if ( null == attribute ) { return false; } if ( !checkPhysicalPortAttributeSatisfied(attribute, physicalResourceRequirement) ) { return false; } } return true; } VNMappingUnit(DataBroker dataBroker,
                         PNComputationUnit pnComputationUnit,
                         PNResourcesTracker pnResourcesTracker); void virtualNetworkMapping(VirtualNetwork virtualNetwork, UserVnPnMapping userVnPnMapping,
                                      List<PhysicalPath> physicalPaths); void virtualNetworkMapping(VirtualNetwork virtualNetwork, List<VirtualLink> unmappedVirtualLinks,
                                      UserVnPnMapping userVnPnMapping, List<PhysicalPath> physicalPaths); @Override void close(); }
VNMappingUnit implements AutoCloseable { private boolean checkPhysicalPortSatisfied(PhysicalPort physicalPort, List<PhysicalResourceRequirement> physicalResourceRequirements) throws VNMappingException { List<Attribute> attributes = physicalPort.getAttribute(); Attribute attribute; for ( PhysicalResourceRequirement physicalResourceRequirement : physicalResourceRequirements ) { attribute = getPhysicalPortAttribute(attributes, physicalResourceRequirement.getAttributeName()); if ( null == attribute ) { return false; } if ( !checkPhysicalPortAttributeSatisfied(attribute, physicalResourceRequirement) ) { return false; } } return true; } VNMappingUnit(DataBroker dataBroker,
                         PNComputationUnit pnComputationUnit,
                         PNResourcesTracker pnResourcesTracker); void virtualNetworkMapping(VirtualNetwork virtualNetwork, UserVnPnMapping userVnPnMapping,
                                      List<PhysicalPath> physicalPaths); void virtualNetworkMapping(VirtualNetwork virtualNetwork, List<VirtualLink> unmappedVirtualLinks,
                                      UserVnPnMapping userVnPnMapping, List<PhysicalPath> physicalPaths); @Override void close();  }