public void CreateAzureNetworkMappingTest() { using (UndoContext context = UndoContext.Current) { context.Start(); var client = GetSiteRecoveryClient(CustomHttpHandler); // Get Servers var servers = client.Servers.List(RequestHeaders); // 57f95c35-6c83-42ce-bb21-2c4f10f92d8e var networks = client.Networks.List(servers.Servers[0].ID, RequestHeaders); CreateAzureNetworkMappingInput createAzureNetworkMappingInput = new CreateAzureNetworkMappingInput(); createAzureNetworkMappingInput.PrimaryServerId = servers.Servers[0].ID; createAzureNetworkMappingInput.PrimaryNetworkId = networks.Networks[0].ID; createAzureNetworkMappingInput.RecoveryNetworkName = "Azure VM Network name"; createAzureNetworkMappingInput.RecoveryNetworkId = "Azure VM Network ID"; NetworkMappingInput networkMappingInput = new NetworkMappingInput(); networkMappingInput.NetworkTargetType = NetworkTargetType.Azure.ToString(); networkMappingInput.CreateNetworkMappingInput = DataContractUtils.Serialize <CreateAzureNetworkMappingInput>(createAzureNetworkMappingInput); var response = client.NetworkMappings.Create(networkMappingInput, RequestHeaders); Assert.NotNull(response.Job); Assert.NotNull(response.Job.ID); Assert.True(response.Job.Errors.Count < 1, "Errors found while creating network mapping"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } }
public void CreateAzureNetworkMappingTest() { using (UndoContext context = UndoContext.Current) { context.Start(); var client = GetSiteRecoveryClient(CustomHttpHandler); // Get Servers var servers = client.Servers.List(RequestHeaders); // 57f95c35-6c83-42ce-bb21-2c4f10f92d8e var networks = client.Networks.List(servers.Servers[0].ID, RequestHeaders); CreateAzureNetworkMappingInput createAzureNetworkMappingInput = new CreateAzureNetworkMappingInput(); createAzureNetworkMappingInput.PrimaryServerId = servers.Servers[0].ID; createAzureNetworkMappingInput.PrimaryNetworkId = networks.Networks[0].ID; createAzureNetworkMappingInput.RecoveryNetworkName = "Azure VM Network name"; createAzureNetworkMappingInput.RecoveryNetworkId = "Azure VM Network ID"; NetworkMappingInput networkMappingInput = new NetworkMappingInput(); networkMappingInput.NetworkTargetType = NetworkTargetType.Azure.ToString(); networkMappingInput.CreateNetworkMappingInput = DataContractUtils.Serialize<CreateAzureNetworkMappingInput>(createAzureNetworkMappingInput); var response = client.NetworkMappings.Create(networkMappingInput, RequestHeaders); Assert.NotNull(response.Job); Assert.NotNull(response.Job.ID); Assert.True(response.Job.Errors.Count < 1, "Errors found while creating network mapping"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } }