fortiswitch_router_bgp – BGP configuration in Fortinet’s FortiSwitch

New in version 1.0.0.

Synopsis

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

Requirements

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_router_bgp yes yes yes yes

Parameters

  • 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
  • router_bgp - BGP configuration. type: dict
    • admin_distance - Administrative distance modifications. type: list member_path: admin_distance:id
      • distance - Administrative distance to apply (1 - 255). type: int
      • id - ID. type: int required: true
      • neighbour_prefix - Neighbor address prefix. type: str
      • route_list - Access list of routes to apply new distance to. Source router.access-list.name. type: str
    • aggregate_address - BGP aggregate address table. type: list member_path: aggregate_address:id
      • as_set - Enable/disable generate AS set path information. type: str choices: enable, disable
      • id - ID. type: int required: true
      • prefix - Aggregate prefix. type: str
      • summary_only - Enable/disable filter more specific routes from updates. type: str choices: enable, disable
    • aggregate_address6 - BGP IPv6 aggregate address table. type: list member_path: aggregate_address6:id
      • id - ID. type: int required: true
      • prefix6 - Aggregate IPv6 prefix. type: str
      • summary_only - Enable/disable filter more specific routes from updates. type: str choices: enable, disable
    • always_compare_med - Enable/disable always compare MED. type: str choices: enable, disable
    • as - Router AS number. type: int
    • bestpath_as_path_ignore - Enable/disable ignore AS path. type: str choices: enable, disable
    • bestpath_aspath_multipath_relax - Allow load sharing across routes that have different AS paths (but same length). type: str choices: disable, enable
    • bestpath_cmp_confed_aspath - Enable/disable compare federation AS path length. type: str choices: enable, disable
    • bestpath_cmp_routerid - Enable/disable compare router ID for identical EBGP paths. type: str choices: enable, disable
    • bestpath_med_confed - Enable/disable compare MED among confederation paths. type: str choices: enable, disable
    • bestpath_med_missing_as_worst - Enable/disable treat missing MED as least preferred. type: str choices: enable, disable
    • client_to_client_reflection - Enable/disable client-to-client route reflection. type: str choices: enable, disable
    • cluster_id - Route reflector cluster ID. type: str
    • confederation_identifier - Confederation identifier. type: int
    • confederation_peers - Confederation peers. type: list member_path: confederation_peers:peer
      • peer - Peer ID. type: str required: true
    • dampening - Enable/disable route-flap dampening. type: str choices: enable, disable
    • dampening_max_suppress_time - Maximum minutes a route can be suppressed. type: int
    • dampening_reachability_half_life - Reachability half-life time for penalty (minutes). type: int
    • dampening_reuse - Threshold to unsuppress routes. type: int
    • dampening_suppress - Threshold to suppress routes. type: int
    • default_local_preference - Default local preference. type: int
    • deterministic_med - Enable/disable enforce deterministic comparison of MED. type: str choices: enable, disable
    • distance_external - Distance for routes external to the AS. type: int
    • distance_internal - Distance for routes internal to the AS. type: int
    • distance_local - Distance for routes local to the AS. type: int
    • enforce_first_as - Enable/disable enforce first AS for EBGP routes. type: str choices: enable, disable
    • fast_external_failover - Enable/disable reset peer BGP session if link goes down. type: str choices: enable, disable
    • graceful_stalepath_time - Time to hold stale paths of restarting neighbour(sec). type: int
    • holdtime_timer - Number of seconds to mark peer as dead. type: int
    • keepalive_timer - Frequency to send keepalive requests. type: int
    • log_neighbour_changes - Enable logging of BGP neighbour"s changes type: str choices: enable, disable
    • maximum_paths_ebgp - Maximum paths for ebgp ecmp. type: int
    • maximum_paths_ibgp - Maximum paths for ibgp ecmp. type: int
    • neighbor - BGP neighbor table. type: list member_path: neighbor:ip
      • activate - Enable/disable address family IPv4 for this neighbor. type: str choices: enable, disable
      • activate6 - Enable/disable address family IPv6 for this neighbor. type: str choices: enable, disable
      • advertisement_interval - Minimum interval (seconds) between sending updates. type: int
      • allowas_in - IPv4 The maximum number of occurrence of my AS number allowed. type: int
      • allowas_in_enable - Enable/disable IPv4 Enable to allow my AS in AS path. type: str choices: enable, disable
      • allowas_in_enable6 - Enable/disable IPv6 Enable to allow my AS in AS path. type: str choices: enable, disable
      • allowas_in6 - IPv6 The maximum number of occurrence of my AS number allowed. type: int
      • as_override - Enable/disable replace peer AS with own AS for IPv4. type: str choices: enable, disable
      • as_override6 - Enable/disable replace peer AS with own AS for IPv6. type: str choices: enable, disable
      • attribute_unchanged - IPv4 List of attributes that should be unchanged. type: str choices: as-path, med, next-hop
      • attribute_unchanged6 - IPv6 List of attributes that should be unchanged. type: str choices: as-path, med, next-hop
      • bfd - Enable/disable BFD for this neighbor. type: str choices: enable, disable
      • bfd_session_mode - Single or multihop BFD session to this neighbor. type: str choices: automatic, multihop, singlehop
      • capability_default_originate - Enable/disable advertise default IPv4 route to this neighbor. type: str choices: enable, disable
      • capability_default_originate6 - Enable/disable advertise default IPv6 route to this neighbor. type: str choices: enable, disable
      • capability_dynamic - Enable/disable advertise dynamic capability to this neighbor. type: str choices: enable, disable
      • capability_orf - Accept/Send IPv4 ORF lists to/from this neighbor. type: str choices: none, receive, send, both
      • capability_orf6 - Accept/Send IPv6 ORF lists to/from this neighbor. type: str choices: none, receive, send, both
      • connect_timer - Interval (seconds) for connect timer. type: int
      • default_originate_routemap - Route map to specify criteria to originate IPv4 default. Source router.route-map.name. type: str
      • default_originate_routemap6 - Route map to specify criteria to originate IPv6 default. Source router.route-map.name. type: str
      • description - Description. type: str
      • distribute_list_in - Filter for IPv4 updates from this neighbor. Source router.access-list.name. type: str
      • distribute_list_in6 - Filter for IPv6 updates from this neighbor. Source router.access-list6.name. type: str
      • distribute_list_out - Filter for IPv4 updates to this neighbor. Source router.access-list.name. type: str
      • distribute_list_out6 - Filter for IPv6 updates to this neighbor. Source router.access-list6.name. type: str
      • dont_capability_negotiate - Don"t negotiate capabilities with this neighbor type: str choices: enable, disable
      • ebgp_enforce_multihop - Enable/disable allow multi-hop next-hops from EBGP neighbors. type: str choices: enable, disable
      • ebgp_multihop_ttl - EBGP multihop TTL for this peer. type: int
      • ebgp_ttl_security_hops - Specify the maximum number of hops to the EBGP peer. type: int
      • filter_list_in - BGP aspath filter for IPv4 inbound routes. Source router.aspath-list.name. type: str
      • filter_list_in6 - BGP filter for IPv6 inbound routes. Source router.aspath-list.name. type: str
      • filter_list_out - BGP aspath filter for IPv4 outbound routes. Source router.aspath-list.name. type: str
      • filter_list_out6 - BGP filter for IPv6 outbound routes. Source router.aspath-list.name. type: str
      • holdtime_timer - Interval (seconds) before peer considered dead. type: int
      • interface - Interface. Source system.interface.name. type: str
      • ip - IP/IPv6 address of neighbor. type: str required: true
      • keep_alive_timer - Keepalive timer interval (seconds). type: int
      • maximum_prefix - Maximum number of IPv4 prefixes to accept from this peer. type: int
      • maximum_prefix_threshold - Maximum IPv4 prefix threshold value (1-100 percent). type: int
      • maximum_prefix_threshold6 - Maximum IPv6 prefix threshold value (1-100 percent) type: int
      • maximum_prefix_warning_only - Enable/disable IPv4 Only give warning message when threshold is exceeded. type: str choices: enable, disable
      • maximum_prefix_warning_only6 - Enable/disable IPv6 Only give warning message when threshold is exceeded. type: str choices: enable, disable
      • maximum_prefix6 - Maximum number of IPv6 prefixes to accept from this peer. type: int
      • next_hop_self - Enable/disable IPv4 next-hop calculation for this neighbor. type: str choices: enable, disable
      • next_hop_self6 - Enable/disable IPv6 next-hop calculation for this neighbor. type: str choices: enable, disable
      • override_capability - Enable/disable override result of capability negotiation. type: str choices: enable, disable
      • passive - Enable/disable sending of open messages to this neighbor. type: str choices: enable, disable
      • password - Password used in MD5 authentication. type: str
      • prefix_list_in - IPv4 Inbound filter for updates from this neighbor. Source router.prefix-list.name. type: str
      • prefix_list_in6 - IPv6 Inbound filter for updates from this neighbor. Source router.prefix-list6.name. type: str
      • prefix_list_out - IPv4 Outbound filter for updates to this neighbor. Source router.prefix-list.name. type: str
      • prefix_list_out6 - IPv6 Outbound filter for updates to this neighbor. Source router.prefix-list6.name. type: str
      • remote_as - AS number of neighbor. type: int
      • remove_private_as - Enable/disable remove private AS number from IPv4 outbound updates. type: str choices: enable, disable
      • remove_private_as6 - Enable/disable remove private AS number from IPv6 outbound updates. type: str choices: enable, disable
      • route_map_in - IPv4 Inbound route map filter. Source router.route-map.name. type: str
      • route_map_in6 - IPv6 Inbound route map filter. Source router.route-map.name. type: str
      • route_map_out - IPv4 outbound route map filter. Source router.route-map.name. type: str
      • route_map_out6 - IPv6 Outbound route map filter. Source router.route-map.name. type: str
      • route_reflector_client - Enable/disable IPv4 AS route reflector client. type: str choices: enable, disable
      • route_reflector_client6 - Enable/disable IPv6 AS route reflector client. type: str choices: enable, disable
      • route_server_client - Enable/disable IPv4 AS route server client. type: str choices: enable, disable
      • route_server_client6 - Enable/disable IPv6 AS route server client. type: str choices: enable, disable
      • send_community - IPv4 Send community attribute to neighbor. type: str choices: standard, extended, both, disable
      • send_community6 - IPv6 Send community attribute to neighbor. type: str choices: standard, extended, both, disable
      • shutdown - Enable/disable shutdown this neighbor. type: str choices: enable, disable
      • soft_reconfiguration - Enable/disable allow IPv4 inbound soft reconfiguration. type: str choices: enable, disable
      • soft_reconfiguration6 - Enable/disable allow IPv6 inbound soft reconfiguration. type: str choices: enable, disable
      • strict_capability_match - Enable/disable strict capability matching. type: str choices: enable, disable
      • unsuppress_map - IPv4 Route map to selectively unsuppress suppressed routes. Source router.route-map.name. type: str
      • unsuppress_map6 - IPv6 Route map to selectively unsuppress suppressed routes. Source router.route-map.name. type: str
      • update_source - Interface to use as source IP/IPv6 address of TCP connections. Source system.interface.name. type: str
      • weight - Neighbor weight. type: int
    • network - BGP network table. type: list member_path: network:id
      • backdoor - Enable/disable route as backdoor. type: str choices: enable, disable
      • id - ID. type: int required: true
      • prefix - Network prefix. type: str
      • route_map - Route map to modify generated route. Source router.route-map.name. type: str
    • network6 - BGP IPv6 network table. type: list member_path: network6:id
      • id - ID. type: int required: true
      • prefix6 - Network IPv6 prefix. type: str
      • route_map - Route map to modify generated route. Source router.route-map.name. type: str
    • redistribute - BGP IPv4 redistribute table. type: list member_path: redistribute:name
      • name - Redistribute protocol name. type: str required: true
      • route_map - Route map name. Source router.route-map.name. type: str
      • status - Status type: str choices: enable, disable
    • redistribute6 - BGP IPv6 redistribute table. type: list member_path: redistribute6:name
      • name - Distribute list entry name. type: str required: true
      • route_map - Route map name. Source router.route-map.name. type: str
      • status - Status type: str choices: enable, disable
    • router_id - Router ID. type: str
    • scan_time - Background scanner interval (seconds). type: int

