Exemple #1
0
        public async Task CreateLargeWebDeploymentTemplateWorks()
        {
            string resourceName   = Recording.GenerateAssetName("csmr");
            string groupName      = Recording.GenerateAssetName("csmrg");
            string deploymentName = Recording.GenerateAssetName("csmd");

            var parameters = new Deployment
                             (
                new DeploymentProperties(DeploymentMode.Incremental)
            {
                TemplateLink = new TemplateLink(GoodWebsiteTemplateUri),
                Parameters   = ("{'repoURL': {'value': 'https://github.com/devigned/az-roadshow-oss.git'}, 'siteName': {'value': '" + resourceName + "'}, 'location': {'value': 'westus'}, 'sku': {'value': 'F1'}}").Replace("'", "\"")
            }
                             );

            await ResourceGroupsOperations.CreateOrUpdateAsync(groupName, new ResourceGroup(LiveDeploymentTests.LocationSouthCentralUS));

            await DeploymentsOperations.StartCreateOrUpdateAsync(groupName, deploymentName, parameters);

            // Wait until deployment completes
            if (Mode == RecordedTestMode.Record)
            {
                Thread.Sleep(30 * 1000);
            }
            var operations = await DeploymentOperations.ListAsync(groupName, deploymentName, null).ToEnumerableAsync();

            Assert.True(operations.Any());
        }
 public void SetParameters(Dictionary <string, dynamic> parameters, DeploymentOperations operation)
 {
     foreach (var key in parameters.Keys)
     {
         values[key] = parameters[key];
     }
     Operation = operation;
 }
Exemple #3
0
        private static void Validate(
            DeploymentParameters parameters,
            DeploymentOperations expectedOperation,
            string expectedDataRoot,
            string expectedLogRoot,
            string expectedClusterManifestLocation,
            bool expectedDeleteTargetFile,
            string expectedInstanceId,
            string expectedTargetVersion,
            string expectedCurrentVersion,
            string expectedInfrastructureManifestLocation,
            string expectedNodeName)
        {
            Verify.AreEqual(expectedOperation, parameters.Operation, "DeploymentOperations");
            Verify.AreEqual(Path.Combine(RootLocation, "bin"), parameters.FabricBinRoot, "FabricBinRoot");
            Verify.AreEqual(expectedDataRoot, parameters.FabricDataRoot, "FabricDataRoot");
            Verify.AreEqual(expectedLogRoot, parameters.FabricLogRoot, "FabricLogRoot");
            Verify.AreEqual(expectedClusterManifestLocation, parameters.ClusterManifestLocation, "ClusterManifestLocation");
            Verify.AreEqual(expectedDeleteTargetFile, parameters.DeleteTargetFile, "DeleteTargetFile");
            Verify.AreEqual(expectedInstanceId, parameters.InstanceId, "InstanceId");
            Verify.AreEqual(expectedTargetVersion, parameters.TargetVersion, "TargetVersion");

            if (string.IsNullOrEmpty(expectedCurrentVersion))
            {
                Verify.IsTrue(string.IsNullOrEmpty(parameters.CurrentVersion), "CurrentVersion");
            }
            else
            {
                Verify.AreEqual(expectedCurrentVersion, parameters.CurrentVersion, "CurrentVersion");
            }

            if (string.IsNullOrEmpty(expectedInfrastructureManifestLocation))
            {
                Verify.IsTrue(string.IsNullOrEmpty(parameters.InfrastructureManifestLocation), "InfrastructureManifestLocation");
            }
            else
            {
                Verify.IsTrue(string.IsNullOrEmpty(parameters.InfrastructureManifestLocation), "InfrastructureManifestLocation");
            }

            if (string.IsNullOrEmpty(expectedNodeName))
            {
                Verify.IsTrue(string.IsNullOrEmpty(parameters.NodeName), "NodeName");
            }
            else
            {
                Verify.AreEqual(expectedNodeName, parameters.NodeName, "NodeName");
            }

            Verify.IsTrue((parameters.RunAsPassword != null), "RunAsPassword");
            Verify.IsTrue(string.IsNullOrEmpty(parameters.RunAsUserName), "RunAsUserName");
            Verify.IsTrue(string.IsNullOrEmpty(parameters.RunAsUserType), "RunAsUserType");
            Verify.IsTrue(string.IsNullOrEmpty(parameters.ServiceStartupType), "ServiceStartupType");
        }
