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 ResetSharedKey()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.SetNetworkConfiguration(NetworkTestConstants.SiteToSiteNetworkConfigurationParameters);

                networkTestClient.Gateways.CreateGateway(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.CreateStaticRoutingGatewayParameters());

                GatewayGetSharedKeyResponse firstGetResponse = networkTestClient.Gateways.GetSharedKey(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.LocalNetworkSiteName);
                string firstSharedKey = firstGetResponse.SharedKey;

                GatewayResetSharedKeyParameters parameters = new GatewayResetSharedKeyParameters()
                {
                    KeyLength = 128,
                };
                GatewayGetOperationStatusResponse resetResponse = networkTestClient.Gateways.ResetSharedKey(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.LocalNetworkSiteName, parameters);
                Assert.NotNull(resetResponse);
                Assert.Equal(HttpStatusCode.OK, resetResponse.HttpStatusCode);

                GatewayGetSharedKeyResponse secondGetResponse = networkTestClient.Gateways.GetSharedKey(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.LocalNetworkSiteName);
                string secondSharedKey = secondGetResponse.SharedKey;

                Assert.NotEqual(firstSharedKey, secondSharedKey);
            }
        }
Пример #3
0
        public void GetSharedKeyWhenGatewayIsProvisionedButNoSharedKeyHasBeenSet()
        {
            using (NetworkTestClient networkTestClient = new NetworkTestClient())
            {
                networkTestClient.SetNetworkConfiguration(NetworkTestConstants.SiteToSiteNetworkConfigurationParameters);

                networkTestClient.Gateways.CreateGateway(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.CreateStaticRoutingGatewayParameters());

                GatewayGetSharedKeyResponse response = networkTestClient.Gateways.GetSharedKey(NetworkTestConstants.VirtualNetworkSiteName, NetworkTestConstants.LocalNetworkSiteName);
                Assert.NotNull(response);
                Assert.NotNull(response.SharedKey);
                Assert.NotEmpty(response.SharedKey);
            }
        }