Small Python utility for bulk creation of Meraki policy objects and object groups from a text list.
- reads IP/CIDR and FQDN entries from an input file,
- validates entries and normalizes names,
- creates missing Meraki policy objects,
- reuses IDs for objects that already exist,
- creates/updates an object group from created/found object IDs,
- writes results to
objects_created.json.
meraki_object_loader.py- main entrypointmeraki_utils.py- validation and API helper functionsmeraki_api_test.py- simple API connectivity test scriptinput_examples.txt- example input file with different object types
- Python 3.10+
- packages:
meraki,requests
MERAKI_API_KEY(required)MERAKI_ORG_ID(required)MERAKI_GROUP_NAME(optional, default:G_POLICY_OBJECTS)MERAKI_INPUT_FILE(optional, default:lista.txt)
Each non-empty line in the input file:
value[,custom_name]
Examples:
10.10.10.1010.10.20.0/24,BranchA_Netprinter01.example.com,Printer01
For a full sample list (hosts, CIDR networks, FQDNs), use input_examples.txt.
Names are generated in meraki_utils.py and truncated to 50 characters.
-
IPv4 host (
/32) ->H_<ip_with_underscores>Example:10.10.10.10->H_10_10_10_10 -
IPv4 network (
/<prefix>other than/32) ->N_<network_ip_with_underscores>-<prefix>Example:10.10.20.0/24->N_10_10_20_0-24 -
FQDN -> normalized FQDN value (or
custom_nameif provided) Example:printer01.example.com->printer01_example_com -
If
custom_nameis provided for IP/CIDR, it is appended:<base_name>_<normalized_custom_name>Example:10.10.20.0/24,BranchA->N_10_10_20_0-24_BranchA
source .venv/bin/activate
export MERAKI_API_KEY='your_key'
export MERAKI_ORG_ID='123456'
export MERAKI_INPUT_FILE='input_examples.txt'
python meraki_object_loader.py