netascode / ansible-dc-vxlan

Ansible Collection for configuring a VXLAN Fabric using Direct to Controller (DTC) or Direct To Device (DTD) workflows.
https://galaxy.ansible.com/ui/repo/published/cisco/nac_dc_vxlan/
MIT License
7 stars 9 forks source link

Role: cisco.nac_dc_vxlan.dtc.create - vPC Peering #4

Closed mikewiebe closed 7 months ago

mikewiebe commented 9 months ago

Role Entry Point: https://github.com/netascode/ansible-dc-vxlan/blob/main/roles/dtc/create/tasks/ndfc/main.yml#L23

Role should make use of the following NDFC Ansible Collection dcnm_vpc_pair

This work item should enable creation of a vPC peer between two leaf devices:

Scope of Work:

GUI Example for creating vPC pair (https://ndfc-lab.ciscolive.com/lab/pod1/ndfc-fabric1/vpc)

Relavant Schema:

Sample Service Model Data:

fabric:
  global:
    vpc:
      peer_link_vlan: 3600
      peer_keep_alive: management
      auto_recovery_time: 240
      delay_restore_time: 150
      peer_link_port_channel_id: 500
      advertise_pip: False
      advertise_pip_border_only: True
      domain_id_range: 1-100
fabric:
  topology:
    vpc_peers:
      - peer1: netascode-leaf1
        peer1_peerlink_interfaces:
          - name: eth1/3
          - name: eth1/4
        peer2: netascode-leaf2
        peer2_peerlink_interfaces:
          - name: eth1/3
          - name: eth1/4
        fabric_peering: false
        domain_id: 10
        vtep_vip: "10.10.88.1"
        vpc_interfaces:
          - vpc_id: 10

Sample task to query vPC peer status data

- debug: msg="{{ item.peer1 }}, {{ item.peer2 }}"
  loop: "{{ MD.fabric.topology.vpc_peers }}"

- name: Query Fabric {{ MD.fabric.name }} Peers for VPC Configuration
  cisco.dcnm.dcnm_inventory:
    fabric: "{{ MD.fabric.name }}"
    state: query
    config:
      - seed_ip: "{{ MD.fabric.topology.leaf[item.peer1].management_ipv4_address }}"
      - seed_ip: "{{ MD.fabric.topology.leaf[item.peer2].management_ipv4_address }}"
  register: vpc_data
  loop: "{{ MD.fabric.topology.vpc_peers }}"

- name: Check vPC Pair Status
  cisco.nac_dc_vxlan.dtc.vpc_pair_check:
    vpc_data: "{{ vpc_data }}"
rrahimm commented 8 months ago

@mikewiebe , @mtarking

i renamed this to vPC Peering

Looks like we may need an Interface vPC issue like below in addition to this vPC peering issue.

https://github.com/netascode/ansible-dc-vxlan/issues/12

CC: @juburnet , @devegupt

rrahimm commented 8 months ago

@mikewiebe

let me know once vpc peering module is ready.

is this the one >> https://github.com/CiscoDevNet/ansible-dcnm/issues/79

mikewiebe commented 8 months ago

I have patched in the changes for the dcnm_vpc_pair module.

Here is how you pick up the change

Issue the ansible-galaxy collection list command and make sure the version installed is cisco.dcnm 3.4.3-dev-fv

mikewiebe commented 8 months ago

Here is a sample playbook for calling the module

- name: Create VPC switch pair using replaced state
  cisco.dcnm.dcnm_vpc_pair:
    src_fabric: "{{ MD.fabric.name }}"
    deploy: true                                                # Flag indicating whether changes are to be deployed, Mandatory: False, Type: bool, default: True
    state: replaced                                             # only choose form [merged, replaced, deleted, overridden, query. fetch]
    config:
      - peerOneId: "10.122.84.55"                               # IP Address/Host Name of Peer1 of VPC switch pair, Mandatory: True, Type: str
        peerTwoId: "10.122.84.56"                               # IP Address/Host Name of Peer2 of VPC switch pair, Mandatory: True, Type: str
        templateName: "vpc_pair"                                # Template to be applied to this VPC switch pair
        profile:
          ADMIN_STATE: True                                     # Uncheck to disable the vPC Peerlink port-channel, Mandatory: True, Type: bool, Default: true"
          ALLOWED_VLANS: "all"                                  # Allowed values: 'none', 'all', or vlan ranges (ex: 1-200,500-2000,3000), Mandatory: True, Type: str, Default: all"
          DOMAIN_ID: "1"  # vPC Domain ID, Mandatory: True, Min: 1, Max: 1000, Type: int, Default: ''"
          FABRIC_NAME: "{ MD.fabric.name }}"                # Fabric Name, Mandatory: True, Type: str, Default: ''"
          KEEP_ALIVE_HOLD_TIMEOUT: 3                            # Hold timeout to ignore stale peer alive messages, default is 3 if not specified, Mandatory: False, Min: 3, Max: 10, Type: int, Default: 3"
          KEEP_ALIVE_VRF: management                            # Name of VRF used for keep-alive, enter 'default' for default VRF, Mandatory: True, Type: str, Default: ''"
          PC_MODE: active                                       # Channel mode options: on, active and passive, Mandatory: False, ValidValues: ['on', 'active', 'passive'], Type: str, Default: active"
          PEER1_DOMAIN_CONF: "fast-convergence"                 # Additional CLI for Peer-1 vPC Domain, Mandatory: False, Type: str, Default: ''"
          PEER1_KEEP_ALIVE_LOCAL_IP: "10.122.84.55"   # IP address of a L3 interface in non-default VRF on Peer 1, Mandatory: True, Type: str, Default: ''"
          PEER1_MEMBER_INTERFACES: e1/20                        # A list of member interfaces for Peer-1 [e.g. e1/5,eth1/7-9], Mandatory: False, Type: list, Default: []"
          PEER1_PCID: 101                                       # Peer-1 Peerlink port-channel number (Min:1, Max:4096), Mandatory: False, Min: 1, Max: 4096, Type: int, Default: ''"
          PEER1_PO_CONF: "bandwidth inherit"                    # Additional CLI for Peer-1 vPC Peerlink port-channel, Mandatory: False, Type: str, Default: ''"
          PEER1_PO_DESC: "This is peer1 PC"                     # Add description to the port-channel (Max Size 254), Mandatory: False, MinLen: 1, MaxLen: 254, Type: str, Default: ''"
          PEER2_DOMAIN_CONF: "fast-convergence"                 # Additional CLI for Peer-2 vPC Domain, Mandatory: False, Type: str, Default: ''"
          PEER2_KEEP_ALIVE_LOCAL_IP: "10.122.84.56"   # IP address of a L3 interface in non-default VRF on Peer 2, Mandatory: True, Type: str, Default: ''"
          PEER2_MEMBER_INTERFACES: e1/20                        # A list of member interfaces for Peer-2 [e.g. e1/5,eth1/7-9], Mandatory: False, Type: list, Default: []"
          PEER2_PCID: 102                                       # Peer-2 Peerlink port-channel number (Min:1, Max:4096), Mandatory: False, Min: 1, Max: 4096, Type: int, Default: ''"
          PEER2_PO_CONF: "bandwidth inherit"                    # Additional CLI for Peer-1 vPC Peerlink port-channel, Mandatory: False, Type: str, Default: ''"
          PEER2_PO_DESC: "This is peer2 PC"                     # Add description to the port-channel (Max Size 254), Mandatory: False, MinLen: 1, MaxLen: 254, Type: str, Default: ''"
          clear_policy: False                                   # NA, Mandatory: True, Type: str, Default: false"
          isVTEPS: False                                        # Check this to configure NVE source loopback interface, Mandatory: isVpcPlus!=true, Type: bool, Default: false"
          isVpcPlus: False                                      # Check this if it's a vPC topology, Mandatory: True, Type: bool, Default: false"
  register: result

Note: According to the author of the module, you don't need the profile section or parameters under the profile section for vxlan, so try calling the module without that.

mtarking commented 7 months ago

@rrahimm this issue's branch vpc_peering should be ready for a PR. If so, feel free to go ahead and open.