Exemple #4
0
        public async Task DeploymentWithScope_AtSubscription()
        {
            string groupName      = "SDK-test";
            string deploymentName = Recording.GenerateAssetName("csmd");
            var    templateString = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ScenarioTests", "subscription_level_template.json"));

            var parameters = new Deployment
                             (
                new DeploymentProperties(DeploymentMode.Incremental)
            {
                Template   = templateString,
                Parameters = "{'storageAccountName': {'value': 'armbuilddemo1803'}}".Replace("'", "\"")
            }
                             )
            {
                Location = "WestUS",
                Tags     = new Dictionary <string, string> {
                    { "tagKey1", "tagValue1" }
                }
            };

            await ResourceGroupsOperations.CreateOrUpdateAsync(groupName, new ResourceGroup("WestUS"));

            var subscriptionScope = $"//subscriptions/{TestEnvironment.SubscriptionId}";

            //Validate
            var rawValidationResult = await DeploymentsOperations.StartValidateAtScopeAsync(scope : subscriptionScope, deploymentName : deploymentName, parameters : parameters);

            var validationResult = (await WaitForCompletionAsync(rawValidationResult)).Value;

            //Assert
            Assert.Null(validationResult.Error);
            Assert.NotNull(validationResult.Properties);
            Assert.NotNull(validationResult.Properties.Providers);

            //Put deployment
            var deploymentResult = await DeploymentsOperations.StartCreateOrUpdateAtScopeAsync(scope : subscriptionScope, deploymentName : deploymentName, parameters : parameters);

            await WaitForCompletionAsync(deploymentResult);

            var deployment = (await DeploymentsOperations.GetAtScopeAsync(scope: subscriptionScope, deploymentName: deploymentName)).Value;

            Assert.AreEqual("Succeeded", deployment.Properties.ProvisioningState);
            Assert.NotNull(deployment.Tags);
            Assert.True(deployment.Tags.ContainsKey("tagKey1"));

            var deploymentOperations = await DeploymentOperations.ListAtScopeAsync(scope : subscriptionScope, deploymentName : deploymentName).ToEnumerableAsync();

            Assert.AreEqual(4, deploymentOperations.Count());
        }
Exemple #5
0
        public async Task DeploymentWithScope_AtManagementGroup()
        {
            string groupId        = "tag-mg1";
            string deploymentName = Recording.GenerateAssetName("csharpsdktest");
            string accountName    = Recording.GenerateAssetName("tagsa");
            var    templateString =
                File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ScenarioTests", "management_group_level_template.json"));

            var parameters = new Deployment
                             (
                new DeploymentProperties(DeploymentMode.Incremental)
            {
                Template   = templateString,
                Parameters = ("{'storageAccountName': {'value': '" + accountName + "'}}").Replace("'", "\"")
            }
                             )
            {
                Location = "East US",
                Tags     = new Dictionary <string, string> {
                    { "tagKey1", "tagValue1" }
                }
            };

            var managementGroupScope = $"//providers/Microsoft.Management/managementGroups/{groupId}";

            //Validate
            var rawValidationResult = await DeploymentsOperations.StartValidateAtScopeAsync(scope : managementGroupScope, deploymentName : deploymentName, parameters : parameters);

            var validationResult = (await WaitForCompletionAsync(rawValidationResult)).Value;

            //Assert
            Assert.Null(validationResult.Error);
            Assert.NotNull(validationResult.Properties);
            Assert.NotNull(validationResult.Properties.Providers);

            //Put deployment
            var deploymentResult = await DeploymentsOperations.StartCreateOrUpdateAtScopeAsync(scope : managementGroupScope, deploymentName : deploymentName, parameters : parameters);

            await WaitForCompletionAsync(deploymentResult);

            var deployment = (await DeploymentsOperations.GetAtScopeAsync(scope: managementGroupScope, deploymentName: deploymentName)).Value;

            Assert.AreEqual("Succeeded", deployment.Properties.ProvisioningState);
            Assert.NotNull(deployment.Tags);
            Assert.True(deployment.Tags.ContainsKey("tagKey1"));

            var deploymentOperations = await DeploymentOperations.ListAtScopeAsync(scope : managementGroupScope, deploymentName : deploymentName).ToEnumerableAsync();

            Assert.AreEqual(4, deploymentOperations.Count());
        }
