fortinet-ansible-dev / ansible-galaxy-fortiswitch-collection

GNU General Public License v3.0
2 stars 0 forks source link

Problem with switch interface name #3

Closed duit-mr closed 2 years ago

duit-mr commented 2 years ago

Using the collection module fortiswitch_switch_interface, and it is erroring out on the interface name. My module:

 - name: set switch interface
     fortiswitch_switch_interface:
        state: present
        switch_interface:
          name: "port1"
          native_vlan: "2" 

on CLI 8 debug shows

Error in cmf_shm_api.c,cmf_shm_update,765, pid=918,vd=root,query=switch.interface,level=1,pos=0.
Error in cmf_shm_api.c,cmf_shm_update,765, pid=918,vd=root,query=switch.interface,level=1,pos=0.
0: config switch interface
-61: rename "port1" to "interface"
(skipped) edit "interface"

(skipped) set native-vlan 2

and application httpsd -1 shows:

api_global.c  [   65] : ----------------------------------------------------------------------------------
api_global.c  [   66] : Received '/api/v2/cmdb/switch/interface/port1' request from '192.168.88.246'
api_global.c  [   67] : ----------------------------------------------------------------------------------
aps_util.c    [ 1213] : cky-cid (11) loginname (admin) username (admin) prof-name (super_admin) in cookies
api_version.c [  718] : Found out an entry ('switch.interface' -> 'switch.interface') for version (v2)
api_cmdb.c    [ 2352] : finding a CMDB node (path='switch',name='interface')
api_cmdb.c    [ 2390] : querying CMDB node with mkey 'port1'
api_version.c [   30] : Changing Same Type Item : name ('igmps-flood-reports' -> 'igmp-snooping-flood-reports')
api_version.c [   30] : Changing Same Type Item : name ('igmps-flood-traffic' -> 'mcast-snooping-flood-traffic')
api_cmdb.c    [ 2128] : editing CMDB object : append (0) auto_key (0) mkey (port1) flags (0) ...
api_json.c    [ 1975] : setting attribute 'name' : 'interface'
api_json.c    [ 1975] : setting attribute 'native-vlan' : '2'
api_cmdb.c    [  971] : saving failed for main node: 'interface' (err=-61)
api_json.c    [ 1688] : error saving request object to CLI (-61)
api_cmdb.c    [ 1978] : return error code : cmdb (-61) to http code (400)
api_common.c  [  849] : API return HTTP code (400:error)
================== Response ==================
{
  "http_method":"PUT",
  "status":"error",
  "http_status":400,
  "vdom":"root",
  "path":"switch",
  "name":"interface",
  "mkey":"port1",
  "cmdb-index":"771",
  "cmdb-checksum":"17626511090081187947",
  "serial":"S448DXXXXXXXXXXX",
  "version":"v7.0.0",
  "build":22,
  "timestamp":"1970-01-01T04:07:13Z",
  "error_reason":"error saving request object to CLI (-61)"
}

Finally, ansible logs:

fatal: [192.168.88.2]: FAILED! => {"changed": false, "meta": {"build": 22, "cmdb-checksum": "17626511090081187947", "cmdb-index": "771", "error_reason": "error saving request object to CLI (-61)", "http_method": "PUT", "http_status": 400, "mkey": "port1", "name": "interface", "path": "switch", "serial": "S448DXXXXXXXXXXX", "status": "error", "timestamp": "1970-01-01T04:09:47Z", "vdom": "root", "version": "v7.0.0"}, "msg": "Error in repo"}

Funnily enough I can make any changes without issue when using the fortiswitch_physical_port module. It appears that somewhere the "name" is being remapped to "interface," but I'm not sure where. Tested with FSW 7.0.0-3, and releases 1.0.0, 1.0.1, and 1.1.0.

Thanks

duit-mr commented 2 years ago

Fortinet TAC has confirmed this is an API bug (0797444), with no fix version confirmed yet.