Skip to content

Commit fcf9360

Browse files
authored
Merge pull request #10010 from rileymckenna/preview
Bug fix in New direct peering connection
2 parents 4939362 + b97ab82 commit fcf9360

19 files changed

+461
-189
lines changed

src/Peering/Peering.Test/ScenarioTests/CreateNewDirectConnectionTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,15 @@ public void TestNewDirectConnectionWrongV6()
122122
{
123123
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewDirectConnectionWrongV6");
124124
}
125+
126+
/// <summary>
127+
/// The test new direct connection with microsoft ip address
128+
/// </summary>
129+
[Fact]
130+
[Trait(Category.AcceptanceType, Category.CheckIn)]
131+
public void TestNewDirectConnectionWithMicrosoftIpProvidedAddress()
132+
{
133+
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewDirectConnectionWithMicrosoftIpProvidedAddress");
134+
}
125135
}
126136
}

src/Peering/Peering.Test/ScenarioTests/CreateNewDirectConnectionTests.ps1

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ function Test-NewDirectConnectionWithV4V6
4141
Assert-AreEqual $facilityId $createdConnection.PeeringDBFacilityId
4242
Assert-AreEqual $sessionv4 $createdConnection.BgpSession.SessionPrefixV4
4343
Assert-AreEqual $sessionv6 $createdConnection.BgpSession.SessionPrefixV6
44+
Assert-AreEqual $false $createdConnection.UseForPeeringService
45+
Assert-AreEqual "Peer" $createdConnection.SessionAddressProvider
4446
}
4547
<#
4648
.SYNOPSIS
@@ -71,6 +73,8 @@ function Test-NewDirectConnectionWithV4
7173
Assert-AreEqual $facilityId $createdConnection.PeeringDBFacilityId
7274
Assert-AreEqual $sessionv4 $createdConnection.BgpSession.SessionPrefixV4
7375
Assert-Null $createdConnection.BgpSession.SessionPrefixV6
76+
Assert-AreEqual $false $createdConnection.UseForPeeringService
77+
Assert-AreEqual "Peer" $createdConnection.SessionAddressProvider
7478
}
7579
<#
7680
.SYNOPSIS
@@ -100,10 +104,12 @@ function Test-NewDirectConnectionWithV6
100104
Assert-AreEqual $facilityId $createdConnection.PeeringDBFacilityId
101105
Assert-Null $createdConnection.BgpSession.SessionPrefixV4
102106
Assert-AreEqual $sessionv6 $createdConnection.BgpSession.SessionPrefixV6
107+
Assert-AreEqual $false $createdConnection.UseForPeeringService
108+
Assert-AreEqual "Peer" $createdConnection.SessionAddressProvider
103109
}
104110
<#
105111
.SYNOPSIS
106-
NewDirectConnectionNoSession should fail with null value
112+
NewDirectConnectionNoSession should pass with null value
107113
#>
108114
function Test-NewDirectConnectionNoSession
109115
{
@@ -125,8 +131,12 @@ function Test-NewDirectConnectionNoSession
125131
$maxv6 = maxAdvertisedIpv6
126132
Write-Debug "Created maxAdvertised $maxv4 $maxv6"
127133
#create Connection
128-
Assert-ThrowsContains { New-AzPeeringDirectConnectionObject -PeeringDbFacilityId $facilityId -MaxPrefixesAdvertisedIPv4 $maxv4 -BandwidthInMbps $bandwidth -MD5AuthenticationKey $md5 } "Cannot process command because of one or more missing mandatory parameters: SessionPrefixV4."
129-
}
134+
$createdConnection = New-AzPeeringDirectConnectionObject -PeeringDbFacilityId $facilityId -BandwidthInMbps $bandwidth -UseForPeeringService
135+
Assert-AreEqual $bandwidth $createdConnection.BandwidthInMbps
136+
Assert-AreEqual $facilityId $createdConnection.PeeringDBFacilityId
137+
Assert-Null $createdConnection.BgpSession
138+
Assert-AreEqual $true $createdConnection.UseForPeeringService
139+
Assert-AreEqual "Peer" $createdConnection.SessionAddressProvider}
130140
<#
131141
.SYNOPSIS
132142
NewDirectConnectionWithV6 should fail with high BandwidthInMbps message
@@ -237,4 +247,27 @@ function Test-NewDirectConnectionWrongV4
237247
Write-Debug "Created maxAdvertised $maxv4 $maxv6"
238248
#create Connection
239249
Assert-ThrowsContains {New-AzPeeringDirectConnectionObject -PeeringDbFacilityId $facilityId -SessionPrefixV4 $wrongv4 -MaxPrefixesAdvertisedIPv4 $maxv4 -BandwidthInMbps $bandwidth -MD5AuthenticationKey $md5.ToString} "Invalid Prefix: $wrongv4, must be "
250+
}
251+
252+
<#
253+
.SYNOPSIS
254+
Microsoft Provided IP address
255+
#>
256+
function Test-NewDirectConnectionWithMicrosoftIpProvidedAddress
257+
{
258+
#Hard Coded locations becuase of limitations in locations
259+
$kind = isDirect $true;
260+
$loc = "Los Angeles"
261+
$peeringLocation = getPeeringLocation $kind $loc;
262+
$facilityId = $peeringLocation[0].PeeringDBFacilityId
263+
#Create some data for the object
264+
$bandwidth = getBandwidth
265+
Write-Debug "Creating Connection at $facilityId"
266+
#create Connection
267+
$createdConnection = New-AzPeeringDirectConnectionObject -PeeringDbFacilityId $facilityId -MicrosoftProvidedIPAddress -BandwidthInMbps $bandwidth -UseForPeeringService
268+
Assert-AreEqual $bandwidth $createdConnection.BandwidthInMbps
269+
Assert-AreEqual $facilityId $createdConnection.PeeringDBFacilityId
270+
Assert-AreEqual $null $createdConnection.BgpSession
271+
Assert-AreEqual $true $createdConnection.UseForPeeringService
272+
Assert-AreEqual "Microsoft" $createdConnection.SessionAddressProvider
240273
}

