MitchellGulledge / Meraki-vWAN

5 stars 4 forks source link

POST Request for effectiveRoutes of WAN hub always returns empty #1

Closed yujiterada closed 4 years ago

yujiterada commented 4 years ago

POST Request for effectiveRoutes of WAN Hub is always empty and therefore, the script finishes falsely with the log "No connected virtual networks or hubs to {virtual_wan_hub}".

Expected Behavior

Should return the subnet in effective routes of a WAN hub such as subnets of virtual networks.

Current Behavior

Always returns the following empty value regardless of having effective routes.

{
  "status": "Succeeded",
  "properties": {
    "output": {
      "value": []
    }
  }
}

Possible Solution

Craft payload and correct headers for the POST request in function get_azure_virtual_wan_gateway_config.

Steps to Reproduce

  1. Execute the current script with a WAN hub that has effective routes

Possible Implementation

payload = {
    "VirtualWanResourceType": "RouteTable",
    "ResourceId": f"/subscriptions/{AzureConfig.subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualHubs/{virtual_wan_hub}/hubRouteTables/defaultRouteTable"
}

new_header = header_with_bearer_token
new_header['Content-Type'] = 'application/json'
new_header['Accept'] = 'application/json, text/javascript, */*; q=0.01'

effective_routes_endpoint_response = requests.post(effective_routes_endpoint, headers=new_header, data=json.dumps(payload))
JackStromberg commented 4 years ago

Fixed in 8604a11deeaab40ca9e14e0f14ea2c4aab4d895b