cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2124
Views
0
Helpful
7
Replies

Meraki unable to get vlan info

yixiu0317
Level 1
Level 1

I am just trying to use Meraki SDK to retrieve vlan information using the sandbox, but get error when run the code. Any advice will be appreciated.

When I run postman to inquiry the vlan information, I got return error says "Vlans are not enabled for this network", I thought may be it is the reason, but when login to sandbox, vlan 1 is there.

Here is the code.

from meraki_sdk.meraki_sdk_client import MerakiSdkClient
import json
from pprint import pprint

token = '6bec40cf957de430a6f1f2baa056b99a4fac9ea0'
meraki = MerakiSdkClient(token)
orgs = meraki.organizations.get_organizations()

for org in orgs :
if org['name'] == 'DevNet Sandbox' :
orgId = org['id']

params = {}
params['organization_id'] = orgId
networks = meraki.networks.get_organization_networks(params)
pprint(networks)
for network in networks :
if network['name'] == 'DevNet Sandbox Always on READ ONLY' :
netId = network['id']

vlans = meraki.vlans.get_network_vlans(netId) 

 Here is the error.

Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/Meraki/Meraki_SDK1.py", line 30, in <module>
vlans = meraki.vlans.get_network_vlans(netId)
File "C:\Users\user\PycharmProjects\Meraki\venv\lib\site-packages\meraki_sdk\controllers\vlans_controller.py", line 60, in get_network_vlans
self.validate_response(_context)
File "C:\Users\user\PycharmProjects\Meraki\venv\lib\site-packages\meraki_sdk\controllers\base_controller.py", line 94, in validate_response
raise APIException('HTTP response not OK.', context)
meraki_sdk.exceptions.api_exception.APIException: HTTP response not OK.

7 Replies 7

pulkitgupta2k
Level 1
Level 1
 
{
    "errors": [
        "VLANs are not enabled for this network"
    ]
}

I too had this same problem. I tried sending a request using the dashboard API and got this error for the same network. I tried this on other networks as well and got the same error but not on fake made up networks. The made-up ones gave no response.

So I guess the VLANs are not enabled.

Also, I found this to enable VLANs: 

https://documentation.meraki.com/MX/Networks_and_Routing/Configuring_VLANs_on_the_MX_Security_Appliance#:~:text=Enable%20VLANs%20on%20the%20Dashboard,-VLANs%20are%20disabled&text=They%20can%20be%20enabled%20from,were%20disabled%20will%20be%20deleted.

However, this isn't working for me in the sandbox.

I found it is easier to create your own meraki account and play with it instead of using the always on lab.

Once you are familiar with all the settings, then use their reserve lab to play with device.

William20
Level 1
Level 1

Each SSID needs to be configured separately with the bridging and VLAN information dqfansurvey.

Slate55r
Level 1
Level 1

If you make a guest vlan on the MX it will automatically be routable sonic survey

Thank you so much for the information keep suggesting us such informative post I will recommend this post to others.

 

DirtyToucan
Level 1
Level 1

@yixiu0317 wrote:

I am just trying to use Meraki SDK to retrieve vlan information using the sandbox, but get error when run the code. Any advice will be appreciated.

When I run postman to inquiry the vlan information, I got return error says "Vlans are not enabled for this network", I thought may be it is the reason, but when login to sandbox, vlan 1 is there.

Here is the code.

from meraki_sdk.meraki_sdk_client import MerakiSdkClient
import json
from pprint import pprint

token = '6bec40cf957de430a6f1f2baa056b99a4fac9ea0'
meraki = MerakiSdkClient(token)
orgs = meraki.organizations.get_organizations()

for org in orgs :
if org['name'] == 'DevNet Sandbox' :
orgId = org['id']

params = {}
params['organization_id'] = orgId
networks = meraki.networks.get_organization_networks(params)
pprint(networks)
for network in networks :
if network['name'] == 'DevNet Sandbox Always on READ ONLY' :
netId = network['id']

vlans = meraki.vlans.get_network_vlans(netId) 

 Here is the error.

Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/Meraki/Meraki_SDK1.py", line 30, in <module>
vlans = meraki.vlans.get_network_vlans(netId)
File "C:\Users\user\PycharmProjects\Meraki\venv\lib\site-packages\meraki_sdk\controllers\vlans_controller.py", line 60, in get_network_vlans official site
self.validate_response(_context)
File "C:\Users\user\PycharmProjects\Meraki\venv\lib\site-packages\meraki_sdk\controllers\base_controller.py", line 94, in validate_response
raise APIException('HTTP response not OK.', context)
meraki_sdk.exceptions.api_exception.APIException: HTTP response not OK.


Great articles thanks for sharing this awesome blogs

RandallMarvin
Level 1
Level 1

Thanks for sharing, I found a lot of interesting information here. A really good post, very thankful and helpful that you will write many more posts like this one.

SubwayListens