MitchellGulledge / Meraki-vWAN

5 stars 4 forks source link

network,getNetworkEvents fail #23

Closed cristianoscarpa92 closed 3 years ago

cristianoscarpa92 commented 3 years ago

the script fail : image

I try to manually request the same API by adding ?productType=appliance and I didn't receive error

The script also create object on Azure with secondary MX public ip image image

MitchellGulledge commented 3 years ago

Hey cristianoscarpa92 can you share your Meraki dashboard mac address so I can have a look? Additionally is this an appliance network or a combined network? Apologies for delay.

MitchellGulledge commented 3 years ago

When looking at the organization I do see that all your networks are in combined networks and the network ID in the output you pasted above has L_ indicating other things. Let me make sure the code isnt only built to failover appliance networks. Will update once I have results.

MitchellGulledge commented 3 years ago

Good news is I was able to replicate the issue, will have update and fix out later today.

2021-03-11 10:49:57       meraki:    ERROR > networks, getNetworkEvents - 400 Bad Request, {'errors': ['productType is required']}
Traceback (most recent call last):
  File "vwan-fail.py", line 14, in <module>
    events_response = MerakiConfig.sdk_auth.networks.getNetworkEvents(
  File "/usr/local/lib/python3.8/site-packages/meraki/api/networks.py", line 551, in getNetworkEvents
    return self._session.get_pages(metadata, resource, params, total_pages, direction, event_log_end_time)
  File "/usr/local/lib/python3.8/site-packages/meraki/rest_session.py", line 283, in get_pages
    response = self.request(metadata, 'GET', url, params=params)
  File "/usr/local/lib/python3.8/site-packages/meraki/rest_session.py", line 262, in request
    raise APIError(metadata, response)
meraki.exceptions.APIError: networks, getNetworkEvents - 400 Bad Request, {'errors': ['productType is required']}

I am able to replicate the error when the network ID begins with L_. Easy fix/validation :) Again apologies for the delay

MitchellGulledge commented 3 years ago
# retrieving third party vpn events for network that is detected as down
events_response = MerakiConfig.sdk_auth.networks.getNetworkEvents(
    'xxxxxxxxxxxx', # inputting network ID but vpns['networkId'] is the value in the code
    total_pages=1,
    includedEventTypes = 'vpn',
    productType= 'appliance'  # here is the fix for the issue you are seeing :) Will add and repack this should take care of everything
)

print(events_response)
MitchellGulledge commented 3 years ago

Fix is merged :) Can you try redeploying? @cristianoscarpa92

cristianoscarpa92 commented 3 years ago

Now the are no errors on the script, but I have a new issue. Azure is configured with Appliance IP address instead of Shared IP. I did packet capture on Meraki switch port and the tunnel is initiated by Shared IP and not by MX IP. image image

As workaround I removed the use of virtual IP

MitchellGulledge commented 3 years ago

Thanks for confirming :) I am going to close this issue out and opened this issue for what you reported: https://github.com/MitchellGulledge/Meraki-vWAN/issues/26

MitchellGulledge commented 3 years ago

@cristianoscarpa92 confirmed the get network events error is no longer present and need to focus on #26 now