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.14

FortiSW Version Compatibility


Supported Version Ranges
fortiswitch_router_bgp v7.0.0 -> latest

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
      • distance - Administrative distance to apply (1 - 255). type: int
      • id - ID. type: int
      • neighbour_prefix - Neighbor address prefix. type: str
      • route_list - Access list of routes to apply new distance to. type: str
    • admin_distance6 - Administrative distance modifications. type: list
      • distance - Administrative distance to apply (1 - 255). type: int
      • id - ID. type: int
      • neighbour_prefix6 - Neighbor IPV6 prefix. type: str
      • route6_list - Access list of routes to apply new distance to. type: str
    • aggregate_address - BGP aggregate address table. type: list
      • as_set - Enable/disable generate AS set path information. type: str choices: enable, disable
      • id - ID. type: int
      • 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
      • id - ID. type: int
      • 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
      • peer - Peer ID. type: str
    • 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
    • ebgp_requires_policy - Enable/disable require in and out policy for eBGP peers (RFC8212). type: str choices: enable, disable
    • 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
      • 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
      • activate_evpn - Enable/disable address family evpn 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_in6 - IPv6 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_in_enable_evpn - Enable/disable EVPN Enable to allow my AS in AS path. type: str choices: enable, disable
      • 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
      • attribute_unchanged_evpn - EVPN List of attributes that should be unchanged. type: str choices: as-path, med
      • 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. type: str
      • default_originate_routemap6 - Route map to specify criteria to originate IPv6 default. type: str
      • description - Description. type: str
      • distribute_list_in - Filter for IPv4 updates from this neighbor. type: str
      • distribute_list_in6 - Filter for IPv6 updates from this neighbor. type: str
      • distribute_list_out - Filter for IPv4 updates to this neighbor. type: str
      • distribute_list_out6 - Filter for IPv6 updates to this neighbor. 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
      • enforce_first_as - Enable/disable - Enable to enforce first AS for all(IPV4/IPV6) EBGP routes. type: str choices: enable, disable
      • filter_list_in - BGP aspath filter for IPv4 inbound routes. type: str
      • filter_list_in6 - BGP filter for IPv6 inbound routes. type: str
      • filter_list_out - BGP aspath filter for IPv4 outbound routes. type: str
      • filter_list_out6 - BGP filter for IPv6 outbound routes. type: str
      • holdtime_timer - Interval (seconds) before peer considered dead. type: int
      • interface - Interface. type: str
      • ip - IP/IPv6 address of neighbor. type: str
      • keep_alive_timer - Keepalive timer interval (seconds). type: int
      • maximum_prefix - Maximum number of IPv4 prefixes to accept from this peer. type: int
      • maximum_prefix6 - Maximum number of IPv6 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
      • 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. type: str
      • prefix_list_in6 - IPv6 Inbound filter for updates from this neighbor. type: str
      • prefix_list_out - IPv4 Outbound filter for updates to this neighbor. type: str
      • prefix_list_out6 - IPv6 Outbound filter for updates to this neighbor. 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. type: str
      • route_map_in6 - IPv6 Inbound route map filter. type: str
      • route_map_in_evpn - EVPN Inbound route map filter. type: str
      • route_map_out - IPv4 outbound route map filter. type: str
      • route_map_out6 - IPv6 Outbound route map filter. type: str
      • route_map_out_evpn - EVPN outbound route map filter. 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_reflector_client_evpn - Enable/disable EVPN 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
      • soft_reconfiguration_evpn - Enable/disable allow EVPN 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. type: str
      • unsuppress_map6 - IPv6 Route map to selectively unsuppress suppressed routes. type: str
      • update_source - Interface to use as source IP/IPv6 address of TCP connections. type: str
      • weight - Neighbor weight. type: int
    • network - BGP network table. type: list
      • backdoor - Enable/disable route as backdoor. type: str choices: enable, disable
      • id - ID. type: int
      • prefix - Network prefix. type: str
      • route_map - Route map to modify generated route. type: str
    • network6 - BGP IPv6 network table. type: list
      • id - ID. type: int
      • prefix6 - Network IPv6 prefix. type: str
      • route_map - Route map to modify generated route. type: str
    • redistribute - BGP IPv4 redistribute table. type: list
      • name - Redistribute protocol name. type: str
      • route_map - Route map name. type: str
      • status - Status type: str choices: enable, disable
    • redistribute6 - BGP IPv6 redistribute table. type: list
      • name - Distribute list entry name. type: str
      • route_map - Route map name. type: str
      • status - Status type: str choices: enable, disable
    • route_reflector_allow_outbound_policy - Enable/disable route reflector to apply a route-map to reflected routes. type: str choices: enable, disable
    • router_id - Router ID. type: str
    • scan_time - Background scanner interval (seconds). type: int

Examples

- name: BGP configuration.
  fortinet.fortiswitch.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)"
          admin_distance6:
              -
                  distance: "9"
                  id: "10"
                  neighbour_prefix6: "<your_own_value>"
                  route6_list: "<your_own_value> (source router.access-list6.name)"
          aggregate_address:
              -
                  as_set: "enable"
                  id: "15"
                  prefix: "<your_own_value>"
                  summary_only: "enable"
          aggregate_address6:
              -
                  id: "19"
                  prefix6: "<your_own_value>"
                  summary_only: "enable"
          always_compare_med: "enable"
          as: "23"
          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: "32"
          confederation_peers:
              -
                  peer: "<your_own_value>"
          dampening: "enable"
          dampening_max_suppress_time: "36"
          dampening_reachability_half_life: "37"
          dampening_reuse: "38"
          dampening_suppress: "39"
          default_local_preference: "40"
          deterministic_med: "enable"
          distance_external: "42"
          distance_internal: "43"
          distance_local: "44"
          ebgp_requires_policy: "enable"
          enforce_first_as: "enable"
          fast_external_failover: "enable"
          graceful_stalepath_time: "48"
          holdtime_timer: "49"
          keepalive_timer: "50"
          log_neighbour_changes: "enable"
          maximum_paths_ebgp: "52"
          maximum_paths_ibgp: "53"
          neighbor:
              -
                  activate: "enable"
                  activate6: "enable"
                  activate_evpn: "enable"
                  advertisement_interval: "58"
                  allowas_in: "59"
                  allowas_in6: "60"
                  allowas_in_enable: "enable"
                  allowas_in_enable6: "enable"
                  allowas_in_enable_evpn: "enable"
                  as_override: "enable"
                  as_override6: "enable"
                  attribute_unchanged: "as-path"
                  attribute_unchanged6: "as-path"
                  attribute_unchanged_evpn: "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: "76"
                  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: "86"
                  ebgp_ttl_security_hops: "87"
                  enforce_first_as: "enable"
                  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: "93"
                  interface: "<your_own_value> (source system.interface.name)"
                  ip: "<your_own_value>"
                  keep_alive_timer: "96"
                  maximum_prefix: "97"
                  maximum_prefix6: "98"
                  maximum_prefix_threshold: "99"
                  maximum_prefix_threshold6: "100"
                  maximum_prefix_warning_only: "enable"
                  maximum_prefix_warning_only6: "enable"
                  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: "112"
                  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_in_evpn: "<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_map_out_evpn: "<your_own_value> (source router.route-map.name)"
                  route_reflector_client: "enable"
                  route_reflector_client6: "enable"
                  route_reflector_client_evpn: "enable"
                  route_server_client: "enable"
                  route_server_client6: "enable"
                  send_community: "standard"
                  send_community6: "standard"
                  shutdown: "enable"
                  soft_reconfiguration: "enable"
                  soft_reconfiguration6: "enable"
                  soft_reconfiguration_evpn: "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: "136"
          network:
              -
                  backdoor: "enable"
                  id: "139"
                  prefix: "<your_own_value>"
                  route_map: "<your_own_value> (source router.route-map.name)"
          network6:
              -
                  id: "143"
                  prefix6: "<your_own_value>"
                  route_map: "<your_own_value> (source router.route-map.name)"
          redistribute:
              -
                  name: "default_name_147"
                  route_map: "<your_own_value> (source router.route-map.name)"
                  status: "enable"
          redistribute6:
              -
                  name: "default_name_151"
                  route_map: "<your_own_value> (source router.route-map.name)"
                  status: "enable"
          route_reflector_allow_outbound_policy: "enable"
          router_id: "<your_own_value>"
          scan_time: "156"

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.