The truth is that there is no magic tool for migrating settings. Everything that exists is basically what was created by someone within the community.
I can try this python code.
import requests
import json
# Define the API key and network ID
API_KEY = 'YOUR_API_KEY'
NETWORK_ID = 'YOUR_NETWORK_ID'
# Define the headers for the API request
headers = {
'X-Cisco-Meraki-API-Key': API_KEY,
'Content-Type': 'application/json'
}
# Define the URL for the API request
url = f'https://api.meraki.com/api/v1/networks/{NETWORK_ID}/switch/accessControlLists'
# Read the Catalyst ACLs from a text file
with open('catalyst_acls.txt', 'r') as file:
catalyst_acls = file.readlines()
# Convert the Catalyst ACLs to the Meraki standard
# This is a basic conversion and might need to be adjusted based on your specific ACLs
meraki_acls = [{'comment': acl.split(' ')[1], 'policy': acl.split(' ')[2], 'protocol': acl.split(' ')[3], 'srcCidr': acl.split(' ')[4], 'srcPort': acl.split(' ')[5], 'dstCidr': acl.split(' ')[6], 'dstPort': acl.split(' ')[7], 'vlan': acl.split(' ')[8]} for acl in catalyst_acls]
# Make the API request
response = requests.put(url, headers=headers, json=meraki_acls)
# Check the response
if response.status_code == 200:
print('Successfully updated ACLs.')
else:
print(f'Failed to update ACLs. Status code: {response.status_code}.')
This script assumes that each line in the text file is a single Catalyst ACL and that the ACLs are formatted as follows: access-list ACL_NAME action protocol source destination. The script splits each line into separate parts and maps them to the corresponding fields in the Meraki ACLs. If your Catalyst ACLs are formatted differently, you’ll need to adjust the script accordingly.
I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.
Please, if this post was useful, leave your kudos and mark it as solved.