public VespaModel createModel(Zone zone, String services, String hosts, boolean failOnOutOfCapacity, boolean useMaxResources,
                                  boolean alwaysReturnOneNode,
                                  NodeResources defaultResources,
                                  int startIndexForClusters, Optional<VespaModel> previousModel,
                                  DeployState.Builder deployStateBuilder, String ... retiredHostNames) {
        VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(hosts, services, generateSchemas("type1"));
        ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;

        Set<ContainerEndpoint> containerEndpoints = deployStateBuilder.build().getEndpoints();
        if (hosted) {
            InMemoryProvisioner provisioner = new InMemoryProvisioner(hostsByResources,
                                                                      failOnOutOfCapacity,
                                                                      useMaxResources,
                                                                      alwaysReturnOneNode,
                                                                      false,
                                                                      defaultResources,
                                                                      startIndexForClusters,
                                                                      retiredHostNames);
            provisioner.setEnvironment(zone.environment());
            this.provisioner = new ProvisionerAdapter(provisioner);
            if (containerEndpoints.isEmpty()) {
                containerEndpoints = Set.of(new ContainerEndpoint("default", ApplicationClusterEndpoint.Scope.zone, List.of("default.example.com")));
            }
        } else {
            provisioner = new SingleNodeProvisioner();
        }

        TestProperties properties = modelProperties
                .setMultitenant(hosted) // Note: system tests are multitenant but not hosted
                .setHostedVespa(hosted)
                .setApplicationId(applicationId)
                .setUseDedicatedNodeForLogserver(useDedicatedNodeForLogserver);

        DeployState.Builder deployState = deployStateBuilder
                .applicationPackage(appPkg)
                .modelHostProvisioner(provisioner)
                .properties(properties)
                .endpoints(containerEndpoints)
                .zone(zone);
        previousModel.ifPresent(deployState::previousModel);
        return modelCreatorWithMockPkg.create(false, deployState.build(), configModelRegistry);
    }
Creates a model using the hosts already added to this

@param services the services xml string
@param hosts the hosts xml string, or null if none
@param useMaxResources false to use the minimal resources (when given a range), true to use max
@param failOnOutOfCapacity whether we should get an exception when not enough hosts of the requested flavor
       is available or if we should just silently receive a smaller allocation
@return the resulting model
config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java