I have to be blind because there error I'm getting is that my ip address is not formatted correctly for the meraki module in python. But it looks correct.
Yes i know i'm importing more then needed.
from meraki import meraki
from ipaddress import ip_address
import random
import requests
import json
import sys
import re
import warnings
import os
import csv
# Used to access Meraki API
import login
(API_KEY, ORG_ID, BASE_URL) = (login.api_key, login.org_id, login.base_url)
####Variables####
my_hub = '#####'
my_mode = 'spoke'
my_usevpn = 'True'
# Get the current list of networks
current_networks = meraki.getnetworklist(API_KEY, ORG_ID)
# Get the current networks' ID
network_id = [network['id'] for network in current_networks]
network_id.pop(1)
#Get VLANS
for line in network_id:
vlans = meraki.getvlans(API_KEY, line)
vpn = meraki.getvpnsettings(API_KEY, line)
#Get the VPN Subnets
vpn_subnet = [subnet['subnet'] for subnet in vlans]
for sub in vpn_subnet:
#Update VPN Settings
update_vpnsettings = meraki.updatevpnsettings(API_KEY, line, mode=my_mode, subnets=sub, usevpn=my_usevpn, hubnetworks=my_hub, defaultroute='False')
print(update_vpnsettings)
raise ValueError('Invalid Subnet IP Address {0} - Address must be formatted as #.#.#.#/#'.format(str(subnetip)))
ValueError: Invalid Subnet IP Address 1 - Address must be formatted as #.#.#.#/#
The issue is with the sub variable. But that comes out formatted as x.x.x.x/x. I have a hard time believing that someone way smarter then me screwed up when making the module.
Sub variable output
192.168.128.0/24
10.110.14.0/24
10.110.15.0/24
10.110.16.0/24
10.110.17.0/24
10.110.20.0/24
10.110.77.0/24
10.110.175.0/24
10.110.215.0/24