<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adjust ip range API not working in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439977#M6274</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/42176"&gt;@johanoosterwaal&lt;/A&gt; wrote:&lt;BR /&gt;&lt;P&gt;Yes you can &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;As i have done this many time&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In that case, are you sure your JSON is well-formed? &lt;/P&gt;&lt;P&gt;Also, are VLANs enabled on your network? I feel like I ran into mystery failures on non-templated MX networks, and the ultimate problem was that VLANs were not enabled. No enabled VLANs, no access to the VLAN calls. Might have changed though.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2020 13:23:10 GMT</pubDate>
    <dc:creator>Nash</dc:creator>
    <dc:date>2020-07-20T13:23:10Z</dc:date>
    <item>
      <title>Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439971#M6268</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm working on a Python script to change ip ranges of MX's that are bound to a template.&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;def setmxipaddresses(p_apikey, p_shardurl, p_nwid, p_vlid):
    try:
        print (p_apikey, p_shardurl, p_nwid, p_vlid)
        r =  requests.put('https://%s/api/v0/networks/%s/vlans/%s' % (p_shardurl, p_nwid, p_vlid), data=json.dumps({'applianceIp':'192.168.1.2','subnet':'192.168.1.0/24'}), headers={'X-Cisco-Meraki-API-Key': p_apikey, 'Content-Type': 'application/json'})
        print (r)
    except:
        printusertext('ERROR 11: Unable to contact Meraki cloud')
        sys.exit(2)
            
    if r.status_code != requests.codes.ok:
        return ('null')
    
    return('ok') 


