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
6 stars 7 forks source link

vPC peering aware run for dcnm_link | vpc peering link prepare | backlog | Good to have #88

Open rrahimm opened 6 months ago

rrahimm commented 6 months ago

We currently use dcnm_links module to prepare links for vpc_peering. and we use the policy "int_pre_provision_intra_fabric_link" for preparing the links.

once this is done and vpc_pairing module pairs the switches, the policy is changed from int_pre_provision_intra_fabric_link to none.

Before Example

[
{
    "link-uuid": "LINK-UUID-375050",
    "is-present": false,
    "link-type": "lan_planned_link",
    "is-discovered": false,
    "is-planned": true,
    "sw2-info": 
{},
"link-dbid": 531270,
"nvPairs": 
{},
"policyId": "POLICY-531280",
"templateName": "int_pre_provision_intra_fabric_link",
"is-port-channel": false,
"sw1-info": 
    {},
    "fabricName": "netascode_fabric4"
},

After Example

{
    "link-uuid": "LINK-UUID-105050",
    "is-present": true,
    "link-type": "ethisl",
    "is-discovered": false,
    "is-planned": false,
    "sw2-info": 
{},
"link-dbid": 510380,
"is-port-channel": false,
"sw1-info": 

    {},
    "port-channel-id": 510670
},

Due to this, everytime we eun the dcnm_links its no more behaving as idempotent and keeps trying to pull the template back to "int_pre_provision_intra_fabric_link" (it doesn't seem to succeed though).

Rerun of dcnm_links for a already provisioned vpc peer link

TASK [cisco.nac_dc_vxlan.create : Manage Intra Fabric Links for vpc peering] *****************************************************************************
changed: [netascode_fabric4] => {
    "changed": true,
    "diff": [
        {
            "debugs": [
                {
                    "Managable": {
                        "192.168.112.1": "9K5ACTZ6071",
                        "192.168.112.151": "9C1V52BBBX5",
                        "192.168.112.152": "9GFVGDY6DOA",
                        "192.168.112.2": "9U6ZZHH0M5G",
                        "192.168.112.3": "9GRR0AIPIRU",
                        "192.168.112.4": "9OI0P2LZKND",
                        "netascode4-leaf1": "9K5ACTZ6071",
                        "netascode4-leaf2": "9U6ZZHH0M5G",
                        "netascode4-leaf3": "9GRR0AIPIRU",
                        "netascode4-leaf4": "9OI0P2LZKND",
                        "netascode4-spine1": "9C1V52BBBX5",
                        "netascode4-spine2": "9GFVGDY6DOA"
                    }
                },
                {
                    "Monitoring": []
                }
            ],
            "deleted": [],
            "deploy": [
                {
                    "netascode_fabric4": [
                        "9K5ACTZ6071",
                        "9U6ZZHH0M5G",
                        "9GRR0AIPIRU",
                        "9OI0P2LZKND"
                    ]
                }
            ],
            "merged": [
                {
                    "destinationDevice": "9U6ZZHH0M5G",
                    "destinationFabric": "netascode_fabric4",
                    "destinationInterface": "Ethernet1/3",
                    "destinationSwitchName": "netascode4-leaf2",
                    "sourceDevice": "9K5ACTZ6071",
                    "sourceFabric": "netascode_fabric4",
                    "sourceInterface": "Ethernet1/3",
                    "sourceSwitchName": "netascode4-leaf1",
                    "templateName": "int_pre_provision_intra_fabric_link"
                },
                {
                    "destinationDevice": "9U6ZZHH0M5G",
                    "destinationFabric": "netascode_fabric4",
                    "destinationInterface": "Ethernet1/4",
                    "destinationSwitchName": "netascode4-leaf2",
                    "sourceDevice": "9K5ACTZ6071",
                    "sourceFabric": "netascode_fabric4",
                    "sourceInterface": "Ethernet1/4",
                    "sourceSwitchName": "netascode4-leaf1",
                    "templateName": "int_pre_provision_intra_fabric_link"
                },
                {
                    "destinationDevice": "9U6ZZHH0M5G",
                    "destinationFabric": "netascode_fabric4",
                    "destinationInterface": "Ethernet1/5",
                    "destinationSwitchName": "netascode4-leaf2",
                    "sourceDevice": "9K5ACTZ6071",
                    "sourceFabric": "netascode_fabric4",
                    "sourceInterface": "Ethernet1/5",
                    "sourceSwitchName": "netascode4-leaf1",
                    "templateName": "int_pre_provision_intra_fabric_link"
                },
                {
                    "destinationDevice": "9OI0P2LZKND",
                    "destinationFabric": "netascode_fabric4",
                    "destinationInterface": "Ethernet1/3",
                    "destinationSwitchName": "netascode4-leaf4",
                    "sourceDevice": "9GRR0AIPIRU",
                    "sourceFabric": "netascode_fabric4",
                    "sourceInterface": "Ethernet1/3",
                    "sourceSwitchName": "netascode4-leaf3",
                    "templateName": "int_pre_provision_intra_fabric_link"
                }
            ],
            "modified": [],
            "query": []
        }
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "dst_device": "192.168.112.2",
                    "dst_fabric": "netascode_fabric4",
                    "dst_interface": "Ethernet1/3",
                    "src_device": "192.168.112.1",
                    "src_interface": "Ethernet1/3",
                    "template": "int_pre_provision_intra_fabric_link"
                },
                {
                    "dst_device": "192.168.112.2",
                    "dst_fabric": "netascode_fabric4",
                    "dst_interface": "Ethernet1/4",
                    "src_device": "192.168.112.1",
                    "src_interface": "Ethernet1/4",
                    "template": "int_pre_provision_intra_fabric_link"
                },
                {
                    "dst_device": "192.168.112.2",
                    "dst_fabric": "netascode_fabric4",
                    "dst_interface": "Ethernet1/5",
                    "src_device": "192.168.112.1",
                    "src_interface": "Ethernet1/5",
                    "template": "int_pre_provision_intra_fabric_link"
                },
                {
                    "dst_device": "192.168.112.4",
                    "dst_fabric": "netascode_fabric4",
                    "dst_interface": "Ethernet1/3",
                    "src_device": "192.168.112.3",
                    "src_interface": "Ethernet1/3",
                    "template": "int_pre_provision_intra_fabric_link"
                }
            ],
            "deploy": true,
            "src_fabric": "netascode_fabric4",
            "state": "replaced"
        }
    },
    "response": [
        {
            "DATA": {
                "linkUUID": "LINK-UUID-8380",
                "status": "Success"
            },
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.195.225.172:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/links",
            "RETURN_CODE": 200
        },
        {
            "DATA": {
                "linkUUID": "LINK-UUID-8400",
                "status": "Success"
            },
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.195.225.172:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/links",
            "RETURN_CODE": 200
        },
        {
            "DATA": {
                "linkUUID": "LINK-UUID-105050",
                "status": "Success"
            },
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.195.225.172:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/links",
            "RETURN_CODE": 200
        },
        {
            "DATA": {
                "linkUUID": "LINK-UUID-9920",
                "status": "Success"
            },
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.195.225.172:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/links",
            "RETURN_CODE": 200
        },
        {
            "DATA": {
                "status": "Configuration deployment completed."
            },
            "MESSAGE": "OK",
            "METHOD": "POST",
            "REQUEST_PATH": "https://10.195.225.172:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/netascode_fabric4/config-deploy/9K5ACTZ6071,9U6ZZHH0M5G,9GRR0AIPIRU,9OI0P2LZKND",
            "RETURN_CODE": 200
        },
        {
            "DATA": [
                {
                    "briefCount": 0,
                    "deployMode": "config",
                    "diff": null,
                    "entityList": [],
                    "expectedConfig": [],
                    "fabricName": null,
                    "pendingConfig": [],
                    "runningConfig": [],
                    "status": "In-Sync",
                    "statusDesc": "In-Sync",
                    "switchId": "9GRR0AIPIRU",
                    "switchMgmtIP": "192.168.112.3",
                    "switchName": "netascode4-leaf3",
                    "switchRole": "leaf"
                },
                {
                    "briefCount": 0,
                    "deployMode": "config",
                    "diff": null,
                    "entityList": [],
                    "expectedConfig": [],
                    "fabricName": null,
                    "pendingConfig": [],
                    "runningConfig": [],
                    "status": "In-Sync",
                    "statusDesc": "In-Sync",
                    "switchId": "9K5ACTZ6071",
                    "switchMgmtIP": "192.168.112.1",
                    "switchName": "netascode4-leaf1",
                    "switchRole": "leaf"
                },
                {
                    "briefCount": 0,
                    "deployMode": "config",
                    "diff": null,
                    "entityList": [],
                    "expectedConfig": [],
                    "fabricName": null,
                    "pendingConfig": [],
                    "runningConfig": [],
                    "status": "In-Sync",
                    "statusDesc": "In-Sync",
                    "switchId": "9U6ZZHH0M5G",
                    "switchMgmtIP": "192.168.112.2",
                    "switchName": "netascode4-leaf2",
                    "switchRole": "leaf"
                },
                {
                    "briefCount": 0,
                    "deployMode": "config",
                    "diff": null,
                    "entityList": [],
                    "expectedConfig": [],
                    "fabricName": null,
                    "pendingConfig": [],
                    "runningConfig": [],
                    "status": "In-Sync",
                    "statusDesc": "In-Sync",
                    "switchId": "9OI0P2LZKND",
                    "switchMgmtIP": "192.168.112.4",
                    "switchName": "netascode4-leaf4",
                    "switchRole": "leaf"
                }
            ],
            "MESSAGE": "OK",
            "METHOD": "GET",
            "REQUEST_PATH": "https://10.195.225.172:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/netascode_fabric4/config-preview/9K5ACTZ6071,9U6ZZHH0M5G,9GRR0AIPIRU,9OI0P2LZKND?forceShowRun=false&showBrief=true",
            "RETURN_CODE": 200
        }
    ]
}

The action is to add intelligence to the prepare link task to skip dcnm_link preparation when the vpc is already paired.