Exemple #6
0
        internal void ExecuteOperation(string containerNetworkName, DeploymentOperations operation = DeploymentOperations.None)
        {
            if (operation == DeploymentOperations.UpdateInstanceId)
            {
                DeployerTrace.WriteInfo("Skipping Container network clean up invoked in context: {0}", operation);
                return;
            }

            if (Utility.IsContainersFeaturePresent())
            {
                // Wire server check is being made for the edge cluster scenario,
                // so that clean up is a noop. Wire server is not explicitly needed
                // for the clean up process.
                if (IsWireServerAvailable())
                {
                    var networkName = (!string.IsNullOrEmpty(containerNetworkName)) ? (containerNetworkName) : (FlatNetworkConstants.NetworkName);

                    DeployerTrace.WriteInfo("Container network clean up invoked in context: {0}", operation);

                    bool containerServiceRunningOnCustomPort = false;
                    if (operation == DeploymentOperations.Update || operation == DeploymentOperations.UpdateInstanceId)
                    {
                        containerServiceRunningOnCustomPort = IsContainerServiceRunning();
                        DeployerTrace.WriteInfo("Container service running on custom port: {0}", containerServiceRunningOnCustomPort);
                    }

                    if (CleanupContainerNetwork(networkName, containerServiceRunningOnCustomPort))
                    {
                        DeployerTrace.WriteInfo("Successfully cleaned up container network.");
                    }
                    else
                    {
                        DeployerTrace.WriteError("Failed to clean up container network.");
                        throw new InvalidDeploymentException("Failed to clean up container network.");
                    }
                }
                else
                {
                    DeployerTrace.WriteInfo("Skipping container network clean up since wire server is not available.");
                }
            }
            else
            {
                DeployerTrace.WriteInfo("Skipping container network clean up since containers feature has been disabled.");
            }
        }
Exemple #7
0
        public async Task TenantLevelDeployment()
        {
            string deploymentName = Recording.GenerateAssetName("csharpsdktest");
            var    templateString = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ScenarioTests", "tenant_level_template.json"));

            var parameters = new ScopedDeployment
                             (
                "East US 2",
                new DeploymentProperties(DeploymentMode.Incremental)
            {
                Template   = templateString,
                Parameters = "{'managementGroupId': {'value': 'tiano-mgtest01'}}".Replace("'", "\"")
            }
                             )
            {
                Tags = new Dictionary <string, string> {
                    { "tagKey1", "tagValue1" }
                }
            };

            //Validate
            var rawValidationResult = await DeploymentsOperations.StartValidateAtTenantScopeAsync(deploymentName, parameters);

            var validationResult = (await WaitForCompletionAsync(rawValidationResult)).Value;

            //Assert
            Assert.Null(validationResult.Error);
            Assert.NotNull(validationResult.Properties);
            Assert.NotNull(validationResult.Properties.Providers);

            //Put deployment
            var deploymentResult = await DeploymentsOperations.StartCreateOrUpdateAtTenantScopeAsync(deploymentName, parameters);

            await WaitForCompletionAsync(deploymentResult);

            var deployment = (await DeploymentsOperations.GetAtTenantScopeAsync(deploymentName)).Value;

            Assert.AreEqual("Succeeded", deployment.Properties.ProvisioningState);
            Assert.NotNull(deployment.Tags);
            Assert.True(deployment.Tags.ContainsKey("tagKey1"));

            var deploymentOperations = await DeploymentOperations.ListAtTenantScopeAsync(deploymentName).ToEnumerableAsync();

            Assert.AreEqual(4, deploymentOperations.Count());
        }
