Network Checker Group Policies python

jasonbrown23
Here to help

Network Checker Group Policies python

I'm trying to create a Python script that looks at a list in Python And compares it to all of the group policies In a network.

 

I'm generating the list. By creating a network in Meraki Dashboard that has all the group policies that I would like. And then I run "dashboard.networks.getNetworkGroupPolicies" that returns a list of dictionaries. I then save that list to be called when i run the group p check. 

 

for the checker to run i also pull the list for the network i want to check against. "dashboard.networks.getNetworkGroupPolicies"

 

Then i for loop though each group policies

 

for gp in grouppolicies:

this give me each gp from the network 

then i loop though all the MasterGroupPolicies

for MGP in MasterGroupPolicies

 if gp == MGP then print all good

 else: dash.networks.updatenetworkgp

or should i say just update / crate gp i want and why check them just update it.

 

 

1 Reply 1
jasonbrown23
Here to help

Never mind no need to check if its right the scrip should just correct.

 

I'm now just doing a 
+++++++++++++++++

try:
    dashboard.networks.createNetworkGroupPolicy(
        networkId=network_id,name="Guest", scheduling={'enabled': False},
        bandwidth={"settings":"custom","bandwidthLimits":{"limitUp":25600,"limitDown":25600}},
        vlanTagging={'settings': 'custom', 'vlanId': '80'},
        firewallAndTrafficShaping={'settings': 'custom', 'trafficShapingRules': [], 'l3FirewallRules': [{'comment': '', 'policy': 'deny', 'protocol': 'any', 'destPort': 'Any', 'destCidr': '10.0.0.0/8'}, {'comment': '', 'policy': 'deny', 'protocol': 'any', 'destPort': 'Any', 'destCidr': '172.168.0.0/16'}, {'comment': '', 'policy': 'deny', 'protocol': 'any', 'destPort': 'Any', 'destCidr': '192.168.0.0/16'}], 'l7FirewallRules': []},
        bonjourForwarding= {'settings': 'ignore', 'rules': []}
    )
except:
    dashboard.networks.updateNetworkGroupPolicy(
        groupPolicyId="106", networkId=network_id,name="Guest", scheduling={'enabled': False},
        bandwidth={"settings":"custom","bandwidthLimits":{"limitUp":25600,"limitDown":25600}},
        vlanTagging={'settings': 'custom', 'vlanId': '80'},
        firewallAndTrafficShaping={'settings': 'custom', 'trafficShapingRules': [], 'l3FirewallRules': [{'comment': '', 'policy': 'deny', 'protocol': 'any', 'destPort': 'Any', 'destCidr': '10.0.0.0/8'}, {'comment': '', 'policy': 'deny', 'protocol': 'any', 'destPort': 'Any', 'destCidr': '172.168.0.0/16'}, {'comment': '', 'policy': 'deny', 'protocol': 'any', 'destPort': 'Any', 'destCidr': '192.168.0.0/16'}], 'l7FirewallRules': []},
        bonjourForwarding= {'settings': 'ignore', 'rules': []}
    )
 
for each GP and adjusting per GP
Get notified when there are additional replies to this discussion.