fortiswitch_switch_physical_port – Physical port specific configuration in Fortinet’s FortiSwitch

New in version 1.0.0.


  • This module is able to configure a FortiSwitch device by allowing the user to set and modify switch feature and physical_port category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v7.0.0


The below requirements are needed on the host that executes this module.

  • ansible>=2.11

FortiSW Version Compatibility

v7.0.0 v7.0.1 v7.0.2 v7.0.3
fortiswitch_switch_physical_port yes yes yes yes


  • enable_log - Enable/Disable logging for task. type: bool required: false default: False
  • member_path - Member attribute path to operate on. type: str
  • member_state - Add or delete a member under specified attribute path. type: str choices: present, absent
  • state - Indicates whether to create or remove the object. type: str required: true choices: present, absent
  • switch_physical_port - Physical port specific configuration. type: dict
    • cdp_status - CDP transmit and receive status (LLDP must be enabled in LLDP settings). type: str choices: disable, rx-only, tx-only, tx-rx
    • description - Description. type: str
    • dmi_status - DMI status. type: str choices: enable, disable, global
    • eee_tx_idle_time - EEE Transmit idle time (microseconds)(0-2560). type: int
    • eee_tx_wake_time - EEE Transmit wake time (microseconds)(0-2560). type: int
    • egress_drop_mode - Enable/Disable egress drop. type: str choices: enabled, disabled
    • energy_efficient_ethernet - Enable / disable energy efficient ethernet. type: str choices: enable, disable
    • flap_duration - Period over which flap events are calculated (seconds). type: int
    • flap_rate - Number of stage change events needed within flap-duration. type: int
    • flap_timeout - Flap guard disabling protection (min). type: int
    • flap_trig - Flag is set if triggered on this port. type: int
    • flapguard - Enable / disable FlapGuard. type: str choices: enabled, disabled
    • flapguard_state - Timestamp of last triggered event (or 0 if none). type: str
    • flow_control - Configure flow control pause frames. type: str choices: disable, tx, rx, both
    • fortilink_p2p - FortiLink point-to-point. type: str choices: enable, disable
    • l2_learning - Enable / disable dynamic MAC address learning. type: str choices: enabled, disabled
    • l2_sa_unknown - Forward / drop unknown(SMAC) packets when dynamic MAC address learning is disabled. type: str choices: forward, drop
    • link_status - Physical link status. type: str
    • lldp_profile - LLDP port TLV profile. Source type: str
    • lldp_status - LLDP transmit and receive status. type: str choices: disable, rx-only, tx-only, tx-rx
    • loopback - Phy Port Loopback. type: str choices: local, remote, disable
    • max_frame_size - Maximum frame size. type: int
    • medium - Configure port preference for shared ports. type: str choices: fiber-preferred, copper-preferred, fiber-forced, copper-forced
    • name - Port name. type: str required: true
    • owning_interface - Trunk interface. type: str
    • pause_meter_rate - Configure ingress metering rate. In kbits. 0 = disabled. type: int
    • pause_resume - Resume threshold for resuming reception on pause metering of an ingress port. type: str choices: 75%, 50%, 25%
    • poe_port_mode - IEEE802.3AF/IEEE802.3AT type: str choices: IEEE802_3AF, IEEE802_3AT
    • poe_port_priority - Configure port priority type: str choices: low-priority, high-priority, critical-priority
    • poe_status - Enable/disable PSE. type: str choices: enable, disable
    • port_index - Port index. type: int
    • priority_based_flow_control - Enable / disable priority-based flow control. 802.3 flow control will be applied when disabled type: str choices: disable, enable
    • qsfp_low_power_mode - Enable/Disable QSFP low power mode. type: str choices: enabled, disabled
    • speed - Configure interface speed and duplex. type: str choices: auto, 10half, 10full, 100half, 100full, 100FX-half, 100FX-full, 1000full, 2500auto, 5000auto, 10000full, 10000cr, 10000sr, 40000full, 40000sr4, 40000cr4, 100000full, 100000cr4, 100000sr4, auto-module, 1000full-fiber, 1000auto, 25000full, 25000cr, 25000sr, 50000full, 50000cr, 50000sr
    • status - Administrative status. type: str choices: up, down
    • storm_control - Storm control. type: dict
      • broadcast - Enable/disable broadcast storm control. type: str choices: enable, disable
      • burst_size_level - Storm control burst size level 0-4. type: int
      • rate - Storm control traffic rate. type: int
      • unknown_multicast - Enable/disable unknown multicast storm control. type: str choices: enable, disable
      • unknown_unicast - Enable/disable unknown unicast storm control. type: str choices: enable, disable
    • storm_control_mode - Storm control mode. type: str choices: global, override, disabled


- hosts: fortiswitch01
    - fortinet.fortiswitch
  connection: httpapi
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  - name: Physical port specific configuration.
      state: "present"
        cdp_status: "disable"
        description: "<your_own_value>"
        dmi_status: "enable"
        eee_tx_idle_time: "6"
        eee_tx_wake_time: "7"
        egress_drop_mode: "enabled"
        energy_efficient_ethernet: "enable"
        flap_duration: "10"
        flap_rate: "11"
        flap_timeout: "12"
        flap_trig: "13"
        flapguard: "enabled"
        flapguard_state: "<your_own_value>"
        flow_control: "disable"
        fortilink_p2p: "enable"
        l2_learning: "enabled"
        l2_sa_unknown: "forward"
        link_status: "<your_own_value>"
        lldp_profile: "<your_own_value> (source"
        lldp_status: "disable"
        loopback: "local"
        max_frame_size: "24"
        medium: "fiber-preferred"
        name: "default_name_26"
        owning_interface: "<your_own_value>"
        pause_meter_rate: "28"
        pause_resume: "75%"
        poe_port_mode: "IEEE802_3AF"
        poe_port_priority: "low-priority"
        poe_status: "enable"
        port_index: "33"
        priority_based_flow_control: "disable"
        qsfp_low_power_mode: "enabled"
        speed: "auto"
        status: "up"
            broadcast: "enable"
            burst_size_level: "40"
            rate: "41"
            unknown_multicast: "enable"
            unknown_unicast: "enable"
        storm_control_mode: "global"

Return Values

Common return values are documented:, the following are the fields unique to this module:

  • build - Build number of the fortiSwitch image returned: always type: str sample: 1547
  • http_method - Last method used to provision the content into FortiSwitch returned: always type: str sample: PUT
  • http_status - Last result given by FortiSwitch on last operation applied returned: always type: str sample: 200
  • mkey - Master key (id) used in the last call to FortiSwitch returned: success type: str sample: id
  • name - Name of the table used to fulfill the request returned: always type: str sample: urlfilter
  • path - Path of the table used to fulfill the request returned: always type: str sample: webfilter
  • serial - Serial number of the unit returned: always type: str sample: FS1D243Z13000122
  • status - Indication of the operation's result returned: always type: str sample: success
  • version - Version of the FortiSwitch returned: always type: str sample: v7.0.0


  • This module is not guaranteed to have a backwards compatible interface.


  • Link Zheng (@chillancezen)
  • Jie Xue (@JieX19)
  • Hongbin Lu (@fgtdev-hblu)
  • Frank Shen (@frankshen01)
  • Miguel Angel Munoz (@mamunozgonzalez)


If you notice any issues in this documentation, you can create a pull request to improve it.