Exemple #8
0
        internal void ExecuteOperation(string containerNetworkName, string containerServiceArguments, string fabricDataRoot, DeploymentOperations operation = DeploymentOperations.None)
        {
            if (operation == DeploymentOperations.UpdateInstanceId)
            {
                DeployerTrace.WriteInfo("Skipping Container network clean up invoked in context: {0}", operation);
                return;
            }

            if (!Utility.IsContainersFeaturePresent())
            {
                DeployerTrace.WriteInfo("Skipping container network clean up since containers feature has been disabled.");
                return;
            }

#if !DotNetCoreClrLinux
            if (!Utility.IsContainerNTServicePresent())
            {
                DeployerTrace.WriteInfo("Skipping container network clean up since containers NT service is not installed.");
                return;
            }
#endif

            // Wire server check is being made for the edge cluster scenario,
            // so that clean up is a noop. Wire server is not explicitly needed
            // for the clean up process.
            if (!IsWireServerAvailable())
            {
                DeployerTrace.WriteInfo("Skipping container network clean up since wire server is not available.");
                return;
            }

            containerNetworkName      = (!string.IsNullOrEmpty(containerNetworkName)) ? (containerNetworkName) : (FlatNetworkConstants.NetworkName);
            containerServiceArguments = (!string.IsNullOrEmpty(containerServiceArguments)) ? (containerServiceArguments) : (FlatNetworkConstants.ContainerServiceArguments);

            if (string.IsNullOrEmpty(fabricDataRoot))
            {
                fabricDataRoot = Utility.GetFabricDataRoot();
                DeployerTrace.WriteInfo("Fabric data root passed in was empty, using environment fabric data root instead: {0}.", fabricDataRoot);
            }

            DeployerTrace.WriteInfo("Container network clean up invoked in context: {0}", operation);

            bool containerServiceRunning = false;
            if (operation == DeploymentOperations.Update || operation == DeploymentOperations.UpdateInstanceId)
            {
                containerServiceRunning = IsContainerServiceRunning();
                DeployerTrace.WriteInfo("Container service running: {0}", containerServiceRunning);
            }

            if (CleanupContainerNetwork(containerNetworkName, containerServiceArguments, fabricDataRoot, containerServiceRunning))
            {
                DeployerTrace.WriteInfo("Successfully cleaned up container network.");
            }
            else
            {
                string message = "Failed to clean up container network.";
                DeployerTrace.WriteError(message);
                throw new InvalidDeploymentException(message);
            }
        }
Exemple #9
0
        public static FabricValidator Create(ClusterManifestType clusterManifest, List <InfrastructureNodeType> infrastructure, WindowsFabricSettings windowsFabricSettings, DeploymentOperations deploymentOperation)
        {
#if DotNetCoreClrLinux
            var isServer = clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureLinux;
#else
            var isServer = clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsServer;
#endif
            if (isServer)
            {
                return(new FabricValidatorServer(clusterManifest, infrastructure, windowsFabricSettings));
            }
            if (clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsAzure || clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsAzureStaticTopology)
            {
                return(new FabricValidatorAzure(clusterManifest, infrastructure, windowsFabricSettings));
            }
            if (clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureBlackbird)
            {
                return(new FabricValidatorBlackbird(clusterManifest, infrastructure, windowsFabricSettings));
            }
            if (clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructurePaaS)
            {
                var paasValidator = new FabricValidatorPaaS(clusterManifest, infrastructure, windowsFabricSettings);
                paasValidator.DeploymentOperation = deploymentOperation;
                return(paasValidator);
            }

            throw new InvalidOperationException("The Infrastucture type is not supported");
        }
Exemple #10
0
        static async Task Main(string[] args)
        {
            bool localInstall = args != null && args.Length == 1;

            if (localInstall)
            {
                if (!File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "LMS.Setup.exe")))
                {
                    throw new Exception("Setup file missing!");
                }
            }

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            var logFile = Path.Combine(localInstall ? Directory.GetCurrentDirectory() : @"C:\Windows\temp", "lms-deploy.txt");

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .WriteTo.Logger(config => config
                                         .MinimumLevel.Verbose()
                                         .Filter.ByExcluding(e => e.Level == LogEventLevel.Debug)
                                         .WriteTo.Console())
                         .WriteTo.Logger(config => config
                                         .MinimumLevel.Verbose()
                                         .Filter.ByExcluding(e => e.Level == LogEventLevel.Verbose)
                                         .WriteTo.File(logFile))
                         .CreateLogger();

            Log.Information($"Log Path: {logFile}");
            Log.Information("Starting deployment....");

            try
            {
                var deploymentOperations = new DeploymentOperations(localInstall);
                await deploymentOperations.StartAsync();
            }
            catch (Exception ex)
            {
                Log.Error(ex, ex.Message);
                Log.Error("************ Deployment  Failed ************");
                throw;
            }

            Log.Information("************ Deployment  Successful ************");

            Log.Debug("Cleaning up old installations.");
            if (Environment.Is64BitOperatingSystem)
            {
                var programFiles = Environment.GetEnvironmentVariable("ProgramFiles");
                if (!string.IsNullOrEmpty(programFiles))
                {
                    var oldInstallPath = Path.Combine(programFiles, "License Monitoring System");
                    if (Directory.Exists(oldInstallPath))
                    {
                        Log.Information($"Old installation detected at: {oldInstallPath}");
                        Log.Information("Attempting to delete the directory.");

                        try
                        {
                            Directory.Delete(oldInstallPath, true);
                            Log.Information("Deletion successful.");
                        }
                        catch (Exception ex)
                        {
                            Log.Error($"Deletion failed - {ex.Message}");
                            Log.Debug(ex, ex.Message);
                        }
                    }
                }
            }

            if (Environment.UserInteractive)
            {
                Console.WriteLine("Press [Enter] to exit.");
                Console.ReadLine();
            }
        }
        public void Initialize()
        {
            DeploymentOperations operation = Operation;

            if (operation == DeploymentOperations.Create || operation == DeploymentOperations.Update || operation == DeploymentOperations.Configure)
            {
                if (this.ClusterManifestLocation == null || !File.Exists(this.ClusterManifestLocation))
                {
                    throw new InvalidDeploymentParameterException(StringResources.Error_FabricDeployer_ClusterManifestNotFound_Formatted);
                }
            }

            switch (operation)
            {
            case DeploymentOperations.Configure:
            {
                ClusterManifestType manifest = XmlHelper.ReadXml <ClusterManifestType>(this.ClusterManifestLocation, SchemaLocation.GetWindowsFabricSchemaLocation());
                SetupSettings       settings = new SetupSettings(manifest);
                this.FabricDataRoot = settings.FabricDataRoot == null ? this.FabricDataRoot : settings.FabricDataRoot;
                this.FabricLogRoot  = settings.FabricLogRoot == null ? this.FabricLogRoot : settings.FabricLogRoot;
                bool isDataRootProvided = this.FabricDataRoot != null;
                ResolveDataRoot(isDataRootProvided);
                DeploymentSpecification.SetDataRoot(this.FabricDataRoot);
                ResolveLogRoot(isDataRootProvided);
                DeploymentSpecification.SetLogRoot(this.FabricLogRoot);
            }
            break;

            case DeploymentOperations.RemoveNodeConfig:
                // for RemoveNodeConfig the user does not pass the data root in, so it has to be determined
                this.FabricDataRoot = FabricEnvironment.GetDataRoot(this.MachineName);
                this.FabricLogRoot  = FabricEnvironment.GetLogRoot(this.MachineName);
                DeploymentSpecification.SetDataRoot(this.FabricDataRoot);
                DeploymentSpecification.SetLogRoot(this.FabricLogRoot);
                break;

            case DeploymentOperations.Create:
            case DeploymentOperations.None:
            case DeploymentOperations.Remove:
            case DeploymentOperations.Rollback:
            case DeploymentOperations.Update:
            case DeploymentOperations.UpdateNodeState:
            case DeploymentOperations.UpdateInstanceId:
                SetCommonRoots();
                break;

            case DeploymentOperations.ValidateClusterManifest:
                SetCommonRoots(Directory.GetCurrentDirectory());
                break;

            case DeploymentOperations.Validate:
                if (this.OldClusterManifestLocation != null && File.Exists(this.OldClusterManifestLocation) && this.FabricDataRoot == null)
                {
                    SetCommonRoots(Path.GetDirectoryName(this.OldClusterManifestLocation));
                }
                else
                {
                    SetCommonRoots();
                }
                break;

            case DeploymentOperations.DockerDnsSetup:
            case DeploymentOperations.DockerDnsCleanup:
            case DeploymentOperations.ContainerNetworkSetup:
            case DeploymentOperations.ContainerNetworkCleanup:
            case DeploymentOperations.IsolatedNetworkSetup:
            case DeploymentOperations.IsolatedNetworkCleanup:
                break;

            default:
                throw new InvalidOperationException(String.Format("The operation {0} has no explicit deployment criteria.", operation.ToString()));
            }

            if (this.InfrastructureManifestLocation == null && this.NodeName != null)
            {
                this.InfrastructureManifestLocation = this.DeploymentSpecification.GetInfrastructureManfiestFile(this.NodeName);
            }

            if (operation == DeploymentOperations.UpdateNodeState ||
                operation == DeploymentOperations.Remove ||
                operation == DeploymentOperations.UpdateInstanceId ||
                (operation == DeploymentOperations.RemoveNodeConfig && !string.IsNullOrEmpty(this.FabricDataRoot) && Directory.Exists(this.FabricDataRoot)))
            {
                this.ClusterManifestLocation        = Helpers.GetCurrentClusterManifestPath(this.FabricDataRoot);
                this.InfrastructureManifestLocation = Helpers.GetInfrastructureManifestPath(this.FabricDataRoot);
            }

            if (!string.IsNullOrEmpty(this.ClusterManifestLocation))
            {
                ClusterManifestType manifest = XmlHelper.ReadXml <ClusterManifestType>(this.ClusterManifestLocation, SchemaLocation.GetWindowsFabricSchemaLocation());
                SetupSettings       settings = new SetupSettings(manifest);
                this.SkipFirewallConfiguration = settings.SkipFirewallConfiguration;
                this.ContainerDnsSetup         = settings.ContainerDnsSetup;
                this.ContainerNetworkSetup     = settings.ContainerNetworkSetup;
                this.ContainerNetworkName      = settings.ContainerNetworkName;
#if !DotNetCoreClrLinux
                this.SkipContainerNetworkResetOnReboot = settings.SkipContainerNetworkResetOnReboot;
                this.SkipIsolatedNetworkResetOnReboot  = settings.SkipIsolatedNetworkResetOnReboot;
#endif
                this.IsolatedNetworkSetup            = settings.IsolatedNetworkSetup;
                this.IsolatedNetworkName             = settings.IsolatedNetworkName;
                this.IsolatedNetworkInterfaceName    = settings.IsolatedNetworkInterfaceName;
                this.UseContainerServiceArguments    = settings.UseContainerServiceArguments;
                this.ContainerServiceArguments       = settings.ContainerServiceArguments;
                this.EnableContainerServiceDebugMode = settings.EnableContainerServiceDebugMode;

                SetOptionalFeatureParameters(settings);
            }
            else
            {
                this.SkipFirewallConfiguration = false;
            }

            Validate();
        }