if arg_IP_address != 'null':
    #print (getvlan (arg_apikey, shardurl, nwid))
    setmxipaddresses(arg_apikey, shardurl, nwid, arg_IP_address)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But is seems that there is something wrong as i'm getting a error 400 back but i cannot figure out what is wrong.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 15:48:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439971#M6268</guid>
      <dc:creator>johanoosterwaal</dc:creator>
      <dc:date>2020-07-18T15:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439972#M6269</link>
      <description>&lt;P&gt;So your MX are all bound to a template that includes the vlan setup, but you want to override that part of the template?&lt;/P&gt;&lt;P&gt;Pretty sure you can't:&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.meraki.com/zGeneral_Administration/Templates_and_Config_Sync/Managing_Multiple_Networks_with_Configuration_Templates#MX_-_Template_VLAN_IP_Address_Range_Allocations" target="_blank" rel="noopener nofollow noreferrer"&gt;https://documentation.meraki.com/zGeneral_Administration/Templates_and_Config_Sync/Managing_Multiple_Networks_with_Configuration_Templates#MX_-_Template_VLAN_IP_Address_Range_Allocations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.meraki.com/Architectures_and_Best_Practices/Cisco_Meraki_Best_Practice_Design/Best_Practice_Design_-_MX_Security_and_SD-WAN/MX_Templates_Best_Practices" target="_blank" rel="noopener nofollow noreferrer"&gt;https://documentation.meraki.com/Architectures_and_Best_Practices/Cisco_Meraki_Best_Practice_Design/Best_Practice_Design_-_MX_Security_and_SD-WAN/MX_Templates_Best_Practices&lt;/A&gt; Specifically: "&lt;SPAN&gt;If &lt;/SPAN&gt;&lt;STRONG&gt;unique&lt;/STRONG&gt;&lt;SPAN&gt; is chosen, each network bound to the template will get a unique subnet based on the configured options. The MX does not support local VLAN overrides on templates."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So you're getting a 400 Bad Request response because you're asking it to do something that you're not allowed to do, b/c the network is using a template that includes vlan setup.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;By the way, I strongly encourage you to look into the &lt;A href="https://requests.readthedocs.io/en/master/_modules/requests/exceptions/" target="_self" rel="nofollow noopener noreferrer"&gt;available exceptions for the requests module&lt;/A&gt; instead of passing all errors the way you are. Unless you are deliberately passing a generic error and aren't concerned about why an attempt at a particular request failed. &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 22:11:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439972#M6269</guid>
      <dc:creator>Nash</dc:creator>
      <dc:date>2020-07-18T22:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439973#M6270</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for the reply. &lt;/P&gt;&lt;P&gt;The ip addresses are unique per site and only want to change the ip range on the MX and not change the VLAN.&lt;/P&gt;&lt;P&gt;you cannot change the VLAN on a MX once it is bound to a template but i can change the ip range. &lt;/P&gt;&lt;P&gt;Is that possible or ?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 07:30:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439973#M6270</guid>
      <dc:creator>johanoosterwaal</dc:creator>
      <dc:date>2020-07-20T07:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439974#M6271</link>
      <description>&lt;P&gt;I am pretty sure you cannot change the IP addresses when a site is bound to a template....&lt;/P&gt;&lt;P&gt;There for you need to unbind, but then you loose a lot of details of the site,...&lt;/P&gt;&lt;P&gt;Also wondering why you make your own definitions within python, simply use the meraki API and not use your own requests REST API calls and live is much easier.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 10:01:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439974#M6271</guid>
      <dc:creator>Edgar-VO</dc:creator>
      <dc:date>2020-07-20T10:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439975#M6272</link>
      <description>&lt;P&gt;Yes you can &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;As i have done this many time&lt;/P&gt;&lt;P&gt;MX:&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MX" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/262350iCC508A8BFB903D9D/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;MX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Template:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Template" style="width: 680px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/262351i9FC11188174B45F8/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Template&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 13:17:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439975#M6272</guid>
      <dc:creator>johanoosterwaal</dc:creator>
      <dc:date>2020-07-20T13:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439976#M6273</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/37463"&gt;@Edgar-VO&lt;/A&gt; wrote:&lt;BR /&gt;&lt;P&gt;I am pretty sure you cannot change the IP addresses when a site is bound to a template....&lt;/P&gt;&lt;P&gt;There for you need to unbind, but then you loose a lot of details of the site,...&lt;/P&gt;&lt;P&gt;Also wondering why you make your own definitions within python, simply use the meraki API and not use your own requests REST API calls and live is much easier.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;"Easier" is a matter of opinion. I use Python and the requests module because I use the requests module with REST APIs from multiple vendors, and it's a standard method. SDKs all have their own quirks.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 13:18:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439976#M6273</guid>
      <dc:creator>Nash</dc:creator>
      <dc:date>2020-07-20T13:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439977#M6274</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/42176"&gt;@johanoosterwaal&lt;/A&gt; wrote:&lt;BR /&gt;&lt;P&gt;Yes you can &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;As i have done this many time&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In that case, are you sure your JSON is well-formed? &lt;/P&gt;&lt;P&gt;Also, are VLANs enabled on your network? I feel like I ran into mystery failures on non-templated MX networks, and the ultimate problem was that VLANs were not enabled. No enabled VLANs, no access to the VLAN calls. Might have changed though.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 13:23:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439977#M6274</guid>
      <dc:creator>Nash</dc:creator>
      <dc:date>2020-07-20T13:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439978#M6275</link>
      <description>&lt;P&gt;Well i think the JSON is well formed but i'm not sure.&lt;/P&gt;&lt;P&gt;maybe need help with that. do you have an example on this ?&lt;/P&gt;&lt;P&gt;On the MX and template there are 2 vlans enabled, vlan 100 and vlan 5.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 12:40:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439978#M6275</guid>
      <dc:creator>johanoosterwaal</dc:creator>
      <dc:date>2020-07-22T12:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439979#M6276</link>
      <description>&lt;P&gt;&lt;A href="https://jsonlint.com/" target="_self" rel="nofollow noopener noreferrer"&gt;JSONLint, for all your validating needs.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 20:33:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439979#M6276</guid>
      <dc:creator>Nash</dc:creator>
      <dc:date>2020-07-22T20:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust ip range API not working</title>
      <link>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439980#M6277</link>
      <description>&lt;P&gt;Got it to work now and i can change ip addresses on templates! Thank all for your help:&lt;/P&gt;&lt;P&gt;The issue was that i tried to changed it to a complete different ip range then configured on the template:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/24 from 172.16.0.0/8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when i do change it but in the given range it works. Also the JSON i used wasn't formed correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;def setmxipaddresses(p_apikey, p_shardurl, p_nwid, p_vlid):
    try:
        Data = {"applianceIp":"172.9.20.1","subnet":"172.9.20.0/24"}
        print (p_apikey, p_shardurl, p_nwid, p_vlid)
        r =  requests.put('https://%s/api/v0/networks/%s/vlans/%s' % (p_shardurl, p_nwid, p_vlid), data=json.dumps(Data), headers={'X-Cisco-Meraki-API-Key': p_apikey, 'Content-Type': 'application/json'})
        print (r)
    except:
        printusertext('ERROR 11: Unable to contact Meraki cloud')
        sys.exit(2)
            
    if r.status_code != requests.codes.ok:
        return ('null')
    
    return('ok')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Jul 2020 16:46:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adjust-ip-range-api-not-working/m-p/5439980#M6277</guid>
      <dc:creator>johanoosterwaal</dc:creator>
      <dc:date>2020-07-25T16:46:18Z</dc:date>
    </item>
  </channel>
</rss>

