public void StartDiagnosticsWithNoCustomerStorageName()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters()
                {
                    Operation = UpdateGatewayPublicDiagnosticsOperation.StartDiagnostics,
                    CustomerStorageKey = "EyXneSsrZJJbBT4bHL6p4KdO+S5YCtM75PAA1gVWd39vwHm2CHfosBRRDkJYJWpY2mpnYlMROpgqmEci6b3u0w==",
                    ContainerName = "hydra-test-diagnostics",
                    CaptureDurationInSeconds = "1",
                };

                try
                {
                    networkTestClient.Gateways.StartDiagnostics(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "UpdateDiagnostics should have thrown a CloudException.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("CustomerStorageName was not valid"));
                }
            }
        }
        public void SetDefaultSitesWhenGatewayIsNotProvisioned()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                networkTestClient.Gateways.EnsureNoGatewayExists();

                const string virtualNetworkSiteName            = NetworkTestConstants.VirtualNetworkSiteName;
                GatewaySetDefaultSiteListParameters parameters = CreateParameters("localNetworkSiteName");

                try
                {
                    networkTestClient.Gateways.SetDefaultSites(virtualNetworkSiteName, parameters);
                    Assert.True(false, "SetDefaultSites should throw an CloudException when the gateway was not provisioned.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.NotNull(e.Response);
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("current provisioning status of the gateway prevents this operation"));
                    Assert.Equal(HttpStatusCode.BadRequest, e.Response.StatusCode);
                    Assert.Equal("Bad Request", e.Response.ReasonPhrase);
                }
            }
        }
Beispiel #3
0
        public void StartDiagnosticsWithNoCustomerStorageName()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters()
                {
                    Operation = UpdateGatewayPublicDiagnosticsOperation.StartDiagnostics,
                    // [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
                    CustomerStorageKey       = "EyXneSsrZJJbBT4bHL6p4KdO+S5YCtM75PAA1gVWd39vwHm2CHfosBRRDkJYJWpY2mpnYlMROpgqmEci6b3u0w==",
                    ContainerName            = "hydra-test-diagnostics",
                    CaptureDurationInSeconds = "1",
                };

                try
                {
                    networkTestClient.Gateways.StartDiagnostics(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "UpdateDiagnostics should have thrown a CloudException.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("CustomerStorageName was not valid"));
                }
            }
        }
Beispiel #4
0
        public void GenerateVpnClientPackageWithStaticRoutingConfiguration()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();
                networkTestClient.Gateways.EnsureNoGatewayExists();

                const string networkName = "virtualNetworkSiteName";
                GatewayGenerateVpnClientPackageParameters parameters = new GatewayGenerateVpnClientPackageParameters()
                {
                    ProcessorArchitecture = GatewayProcessorArchitecture.Amd64,
                };

                try
                {
                    networkTestClient.Gateways.GenerateVpnClientPackage(networkName, parameters);
                    Assert.True(false, "GenerateVpnClientPackage should have thrown a CloudException when the networkName was empty.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.Contains("current provisioning status of the gateway prevents this operation", e.Error.Message, StringComparison.InvariantCultureIgnoreCase);
                }
            }
        }