Examples

- hosts: fortiswitch01
  collections:
    - fortinet.fortiswitch
  connection: httpapi
  vars:
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  tasks:
  - name: BGP configuration.
    fortiswitch_router_bgp:
      router_bgp:
        admin_distance:
         -
            distance: "4"
            id:  "5"
            neighbour_prefix: "<your_own_value>"
            route_list: "<your_own_value> (source router.access-list.name)"
        aggregate_address:
         -
            as_set: "enable"
            id:  "10"
            prefix: "<your_own_value>"
            summary_only: "enable"
        aggregate_address6:
         -
            id:  "14"
            prefix6: "<your_own_value>"
            summary_only: "enable"
        always_compare_med: "enable"
        as: "18"
        bestpath_as_path_ignore: "enable"
        bestpath_aspath_multipath_relax: "disable"
        bestpath_cmp_confed_aspath: "enable"
        bestpath_cmp_routerid: "enable"
        bestpath_med_confed: "enable"
        bestpath_med_missing_as_worst: "enable"
        client_to_client_reflection: "enable"
        cluster_id: "<your_own_value>"
        confederation_identifier: "27"
        confederation_peers:
         -
            peer: "<your_own_value>"
        dampening: "enable"
        dampening_max_suppress_time: "31"
        dampening_reachability_half_life: "32"
        dampening_reuse: "33"
        dampening_suppress: "34"
        default_local_preference: "35"
        deterministic_med: "enable"
        distance_external: "37"
        distance_internal: "38"
        distance_local: "39"
        enforce_first_as: "enable"
        fast_external_failover: "enable"
        graceful_stalepath_time: "42"
        holdtime_timer: "43"
        keepalive_timer: "44"
        log_neighbour_changes: "enable"
        maximum_paths_ebgp: "46"
        maximum_paths_ibgp: "47"
        neighbor:
         -
            activate: "enable"
            activate6: "enable"
            advertisement_interval: "51"
            allowas_in: "52"
            allowas_in_enable: "enable"
            allowas_in_enable6: "enable"
            allowas_in6: "55"
            as_override: "enable"
            as_override6: "enable"
            attribute_unchanged: "as-path"
            attribute_unchanged6: "as-path"
            bfd: "enable"
            bfd_session_mode: "automatic"
            capability_default_originate: "enable"
            capability_default_originate6: "enable"
            capability_dynamic: "enable"
            capability_orf: "none"
            capability_orf6: "none"
            connect_timer: "67"
            default_originate_routemap: "<your_own_value> (source router.route-map.name)"
            default_originate_routemap6: "<your_own_value> (source router.route-map.name)"
            description: "<your_own_value>"
            distribute_list_in: "<your_own_value> (source router.access-list.name)"
            distribute_list_in6: "<your_own_value> (source router.access-list6.name)"
            distribute_list_out: "<your_own_value> (source router.access-list.name)"
            distribute_list_out6: "<your_own_value> (source router.access-list6.name)"
            dont_capability_negotiate: "enable"
            ebgp_enforce_multihop: "enable"
            ebgp_multihop_ttl: "77"
            ebgp_ttl_security_hops: "78"
            filter_list_in: "<your_own_value> (source router.aspath-list.name)"
            filter_list_in6: "<your_own_value> (source router.aspath-list.name)"
            filter_list_out: "<your_own_value> (source router.aspath-list.name)"
            filter_list_out6: "<your_own_value> (source router.aspath-list.name)"
            holdtime_timer: "83"
            interface: "<your_own_value> (source system.interface.name)"
            ip: "<your_own_value>"
            keep_alive_timer: "86"
            maximum_prefix: "87"
            maximum_prefix_threshold: "88"
            maximum_prefix_threshold6: "89"
            maximum_prefix_warning_only: "enable"
            maximum_prefix_warning_only6: "enable"
            maximum_prefix6: "92"
            next_hop_self: "enable"
            next_hop_self6: "enable"
            override_capability: "enable"
            passive: "enable"
            password: "<your_own_value>"
            prefix_list_in: "<your_own_value> (source router.prefix-list.name)"
            prefix_list_in6: "<your_own_value> (source router.prefix-list6.name)"
            prefix_list_out: "<your_own_value> (source router.prefix-list.name)"
            prefix_list_out6: "<your_own_value> (source router.prefix-list6.name)"
            remote_as: "102"
            remove_private_as: "enable"
            remove_private_as6: "enable"
            route_map_in: "<your_own_value> (source router.route-map.name)"
            route_map_in6: "<your_own_value> (source router.route-map.name)"
            route_map_out: "<your_own_value> (source router.route-map.name)"
            route_map_out6: "<your_own_value> (source router.route-map.name)"
            route_reflector_client: "enable"
            route_reflector_client6: "enable"
            route_server_client: "enable"
            route_server_client6: "enable"
            send_community: "standard"
            send_community6: "standard"
            shutdown: "enable"
            soft_reconfiguration: "enable"
            soft_reconfiguration6: "enable"
            strict_capability_match: "enable"
            unsuppress_map: "<your_own_value> (source router.route-map.name)"
            unsuppress_map6: "<your_own_value> (source router.route-map.name)"
            update_source: "<your_own_value> (source system.interface.name)"
            weight: "122"
        network:
         -
            backdoor: "enable"
            id:  "125"
            prefix: "<your_own_value>"
            route_map: "<your_own_value> (source router.route-map.name)"
        network6:
         -
            id:  "129"
            prefix6: "<your_own_value>"
            route_map: "<your_own_value> (source router.route-map.name)"
        redistribute:
         -
            name: "default_name_133"
            route_map: "<your_own_value> (source router.route-map.name)"
            status: "enable"
        redistribute6:
         -
            name: "default_name_137"
            route_map: "<your_own_value> (source router.route-map.name)"
            status: "enable"
        router_id: "<your_own_value>"
        scan_time: "141"

Return Values

Common return values are documented: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values, 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

Status

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

Authors

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

Hint

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