You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mr...@apache.org on 2017/10/30 19:04:42 UTC

[06/30] ambari git commit: use V2 objects in TopologyManager

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
index f50e60f..8feb979 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
@@ -19,36 +19,34 @@
 
 package org.apache.ambari.server.topology;
 
-import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_AND_START;
-import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_ONLY;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.RequestStatusResponse;
+import org.apache.ambari.server.controller.internal.ConfigurationContext;
 import org.apache.ambari.server.controller.internal.ProvisionAction;
 import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.*;
+
+import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_AND_START;
+import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_ONLY;
+
 /**
  * Represents a cluster topology.
  * Topology includes the the associated blueprint, cluster configuration and hostgroup -> host mapping.
  */
 public class ClusterTopologyImpl implements ClusterTopology {
 
+  private final static Logger LOG = LoggerFactory.getLogger(ClusterTopologyImpl.class);
+
   private Long clusterId;
 
   //todo: currently topology is only associated with a single bp
   //todo: this will need to change to allow usage of multiple bp's for the same cluster
   //todo: for example: provision using bp1 and scale using bp2
-  private Blueprint blueprint;
-  private Configuration configuration;
+  private BlueprintV2 blueprint;
+  private Collection<Service> serviceConfigs;
   private ConfigRecommendationStrategy configRecommendationStrategy;
   private ProvisionAction provisionAction = ProvisionAction.INSTALL_AND_START;
   private Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>();
@@ -56,16 +54,13 @@ public class ClusterTopologyImpl implements ClusterTopology {
   private final AmbariContext ambariContext;
   private final String defaultPassword;
 
-  private final static Logger LOG = LoggerFactory.getLogger(ClusterTopologyImpl.class);
-
-
   //todo: will need to convert all usages of hostgroup name to use fully qualified name (BP/HG)
   //todo: for now, restrict scaling to the same BP
   public ClusterTopologyImpl(AmbariContext ambariContext, TopologyRequest topologyRequest) throws InvalidTopologyException {
     this.clusterId = topologyRequest.getClusterId();
     // provision cluster currently requires that all hostgroups have same BP so it is ok to use root level BP here
     this.blueprint = topologyRequest.getBlueprint();
-    this.configuration = topologyRequest.getConfiguration();
+    this.serviceConfigs = topologyRequest.getServiceConfigs();
     if (topologyRequest instanceof ProvisionClusterRequest) {
       this.defaultPassword = ((ProvisionClusterRequest) topologyRequest).getDefaultPassword();
     } else {
@@ -95,13 +90,18 @@ public class ClusterTopologyImpl implements ClusterTopology {
   }
 
   @Override
-  public Blueprint getBlueprint() {
+  public BlueprintV2 getBlueprint() {
     return blueprint;
   }
 
   @Override
+  @Deprecated
   public Configuration getConfiguration() {
-    return configuration;
+    return null;
+  }
+
+  public Collection<Service> getServiceConfigs() {
+    return serviceConfigs;
   }
 
   @Override
@@ -113,7 +113,7 @@ public class ClusterTopologyImpl implements ClusterTopology {
   @Override
   public Collection<String> getHostGroupsForComponent(String component) {
     Collection<String> resultGroups = new ArrayList<>();
-    for (HostGroup group : getBlueprint().getHostGroups().values() ) {
+    for (HostGroupV2 group : getBlueprint().getHostGroups().values() ) {
       if (group.getComponentNames().contains(component)) {
         resultGroups.add(group.getName());
       }
@@ -178,49 +178,48 @@ public class ClusterTopologyImpl implements ClusterTopology {
   }
 
   @Override
-  public boolean isNameNodeHAEnabled() {
-    return isNameNodeHAEnabled(configuration.getFullProperties());
-  }
-
-  public static boolean isNameNodeHAEnabled(Map<String, Map<String, String>> configurationProperties) {
-    return configurationProperties.containsKey("hdfs-site") &&
-           (configurationProperties.get("hdfs-site").containsKey("dfs.nameservices") ||
-            configurationProperties.get("hdfs-site").containsKey("dfs.internal.nameservices"));
-  }
-
-  @Override
-  public boolean isYarnResourceManagerHAEnabled() {
-    return isYarnResourceManagerHAEnabled(configuration.getFullProperties());
+  public boolean isNameNodeHAEnabled(ConfigurationContext configurationContext) {
+    return configurationContext.isNameNodeHAEnabled();
   }
 
   /**
    * Static convenience function to determine if Yarn ResourceManager HA is enabled
-   * @param configProperties configuration properties for this cluster
+   * @param configurationContext configuration context
    * @return true if Yarn ResourceManager HA is enabled
    *         false if Yarn ResourceManager HA is not enabled
    */
-  static boolean isYarnResourceManagerHAEnabled(Map<String, Map<String, String>> configProperties) {
-    return configProperties.containsKey("yarn-site") && configProperties.get("yarn-site").containsKey("yarn.resourcemanager.ha.enabled")
-      && configProperties.get("yarn-site").get("yarn.resourcemanager.ha.enabled").equals("true");
+  @Override
+  public boolean isYarnResourceManagerHAEnabled(ConfigurationContext configurationContext) {
+    return configurationContext.isYarnResourceManagerHAEnabled();
   }
 
   private void validateTopology()
       throws InvalidTopologyException {
 
-    if(isNameNodeHAEnabled()){
+    Collection<Service> hdfsServices = getBlueprint().getServicesByType("HDFS");
+    for (Service hdfsService : hdfsServices) {
+      ConfigurationContext configContext = new ConfigurationContext(hdfsService.getStack(), hdfsService.getConfiguration());
+      if(isNameNodeHAEnabled(configContext)) {
+
         Collection<String> nnHosts = getHostAssignmentsForComponent("NAMENODE");
         if (nnHosts.size() != 2) {
-            throw new InvalidTopologyException("NAMENODE HA requires exactly 2 hosts running NAMENODE but there are: " +
-                nnHosts.size() + " Hosts: " + nnHosts);
+          throw new InvalidTopologyException("NAMENODE HA requires exactly 2 hosts running NAMENODE but there are: " +
+            nnHosts.size() + " Hosts: " + nnHosts);
         }
-        Map<String, String> hadoopEnvConfig = configuration.getFullProperties().get("hadoop-env");
+
+        Map<String, String> hadoopEnvConfig = hdfsService.getConfiguration().getProperties().get("hadoop-env");
         if(hadoopEnvConfig != null && !hadoopEnvConfig.isEmpty() && hadoopEnvConfig.containsKey("dfs_ha_initial_namenode_active") && hadoopEnvConfig.containsKey("dfs_ha_initial_namenode_standby")) {
-           if((!HostGroup.HOSTGROUP_REGEX.matcher(hadoopEnvConfig.get("dfs_ha_initial_namenode_active")).matches() && !nnHosts.contains(hadoopEnvConfig.get("dfs_ha_initial_namenode_active")))
-             || (!HostGroup.HOSTGROUP_REGEX.matcher(hadoopEnvConfig.get("dfs_ha_initial_namenode_standby")).matches() && !nnHosts.contains(hadoopEnvConfig.get("dfs_ha_initial_namenode_standby")))){
-              throw new IllegalArgumentException("NAMENODE HA hosts mapped incorrectly for properties 'dfs_ha_initial_namenode_active' and 'dfs_ha_initial_namenode_standby'. Expected hosts are: " + nnHosts);
-        }
+          if((!HostGroup.HOSTGROUP_REGEX.matcher(hadoopEnvConfig.get("dfs_ha_initial_namenode_active")).matches() && !nnHosts.contains(hadoopEnvConfig.get("dfs_ha_initial_namenode_active")))
+            || (!HostGroup.HOSTGROUP_REGEX.matcher(hadoopEnvConfig.get("dfs_ha_initial_namenode_standby")).matches() && !nnHosts.contains(hadoopEnvConfig.get("dfs_ha_initial_namenode_standby")))){
+            throw new IllegalArgumentException("NAMENODE HA hosts mapped incorrectly for properties 'dfs_ha_initial_namenode_active' and 'dfs_ha_initial_namenode_standby'. Expected hosts are: " + nnHosts);
+          }
         }
+
+      }
+
     }
+
+
   }
 
   @Override
@@ -232,7 +231,7 @@ public class ClusterTopologyImpl implements ClusterTopology {
   public RequestStatusResponse installHost(String hostName, boolean skipInstallTaskCreate, boolean skipFailure) {
     try {
       String hostGroupName = getHostGroupForHost(hostName);
-      HostGroup hostGroup = this.blueprint.getHostGroup(hostGroupName);
+      HostGroupV2 hostGroup = this.blueprint.getHostGroup(hostGroupName);
 
       Collection<String> skipInstallForComponents = new ArrayList<>();
       if (skipInstallTaskCreate) {
@@ -257,7 +256,7 @@ public class ClusterTopologyImpl implements ClusterTopology {
   public RequestStatusResponse startHost(String hostName, boolean skipFailure) {
     try {
       String hostGroupName = getHostGroupForHost(hostName);
-      HostGroup hostGroup = this.blueprint.getHostGroup(hostGroupName);
+      HostGroupV2 hostGroup = this.blueprint.getHostGroup(hostGroupName);
 
       // get the set of components that are marked as INSTALL_ONLY
       // for this hostgroup
@@ -321,7 +320,7 @@ public class ClusterTopologyImpl implements ClusterTopology {
       String hostGroupName = requestedHostGroupInfo.getHostGroupName();
 
       //todo: doesn't support using a different blueprint for update (scaling)
-      HostGroup baseHostGroup = getBlueprint().getHostGroup(hostGroupName);
+      HostGroupV2 baseHostGroup = getBlueprint().getHostGroup(hostGroupName);
 
       if (baseHostGroup == null) {
         throw new IllegalArgumentException("Invalid host_group specified: " + hostGroupName +

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
index 175fe99..d7c08f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
@@ -23,6 +23,8 @@ import org.apache.ambari.server.controller.internal.ProvisionAction;
 
 public class ComponentV2 {
 
+  private final String type;
+
   private final String name;
 
   private final Service service;
@@ -31,12 +33,17 @@ public class ComponentV2 {
 
   private final Configuration configuration;
 
+  public ComponentV2(String type, Service service) {
+    this(type, type, service, null, null);
+  }
+
 
-  public ComponentV2(String name, Service service) {
-    this(name, service, null, null);
+  public ComponentV2(String type, String name, Service service) {
+    this(type, name, service, null, null);
   }
 
-  public ComponentV2(String name, Service service, ProvisionAction provisionAction, Configuration configuration) {
+  public ComponentV2(String type, String name, Service service, ProvisionAction provisionAction, Configuration configuration) {
+    this.type = type;
     this.name = name;
     this.service = service;
     this.provisionAction = provisionAction;
@@ -52,6 +59,10 @@ public class ComponentV2 {
     return this.name;
   }
 
+  public String getType() {
+    return type;
+  }
+
   /**
    * Gets the provision action associated with this component.
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupInfo.java
index 4648412..4db3a92 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupInfo.java
@@ -18,17 +18,17 @@
 
 package org.apache.ambari.server.topology;
 
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.PredicateCompiler;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
 /**
  * Host Group information specific to a cluster instance.
  */
@@ -57,14 +57,14 @@ public class HostGroupInfo {
   private final Map<String, String> hostRackInfo = new HashMap<>();
 
   /**
-   * explicitly specified host count
+   * List of services
    */
-  private int requested_count = 0;
+  protected Collection<Service> serviceConfigs;
 
   /**
-   * host group scoped configuration
+   * explicitly specified host count
    */
-  Configuration configuration;
+  private int requested_count = 0;
 
   /**
    * explicitly specified host predicate string
@@ -110,6 +110,10 @@ public class HostGroupInfo {
     }
   }
 
+  public Collection<Service> getServiceConfigs() {
+    return serviceConfigs;
+  }
+
   /**
    * Get the requested host count.
    * This is either the user specified value or
@@ -166,7 +170,7 @@ public class HostGroupInfo {
    * @param configuration configuration instance
    */
   public void setConfiguration(Configuration configuration) {
-    this.configuration = configuration;
+
   }
 
   /**
@@ -175,8 +179,9 @@ public class HostGroupInfo {
    * @return associated host group scoped configuration or null if no configuration
    *         is specified for the host group
    */
+  @Deprecated
   public Configuration getConfiguration() {
-    return configuration;
+    return null;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2.java
index df26b68..fd0f966 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2.java
@@ -110,9 +110,15 @@ public interface HostGroupV2 {
    *
    * @return host group configuration
    */
+  @Deprecated
   Configuration getConfiguration();
 
   /**
+   * List of services
+   */
+  Collection<Service> getServiceConfigs();
+
+  /**
    * Get the cardinality value that was specified for the host group.
    * This is simply meta-data for the stack that a deployer can use
    * and this information is not used by ambari.

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
index 7045912..d8390c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
@@ -18,22 +18,12 @@
 
 package org.apache.ambari.server.topology;
 
-import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_AND_START;
-import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_ONLY;
-import static org.apache.ambari.server.controller.internal.ProvisionAction.START_ONLY;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.PredicateCompiler;
 import org.apache.ambari.server.controller.internal.HostResourceProvider;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
-import org.apache.ambari.server.controller.internal.Stack;
+import org.apache.ambari.server.controller.internal.StackV2;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
@@ -41,14 +31,14 @@ import org.apache.ambari.server.orm.entities.TopologyHostRequestEntity;
 import org.apache.ambari.server.orm.entities.TopologyHostTaskEntity;
 import org.apache.ambari.server.orm.entities.TopologyLogicalTaskEntity;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.topology.tasks.InstallHostTask;
-import org.apache.ambari.server.topology.tasks.PersistHostResourcesTask;
-import org.apache.ambari.server.topology.tasks.RegisterWithConfigGroupTask;
-import org.apache.ambari.server.topology.tasks.StartHostTask;
-import org.apache.ambari.server.topology.tasks.TopologyTask;
+import org.apache.ambari.server.topology.tasks.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.*;
+
+import static org.apache.ambari.server.controller.internal.ProvisionAction.*;
+
 
 
 /**
@@ -60,7 +50,7 @@ public class HostRequest implements Comparable<HostRequest> {
 
   private long requestId;
   private String blueprint;
-  private HostGroup hostGroup;
+  private HostGroupV2 hostGroup;
   private String hostgroupName;
   private Predicate predicate;
   private String hostname = null;
@@ -84,7 +74,7 @@ public class HostRequest implements Comparable<HostRequest> {
   private static PredicateCompiler predicateCompiler = new PredicateCompiler();
 
   public HostRequest(long requestId, long id, long clusterId, String hostname, String blueprintName,
-                     HostGroup hostGroup, Predicate predicate, ClusterTopology topology, boolean skipFailure) {
+                     HostGroupV2 hostGroup, Predicate predicate, ClusterTopology topology, boolean skipFailure) {
     this.requestId = requestId;
     this.id = id;
     this.clusterId = clusterId;
@@ -164,7 +154,7 @@ public class HostRequest implements Comparable<HostRequest> {
     return blueprint;
   }
 
-  public HostGroup getHostGroup() {
+  public HostGroupV2 getHostGroup() {
     return hostGroup;
   }
 
@@ -206,13 +196,13 @@ public class HostRequest implements Comparable<HostRequest> {
     }
 
     // lower level logical component level tasks which get mapped to physical tasks
-    HostGroup hostGroup = getHostGroup();
+    HostGroupV2 hostGroup = getHostGroup();
     Collection<String> startOnlyComponents = hostGroup.getComponentNames(START_ONLY);
     Collection<String> installOnlyComponents = hostGroup.getComponentNames(INSTALL_ONLY);
     Collection<String> installAndStartComponents = hostGroup.getComponentNames(INSTALL_AND_START);
 
-    for (String component : hostGroup.getComponentNames()) {
-      if (component == null || component.equals("AMBARI_SERVER")) {
+    for (ComponentV2 component : hostGroup.getComponents()) {
+      if (component == null || component.getType().equals("AMBARI_SERVER")) {
         LOG.info("Skipping component {} when creating request\n", component);
         continue;
       }
@@ -222,31 +212,31 @@ public class HostRequest implements Comparable<HostRequest> {
           "PENDING HOST ASSIGNMENT : HOSTGROUP=" + getHostgroupName();
 
       AmbariContext context = topology.getAmbariContext();
-      Stack stack = hostGroup.getStack();
+      StackV2 stack = component.getService().getStack();
 
       // Skip INSTALL task in case server component is marked as START_ONLY, or the cluster provision_action is
       // START_ONLY, unless component is marked with INSTALL_ONLY or INSTALL_AND_START.
-      if (startOnlyComponents.contains(component) || (skipInstallTaskCreate &&
-        !installOnlyComponents.contains(component) && !installAndStartComponents.contains(component))
-          && stack != null && !stack.getComponentInfo(component).isClient()) {
-        LOG.info("Skipping create of INSTALL task for {} on {}.", component, hostName);
+      if (startOnlyComponents.contains(component.getName()) || (skipInstallTaskCreate &&
+        !installOnlyComponents.contains(component.getName()) && !installAndStartComponents.contains(component.getName()))
+          && stack != null && !stack.getComponentInfo(component.getType()).isClient()) {
+        LOG.info("Skipping create of INSTALL task for {} on {}.", component.getName(), hostName);
       } else {
         HostRoleCommand logicalInstallTask = context.createAmbariTask(
-          getRequestId(), id, component, hostName, AmbariContext.TaskType.INSTALL, skipFailure);
+          getRequestId(), id, component.getName(), hostName, AmbariContext.TaskType.INSTALL, skipFailure);
         logicalTasks.put(logicalInstallTask.getTaskId(), logicalInstallTask);
-        logicalTaskMap.get(installTask).put(component, logicalInstallTask.getTaskId());
+        logicalTaskMap.get(installTask).put(component.getName(), logicalInstallTask.getTaskId());
       }
 
       // Skip START task if component is a client, or ir marked as INSTALL_ONLY or cluster provision_action is
       // INSTALL_ONLY
-      if (installOnlyComponents.contains(component) || skipStartTaskCreate ||
-        (stack != null && stack.getComponentInfo(component).isClient())) {
-        LOG.info("Skipping create of START task for {} on {}.", component, hostName);
+      if (installOnlyComponents.contains(component.getName()) || skipStartTaskCreate ||
+        (stack != null && stack.getComponentInfo(component.getType()).isClient())) {
+        LOG.info("Skipping create of START task for {} on {}.", component.getName(), hostName);
       } else {
         HostRoleCommand logicalStartTask = context.createAmbariTask(
-            getRequestId(), id, component, hostName, AmbariContext.TaskType.START, skipFailure);
+            getRequestId(), id, component.getName(), hostName, AmbariContext.TaskType.START, skipFailure);
         logicalTasks.put(logicalStartTask.getTaskId(), logicalStartTask);
-        logicalTaskMap.get(startTask).put(component, logicalStartTask.getTaskId());
+        logicalTaskMap.get(startTask).put(component.getName(), logicalStartTask.getTaskId());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
index b63bbad..1049b90 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
@@ -18,18 +18,7 @@
 
 package org.apache.ambari.server.topology;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicLong;
-
+import com.google.common.collect.Iterables;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
@@ -39,17 +28,14 @@ import org.apache.ambari.server.controller.AmbariServer;
 import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.ShortTaskStatus;
 import org.apache.ambari.server.orm.dao.HostRoleCommandStatusSummaryDTO;
-import org.apache.ambari.server.orm.entities.StageEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostGroupEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostInfoEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostRequestEntity;
-import org.apache.ambari.server.orm.entities.TopologyLogicalRequestEntity;
+import org.apache.ambari.server.orm.entities.*;
 import org.apache.ambari.server.state.Host;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.Iterables;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicLong;
 
 
 /**
@@ -222,7 +208,7 @@ public class LogicalRequest extends Request {
 
     //todo: synchronization
     for (HostRequest hostRequest : allHostRequests) {
-      HostGroup hostGroup = hostRequest.getHostGroup();
+      HostGroupV2 hostGroup = hostRequest.getHostGroup();
       for (String host : topology.getHostGroupInfo().get(hostGroup.getName()).getHostNames()) {
         Collection<String> hostComponents = hostComponentMap.get(host);
         if (hostComponents == null) {
@@ -407,7 +393,7 @@ public class LogicalRequest extends Request {
 
   private void createHostRequests(TopologyRequest request, ClusterTopology topology) {
     Map<String, HostGroupInfo> hostGroupInfoMap = request.getHostGroupInfo();
-    Blueprint blueprint = topology.getBlueprint();
+    BlueprintV2 blueprint = topology.getBlueprint();
     boolean skipFailure = topology.getBlueprint().shouldSkipFailure();
     for (HostGroupInfo hostGroupInfo : hostGroupInfoMap.values()) {
       String groupName = hostGroupInfo.getHostGroupName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
index 12af131..dfeb99b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
@@ -18,43 +18,23 @@
 
 package org.apache.ambari.server.topology;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
+import com.google.gson.Gson;
+import com.google.inject.Inject;
+import com.google.inject.persist.Transactional;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.controller.internal.BaseClusterRequest;
-import org.apache.ambari.server.orm.dao.HostDAO;
-import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
-import org.apache.ambari.server.orm.dao.TopologyHostGroupDAO;
-import org.apache.ambari.server.orm.dao.TopologyHostInfoDAO;
-import org.apache.ambari.server.orm.dao.TopologyHostRequestDAO;
-import org.apache.ambari.server.orm.dao.TopologyLogicalRequestDAO;
-import org.apache.ambari.server.orm.dao.TopologyLogicalTaskDAO;
-import org.apache.ambari.server.orm.dao.TopologyRequestDAO;
-import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostGroupEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostInfoEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostRequestEntity;
-import org.apache.ambari.server.orm.entities.TopologyHostTaskEntity;
-import org.apache.ambari.server.orm.entities.TopologyLogicalRequestEntity;
-import org.apache.ambari.server.orm.entities.TopologyLogicalTaskEntity;
-import org.apache.ambari.server.orm.entities.TopologyRequestEntity;
+import org.apache.ambari.server.orm.dao.*;
+import org.apache.ambari.server.orm.entities.*;
 import org.apache.ambari.server.stack.NoSuchStackException;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.topology.tasks.TopologyTask;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-import com.google.inject.Inject;
-import com.google.inject.persist.Transactional;
+import javax.inject.Singleton;
+import java.util.*;
 
 /**
  * Implementation which uses Ambari Database DAO and Entity objects for persistence
@@ -378,8 +358,8 @@ public class PersistedStateImpl implements PersistedState {
     private final Long clusterId;
     private final Type type;
     private final String description;
-    private final Blueprint blueprint;
-    private final Configuration configuration;
+    private final BlueprintV2 blueprint;
+    private final Collection<Service> services;
     private final Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<>();
 
     public ReplayedTopologyRequest(TopologyRequestEntity entity, BlueprintFactory blueprintFactory) {
@@ -392,8 +372,11 @@ public class PersistedStateImpl implements PersistedState {
       } catch (NoSuchStackException e) {
         throw new RuntimeException("Unable to load blueprint while replaying topology request: " + e, e);
       }
-      configuration = createConfiguration(entity.getClusterProperties(), entity.getClusterAttributes());
-      configuration.setParentConfiguration(blueprint.getConfiguration());
+      //TODO load services, merge servie configs from Cluster template with service configs from Blueprint
+      services = new ArrayList<>();
+      //configuration = createConfiguration(entity.getClusterProperties(), entity.getClusterAttributes());
+      //configuration.setParentConfiguration(blueprint.getConfiguration());
+
 
       parseHostGroupInfo(entity);
     }
@@ -409,13 +392,19 @@ public class PersistedStateImpl implements PersistedState {
     }
 
     @Override
-    public Blueprint getBlueprint() {
+    public BlueprintV2 getBlueprint() {
       return blueprint;
     }
 
     @Override
+    @Deprecated
     public Configuration getConfiguration() {
-      return configuration;
+      return null;
+    }
+
+    @Override
+    public Collection<Service> getServiceConfigs() {
+      return services;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
index 62acdfd..f897f7b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
@@ -19,9 +19,9 @@
 package org.apache.ambari.server.topology;
 
 
-import java.util.Set;
+import org.apache.ambari.server.controller.internal.StackV2;
 
-import org.apache.ambari.server.controller.internal.Stack;
+import java.util.Set;
 
 public class Service {
 
@@ -29,14 +29,16 @@ public class Service {
 
   private final String name;
 
-  private final Stack stack;
+  private final StackV2 stack;
 
   private final Configuration configuration;
 
+  private final ServiceGroup serviceGroup;
+
   private final Set<Service> dependentServices;
 
-  public Service(String type, Stack stack) {
-    this(type, null, stack, null, null);
+  public Service(String type, StackV2 stack, ServiceGroup serviceGroup) {
+    this(type, type, stack, serviceGroup,  null, null);
   }
 
   /**
@@ -46,7 +48,7 @@ public class Service {
    * @param stack
    * @param configuration
    */
-  public Service(String type, String name, Stack stack, Configuration configuration, Set<Service> dependentServices) {
+  public Service(String type, String name, StackV2 stack, ServiceGroup serviceGroup, Configuration configuration, Set<Service> dependentServices) {
     this.type = type;
     if (name == null) {
       this.name = type;
@@ -54,6 +56,7 @@ public class Service {
       this.name = name;
     }
     this.stack = stack;
+    this.serviceGroup = serviceGroup;
     this.configuration = configuration;
     this.dependentServices = dependentServices;
   }
@@ -71,11 +74,19 @@ public class Service {
     return type;
   }
 
-  public Stack getStack() {
+  public StackV2 getStack() {
     return stack;
   }
 
   public Configuration getConfiguration() {
     return configuration;
   }
+
+  public ServiceGroup getServiceGroup() {
+    return serviceGroup;
+  }
+
+  public Set<Service> getDependentServices() {
+    return dependentServices;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java
index 8e66f02..4b59293 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java
@@ -64,4 +64,5 @@ public class ServiceGroup {
   public Set<ServiceGroup> getDependencies() {
     return dependencies;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index d07dec0..cfd3501 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -18,22 +18,10 @@
 
 package org.apache.ambari.server.topology;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.eventbus.Subscribe;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
@@ -42,21 +30,9 @@ import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.AmbariServer;
 import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.ShortTaskStatus;
-import org.apache.ambari.server.controller.internal.ArtifactResourceProvider;
-import org.apache.ambari.server.controller.internal.BaseClusterRequest;
-import org.apache.ambari.server.controller.internal.CalculatedStatus;
-import org.apache.ambari.server.controller.internal.CredentialResourceProvider;
-import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
-import org.apache.ambari.server.controller.internal.RequestImpl;
-import org.apache.ambari.server.controller.internal.ScaleClusterRequest;
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
-import org.apache.ambari.server.controller.spi.RequestStatus;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
-import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
+import org.apache.ambari.server.controller.internal.StackV2;
+import org.apache.ambari.server.controller.internal.*;
+import org.apache.ambari.server.controller.spi.*;
 import org.apache.ambari.server.events.AmbariEvent;
 import org.apache.ambari.server.events.ClusterConfigFinishedEvent;
 import org.apache.ambari.server.events.HostsRemovedEvent;
@@ -79,10 +55,8 @@ import org.apache.ambari.server.utils.RetryHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.eventbus.Subscribe;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
+import java.util.*;
+import java.util.concurrent.*;
 
 /**
  * Manages all cluster provisioning actions on the cluster topology.
@@ -274,7 +248,6 @@ public class TopologyManager {
 
     final ClusterTopology topology = new ClusterTopologyImpl(ambariContext, request);
     final String clusterName = request.getClusterName();
-    final Stack stack = topology.getBlueprint().getStack();
     final String repoVersion = request.getRepositoryVersion();
     final Long repoVersionID = request.getRepositoryVersionId();
 
@@ -291,7 +264,7 @@ public class TopologyManager {
       addKerberosClient(topology);
 
       // refresh default stack config after adding KERBEROS_CLIENT component to topology
-      topology.getBlueprint().getConfiguration().setParentConfiguration(stack.getConfiguration(topology.getBlueprint().getServices()));
+      //topology.getBlueprint().getConfiguration().setParentConfiguration(stack.getConfiguration(topology.getBlueprint().getAllServices()));
 
       credential = request.getCredentialsMap().get(KDC_ADMIN_CREDENTIAL);
       if (credential == null) {
@@ -301,9 +274,8 @@ public class TopologyManager {
 
     topologyValidatorService.validateTopologyConfiguration(topology);
 
-
     // create resources
-    ambariContext.createAmbariResources(topology, clusterName, securityType, repoVersion, repoVersionID);
+    ambariContext.createAmbariResources(topology, clusterName, securityType);
 
     if (securityConfiguration != null && securityConfiguration.getDescriptor() != null) {
       submitKerberosDescriptorAsArtifact(clusterName, securityConfiguration.getDescriptor());
@@ -345,8 +317,11 @@ public class TopologyManager {
 
     //todo: this should be invoked as part of a generic lifecycle event which could possibly
     //todo: be tied to cluster state
-
+    //TODO add all stack or remove concrete stack version
+    Collection<StackV2> stackList = topology.getBlueprint().getStacks();
+    StackV2 stack = stackList.iterator().next();
     ambariContext.persistInstallStateForUI(clusterName, stack.getName(), stack.getVersion());
+
     clusterProvisionWithBlueprintCreateRequests.put(clusterId, logicalRequest);
     return getRequestStatus(logicalRequest.getRequestId());
   }
@@ -1101,9 +1076,10 @@ public class TopologyManager {
    * @param topology  cluster topology
    */
   private void addKerberosClient(ClusterTopology topology) {
-    for (HostGroup group : topology.getBlueprint().getHostGroups().values()) {
-      group.addComponent("KERBEROS_CLIENT");
-    }
+    //TODO lookup KERBEROS_CLIENT
+//    for (HostGroupV2 group : topology.getBlueprint().getHostGroups().values()) {
+//      group.addComponent("KERBEROS_CLIENT");
+//    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyRequest.java
index bd5630b..632473a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyRequest.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.topology;
 
+import java.util.Collection;
 import java.util.Map;
 
 /**
@@ -52,16 +53,23 @@ public interface TopologyRequest {
    *
    * @return associated blueprint instance
    */
-  Blueprint getBlueprint();
+  BlueprintV2 getBlueprint();
 
   /**
    * Get the cluster scoped configuration for the request.
    *
    * @return cluster scoped configuration
    */
+  @Deprecated
   Configuration getConfiguration();
 
   /**
+   * Returns services.
+   * @return
+   */
+  Collection<Service> getServiceConfigs();
+
+  /**
    * Get host group info.
    *
    * @return map of host group name to group info

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
index 990aee7..f8ad78e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/PersistHostResourcesTask.java
@@ -17,20 +17,17 @@
  */
 package org.apache.ambari.server.topology.tasks;
 
+import com.google.inject.assistedinject.Assisted;
+import com.google.inject.assistedinject.AssistedInject;
+import org.apache.ambari.server.topology.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 
-import org.apache.ambari.server.topology.ClusterTopology;
-import org.apache.ambari.server.topology.HostGroup;
-import org.apache.ambari.server.topology.HostRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.assistedinject.Assisted;
-import com.google.inject.assistedinject.AssistedInject;
-
 public class PersistHostResourcesTask extends TopologyHostTask  {
 
   private final static Logger LOG = LoggerFactory.getLogger(PersistHostResourcesTask.class);
@@ -49,10 +46,10 @@ public class PersistHostResourcesTask extends TopologyHostTask  {
   public void runTask() {
     LOG.info("HostRequest: Executing RESOURCE_CREATION task for host: {}", hostRequest.getHostName());
 
-    HostGroup group = hostRequest.getHostGroup();
-    Map<String, Collection<String>> serviceComponents = new HashMap<>();
-    for (String service : group.getServices()) {
-      serviceComponents.put(service, new HashSet<>(group.getComponents(service)));
+    HostGroupV2 group = hostRequest.getHostGroup();
+    Map<Service, Collection<ComponentV2>> serviceComponents = new HashMap<>();
+    for (Service service : group.getServices()) {
+      serviceComponents.put(service, new HashSet(group.getComponents(service)));
     }
     clusterTopology.getAmbariContext().createAmbariHostResources(hostRequest.getClusterId(),
       hostRequest.getHostName(), serviceComponents);

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
index 0170186..4895c40 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
@@ -13,15 +13,16 @@
  */
 package org.apache.ambari.server.topology.validators;
 
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.apache.ambari.server.topology.TopologyValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * Validates configuration types related to services specified in the blueprint.
  * If the cluster creation template contains configuration types that are not related to services in the blueprint the
@@ -44,8 +45,8 @@ public class ClusterConfigTypeValidator implements TopologyValidator {
 
     // collecting all config types for services in the blueprint (from the related stack)
     Set<String> stackServiceConfigTypes = new HashSet<>();
-    for (String serviceName : topology.getBlueprint().getServices()) {
-      stackServiceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
+    for (Service service : topology.getBlueprint().getAllServices()) {
+      stackServiceConfigTypes.addAll(service.getStack().getConfigurationTypes(service.getType()));
     }
 
     // identifying invalid config types

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
index 80b2593..3f8b517 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
@@ -14,13 +14,12 @@
 
 package org.apache.ambari.server.topology.validators;
 
-import org.apache.ambari.server.topology.ClusterTopology;
-import org.apache.ambari.server.topology.Configuration;
-import org.apache.ambari.server.topology.InvalidTopologyException;
-import org.apache.ambari.server.topology.TopologyValidator;
+import org.apache.ambari.server.topology.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Collection;
+
 /**
  * Validates hive service related setup before provisioning the cluster.
  */
@@ -37,34 +36,41 @@ public class HiveServiceValidator implements TopologyValidator {
   @Override
   public void validate(ClusterTopology topology) throws InvalidTopologyException {
 
+    Collection<Service> services = topology.getBlueprint().getServicesByType(HIVE_SERVICE);
     // there is no hive configured in the blueprint, nothing to do (does the validator apply?)
-    if (!topology.getBlueprint().getServices().contains(HIVE_SERVICE)) {
+    if (services.isEmpty()) {
       LOGGER.info(" [{}] service is not listed in the blueprint, skipping hive service validation.", HIVE_SERVICE);
       return;
     }
 
-    Configuration clusterConfiguration = topology.getConfiguration();
+    for (Service service : services) {
 
-    // hive database settings are missing (this should never be the case, defaults come from the stack def.)
-    if (!clusterConfiguration.getAllConfigTypes().contains(HIVE_ENV)) {
-      String errorMessage = String.format(" [ %s ] config type is missing from the service [ %s ]. HIVE service validation failed.", HIVE_ENV, HIVE_SERVICE);
-      LOGGER.error(errorMessage);
-      throw new InvalidTopologyException(errorMessage);
-    }
+      Configuration serviceConfiguration = service.getConfiguration();
 
-    // hive database has custom configuration, skipping validation
-    if (!HIVE_DB_DEFAULT.equals(clusterConfiguration.getPropertyValue(HIVE_ENV, HIVE_DB_PROPERTY))) {
-      LOGGER.info("Custom hive database settings detected. HIVE service validation succeeded.");
-      return;
-    }
+      // hive database settings are missing (this should never be the case, defaults come from the stack def.)
+      if (!serviceConfiguration.getAllConfigTypes().contains(HIVE_ENV)) {
+        String errorMessage = String.format(" [ %s ] config type is missing from the service [ %s ]. HIVE service validation failed.", HIVE_ENV, HIVE_SERVICE);
+        LOGGER.error(errorMessage);
+        throw new InvalidTopologyException(errorMessage);
+      }
 
-    // hive database settings need the mysql-server component in the blueprint
-    if (!topology.getBlueprint().getComponents(HIVE_SERVICE).contains(MYSQL_SERVER_COMPONENT)) {
-      String errorMessage = String.format("Component [%s] must explicitly be set in the blueprint when hive database " +
+      // hive database has custom configuration, skipping validation
+      if (!HIVE_DB_DEFAULT.equals(serviceConfiguration.getPropertyValue(HIVE_ENV, HIVE_DB_PROPERTY))) {
+        LOGGER.info("Custom hive database settings detected. HIVE service validation succeeded.");
+        return;
+      }
+
+      Collection<ComponentV2> mySqlComponents = topology.getBlueprint().getComponentsByType(service, MYSQL_SERVER_COMPONENT);
+
+      // hive database settings need the mysql-server component in the blueprint
+      if (mySqlComponents.isEmpty()) {
+        String errorMessage = String.format("Component [%s] must explicitly be set in the blueprint when hive database " +
         "is configured with the current settings. HIVE service validation failed.", MYSQL_SERVER_COMPONENT);
-      LOGGER.error(errorMessage);
-      throw new InvalidTopologyException(errorMessage);
+        LOGGER.error(errorMessage);
+        throw new InvalidTopologyException(errorMessage);
+      }
     }
+
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java
index 4022fcb..4d37a02 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java
@@ -14,23 +14,14 @@
 
 package org.apache.ambari.server.topology.validators;
 
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.apache.ambari.server.controller.internal.Stack;
+import org.apache.ambari.server.controller.internal.StackV2;
 import org.apache.ambari.server.state.PropertyInfo;
-import org.apache.ambari.server.topology.Blueprint;
-import org.apache.ambari.server.topology.ClusterTopology;
-import org.apache.ambari.server.topology.HostGroup;
-import org.apache.ambari.server.topology.InvalidTopologyException;
-import org.apache.ambari.server.topology.TopologyValidator;
+import org.apache.ambari.server.topology.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.*;
+
 
 /**
  * Validates the configuration by checking the existence of required properties for the services listed in the blueprint.
@@ -52,14 +43,11 @@ public class RequiredConfigPropertiesValidator implements TopologyValidator {
   @Override
   public void validate(ClusterTopology topology) throws InvalidTopologyException {
 
-    // collect required properties
-    Map<String, Map<String, Collection<String>>> requiredPropertiesByService = getRequiredPropertiesByService(topology.getBlueprint());
-
     // find missing properties in the cluster configuration
     Map<String, Collection<String>> missingProperties = new TreeMap<>();
     Map<String, Map<String, String>> topologyConfiguration = new HashMap<>(topology.getConfiguration().getFullProperties(1));
 
-    for (HostGroup hostGroup : topology.getBlueprint().getHostGroups().values()) {
+    for (HostGroupV2 hostGroup : topology.getBlueprint().getHostGroups().values()) {
       LOGGER.debug("Processing hostgroup configurations for hostgroup: {}", hostGroup.getName());
 
       // copy of all configurations available in the topology hgConfig -> topologyConfig -> bpConfig
@@ -73,21 +61,21 @@ public class RequiredConfigPropertiesValidator implements TopologyValidator {
         }
       }
 
-      for (String hostGroupService : hostGroup.getServices()) {
+      for (Service hostGroupService : hostGroup.getServices()) {
 
-        if (!requiredPropertiesByService.containsKey(hostGroupService)) {
+        // collect required properties
+        Map<String, Collection<String>> requiredPropertiesForService = getRequiredPropertiesForService(hostGroupService);
+        if (requiredPropertiesForService.isEmpty()) {
           // there are no required properties for the service
           LOGGER.debug("There are no required properties found for hostgroup/service: [{}/{}]", hostGroup.getName(), hostGroupService);
           continue;
         }
 
-        Map<String, Collection<String>> requiredPropertiesByType = requiredPropertiesByService.get(hostGroupService);
-
-        for (String configType : requiredPropertiesByType.keySet()) {
+        for (String configType : requiredPropertiesForService.keySet()) {
 
           // We need a copy not to modify the original
           Collection<String> requiredPropertiesForType = new HashSet(
-              requiredPropertiesByType.get(configType));
+            requiredPropertiesForService.get(configType));
 
           if (!operationalConfigurations.containsKey(configType)) {
             // all required configuration is missing for the config type
@@ -116,60 +104,48 @@ public class RequiredConfigPropertiesValidator implements TopologyValidator {
 
 
   /**
-   * Collects required properties for services in the blueprint. Configuration properties are returned by configuration type.
-   * service -> configType -> properties
-   *
-   * @param blueprint the blueprint from the cluster topology
+   * Collects required properties for a specified services in the blueprint. Configuration properties are returned
+   * by configuration type. configType -> properties
+   * @param service the blueprint from the cluster topology
    * @return a map with configuration types mapped to collections of required property names
    */
 
-  private Map<String, Map<String, Collection<String>>> getRequiredPropertiesByService(Blueprint blueprint) {
+  private Map<String, Collection<String>> getRequiredPropertiesForService(Service service) {
 
-    Map<String, Map<String, Collection<String>>> requiredPropertiesForServiceByType = new HashMap<>();
+    LOGGER.debug("Collecting required properties for the service: {}", service.getName());
 
-    for (String bpService : blueprint.getServices()) {
-      LOGGER.debug("Collecting required properties for the service: {}", bpService);
+    Collection<StackV2.ConfigProperty> requiredConfigsForService = service.getStack().
+      getRequiredConfigurationProperties(service.getType());
+    Map<String, Collection<String>> requiredPropertiesByConfigType = new HashMap<>();
 
-      Collection<Stack.ConfigProperty> requiredConfigsForService = blueprint.getStack().getRequiredConfigurationProperties(bpService);
-      Map<String, Collection<String>> requiredPropertiesByConfigType = new HashMap<>();
-
-      for (Stack.ConfigProperty configProperty : requiredConfigsForService) {
-
-        if (configProperty.getPropertyTypes() != null && configProperty.getPropertyTypes().contains(PropertyInfo.PropertyType.PASSWORD)) {
-          LOGGER.debug("Skipping required property validation for password type: {}", configProperty.getName());
-          // skip password types
-          continue;
-        }
+    for (StackV2.ConfigProperty configProperty : requiredConfigsForService) {
 
-        // add / get  service related required propeByType map
-        if (requiredPropertiesForServiceByType.containsKey(bpService)) {
-          requiredPropertiesByConfigType = requiredPropertiesForServiceByType.get(bpService);
-        } else {
-          LOGGER.debug("Adding required properties entry for service: {}", bpService);
-          requiredPropertiesForServiceByType.put(bpService, requiredPropertiesByConfigType);
-        }
-
-        // add collection of required properties
-        Collection<String> requiredPropsForType = new HashSet<>();
-        if (requiredPropertiesByConfigType.containsKey(configProperty.getType())) {
-          requiredPropsForType = requiredPropertiesByConfigType.get(configProperty.getType());
-        } else {
-          LOGGER.debug("Adding required properties entry for configuration type: {}", configProperty.getType());
-          requiredPropertiesByConfigType.put(configProperty.getType(), requiredPropsForType);
-        }
+      if (configProperty.getPropertyTypes() != null && configProperty.getPropertyTypes().contains(PropertyInfo.PropertyType.PASSWORD)) {
+        LOGGER.debug("Skipping required property validation for password type: {}", configProperty.getName());
+        // skip password types
+        continue;
+      }
 
-        requiredPropsForType.add(configProperty.getName());
-        LOGGER.debug("Added required property for service; {}, configuration type: {}, property: {}", bpService,
-          configProperty.getType(), configProperty.getName());
+      // add collection of required properties
+      Collection<String> requiredPropsForType = new HashSet<>();
+      if (requiredPropertiesByConfigType.containsKey(configProperty.getType())) {
+        requiredPropsForType = requiredPropertiesByConfigType.get(configProperty.getType());
+      } else {
+        LOGGER.debug("Adding required properties entry for configuration type: {}", configProperty.getType());
+        requiredPropertiesByConfigType.put(configProperty.getType(), requiredPropsForType);
       }
+
+      requiredPropsForType.add(configProperty.getName());
+      LOGGER.debug("Added required property for service; {}, configuration type: {}, property: {}", service.getName(),
+        configProperty.getType(), configProperty.getName());
     }
 
-    LOGGER.info("Identified required properties for blueprint services: {}", requiredPropertiesForServiceByType);
-    return requiredPropertiesForServiceByType;
+    return requiredPropertiesByConfigType;
 
   }
 
-  private Map<String, Collection<String>> addTomissingProperties(Map<String, Collection<String>> missingProperties, String hostGroup, Collection<String> values) {
+  private Map<String, Collection<String>> addTomissingProperties(Map<String, Collection<String>> missingProperties,
+                                                                 String hostGroup, Collection<String> values) {
     Map<String, Collection<String>> missing;
 
     if (missingProperties == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredPasswordValidator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredPasswordValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredPasswordValidator.java
index 5b4ecc1..9a2b846 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredPasswordValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredPasswordValidator.java
@@ -14,20 +14,15 @@ package org.apache.ambari.server.topology.validators;
  * limitations under the License.
  */
 
+import org.apache.ambari.server.controller.internal.StackV2;
+import org.apache.ambari.server.state.PropertyInfo;
+import org.apache.ambari.server.topology.*;
+
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.state.PropertyInfo;
-import org.apache.ambari.server.topology.Blueprint;
-import org.apache.ambari.server.topology.ClusterTopology;
-import org.apache.ambari.server.topology.HostGroup;
-import org.apache.ambari.server.topology.HostGroupInfo;
-import org.apache.ambari.server.topology.InvalidTopologyException;
-import org.apache.ambari.server.topology.TopologyValidator;
-
 /**
  * Validates that all required passwords are provided.
  */
@@ -80,23 +75,22 @@ public class RequiredPasswordValidator implements TopologyValidator {
           groupEntry.getValue().getConfiguration().getFullProperties(3);
 
       Collection<String> processedServices = new HashSet<>();
-      Blueprint blueprint = topology.getBlueprint();
-      Stack stack = blueprint.getStack();
+      BlueprintV2 blueprint = topology.getBlueprint();
 
-      HostGroup hostGroup = blueprint.getHostGroup(hostGroupName);
-      for (String component : hostGroup.getComponentNames()) {
+      HostGroupV2 hostGroup = blueprint.getHostGroup(hostGroupName);
+      for (ComponentV2 component : hostGroup.getComponents()) {
         //for now, AMBARI is not recognized as a service in Stacks
-        if (component.equals("AMBARI_SERVER")) {
+        if (component.getType().equals("AMBARI_SERVER")) {
           continue;
         }
 
-        String serviceName = stack.getServiceForComponent(component);
-        if (processedServices.add(serviceName)) {
+        Service service = component.getService();
+        if (processedServices.add(service.getName())) {
           //todo: do I need to subtract excluded configs?
-          Collection<Stack.ConfigProperty> requiredProperties =
-              stack.getRequiredConfigurationProperties(serviceName, PropertyInfo.PropertyType.PASSWORD);
+          Collection<StackV2.ConfigProperty> requiredProperties =
+          service.getStack().getRequiredConfigurationProperties(service.getType(), PropertyInfo.PropertyType.PASSWORD);
 
-          for (Stack.ConfigProperty property : requiredProperties) {
+          for (StackV2.ConfigProperty property : requiredProperties) {
             String category = property.getType();
             String name = property.getName();
             if (! propertyExists(topology, groupProperties, category, name)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidator.java
index f028a31..55660e3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidator.java
@@ -14,15 +14,16 @@
 
 package org.apache.ambari.server.topology.validators;
 
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.apache.ambari.server.topology.TopologyValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * Validates whether incoming config types (form the blueprint or the cluster creation template) are valid.
  * A configuration type is considered valid if the stack based on which the cluster is to be created contains such a
@@ -36,25 +37,27 @@ public class StackConfigTypeValidator implements TopologyValidator {
 
   @Override
   public void validate(ClusterTopology topology) throws InvalidTopologyException {
+    for (Service service : topology.getServiceConfigs()) {
+      // get the config types form the request
+      Set<String> incomingConfigTypes = new HashSet<>(service.getConfiguration().getAllConfigTypes());
 
-    // get the config types form the request
-    Set<String> incomingConfigTypes = new HashSet<>(topology.getConfiguration().getAllConfigTypes());
+      if (incomingConfigTypes.isEmpty()) {
+        LOGGER.debug("No config types to be checked.");
+        return;
+      }
 
-    if (incomingConfigTypes.isEmpty()) {
-      LOGGER.debug("No config types to be checked.");
-      return;
-    }
+      Set<String> stackConfigTypes = new HashSet<>(service.getStack().getConfiguration().getAllConfigTypes());
 
-    Set<String> stackConfigTypes = new HashSet<>(topology.getBlueprint().getStack().getConfiguration().getAllConfigTypes());
+      // remove all "valid" config types from the incoming set
+      incomingConfigTypes.removeAll(stackConfigTypes);
 
-    // remove all "valid" config types from the incoming set
-    incomingConfigTypes.removeAll(stackConfigTypes);
+      if (!incomingConfigTypes.isEmpty()) {
+        // there are config types in the request that are not in the stack
+        String message = String.format("The following config types are not defined in the stack: %s ", incomingConfigTypes);
+        LOGGER.error(message);
+        throw new InvalidTopologyException(message);
+      }
 
-    if (!incomingConfigTypes.isEmpty()) {
-      // there are config types in the request that are not in the stack
-      String message = String.format("The following config types are not defined in the stack: %s ", incomingConfigTypes);
-      LOGGER.error(message);
-      throw new InvalidTopologyException(message);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/UnitValidator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/UnitValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/UnitValidator.java
index e75ffa4..50bdec6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/UnitValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/UnitValidator.java
@@ -17,18 +17,17 @@
  */
 package org.apache.ambari.server.topology.validators;
 
-import static org.apache.ambari.server.controller.internal.UnitUpdater.PropertyValue;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.ambari.server.controller.internal.Stack;
+import org.apache.ambari.server.controller.internal.StackV2;
 import org.apache.ambari.server.controller.internal.UnitUpdater.PropertyUnit;
 import org.apache.ambari.server.topology.ClusterTopology;
-import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyException;
 import org.apache.ambari.server.topology.TopologyValidator;
 
+import java.util.Map;
+import java.util.Set;
+
+import static org.apache.ambari.server.controller.internal.UnitUpdater.PropertyValue;
+
 /**
  * I validate the unit of properties by checking if it matches to the stack defined unit.
  * Properties with different unit than the stack defined unit are rejected.
@@ -42,33 +41,32 @@ public class UnitValidator implements TopologyValidator {
 
   @Override
   public void validate(ClusterTopology topology) throws InvalidTopologyException {
-    Stack stack = topology.getBlueprint().getStack();
-    validateConfig(topology.getConfiguration().getFullProperties(), stack);
-    for (HostGroupInfo hostGroup : topology.getHostGroupInfo().values()) {
-      validateConfig(hostGroup.getConfiguration().getFullProperties(), stack);
-    }
+    topology.getServiceConfigs().forEach(service -> {
+      validateConfig(service.getConfiguration().getFullProperties(), service.getStack());
+      topology.getHostGroupInfo().values().forEach(hostGroup ->
+        validateConfig(hostGroup.getConfiguration().getFullProperties(), service.getStack()));
+    });
+
   }
 
-  private void validateConfig(Map<String, Map<String, String>> configuration, Stack stack) {
-    for (Map.Entry<String, Map<String, String>> each : configuration.entrySet()) {
-      validateConfigType(each.getKey(), each.getValue(), stack);
-    }
+  private void validateConfig(Map<String, Map<String, String>> configuration, StackV2 stack) {
+    configuration.entrySet().forEach(each ->
+      validateConfigType(each.getKey(), each.getValue(), stack)
+    );
   }
 
-  private void validateConfigType(String configType, Map<String, String> config, Stack stack) {
-    for (String propertyName : config.keySet()) {
-      validateProperty(configType, config, propertyName, stack);
-    }
+  private void validateConfigType(String configType, Map<String, String> config, StackV2 stack) {
+    config.keySet().forEach(propertyName -> validateProperty(configType, config, propertyName, stack));
   }
 
-  private void validateProperty(String configType, Map<String, String> config, String propertyName, Stack stack) {
+  private void validateProperty(String configType, Map<String, String> config, String propertyName, StackV2 stack) {
     relevantProps.stream()
       .filter(each -> each.hasTypeAndName(configType, propertyName))
       .findFirst()
       .ifPresent(relevantProperty -> checkUnit(config, stack, relevantProperty));
   }
 
-  private void checkUnit(Map<String, String> configToBeValidated, Stack stack, UnitValidatedProperty prop) {
+  private void checkUnit(Map<String, String> configToBeValidated, StackV2 stack, UnitValidatedProperty prop) {
     PropertyUnit stackUnit = PropertyUnit.of(stack, prop);
     PropertyValue value = PropertyValue.of(prop.getPropertyName(), configToBeValidated.get(prop.getPropertyName()));
     if (value.hasAnyUnit() && !value.hasUnit(stackUnit)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 8c44632..bbd0fea 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -322,7 +322,7 @@ public class AmbariMetaInfoTest {
   }
 
   /**
-   * Method: Map<String, ServiceInfo> getServices(String stackName, String
+   * Method: Map<String, ServiceInfo> getServiceConfigs(String stackName, String
    * version, String serviceName)
    * @throws AmbariException
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
index cbf2036..490d2da 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
@@ -40,7 +40,7 @@ public class RootServiceServiceTest extends BaseServiceTest {
   public List<ServiceTestInvocation> getTestInvocations() throws Exception {
     List<ServiceTestInvocation> listInvocations = new ArrayList<>();
     
-    //getServices
+    //getServiceConfigs
     RootServiceService service = new TestRootServiceService(null, null, null);
     Method m = service.getClass().getMethod("getRootServices", String.class, HttpHeaders.class, UriInfo.class);
     Object[] args = new Object[] {null, getHttpHeaders(), getUriInfo()};

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java
index a51d710..a5bb5e7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java
@@ -45,7 +45,7 @@ public class ServiceServiceTest extends BaseServiceTest {
     Object[] args = new Object[] {null, getHttpHeaders(), getUriInfo(), "serviceName"};
     listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null));
 
-    //getServices
+    //getServiceConfigs
     service = new TestServiceService("clusterName", null);
     m = service.getClass().getMethod("getServices", String.class, HttpHeaders.class, UriInfo.class);
     args = new Object[] {null, getHttpHeaders(), getUriInfo()};

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index bf2b84d..44b46f4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -8961,7 +8961,7 @@ public class AmbariManagementControllerTest {
     expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
     expect(injector.getInstance(KerberosHelper.class)).andReturn(createStrictMock(KerberosHelper.class));
 
-    // getServices
+    // getServiceConfigs
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
     expect(cluster.getService("service1")).andReturn(service);
 
@@ -9005,7 +9005,7 @@ public class AmbariManagementControllerTest {
     expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
     expect(injector.getInstance(KerberosHelper.class)).andReturn(createStrictMock(KerberosHelper.class));
 
-    // getServices
+    // getServiceConfigs
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
     expect(cluster.getService("service1")).andThrow(new ServiceNotFoundException("custer1", "service1"));
 
@@ -9064,7 +9064,7 @@ public class AmbariManagementControllerTest {
     expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
     expect(injector.getInstance(KerberosHelper.class)).andReturn(createStrictMock(KerberosHelper.class));
 
-    // getServices
+    // getServiceConfigs
     expect(clusters.getCluster("cluster1")).andReturn(cluster).times(4);
     expect(cluster.getService("service1")).andReturn(service1);
     expect(cluster.getService("service2")).andThrow(new ServiceNotFoundException("cluster1", "service2"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index 4b09c6d..c9e3ce9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -599,7 +599,7 @@ public class ClusterTest {
     // TODO write unit tests for
     // public void addService(Service service) throws AmbariException;
     // public Service getService(String serviceName) throws AmbariException;
-    // public Map<String, Service> getServices();
+    // public Map<String, Service> getServiceConfigs();
 
     RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(c1);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
index 6ac74a3..bb33edd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
@@ -459,7 +459,7 @@ public class BlueprintImplTest {
 //    expect(request.getProperties()).andReturn(setProperties);
 //    expect(request.getRequestInfoProperties()).andReturn(Collections.<String, String>emptyMap());
 //    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
-//    expect(metaInfo.getServices("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
+//    expect(metaInfo.getServiceConfigs("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
 //    expect(metaInfo.getComponentsByService("test-stack-name", "test-stack-version", "test-service")).
 //        andReturn(serviceComponents).anyTimes();
 //    expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component1")).
@@ -570,7 +570,7 @@ public class BlueprintImplTest {
 //    expect(request.getProperties()).andReturn(setProperties);
 //    expect(request.getRequestInfoProperties()).andReturn(Collections.<String, String>emptyMap());
 //    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
-//    expect(metaInfo.getServices("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
+//    expect(metaInfo.getServiceConfigs("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
 //    expect(metaInfo.getComponentsByService("test-stack-name", "test-stack-version", "test-service")).
 //        andReturn(serviceComponents).anyTimes();
 //    expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component1")).
@@ -689,7 +689,7 @@ public class BlueprintImplTest {
 //    expect(request.getProperties()).andReturn(setProperties);
 //    expect(request.getRequestInfoProperties()).andReturn(Collections.<String, String>emptyMap());
 //    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
-//    expect(metaInfo.getServices("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
+//    expect(metaInfo.getServiceConfigs("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
 //    expect(metaInfo.getComponentsByService("test-stack-name", "test-stack-version", "test-service")).
 //        andReturn(serviceComponents).anyTimes();
 //    expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component1")).
@@ -797,7 +797,7 @@ public class BlueprintImplTest {
 //    expect(request.getProperties()).andReturn(setProperties);
 //    expect(request.getRequestInfoProperties()).andReturn(Collections.<String, String>emptyMap());
 //    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
-//    expect(metaInfo.getServices("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
+//    expect(metaInfo.getServiceConfigs("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
 //    expect(metaInfo.getComponentsByService("test-stack-name", "test-stack-version", "test-service")).
 //        andReturn(serviceComponents).anyTimes();
 //    expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component1")).
@@ -865,7 +865,7 @@ public class BlueprintImplTest {
 //    expect(request.getProperties()).andReturn(setProperties);
 //    expect(request.getRequestInfoProperties()).andReturn(Collections.<String, String>emptyMap());
 //    expect(dao.findByName(BLUEPRINT_NAME)).andReturn(null);
-//    expect(metaInfo.getServices("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
+//    expect(metaInfo.getServiceConfigs("test-stack-name", "test-stack-version")).andReturn(services).anyTimes();
 //    expect(metaInfo.getComponentsByService("test-stack-name", "test-stack-version", "test-service")).
 //        andReturn(serviceComponents).anyTimes();
 //    expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component1")).

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
index e51ce5f..87d6363 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
@@ -18,23 +18,16 @@
 
 package org.apache.ambari.server.topology;
 
-import static org.easymock.EasyMock.expect;
-import static org.powermock.api.easymock.PowerMock.createNiceMock;
-import static org.powermock.api.easymock.PowerMock.replay;
-import static org.powermock.api.easymock.PowerMock.reset;
-import static org.powermock.api.easymock.PowerMock.verify;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
+import org.apache.ambari.server.controller.internal.Stack;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.util.*;
+
+import static org.easymock.EasyMock.expect;
+import static org.powermock.api.easymock.PowerMock.*;
+
 /**
  * Unit tests for ClusterTopologyImpl.
  */
@@ -44,13 +37,14 @@ public class ClusterTopologyImplTest {
   private static final String CLUSTER_NAME = "cluster_name";
   private static final long CLUSTER_ID = 1L;
   private static final String predicate = "Hosts/host_name=foo";
-  private static final Blueprint blueprint = createNiceMock(Blueprint.class);
-  private static final HostGroup group1 = createNiceMock(HostGroup.class);
-  private static final HostGroup group2 = createNiceMock(HostGroup.class);
-  private static final HostGroup group3 = createNiceMock(HostGroup.class);
-  private static final HostGroup group4 = createNiceMock(HostGroup.class);
+  private static final BlueprintV2 blueprint = createNiceMock(BlueprintV2.class);
+  private static final HostGroupV2 group1 = createNiceMock(HostGroupV2.class);
+  private static final HostGroupV2 group2 = createNiceMock(HostGroupV2.class);
+  private static final HostGroupV2 group3 = createNiceMock(HostGroupV2.class);
+  private static final HostGroupV2 group4 = createNiceMock(HostGroupV2.class);
+  private static final Stack stack = createNiceMock(Stack.class);
   private final Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<>();
-  private final Map<String, HostGroup> hostGroupMap = new HashMap<>();
+  private final Map<String, HostGroupV2> hostGroupMap = new HashMap<>();
 
   private Configuration configuration;
   private Configuration bpconfiguration;
@@ -101,20 +95,20 @@ public class ClusterTopologyImplTest {
     hostGroupMap.put("group3", group3);
     hostGroupMap.put("group4", group4);
 
-    Set<Component> group1Components = new HashSet<>();
-    group1Components.add(new Component("component1"));
-    group1Components.add(new Component("component2"));
+    Set<ComponentV2> group1Components = new HashSet<>();
+    group1Components.add(new ComponentV2("component1", new Service("service1", stack)));
+    group1Components.add(new ComponentV2("component2", new Service("service1", stack)));
 
     Set<String> group1ComponentNames = new HashSet<>();
     group1ComponentNames.add("component1");
     group1ComponentNames.add("component2");
 
-    Set<Component> group2Components = new HashSet<>();
-    group2Components.add(new Component("component3"));
-    Set<Component> group3Components = new HashSet<>();
-    group3Components.add(new Component("component4"));
-    Set<Component> group4Components = new HashSet<>();
-    group4Components.add(new Component("component5"));
+    Set<ComponentV2> group2Components = new HashSet<>();
+    group2Components.add(new ComponentV2("component3", new Service("service1", stack)));
+    Set<ComponentV2> group3Components = new HashSet<>();
+    group3Components.add(new ComponentV2("component4", new Service("service2", stack)));
+    Set<ComponentV2> group4Components = new HashSet<>();
+    group4Components.add(new ComponentV2("component5", new Service("service2", stack)));
 
     expect(blueprint.getHostGroups()).andReturn(hostGroupMap).anyTimes();
     expect(blueprint.getHostGroup("group1")).andReturn(group1).anyTimes();
@@ -143,7 +137,6 @@ public class ClusterTopologyImplTest {
     verify(blueprint, group1, group2, group3, group4);
     reset(blueprint, group1, group2, group3, group4);
 
-
     hostGroupInfoMap.clear();
     hostGroupMap.clear();
   }
@@ -241,7 +234,7 @@ public class ClusterTopologyImplTest {
     }
 
     @Override
-    public Blueprint getBlueprint() {
+    public BlueprintV2 getBlueprint() {
       return blueprint;
     }
 
@@ -251,6 +244,11 @@ public class ClusterTopologyImplTest {
     }
 
     @Override
+    public Collection<Service> getServiceConfigs() {
+      return null;
+    }
+
+    @Override
     public Map<String, HostGroupInfo> getHostGroupInfo() {
       return hostGroupInfoMap;
     }