AnsweredAssumed Answered

Adding simple GW with several network interfaces using Web Services API

Question asked by Sergey Slepkov Employee on Mar 1, 2018
Latest reply on Mar 7, 2018 by Heiko Ankenbrand

Hi, API experts!


I'm trying to automatize adding simple GWs to my MGMT using API.

With mgmt cli it works perfectly:


mgmt add simple-gateway name "GW-R80.10-API" color "black" ipv4-address "" version "R80.10" one-time-password "sic123" firewall true application-control true url-filtering true ips true anti-bot true anti-virus true "eth0" interfaces.1.ipv4-address "" interfaces.1.ipv4-network-mask "" interfaces.1.anti-spoofing true interfaces.1.topology "external" "eth1" interfaces.2.ipv4-address "" interfaces.2.ipv4-network-mask "" interfaces.2.anti-spoofing true interfaces.2.topology "internal" interfaces.2.topology-settings.ip-address-behind-this-interface "network defined by the interface ip and net mask"




But mgmt cli is not the thing I need, so Im trying to use Python script with Web Services API: 


>>> add_gw_data = {
... "name": "GW-R80.10-API",
... "color": "black",
... "ipv4-address": "",
... "version": "R80.10",
... "one-time-password": "sic123",
... "firewall": "true",
... "application-control": "true",
... "url-filtering": "true",
... "ips": "true",
... "anti-bot": "true",
... "anti-virus": "true",
... "": "eth0",
... "interfaces.1.ipv4-address": "",
... "interfaces.1.ipv4-network-mask": "",
... "interfaces.1.anti-spoofing": "true",
... "interfaces.1.topology": "external",
... "": "eth1",
... "interfaces.2.ipv4-address": "",
... "interfaces.2.ipv4-network-mask": "",
... "interfaces.2.anti-spoofing": "true",
... "interfaces.2.topology": "internal",
... "interfaces.2.topology-settings.ip-address-behind-this-interface": "network defined by the interface ip and net mask"
... }
>>> add_gw = api_call(mgmt_ip_addr, "add-simple-gateway", add_gw_data, sid)
>>> print(json.dumps(add_gw))
{"message": "Unrecognized parameter []", "code": "generic_err_invalid_parameter_name"}




How can I properly define all network interfaces?


Interfaces is List parameter, what is the proper syntax to define all the interfaces in this structure?