Beispiel #5
0
        public void StartDiagnosticsWithNoCustomerStorageKey()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters()
                {
                    Operation                = UpdateGatewayPublicDiagnosticsOperation.StartDiagnostics,
                    CustomerStorageName      = "daschult20140611a",
                    ContainerName            = "hydra-test-diagnostics",
                    CaptureDurationInSeconds = "1",
                };

                try
                {
                    networkTestClient.Gateways.StartDiagnostics(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "UpdateDiagnostics should have thrown a CloudException.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("CustomerStorageKey was not valid"));
                }
            }
        }
        public void ResizeGatewayWithNotProvisionedGateway()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.Gateways.EnsureNoGatewayExists();
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                ResizeGatewayParameters parameters = new ResizeGatewayParameters()
                {
                    GatewaySKU = GatewaySKU.HighPerformance,
                };

                try
                {
                    networkTestClient.Gateways.ResizeGateway(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "ResizeGateway should have thrown a CloudException when the virtual network gateway was not provisioned.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.Equal("The current provisioning status of the gateway prevents this operation.", e.Error.Message);
                    Assert.NotNull(e.Response);
                    Assert.Equal("Bad Request", e.Response.ReasonPhrase);
                    Assert.Equal(HttpStatusCode.BadRequest, e.Response.StatusCode);
                }
            }
        }
        public void GenerateVpnClientPackageWithStaticRoutingConfiguration()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();
                networkTestClient.Gateways.EnsureNoGatewayExists();

                const string networkName = "virtualNetworkSiteName";
                GatewayGenerateVpnClientPackageParameters parameters = new GatewayGenerateVpnClientPackageParameters()
                {
                    ProcessorArchitecture = GatewayProcessorArchitecture.Amd64,
                };

                try
                {
                    networkTestClient.Gateways.GenerateVpnClientPackage(networkName, parameters);
                    Assert.True(false, "GenerateVpnClientPackage should have thrown a CloudException when the networkName was empty.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.Contains("current provisioning status of the gateway prevents this operation", e.Error.Message, StringComparison.InvariantCultureIgnoreCase);
                }
            }
        }
        public void ResizeGatewayWithNotProvisionedGateway()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.Gateways.EnsureNoGatewayExists();
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                ResizeGatewayParameters parameters = new ResizeGatewayParameters()
                {
                    GatewaySKU = GatewaySKU.HighPerformance,
                };

                try
                {
                    networkTestClient.Gateways.ResizeGateway(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "ResizeGateway should have thrown a CloudException when the virtual network gateway was not provisioned.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.Equal("The current provisioning status of the gateway prevents this operation.", e.Error.Message);
                    Assert.NotNull(e.Response);
                    Assert.Equal("Bad Request", e.Response.ReasonPhrase);
                    Assert.Equal(HttpStatusCode.BadRequest, e.Response.StatusCode);
                }
            }
        }
        public void SetDefaultSitesWhenGatewayIsNotProvisioned()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                networkTestClient.Gateways.EnsureNoGatewayExists();

                const string virtualNetworkSiteName = NetworkTestConstants.VirtualNetworkSiteName;
                GatewaySetDefaultSiteListParameters parameters = CreateParameters("localNetworkSiteName");

                try
                {
                    networkTestClient.Gateways.SetDefaultSites(virtualNetworkSiteName, parameters);
                    Assert.True(false, "SetDefaultSites should throw an CloudException when the gateway was not provisioned.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.NotNull(e.Response);
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("current provisioning status of the gateway prevents this operation"));
                    Assert.Equal(HttpStatusCode.BadRequest, e.Response.StatusCode);
                    Assert.Equal("Bad Request", e.Response.ReasonPhrase);
                }
            }
        }
Beispiel #10
0
        public void GetGatewayWhenGatewayIsNotProvisioned()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();
                networkTestClient.Gateways.EnsureNoGatewayExists();

                GatewayGetResponse response = networkTestClient.Gateways.GetGateway(NetworkTestConstants.VirtualNetworkSiteName);
                Assert.NotNull(response);
                Assert.Equal("NotProvisioned", response.State);
                Assert.Null(response.VipAddress);
            }
        }
        public void GetGatewayWhenGatewayIsNotProvisioned()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();
                networkTestClient.Gateways.EnsureNoGatewayExists();

                GatewayGetResponse response = networkTestClient.Gateways.GetGateway(NetworkTestConstants.VirtualNetworkSiteName);
                Assert.NotNull(response);
                Assert.Equal("NotProvisioned", response.State);
                Assert.Null(response.VipAddress);
            }
        }
Beispiel #12
0
        public void StartDiagnosticsWithEmptyParameters()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters();

                try
                {
                    networkTestClient.Gateways.StartDiagnostics(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "UpdateDiagnostics should have thrown a CloudException with an InternalError.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("CustomerStorageName was not valid."));
                }
            }
        }
        public void StartDiagnosticsWithEmptyParameters()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters();

                try
                {
                    networkTestClient.Gateways.StartDiagnostics(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "UpdateDiagnostics should have thrown a CloudException with an InternalError.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("CustomerStorageName was not valid."));
                }
            }
        }
        public void CreateStaticRoutingGateway()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                GatewayGetOperationStatusResponse response =
                    networkTestClient.Gateways.CreateGateway(
                        NetworkTestConstants.VirtualNetworkSiteName,
                        NetworkTestConstants.CreateStaticRoutingGatewayParameters());
                Assert.NotNull(response);
                Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode);

                GatewayGetResponse getGatewayResponse = networkTestClient.Gateways.GetGateway("virtualNetworkSiteName");
                Assert.NotNull(getGatewayResponse);
                Assert.Equal(GatewayType.StaticRouting, getGatewayResponse.GatewayType);
                Assert.Equal("Provisioned", getGatewayResponse.State);
                Assert.NotNull(getGatewayResponse.VipAddress);
                Assert.NotEmpty(getGatewayResponse.VipAddress);
            }
        }
        public void CreateStaticRoutingGateway()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                GatewayGetOperationStatusResponse response =
                    networkTestClient.Gateways.CreateGateway(
                        NetworkTestConstants.VirtualNetworkSiteName,
                        NetworkTestConstants.CreateStaticRoutingGatewayParameters());
                Assert.NotNull(response);
                Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode);

                GatewayGetResponse getGatewayResponse = networkTestClient.Gateways.GetGateway("virtualNetworkSiteName");
                Assert.NotNull(getGatewayResponse);
                Assert.Equal(GatewayType.StaticRouting, getGatewayResponse.GatewayType);
                Assert.Equal("Provisioned", getGatewayResponse.State);
                Assert.NotNull(getGatewayResponse.VipAddress);
                Assert.NotEmpty(getGatewayResponse.VipAddress);
            }
        }
Beispiel #16
0
        public void SetIPsecParametersWithNotProvisionedGateway()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.Gateways.EnsureNoGatewayExists();
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                try
                {
                    networkTestClient.Gateways.SetIPsecParameters(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.LocalNetworkSiteName, CreateParameters());
                    Assert.True(false, "SetIPsecParameters should have thrown a CloudException when the gateway wasn't provisioned.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.Equal("The current provisioning status of the gateway prevents this operation.", e.Error.Message);
                    Assert.NotNull(e.Response);
                    Assert.Equal("Bad Request", e.Response.ReasonPhrase);
                    Assert.Equal(HttpStatusCode.BadRequest, e.Response.StatusCode);
                }
            }
        }
        public void GetIPsecParametersWithNotProvisionedGateway()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.Gateways.EnsureNoGatewayExists();
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                try
                {
                    networkTestClient.Gateways.GetIPsecParameters(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.LocalNetworkSiteName);
                    Assert.True(false, "GetIPsecParameters should have thrown a CloudException when the gateway wasn't provisioned.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.Equal("The current provisioning status of the gateway prevents this operation.", e.Error.Message);
                    Assert.NotNull(e.Response);
                    Assert.Equal("Bad Request", e.Response.ReasonPhrase);
                    Assert.Equal(HttpStatusCode.BadRequest, e.Response.StatusCode);
                }
            }
        }
        public void StartDiagnosticsWithNoCustomerStorageKey()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.EnsureSiteToSiteNetworkConfigurationExists();

                StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters()
                {
                    Operation = UpdateGatewayPublicDiagnosticsOperation.StartDiagnostics,
                    CustomerStorageName = "daschult20140611a",
                    ContainerName = "hydra-test-diagnostics",
                    CaptureDurationInSeconds = "1",
                };

                try
                {
                    networkTestClient.Gateways.StartDiagnostics(NetworkTestConstants.VirtualNetworkSiteName, parameters);
                    Assert.True(false, "UpdateDiagnostics should have thrown a CloudException.");
                }
                catch (Hyak.Common.CloudException e)
                {
                    Assert.Equal("BadRequest", e.Error.Code);
                    Assert.True(e.Error.Message.Contains("CustomerStorageKey was not valid"));
                }
            }
        }