public ClusterManifestTypeNodeType ToClusterManifestTypeNodeType() { var endpoints = new FabricEndpointsType() { ClientConnectionEndpoint = new InputEndpointType() { Port = this.ClientConnectionEndpointPort.ToString(), Protocol = InputEndpointTypeProtocol.tcp }, HttpGatewayEndpoint = new InputEndpointType() { Port = this.HttpGatewayEndpointPort.ToString(), Protocol = InputEndpointTypeProtocol.http }, }; if (this.HttpApplicationGatewayEndpointPort != null) { endpoints.HttpApplicationGatewayEndpoint = new InputEndpointType() { Port = this.HttpApplicationGatewayEndpointPort.ToString(), Protocol = InputEndpointTypeProtocol.http }; } LogicalDirectoryType[] logicalDirectories = null; if (this.LogicalDirectories != null && this.LogicalDirectories.Length > 0) { logicalDirectories = new LogicalDirectoryType[this.LogicalDirectories.Count()]; var i = 0; foreach (var dir in this.LogicalDirectories) { logicalDirectories[i++] = dir.ToLogicalDirectoryType(); } } return(new ClusterManifestTypeNodeType() { Name = this.Name, PlacementProperties = (this.PlacementProperties == null) ? null : this.PlacementProperties.Select( property => new KeyValuePairType() { Name = property.Key, Value = property.Value }).ToArray(), Capacities = (this.Capacities == null) ? null : this.Capacities.Select( capacity => new KeyValuePairType() { Name = capacity.Key, Value = capacity.Value }).ToArray(), SfssRgPolicies = (this.SfssRgPolicies == null) ? null : this.SfssRgPolicies.Select( rgPolicy => new KeyValuePairType() { Name = rgPolicy.Key, Value = rgPolicy.Value }).ToArray(), Endpoints = endpoints, KtlLoggerSettings = (this.KtlLogger == null) ? null : this.KtlLogger.ToFabricKtlLoggerSettingsType(), LogicalDirectories = logicalDirectories }); }
public InfrastructureNode(FabricNodeType node, FabricEndpointsType endpoints, CertificatesType certificates) { FabricNode = node; NodeEndpoints = endpoints; NodeCertificates = certificates; }
private static void VerifyAreEqual(FabricEndpointsType endpoints1, FabricEndpointsType endpoints2) { Assert.AreEqual(endpoints1.ApplicationEndpoints.EndPort, endpoints2.ApplicationEndpoints.EndPort, "ApplicationEndpoints.EndPort"); Assert.AreEqual(endpoints1.ApplicationEndpoints.StartPort, endpoints2.ApplicationEndpoints.StartPort, "ApplicationEndpoints.StartPort"); Assert.AreEqual(endpoints1.ClientConnectionEndpoint.Port, endpoints2.ClientConnectionEndpoint.Port, "ClientConnectionEndpoint.Port"); Assert.AreEqual(endpoints1.ClientConnectionEndpoint.Protocol, endpoints2.ClientConnectionEndpoint.Protocol, "ClientConnectionEndpoint.Protocol"); Assert.AreEqual(endpoints1.ClusterConnectionEndpoint.Port, endpoints2.ClusterConnectionEndpoint.Port, "ClusterConnectionEndpoint.Port"); Assert.AreEqual(endpoints1.ClusterConnectionEndpoint.Protocol, endpoints2.ClusterConnectionEndpoint.Protocol, "ClusterConnectionEndpoint.Protocol"); Assert.AreEqual(endpoints1.LeaseDriverEndpoint.Port, endpoints2.LeaseDriverEndpoint.Port, "LeaseDriverEndpoint.Port"); Assert.AreEqual(endpoints1.LeaseDriverEndpoint.Protocol, endpoints2.LeaseDriverEndpoint.Protocol, "LeaseDriverEndpoint.Protocol"); if (endpoints1.HttpGatewayEndpoint == null) { Assert.IsNull(endpoints2.HttpGatewayEndpoint); } else { Assert.AreEqual(endpoints1.HttpGatewayEndpoint.Port, endpoints2.HttpGatewayEndpoint.Port, "HttpGatewayEndpoint.Port"); Assert.AreEqual(endpoints1.HttpGatewayEndpoint.Protocol, endpoints2.HttpGatewayEndpoint.Protocol, "HttpGatewayEndpoint.Protocol"); } if (endpoints1.HttpGatewayEndpoint == null) { Assert.IsNull(endpoints2.HttpGatewayEndpoint); } else { Assert.AreEqual(endpoints1.HttpGatewayEndpoint.Port, endpoints2.HttpGatewayEndpoint.Port, "HttpGatewayEndpoint.Port"); Assert.AreEqual(endpoints1.HttpGatewayEndpoint.Protocol, endpoints2.HttpGatewayEndpoint.Protocol, "HttpGatewayEndpoint.Protocol"); } if (endpoints1.HttpGatewayEndpoint == null) { Assert.IsNull(endpoints2.HttpGatewayEndpoint); } else { Assert.AreEqual(endpoints1.HttpGatewayEndpoint.Port, endpoints2.HttpGatewayEndpoint.Port, "HttpGatewayEndpoint.Port"); Assert.AreEqual(endpoints1.HttpGatewayEndpoint.Protocol, endpoints2.HttpGatewayEndpoint.Protocol, "HttpGatewayEndpoint.Protocol"); } if (endpoints1.ClusterManagerReplicatorEndpoint == null) { Assert.IsNull(endpoints2.ClusterManagerReplicatorEndpoint); } else { Assert.AreEqual(endpoints1.ClusterManagerReplicatorEndpoint.Port, endpoints2.ClusterManagerReplicatorEndpoint.Port, "ClusterManagerReplicatorEndpoint.Port"); Assert.AreEqual(endpoints1.ClusterManagerReplicatorEndpoint.Protocol, endpoints2.ClusterManagerReplicatorEndpoint.Protocol, "ClusterManagerReplicatorEndpoint.Protocol"); } if (endpoints1.DefaultReplicatorEndpoint == null) { Assert.IsNull(endpoints2.DefaultReplicatorEndpoint); } else { Assert.AreEqual(endpoints1.DefaultReplicatorEndpoint.Port, endpoints2.DefaultReplicatorEndpoint.Port, "DefaultReplicatorEndpoint.Port"); Assert.AreEqual(endpoints1.DefaultReplicatorEndpoint.Protocol, endpoints2.DefaultReplicatorEndpoint.Protocol, "DefaultReplicatorEndpoint.Protocol"); } if (endpoints1.NamingReplicatorEndpoint == null) { Assert.IsNull(endpoints2.NamingReplicatorEndpoint); } else { Assert.AreEqual(endpoints1.NamingReplicatorEndpoint.Port, endpoints2.NamingReplicatorEndpoint.Port, "NamingReplicatorEndpoint.Port"); Assert.AreEqual(endpoints1.NamingReplicatorEndpoint.Protocol, endpoints2.NamingReplicatorEndpoint.Protocol, "NamingReplicatorEndpoint.Protocol"); } if (endpoints1.FailoverManagerReplicatorEndpoint == null) { Assert.IsNull(endpoints2.FailoverManagerReplicatorEndpoint); } else { Assert.AreEqual(endpoints1.FailoverManagerReplicatorEndpoint.Port, endpoints2.FailoverManagerReplicatorEndpoint.Port, "FailoverManagerReplicatorEndpoint.Port"); Assert.AreEqual(endpoints1.FailoverManagerReplicatorEndpoint.Protocol, endpoints2.FailoverManagerReplicatorEndpoint.Protocol, "FailoverManagerReplicatorEndpoint.Protocol"); } if (endpoints1.ServiceConnectionEndpoint == null) { Assert.IsNull(endpoints2.ServiceConnectionEndpoint); } else { Assert.AreEqual(endpoints1.ServiceConnectionEndpoint.Port, endpoints2.ServiceConnectionEndpoint.Port, "ServiceConnectionEndpoint.Port"); Assert.AreEqual(endpoints1.ServiceConnectionEndpoint.Protocol, endpoints2.ServiceConnectionEndpoint.Protocol, "ServiceConnectionEndpoint.Protocol"); } }
private void InitializeInfrastructureSettings( int nNodeTypes, bool isScaleMin, bool isLogicalDirectories, int[] nNodes, int[] nSeedNodes, int[] nFaultDomains, int[] nUpgradDomains, InfrastructureType infrastructureType) { this.nodeTypes = new ClusterManifestTypeNodeType[nNodeTypes]; int totalNodes = 0; for (int i = 0; i < nNodeTypes; i++) { totalNodes += nNodes[i]; } this.nodes = new FabricNodeType[totalNodes]; this.infraNodes = new InfrastructureNodeType[totalNodes]; int nodeIndex = 0; for (int i = 0; i < nNodeTypes; i++) { int clientConnectionPort = 19000 + i; int leaseDriverPort = 19000 + nNodeTypes + i; int clusterConnectionPort = 19000 + 2 * nNodeTypes + i; int httpGatewayPort = 19000 + 3 * nNodeTypes + i; int serviceConnectionPort = 19000 + 4 * nNodeTypes + i; int startAppPort = 30000 + 1000 * i + 1; int endAppPort = 30000 + 1000 * (i + 1); string host = isScaleMin ? "localhost" : System.Net.Dns.GetHostName(); string roleOrTierName = GetRoleOrTiername(i); string faultDomain = string.Format(CultureInfo.InvariantCulture, "fd:/Rack{0}", i % nFaultDomains[i]); string upgradeDomain = string.Format(CultureInfo.InvariantCulture, "MYUD{0}", i % nUpgradDomains[i]); FabricEndpointsType endpoints = new FabricEndpointsType() { ApplicationEndpoints = new FabricEndpointsTypeApplicationEndpoints() { StartPort = startAppPort, EndPort = endAppPort }, LeaseDriverEndpoint = new InternalEndpointType() { Port = leaseDriverPort.ToString(CultureInfo.InvariantCulture) }, ClusterConnectionEndpoint = new InternalEndpointType() { Port = clusterConnectionPort.ToString(CultureInfo.InvariantCulture) }, ClientConnectionEndpoint = new InputEndpointType() { Port = clientConnectionPort.ToString(CultureInfo.InvariantCulture) }, HttpGatewayEndpoint = new InputEndpointType() { Port = httpGatewayPort.ToString(CultureInfo.InvariantCulture) }, ServiceConnectionEndpoint = new InternalEndpointType() { Port = serviceConnectionPort.ToString(CultureInfo.InvariantCulture) } }; for (int j = 0; j < nNodes[i]; j++) { bool isSeedNode = j < nSeedNodes[i]; string nodeName = string.Format(CultureInfo.InvariantCulture, "{0}.Node.{1}", roleOrTierName, j); FabricNodeType node = new FabricNodeType() { NodeName = nodeName, FaultDomain = faultDomain, IPAddressOrFQDN = host, IsSeedNode = isSeedNode, NodeTypeRef = roleOrTierName, UpgradeDomain = upgradeDomain }; InfrastructureNodeType infraNode = new InfrastructureNodeType() { NodeName = nodeName, FaultDomain = faultDomain, IPAddressOrFQDN = host, IsSeedNode = isSeedNode, NodeTypeRef = roleOrTierName, UpgradeDomain = upgradeDomain, RoleOrTierName = roleOrTierName, Certificates = null, Endpoints = endpoints }; this.nodes[nodeIndex] = node; this.infraNodes[nodeIndex] = infraNode; nodeIndex++; } nodeTypes[i] = new ClusterManifestTypeNodeType(); nodeTypes[i].Certificates = null; if (infrastructureType == InfrastructureType.WindowsServer || infrastructureType == InfrastructureType.VMM || infrastructureType == InfrastructureType.PaaS) { nodeTypes[i].Endpoints = endpoints; } nodeTypes[i].Name = roleOrTierName; } if (isLogicalDirectories) { nodeTypes[0].LogicalDirectories = new LogicalDirectoryType[5]; nodeTypes[0].LogicalDirectories[0] = new LogicalDirectoryType { LogicalDirectoryName = "0", MappedTo = TestUtility.LogicalDirectoriesApplicationCheckPointFilesDir, Context = LogicalDirectoryTypeContext.node }; nodeTypes[0].LogicalDirectories[1] = new LogicalDirectoryType { LogicalDirectoryName = "1", MappedTo = TestUtility.LogicalDirectoriesLogDir, Context = LogicalDirectoryTypeContext.node }; nodeTypes[0].LogicalDirectories[2] = new LogicalDirectoryType { LogicalDirectoryName = "2", MappedTo = TestUtility.LogicalDirectoriesBackupDir, Context = LogicalDirectoryTypeContext.application }; nodeTypes[0].LogicalDirectories[3] = new LogicalDirectoryType { LogicalDirectoryName = "3", MappedTo = TestUtility.LogicalDirectoriesUserDefined1Dir }; nodeTypes[0].LogicalDirectories[4] = new LogicalDirectoryType { LogicalDirectoryName = "4", MappedTo = TestUtility.LogicalDirectoriesUserDefined2Dir, Context = LogicalDirectoryTypeContext.node }; nodeTypes[1].LogicalDirectories = new LogicalDirectoryType[5]; nodeTypes[1].LogicalDirectories[0] = new LogicalDirectoryType { LogicalDirectoryName = "0", MappedTo = TestUtility.LogicalDirectoriesApplicationCheckPointFilesDir2, Context = LogicalDirectoryTypeContext.application }; nodeTypes[1].LogicalDirectories[1] = new LogicalDirectoryType { LogicalDirectoryName = "1", MappedTo = TestUtility.LogicalDirectoriesLogDir2, Context = LogicalDirectoryTypeContext.application }; nodeTypes[1].LogicalDirectories[2] = new LogicalDirectoryType { LogicalDirectoryName = "2", MappedTo = TestUtility.LogicalDirectoriesBackupDir2, Context = LogicalDirectoryTypeContext.node }; nodeTypes[1].LogicalDirectories[3] = new LogicalDirectoryType { LogicalDirectoryName = "3", MappedTo = TestUtility.LogicalDirectoriesUserDefined1Dir2, Context = LogicalDirectoryTypeContext.application }; nodeTypes[1].LogicalDirectories[4] = new LogicalDirectoryType { LogicalDirectoryName = "4", MappedTo = TestUtility.LogicalDirectoriesUserDefined2Dir2, Context = LogicalDirectoryTypeContext.application }; } }
private void AddFabricNodeSection(FabricNodeType fabricNode, FabricEndpointsType endpoints, ClusterManifestTypeNodeType nodeType, bool isScaleMin) { CertificatesType certificates = nodeType.Certificates; List <SettingsTypeSectionParameter> parameters = new List <SettingsTypeSectionParameter>(); parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.InstanceName, Value = this.NodeName, MustOverride = false }); if (Helpers.isIPV6AddressAndNoBracket(this.IPAddressOrFQDN)) { parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.IPAddressOrFQDN, Value = Helpers.AddBracketsAroundIPV6(this.IPAddressOrFQDN), MustOverride = false }); } else { parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.IPAddressOrFQDN, Value = this.IPAddressOrFQDN, MustOverride = false }); } parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.WorkingDir, Value = this.DeploymentFoldersInfo.WorkFolder, MustOverride = false }); parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.NodeVersion, Value = this.DeploymentFoldersInfo.versions.FabricInstanceVersion, MustOverride = false }); parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.NodeType, Value = fabricNode.NodeTypeRef, MustOverride = false }); parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.IsScaleMin, Value = isScaleMin.ToString(), MustOverride = false }); // // Fill in any KTLLogger values from the NodeTypes // if (nodeType.KtlLoggerSettings != null) { if (nodeType.KtlLoggerSettings.SharedLogFilePath != null) { parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.SharedLogFilePath, Value = nodeType.KtlLoggerSettings.SharedLogFilePath.Value, MustOverride = false }); } if (nodeType.KtlLoggerSettings.SharedLogFileId != null) { parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.SharedLogFileId, Value = nodeType.KtlLoggerSettings.SharedLogFileId.Value, MustOverride = false }); } if (nodeType.KtlLoggerSettings.SharedLogFileSizeInMB != null) { parameters.Add(new SettingsTypeSectionParameter() { Name = Constants.ParameterNames.SharedLogFileSizeInMB, Value = nodeType.KtlLoggerSettings.SharedLogFileSizeInMB.Value.ToString(), MustOverride = false }); } } AddEndpoints(parameters, endpoints); AddCertifcateInformation(parameters, certificates); this.Settings.Add(new SettingsTypeSection() { Name = Constants.SectionNames.FabricNode, Parameter = parameters.ToArray() }); }
public NodeSettings(FabricNodeType fabricNode, ClusterManifestTypeNodeType nodeType, DeploymentFolders deploymentFolders, bool isScaleMin, FabricEndpointsType endpoints) { this.Settings = new List <SettingsTypeSection>(); this.NodeName = fabricNode.NodeName; this.IPAddressOrFQDN = fabricNode.IPAddressOrFQDN; this.DeploymentFoldersInfo = deploymentFolders; AddFabricNodeSection(fabricNode, endpoints, nodeType, isScaleMin); AddDomainIds(fabricNode); AddNodeProperties(nodeType); }