Exemple #12
0
        internal void ExecuteOperation(string isolatedNetworkName, string fabricBinRoot, DeploymentOperations operation = DeploymentOperations.None)
        {
            if (operation == DeploymentOperations.UpdateInstanceId)
            {
                DeployerTrace.WriteInfo("Skipping isolated network clean up invoked in context: {0}.", operation);
                return;
            }

            if (!Utility.IsContainersFeaturePresent())
            {
                DeployerTrace.WriteInfo("Skipping isolated network clean up since containers feature has been disabled.");
                return;
            }

#if !DotNetCoreClrLinux
            if (!Utility.IsContainerNTServicePresent())
            {
                DeployerTrace.WriteInfo("Skipping isolated network clean up since containers NT service is not installed.");
                return;
            }
#endif
            var networkName = (!string.IsNullOrEmpty(isolatedNetworkName)) ? (isolatedNetworkName) : (IsolatedNetworkConstants.NetworkName);

            if (string.IsNullOrEmpty(fabricBinRoot))
            {
                fabricBinRoot = Utility.GetFabricCodePath();
                DeployerTrace.WriteInfo("Fabric bin root was empty, using fabric code path instead: {0}.", fabricBinRoot);
            }

            DeployerTrace.WriteInfo("Isolated network clean up invoked in context: {0}.", operation);

#if !DotNetCoreClr
            bool networkPluginRunning = false;
            if (operation == DeploymentOperations.Update)
            {
                networkPluginRunning = IsNetworkPluginRunning();
                DeployerTrace.WriteInfo("Isolated network plugin running: {0}.", networkPluginRunning);
            }

            if (CleanupIsolatedNetwork(networkName, fabricBinRoot, networkPluginRunning))
#else
            if (CleanupIsolatedNetwork())
#endif
            {
                DeployerTrace.WriteInfo("Successfully cleaned up isolated network.");
            }
            else
            {
                string message = "Failed to clean up isolated network.";
                DeployerTrace.WriteError(message);
                throw new InvalidDeploymentException(message);
            }
        }