src/Peering/Peering.Test/SessionRecords/Microsoft.Azure.Commands.Peering.Test.ScenarioTests.CreateNewDirectConnectionTests/TestNewDirectConnectionHighBandwidth.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"RequestBody": "",
88
"RequestHeaders": {
99
"x-ms-client-request-id": [
10-
"4f5b5221-06fc-4ca0-8919-c30189a12565"
10+
"ae250049-8277-4745-a1a3-eff028c25600"
1111
],
1212
"Accept-Language": [
1313
"en-US"
@@ -27,16 +27,16 @@
2727
"no-cache"
2828
],
2929
"x-ms-request-id": [
30-
"dc5c0213-7b23-4f04-8276-33d474b6e32d"
30+
"db61bbf3-6788-4e84-b7b7-646434dac1bb"
3131
],
3232
"x-ms-ratelimit-remaining-subscription-resource-requests": [
33-
"598"
33+
"596"
3434
],
3535
"x-ms-correlation-request-id": [
36-
"491b787f-6cbd-4756-81f5-4d035d834882"
36+
"98c4da14-aa25-42d7-b2c1-9d904988ad5a"
3737
],
3838
"x-ms-routing-request-id": [
39-
"NORTHEUROPE:20190829T183238Z:491b787f-6cbd-4756-81f5-4d035d834882"
39+
"NORTHEUROPE:20190911T170957Z:98c4da14-aa25-42d7-b2c1-9d904988ad5a"
4040
],
4141
"Strict-Transport-Security": [
4242
"max-age=31536000; includeSubDomains"
@@ -45,7 +45,7 @@
4545
"nosniff"
4646
],
4747
"Date": [
48-
"Thu, 29 Aug 2019 18:32:38 GMT"
48+
"Wed, 11 Sep 2019 17:09:56 GMT"
4949
],
5050
"Content-Length": [
5151
"68896"
@@ -64,9 +64,9 @@
6464
"Names": {},
6565
"Variables": {
6666
"SubscriptionId": "3e919f9a-4e26-4736-aa8d-d596d9a49239",
67-
"bandwidth": "40000",
68-
"Hash": "e1335d26ccc4ac2872d3deb12158460d",
69-
"MaxPrefixV4": "5904",
70-
"MaxPrefixV6": "1342"
67+
"bandwidth": "70000",
68+
"Hash": "199af1237016b0b65e69bb1f915e7009",
69+
"MaxPrefixV4": "18612",
70+
"MaxPrefixV6": "52"
7171
}
7272
}

src/Peering/Peering.Test/SessionRecords/Microsoft.Azure.Commands.Peering.Test.ScenarioTests.CreateNewDirectConnectionTests/TestNewDirectConnectionLowBandwidth.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"RequestBody": "",
88
"RequestHeaders": {
99
"x-ms-client-request-id": [
10-
"04294a29-7b86-4bb8-bb2b-642a4848f494"
10+
"c309e564-d633-4387-8f5b-9c1be1b8db24"
1111
],
1212
"Accept-Language": [
1313
"en-US"
@@ -27,16 +27,16 @@
2727
"no-cache"
2828
],
2929
"x-ms-request-id": [
30-
"2c16ddfc-b787-492f-9ef4-65dabecad849"
30+
"620b8309-c83d-4f60-87d6-c51853977a40"
3131
],
3232
"x-ms-ratelimit-remaining-subscription-resource-requests": [
33-
"598"
33+
"593"
3434
],
3535
"x-ms-correlation-request-id": [
36-
"a68feae6-a795-489a-8a37-236fe50615f3"
36+
"92faa76e-46ba-4a3f-9782-f3a2846776d3"
3737
],
3838
"x-ms-routing-request-id": [
39-
"NORTHEUROPE:20190829T183232Z:a68feae6-a795-489a-8a37-236fe50615f3"
39+
"NORTHEUROPE:20190911T170951Z:92faa76e-46ba-4a3f-9782-f3a2846776d3"
4040
],
4141
"Strict-Transport-Security": [
4242
"max-age=31536000; includeSubDomains"
@@ -45,7 +45,7 @@
4545
"nosniff"
4646
],
4747
"Date": [
48-
"Thu, 29 Aug 2019 18:32:32 GMT"
48+
"Wed, 11 Sep 2019 17:09:50 GMT"
4949
],
5050
"Content-Length": [
5151
"68896"
@@ -64,8 +64,8 @@
6464
"Names": {},
6565
"Variables": {
6666
"SubscriptionId": "3e919f9a-4e26-4736-aa8d-d596d9a49239",
67-
"Hash": "189321a39bac466b9de9ad74df8879da",
68-
"MaxPrefixV4": "11013",
69-
"MaxPrefixV6": "1528"
67+
"Hash": "7799df9754393ba18ad855bd1bdcde76",
68+
"MaxPrefixV4": "10008",
69+
"MaxPrefixV6": "1857"
7070
}
7171
}

src/Peering/Peering.Test/SessionRecords/Microsoft.Azure.Commands.Peering.Test.ScenarioTests.CreateNewDirectConnectionTests/TestNewDirectConnectionNoSession.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"RequestBody": "",
88
"RequestHeaders": {
99
"x-ms-client-request-id": [
10-
"5c6d6845-e8df-4fe3-84c5-593431341b55"
10+
"005189d9-e096-4181-9668-dc7abe52f3c8"
1111
],
1212
"Accept-Language": [
1313
"en-US"
@@ -27,16 +27,16 @@
2727
"no-cache"
2828
],
2929
"x-ms-request-id": [
30-
"21073f80-380c-4de5-9c50-f77420e82ef2"
30+
"7214cb96-aba3-43f3-befe-720accc7510b"
3131
],
3232
"x-ms-ratelimit-remaining-subscription-resource-requests": [
33-
"597"
33+
"589"
3434
],
3535
"x-ms-correlation-request-id": [
36-
"af5ec4b7-14a0-402a-8886-4f16812fa85d"
36+
"29543863-13f8-4772-a88d-977672048c0e"
3737
],
3838
"x-ms-routing-request-id": [
39-
"NORTHEUROPE:20190829T183244Z:af5ec4b7-14a0-402a-8886-4f16812fa85d"
39+
"NORTHEUROPE:20190911T171001Z:29543863-13f8-4772-a88d-977672048c0e"
4040
],
4141
"Strict-Transport-Security": [
4242
"max-age=31536000; includeSubDomains"
@@ -45,7 +45,7 @@
4545
"nosniff"
4646
],
4747
"Date": [
48-
"Thu, 29 Aug 2019 18:32:43 GMT"
48+
"Wed, 11 Sep 2019 17:10:01 GMT"
4949
],
5050
"Content-Length": [
5151
"68896"
@@ -64,9 +64,9 @@
6464
"Names": {},
6565
"Variables": {
6666
"SubscriptionId": "3e919f9a-4e26-4736-aa8d-d596d9a49239",
67-
"bandwidth": "30000",
68-
"Hash": "47ee06a21f5d4ab950a330cd2099684b",
69-
"MaxPrefixV4": "1105",
70-
"MaxPrefixV6": "435"
67+
"bandwidth": "60000",
68+
"Hash": "9c6b6006fabb6b796e5551382cf47ea2",
69+
"MaxPrefixV4": "12983",
70+
"MaxPrefixV6": "1279"
7171
}
7272
}

src/Peering/Peering.Test/SessionRecords/Microsoft.Azure.Commands.Peering.Test.ScenarioTests.CreateNewDirectConnectionTests/TestNewDirectConnectionWithMicrosoftIpProvidedAddress.json

Lines changed: 69 additions & 0 deletions
Large diffs are not rendered by default.

src/Peering/Peering.Test/SessionRecords/Microsoft.Azure.Commands.Peering.Test.ScenarioTests.CreateNewDirectConnectionTests/TestNewDirectConnectionWithV4.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"RequestBody": "",
88
"RequestHeaders": {
99
"x-ms-client-request-id": [
10-
"6a732cdf-9b14-442d-9df3-eb1f3e2a2350"
10+
"67b477c8-ee3e-4e9b-b009-3929e42aee5f"
1111
],
1212
"Accept-Language": [
1313
"en-US"
@@ -27,16 +27,16 @@
2727
"no-cache"
2828
],
2929
"x-ms-request-id": [
30-
"027ccbcb-412e-4299-86d2-8e2b5fe11307"
30+
"fe50951a-81dc-46b0-bda7-62e4da45a3bf"
3131
],
3232
"x-ms-ratelimit-remaining-subscription-resource-requests": [
33-
"597"
33+
"595"
3434
],
3535
"x-ms-correlation-request-id": [
36-
"2fd23693-cb6f-4d40-a551-698d07ce2177"
36+
"2e9dedbe-ed6d-42b2-b316-c16583337ec5"
3737
],
3838
"x-ms-routing-request-id": [
39-
"NORTHEUROPE:20190829T183250Z:2fd23693-cb6f-4d40-a551-698d07ce2177"
39+
"NORTHEUROPE:20190911T171006Z:2e9dedbe-ed6d-42b2-b316-c16583337ec5"
4040
],
4141
"Strict-Transport-Security": [
4242
"max-age=31536000; includeSubDomains"
@@ -45,7 +45,7 @@
4545
"nosniff"
4646
],
4747
"Date": [
48-
"Thu, 29 Aug 2019 18:32:50 GMT"
48+
"Wed, 11 Sep 2019 17:10:05 GMT"
4949
],
5050
"Content-Length": [
5151
"68896"
@@ -67,7 +67,7 @@
6767
"RequestBody": "",
6868
"RequestHeaders": {
6969
"x-ms-client-request-id": [
70-
"19ed3fba-93eb-42aa-bf0e-3da048e60249"
70+
"7f4b8760-6d5a-4cb4-8d5c-71e730bae6ad"
7171
],
7272
"Accept-Language": [
7373
"en-US"
@@ -87,16 +87,16 @@
8787
"no-cache"
8888
],
8989
"x-ms-request-id": [
90-
"49421e56-92c3-4876-8f60-af35ab8eaeda"
90+
"1953632b-b9de-48bb-800a-5bfcdfa9f228"
9191
],
9292
"x-ms-ratelimit-remaining-subscription-resource-requests": [
93-
"598"
93+
"599"
9494
],
9595
"x-ms-correlation-request-id": [
96-
"f5e976f3-444b-4b8d-97df-f057cafba99e"
96+
"04d7ce43-9f0f-4edd-ad62-3b3753c14348"
9797
],
9898
"x-ms-routing-request-id": [
99-
"NORTHEUROPE:20190829T183251Z:f5e976f3-444b-4b8d-97df-f057cafba99e"
99+
"NORTHEUROPE:20190911T171006Z:04d7ce43-9f0f-4edd-ad62-3b3753c14348"
100100
],
101101
"Strict-Transport-Security": [
102102
"max-age=31536000; includeSubDomains"
@@ -105,10 +105,10 @@
105105
"nosniff"
106106
],
107107
"Date": [
108-
"Thu, 29 Aug 2019 18:32:51 GMT"
108+
"Wed, 11 Sep 2019 17:10:06 GMT"
109109
],
110110
"Content-Length": [
111-
"2944"
111+
"1621"
112112
],
113113
"Content-Type": [
114114
"application/json; charset=utf-8"
@@ -117,15 +117,15 @@
117117
"-1"
118118
]
119119
},
120-
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\",\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"2342432433295\"\r\n ]\r\n },\r\n \"peerName\": \"AS65000-Global9263\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"65000-Global9908\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/65000-Global9908\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\",\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"23424324333927\"\r\n ]\r\n },\r\n \"peerName\": \"AS65000-Global9354\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"65000-Global8757\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/65000-Global8757\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 11164,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\",\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"23424324333010\"\r\n ]\r\n },\r\n \"peerName\": \"AS11164-Global1279\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"11164-Global9635\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/11164-Global9635\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\",\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"23424324333206\"\r\n ]\r\n },\r\n \"peerName\": \"AS65000-Global3318\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"65000-Global7990\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/65000-Global7990\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\",\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"23424324339258\"\r\n ]\r\n },\r\n \"peerName\": \"AS65000-Global276\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"65000-Global3928\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/65000-Global3928\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n }\r\n ]\r\n}",
120+
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 11164,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"323223\"\r\n ]\r\n },\r\n \"peerName\": \"Global9635\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"11164-Global9635\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/11164-Global9635\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 8088,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\",\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"23424324337527\"\r\n ]\r\n },\r\n \"peerName\": \"AS8088-Global8787\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"8088-Global9053\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/8088-Global9053\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 8088,\r\n \"peerContactInfo\": {\r\n \"emails\": [\r\n \"[email protected]\"\r\n ],\r\n \"phone\": [\r\n \"9090909909\"\r\n ]\r\n },\r\n \"peerName\": \"8088-Global3917\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"8088-Global3917\",\r\n \"id\": \"/subscriptions/3e919f9a-4e26-4736-aa8d-d596d9a49239/providers/Microsoft.Peering/peerAsns/8088-Global3917\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n }\r\n ]\r\n}",
121121
"StatusCode": 200
122122
}
123123
],
124124
"Names": {},
125125
"Variables": {
126126
"SubscriptionId": "3e919f9a-4e26-4736-aa8d-d596d9a49239",
127-
"bandwidth": "80000",
128-
"Hash": "6f9813318eedc9bf9599ce6be9cc811a",
129-
"MaxPrefixV4": "1043"
127+
"bandwidth": "70000",
128+
"Hash": "452aef880b0dc75ae3f965c2d4fef6cf",
129+
"MaxPrefixV4": "16255"
130130
}
131131
}

0 commit comments

Comments
 (0)