@Override
    public void validate(Context context) {
        Optional<Reader> deployment = context.deployState().getApplicationPackage().getDeployment();
        if ( deployment.isEmpty()) return;

        Reader deploymentReader = deployment.get();
        DeploymentSpec deploymentSpec = DeploymentSpec.fromXml(deploymentReader);
        List<ContainerModel> containers = context.model().getRoot().configModelRepo().getModels(ContainerModel.class);
        requireUniqueInstanceIds(context, deploymentSpec.instances());
        for (DeploymentInstanceSpec instance : deploymentSpec.instances()) {
            instance.endpoints().forEach(endpoint -> {
                requireClusterId(context, containers, instance.name(),
                                 "Endpoint '" + endpoint.endpointId() + "'", endpoint.containerId());
            });
        }
    }
Validate deployment spec (deployment.xml).

@author hmusum
@author bratseth
config-model/src/main/java/com/yahoo/vespa/model/application/validation/DeploymentSpecValidator.java