Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability for the ios_vrf module to apply route targets to a VRF #34248

Merged
merged 2 commits into from Jan 9, 2018

Conversation

clementtrebuchet
Copy link
Contributor

SUMMARY
  • Add the ability for the ios_vrf module to apply route targets to a VRF to control the import and export of routes between other VRFs.

  • The ios_vrf module can not configure route targets

Solution proposal

  • Creates a route-target extended community for a VRF.

    • The route_import keyword specifies to import routing information from the target VPN extended community.
    • The route_export keyword specifies to export routing information to the target VPN extended community.
    • The route_both keyword specifies to import both import and export routing information to the target VPN extended community.
    • The route-target-ext-community argument adds the route-target extended community attributes to the VRF’s list of import, export, or both (import and export)
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • ios_vrf
ANSIBLE VERSION
(venv) [clement@clemo ansible]$ ansible --version
ansible 2.5.0 (devel_ios_vrf_route 042ebacb8c) last updated 2017/12/27 00:28:51 (GMT +200)
  config file = /home/clement/Documents/PROJECTS/ansible_env_setup/ansible/ansible.cfg
  configured module search path = ['/home/clement/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/clement/Documents/PROJECTS/ansible_env_setup/ansible/lib/ansible
  executable location = /home/clement/Documents/PROJECTS/ansible_env_setup/ansible/bin/ansible
  python version = 3.6.3 (default, Oct  9 2017, 12:07:10) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]

ADDITIONAL INFORMATION
---
- hosts: all
  gather_facts: no
  connection: local
  vars_files:
     - group_vars/all
  tasks:
  - name: Set the test provider
    set_fact:
     provider:
      host: "{{ inventory_hostname}}"
      username: "{{ username }}"
      password: "{{ password }}"
      authorize: yes
      auth_pass: "{{ auth_pass }}"
      timeout: 30


  - name: Add Test_vrf
    ios_vrf:
      name: Test_vrf
      rd: 2:100
      route_both:
       - 2:100
       - 3:100
      provider: "{{ provider }}"


  - name: Add Test_vrf1
    ios_vrf:
      name: Test_vrf1
      rd: 1:100
      route_export:
        - 1:100
        - 3:100
      route_import:
        - 1:100
        - 3:100
      provider: "{{ provider }}"

  - name: Add interface Ethernet0/2
    ios_vrf:
      name: Test_vrf1
      interfaces:
        - Ethernet0/2
      provider: "{{ provider }}"
    (venv) [clement@clemo vrf_playbooks]$ ansible-playbook -i hosts export_import_both.yml 

    PLAY [all] *********************************************************************************************************************************************************************
    
    TASK [Set the test provider] ***************************************************************************************************************************************************
    ok: [30.1.0.31]
    
    TASK [Add Test_vrf] ************************************************************************************************************************************************************
    changed: [30.1.0.31]
    
    TASK [Add Test_vrf1] ***********************************************************************************************************************************************************
    changed: [30.1.0.31]
    
    TASK [Add interface Ethernet0/2] ***********************************************************************************************************************************************
    ok: [30.1.0.31]
    
    PLAY RECAP *********************************************************************************************************************************************************************
    30.1.0.31                  : ok=4    changed=2    unreachable=0    failed=0   
clementroutertest> sh ip vrf      
  Name                             Default RD            Interfaces
  Test_vrf                         2:100                 
  Test_vrf1                        1:100                 Et0/2
  management                       <not set>             Et0/3
  reseau_priv_001                  6500:1                Et0/1.1401
  reseau_priv_002                  6500:20               Et0/1.1402

clementroutertest> sh ip vrf detail 
VRF Test_vrf (VRF Id = 8); default RD 2:100; default VPNID <not set>
  New CLI format, supports multiple address-families
  Flags: 0x180C
  No interfaces
Address family ipv4 unicast (Table ID = 0x8):
  Flags: 0x0
  Export VPN route-target communities
    RT:2:100                 RT:3:100                
  Import VPN route-target communities
    RT:2:100                 RT:3:100                
  No import route-map
  No global export route-map
  No export route-map
  VRF label distribution protocol: not configured
  VRF label allocation mode: per-prefix

VRF Test_vrf1 (VRF Id = 7); default RD 1:100; default VPNID <not set>
  New CLI format, supports multiple address-families
  Flags: 0x180C
  Interfaces:
    Et0/2                   
Address family ipv4 unicast (Table ID = 0x7):
  Flags: 0x0
  Export VPN route-target communities
    RT:1:100                 RT:3:100                
  Import VPN route-target communities
    RT:1:100                 RT:3:100                
  No import route-map
  No global export route-map
  No export route-map
  VRF label distribution protocol: not configured
  VRF label allocation mode: per-prefix

@ansibot
Copy link
Contributor

ansibot commented Dec 26, 2017

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 core_review In order to be merged, this PR must follow the core review workflow. feature_pull_request module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests. labels Dec 26, 2017
@ansibot
Copy link
Contributor

ansibot commented Dec 26, 2017

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/network/ios/ios_vrf.py:100:1: W293 blank line contains whitespace
lib/ansible/modules/network/ios/ios_vrf.py:123:1: W293 blank line contains whitespace
lib/ansible/modules/network/ios/ios_vrf.py:131:1: W293 blank line contains whitespace
lib/ansible/modules/network/ios/ios_vrf.py:139:1: W293 blank line contains whitespace
lib/ansible/modules/network/ios/ios_vrf.py:147:1: W293 blank line contains whitespace
lib/ansible/modules/network/ios/ios_vrf.py:474:5: E303 too many blank lines (2)

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Dec 26, 2017
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Dec 27, 2017
@gundalow gundalow removed the needs_triage Needs a first human triage before being processed. label Jan 3, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jan 9, 2018
@ganeshrn
Copy link
Member

ganeshrn commented Jan 9, 2018

rebuild_merge

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jan 9, 2018
@ansibot ansibot merged commit d5a8974 into ansible:devel Jan 9, 2018
@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_pull_request labels Mar 5, 2018
@dagwieers dagwieers added ios Cisco IOS community cisco Cisco technologies labels Feb 27, 2019
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 cisco Cisco technologies core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. ios Cisco IOS community module This issue/PR relates to a module. networking Network category support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants