10-14-2024 02:50 AM
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)
Solved! Go to Solution.
10-14-2024 05:28 AM
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'}]
)
10-14-2024 05:28 AM
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'}]
)
10-14-2024 06:01 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide