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

cml_lab_facts: "Can’t get L3 address of an external_connector" #34

Open
sky-joker opened this issue Jun 12, 2024 · 2 comments
Open

cml_lab_facts: "Can’t get L3 address of an external_connector" #34

sky-joker opened this issue Jun 12, 2024 · 2 comments

Comments

@sky-joker
Copy link

sky-joker commented Jun 12, 2024

SUMMARY

I tried to gather lab information from my CML2 environment, but the following error occurred, preventing me from doing so.

(snip)
  File \"/xxx/venv/lib/python3.9/site-packages/httpx/_models.py\", line 759, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://100.64.17.16/api/v0/labs/085f1bc7-a471-4326-b0cf-3e90de055f4f/nodes/a96abfcf-061c-484e-b308-1f61d830488d/layer3_addresses'
Can't get L3 addresses of an external_connector.
", "module_stdout": "", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}

I created the lab structure shown below.

[ext-conn-0] -- G0/0[iosvl2-0]

The configuration for ext-conn-0 is the system bridge.

COMPONENT NAME
  • cisco.cml.cml_lab_facts
ANSIBLE AND LIBRARIES VERSION
% pip list | grep -e virl -e ansible
ansible-core      2.14.14
virl2_client      2.7.0
COLLECTION VERSION

latest

OS/ENVIRONMENT

CML2.7

CONFIGURATION
% ansible-config dump --only-changed
CONFIG_FILE() = None
STEPS TO REPRODUCE

I created the playbook and run it.

---
- name: Example
  hosts: localhost
  gather_facts: false
  vars:
    cml_host: 100.64.17.16
    cml_username: admin
    cml_password: secret
    cml_lab: Example
    ansible_python_interpreter: /<PATH>/venv/bin/python
  tasks:
    - name: Example
      cisco.cml.cml_lab_facts:
        host: "{{ cml_host }}"
        user: "{{ cml_username }}"
        password: "{{ cml_password }}"
        validate_certs: false
        lab: "{{ cml_lab }}"
      register: results

    - debug: msg="{{ results }}"
EXPECTED RESULTS

I expected to gather the lab information.

ACTUAL RESULTS

The following error occurred:

httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://100.64.17.16/api/v0/labs/085f1bc7-a471-4326-b0cf-3e90de055f4f/nodes/a96abfcf-061c-484e-b308-1f61d830488d/layer3_addresses'
Can't get L3 addresses of an external_connector.

When ext-conn-0 does not exist, the module works correctly.

@shawnjury
Copy link

This also happens with cisco.cml.inventory (cml_inventory.py file).

I made these changes in the following locations:

inventory/cml_inventory.py: Line 206
modules/cml_lab_facts.py: Line 105

        for interface in node.interfaces():
            no_ips_list = ["external_connector","unmanaged_switch"]
            if node.state == 'BOOTED' and node.node_definition not in no_ips_list:

I'm sure you'll want to clean up the var name, but this allows my external_connector and unmanaged_switch to be found and added to the inventory without the script trying to discover IPs.

@zendritic
Copy link

I can't use the wait param on the clean playbook until this is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants