MitchellGulledge / Meraki-vWAN

5 stars 4 forks source link

Automating the Tag Place Holder Meraki network creation #7

Closed MitchellGulledge closed 4 years ago

MitchellGulledge commented 4 years ago

function to detect if placeholder network exists

def placeholder_check():

obtaining complete list of networks within org

meraki_network_list = mdashboard.networks.getOrganizationNetworks(meraki_config['org_id'])
for network in meraki_network_list:
    # creating placeholder variable
    placeholder_network_created = False
    # now scanning for networks named Tag Placeholder, if one does not exist it will be created
    if network['name'] == 'Tag-Placeholder':
        placeholder_network_created = True
        print(placeholder_network_created)
    elif network['name'] != 'Tag-Placeholder': # need to exclude normal branches
        pass
if placeholder_network_created == False: # placed this outside for loop
    print(placeholder_network_created)
    create_network = mdashboard.networks.createOrganizationNetwork\
        (meraki_config['org_id'], name = "Tag-Placeholder", type = "appliance")

Currently users have to create a Tag-Placeholder network. This function above automates that so users no longer have to create a placeholder network for primary and secondary tags.

JackStromberg commented 4 years ago

Addressed in bfa11851fdbc15491d4e6ea42d5b89bdfe42f481