- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create VLAN using API on MX
Hi
I've noticed that when I use the API to create VLANs on the MX there might be an error in the API.
I use the createNetworkApplianceVlan with the following parameters: (some are comming from a few input statment and will later be part of a data flow between different systems)
My current workaround is to then run the updateNetworkApplianceVlan with the following input:
Ideas / Input appriciated
Solved! Go to solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The main problem here is that creating an endpoint often doesn't accept the same parameters as updating the endpoint.
I always use the same approach as you with generating the VLAN and then setting all needed parameters:
print("Step "+next(step)+": Create VLAN User-LAN ... ")
response = dashboard.appliance.createNetworkApplianceVlan(
network_hq_id, 1000, name='User-LAN',
subnet='10.1.0.0/24',
applianceIp='10.1.0.254'
)
print("Step "+next(step)+": Update VLAN User-LAN DHCP ... ")
response = dashboard.appliance.updateNetworkApplianceVlan(
network_hq_id, 1000,
dhcpHandling='Run a DHCP server',
dhcpLeaseTime='1 day',
dhcpBootOptionsEnabled=False,
reservedIpRanges=[{'start': '10.1.0.128', 'end': '10.1.0.254', 'comment': 'Reserved'}],
dnsNameservers='opendns',
dhcpOptions=[{'code': '18', 'type': 'text', 'value': 'company.intern'},
{'code': '42', 'type': 'IP', 'value': '192.53.103.101'}]
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The main problem here is that creating an endpoint often doesn't accept the same parameters as updating the endpoint.
I always use the same approach as you with generating the VLAN and then setting all needed parameters:
print("Step "+next(step)+": Create VLAN User-LAN ... ")
response = dashboard.appliance.createNetworkApplianceVlan(
network_hq_id, 1000, name='User-LAN',
subnet='10.1.0.0/24',
applianceIp='10.1.0.254'
)
print("Step "+next(step)+": Update VLAN User-LAN DHCP ... ")
response = dashboard.appliance.updateNetworkApplianceVlan(
network_hq_id, 1000,
dhcpHandling='Run a DHCP server',
dhcpLeaseTime='1 day',
dhcpBootOptionsEnabled=False,
reservedIpRanges=[{'start': '10.1.0.128', 'end': '10.1.0.254', 'comment': 'Reserved'}],
dnsNameservers='opendns',
dhcpOptions=[{'code': '18', 'type': 'text', 'value': 'company.intern'},
{'code': '42', 'type': 'IP', 'value': '192.53.103.101'}]
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes that will be the workflow
Little annoying that when you read the schema definition most of the parameters are defined/explained.
I used the same in my code basically just like you, create the basic and then update with specifics
