MitchellGulledge / Meraki-vWAN

5 stars 4 forks source link

Fix Issue #1 #2

Closed yujiterada closed 4 years ago

yujiterada commented 4 years ago

Fix issue #1.

Description

Fixes issue #1 by adding payload and the correct header to the POST request in get_azure_virtual_wan_gateway_config.

Related Issue

1

Motivation and Context

Fixes the script from ending falsely

How Has This Been Tested?

  1. Create Azure environment with a WAN hub with effective routes
  2. Create Function App
  3. Confirm "No connected virtual networks or hubs to {virtual_wan_hub}" is not logged
JackStromberg commented 4 years ago

@yujiterada this is a bit more complex than the change proposed. There are major differences in the responses returned back by the Virtual WAN APIs 2020-04-01 vs 2020-05-01. Depending on if the customer is propagating a route table in Virtual WAN, the response needed is different. Working on another branch that will include detection of the virtual wan hub and will return the routes accordingly.

yujiterada commented 4 years ago

@JackStromberg Isn't this code still calling version 2020-05-01 as the original? The payload also seems correct from the documentation.

effective_routes_endpoint = _get_microsoft_network_base_url(_AZURE_MGMT_URL, AzureConfig.subscription_id, resource_group)\
                        + f"/virtualHubs/{virtual_wan_hub}/effectiveRoutes?api-version=2020-05-01"
JackStromberg commented 4 years ago

@yujiterada yes, you are correct in that the current master branch has a bug in that it's missing the payload. The tricky piece is for VWAN instances still reliant on the 2020-04-01 API, the 2020-05-01 API will return back the same "Success" response with no routes.

In working with @MitchellGulledge we were able to successfully test some new retry logic to correct calls to the 2020-05-01 APIs and then failback to 2020-04-01 based on the result to correctly support the hubs on the 2020-04-01 APIs.

In addition, in that same branch (sorry my branch is local), I did add your device check per #3 (thank you! :)). Will update and merge changes tomorrow after a few more tests.

JackStromberg commented 4 years ago

Addressed in 8604a11deeaab40ca9e14e0f14ea2c4aab4d895b. Thank you for the contribution!