�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z m Z d d
l m Z d � Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: pn_vrouter_bgp
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.9"
short_description: CLI command to add/modify/remove vrouter-bgp
description:
- This module can be used to add Border Gateway Protocol neighbor to a vRouter
modify Border Gateway Protocol neighbor to a vRouter and remove Border Gateway Protocol
neighbor from a vRouter.
options:
pn_cliswitch:
description:
- Target switch to run the CLI on.
required: false
type: str
state:
description:
- vrouter-bgp configuration command.
required: false
type: str
choices: ['present', 'absent', 'update']
default: 'present'
pn_neighbor:
description:
- IP address for BGP neighbor.
required: true
type: str
pn_vrouter_name:
description:
- name of service config.
required: true
type: str
pn_send_community:
description:
- send any community attribute to neighbor.
required: false
type: bool
pn_weight:
description:
- default weight value between 0 and 65535 for the neighbor's routes.
required: false
pn_multi_protocol:
description:
- Multi-protocol features.
required: false
choices: ['ipv4-unicast', 'ipv6-unicast']
pn_prefix_list_in:
description:
- prefixes used for filtering.
required: false
type: str
pn_route_reflector_client:
description:
- set as route reflector client.
required: false
type: bool
pn_default_originate:
description:
- announce default routes to the neighbor or not.
required: false
type: bool
pn_neighbor_holdtime:
description:
- BGP Holdtime (seconds).
required: false
type: str
pn_connect_retry_interval:
description:
- BGP Connect retry interval (seconds).
required: false
type: str
pn_advertisement_interval:
description:
- Minimum interval between sending BGP routing updates.
required: false
type: str
pn_route_map_out:
description:
- route map out for nbr.
required: false
type: str
pn_update_source:
description:
- IP address of BGP packets required for peering over loopback interface.
required: false
type: str
pn_bfd:
description:
- BFD protocol support for fault detection.
required: false
type: bool
default: False
pn_next_hop_self:
description:
- BGP next hop is self or not.
required: false
type: bool
pn_allowas_in:
description:
- Allow/reject routes with local AS in AS_PATH.
required: false
type: bool
pn_neighbor_keepalive_interval:
description:
- BGP Keepalive interval (seconds).
required: false
type: str
pn_max_prefix:
description:
- maximum number of prefixes.
required: false
type: str
pn_bfd_multihop:
description:
- always use BFD multi-hop port for fault detection.
required: false
type: bool
pn_interface:
description:
- Interface to reach the neighbor.
required: false
type: str
pn_password:
description:
- password for MD5 BGP.
required: false
type: str
pn_route_map_in:
description:
- route map in for nbr.
required: false
type: str
pn_soft_reconfig_inbound:
description:
- soft reset to reconfigure inbound traffic.
required: false
type: bool
pn_override_capability:
description:
- override capability.
required: false
type: bool
pn_max_prefix_warn_only:
description:
- warn if the maximum number of prefixes is exceeded.
required: false
type: bool
pn_ebgp_multihop:
description:
- value for external BGP from 1 to 255.
required: false
type: str
pn_remote_as:
description:
- BGP remote AS from 1 to 4294967295.
required: false
type: str
pn_prefix_list_out:
description:
- prefixes used for filtering outgoing packets.
required: false
type: str
pn_no_route_map_out:
description:
- Remove egress route-map from BGP neighbor.
required: false
type: str
pn_no_route_map_in:
description:
- Remove ingress route-map from BGP neighbor.
required: false
type: str
s
- name: "Add BGP to vRouter"
pn_vrouter_bgp:
state: 'present'
pn_vrouter_name: 'sw01-vrouter'
pn_neighbor: '105.104.104.1'
pn_remote_as: 65000
pn_bfd: true
- name: "Remove BGP to vRouter"
pn_vrouter_bgp:
state: 'absent'
pn_vrouter_name: 'sw01-vrouter'
pn_neighbor: '105.104.104.1'
- name: "Modify BGP to vRouter"
pn_vrouter_bgp:
state: 'update'
pn_vrouter_name: 'sw01-vrouter'
pn_neighbor: '105.104.104.1'
pn_remote_as: 65000
pn_bfd: false
pn_allowas_in: true
s�
command:
description: the CLI command run on the target node.
returned: always
type: str
stdout:
description: set of responses from the vrouter-bgp command.
returned: always
type: list
stderr:
description: set of error responses from the vrouter-bgp command.
returned: on error
type: list
changed:
description: indicates whether the CLI caused changes on the target.
returned: always
type: bool
( t
AnsibleModule( t pn_clit run_clit booleanArgs( t run_commandsc C` sN t | � | k s$ t | � | k rJ | j d t d d | | | f � n d S( Nt failedt msgs Valid %s range is %s to %s( t intt fail_jsont True( t modulet
param_namet param_valt min_valt max_val( ( sS /usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_bgp.pyt is_valid� s $ c C` s� | j d } | j d } | d } t | | � d } | rL | j � } n | | k r^ t n t } | r� | d | } | d 7} t | | � d } | r� | | j � k r� t } q� t } n | | f S( s�
This method checks if vRouter exists on the target node.
This method also checks for idempotency using the vrouter-bgp-show command.
If the given vRouter exists, return VROUTER_EXISTS as True else False.
If the given neighbor exists on the given vRouter, return NEIGHBOR_EXISTS as True else False.
:param module: The Ansible module to fetch input parameters
:param cli: The CLI string
:return Booleans: VROUTER_EXISTS, NEIGHBOR_EXISTS
t pn_vrouter_namet pn_neighbors) vrouter-show format name no-show-headersi s"