Repository: wso2/testgrid
Issue: Multiple test-plan yaml files contain same infrastructure combination

**Description:**
When there are multiple possible infrastructure combinations exists, Generate Test-Plan should create test-plan yaml files for each of these combinations. But ATM, although multiple test-plan yaml files are generated, the content of them are identical.
<!-- Give a brief description of the issue -->

**Suggested Labels:**
Bug, Highest
<!-- Optional comma separated list of suggested labels. Non committers can’t assign labels to issues, so this will help issue creators who are not a committer to suggest possible labels-->


<!--Optional comma separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, so this will help issue creators who are not a committer to suggest possible assignees-->

**Steps to reproduce:**
1.Make it possible to exists multiple infrastructure combinations (Ex: add one more OS to infrastructure parameter table).
2.Run Generate-test-plan command.
3.Check yaml files generated.

Changed files:
core/src/main/java/org/wso2/testgrid/core/command/GenerateTestPlanCommand.java, common/src/main/java/org/wso2/testgrid/common/config/InfrastructureConfig.java

diff --git a/common/src/main/java/org/wso2/testgrid/common/config/InfrastructureConfig.java b/common/src/main/java/org/wso2/testgrid/common/config/InfrastructureConfig.java
index 046a0f48..02c8cffb 100644
--- a/common/src/main/java/org/wso2/testgrid/common/config/InfrastructureConfig.java
+++ b/common/src/main/java/org/wso2/testgrid/common/config/InfrastructureConfig.java
@@ -20,6 +20,7 @@
 package org.wso2.testgrid.common.config;
 
 import org.apache.commons.collections4.ListUtils;
+import org.wso2.testgrid.common.TestGridError;
 
 import java.io.Serializable;
 import java.util.List;
@@ -32,7 +33,7 @@ import java.util.Properties;
  *
  * @since 1.0.0
  */
-public class InfrastructureConfig implements Serializable {
+public class InfrastructureConfig implements Serializable, Cloneable {
 
     private static final long serialVersionUID = -1660815137752094462L;
 
@@ -169,4 +170,21 @@ public class InfrastructureConfig implements Serializable {
     public static class Provisioner extends DeploymentConfig.DeploymentPattern {
         private static final long serialVersionUID = -3937792864579403430L;
     }
+
+    @Override
+    public InfrastructureConfig clone() {
+        try {
+            InfrastructureConfig infrastructureConfig = (InfrastructureConfig) super.clone();
+            infrastructureConfig.setProvisioners(provisioners);
+            infrastructureConfig.setParameters(parameters);
+            infrastructureConfig.setContainerOrchestrationEngine(containerOrchestrationEngine);
+            infrastructureConfig.setIacProvider(iacProvider);
+            infrastructureConfig.setInfrastructureProvider(infrastructureProvider);
+
+            return infrastructureConfig;
+        } catch (CloneNotSupportedException e) {
+            throw new TestGridError("Since the super class of this object is java.lang.Object that supports " +
+                    "cloning this failure condition should never happen unless a serious system error occurred.", e);
+        }
+    }
 }
diff --git a/core/src/main/java/org/wso2/testgrid/core/command/GenerateTestPlanCommand.java b/core/src/main/java/org/wso2/testgrid/core/command/GenerateTestPlanCommand.java
index c66b614e..449a3149 100644
--- a/core/src/main/java/org/wso2/testgrid/core/command/GenerateTestPlanCommand.java
+++ b/core/src/main/java/org/wso2/testgrid/core/command/GenerateTestPlanCommand.java
@@ -472,7 +472,7 @@ public class GenerateTestPlanCommand implements Command {
                 setUniqueNamesFor(provisioner.getScripts());
 
                 TestPlan testPlan = new TestPlan();
-                testPlan.setInfrastructureConfig(testgridYaml.getInfrastructureConfig());
+                testPlan.setInfrastructureConfig(testgridYaml.getInfrastructureConfig().clone());
                 testPlan.getInfrastructureConfig().setProvisioners(Collections.singletonList(provisioner));
                 deploymentPattern.ifPresent(dp -> {
                     setUniqueNamesFor(dp.getScripts());
@@ -482,7 +482,6 @@ public class GenerateTestPlanCommand implements Command {
                         combination.getParameters());
                 testPlan.getInfrastructureConfig().setParameters(configAwareInfraCombination);
                 testPlan.setScenarioConfig(testgridYaml.getScenarioConfig());
-                testPlan.setInfrastructureConfig(testgridYaml.getInfrastructureConfig());
 
                 testPlan.setInfrastructureRepository(testgridYaml.getInfrastructureRepository());
                 testPlan.setDeploymentRepository(testgridYaml.getDeploymentRepository());