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

Calls to brocade_interface_fibrechannel returns inconsistent data structures for 'neighbors' #136

Open
samuellay opened this issue Jul 5, 2023 · 4 comments

Comments

@samuellay
Copy link

The brocade.fos.brocade_interface_fibrechannel module returns flogis in 3 different forms. This requires a lot of extra coding to audit the switches since there are 3 special cases to deal with.

When there are multiple flogis, you get a result that is straight-forward to access in the general case:

- name: 3/3
  neighbor:
    wwn: ['20:23:00:14:38:c8:94:fc', '10:00:2e:db:64:d0:00:14', '10:00:2e:db:64:d0:00:00']

If a port has no flogis, you get something like this:

- name: 3/5
  neighbor: null

When it has one flogi you'll get:

- name: 3/10
  neighbor: {wwn: '50:00:e1:11:6c:8d:30:16'}

It would be a lot easier to extract the data if the data structure was consistent:

- name: 3/3
  neighbor:
    wwn: ['20:23:00:14:38:c8:94:fc', '10:00:2e:db:64:d0:00:14', '10:00:2e:db:64:d0:00:00']
- name: 3/5
  neighbor: 
    wwn: []
- name: 3/10
  neighbor: 
    wwn: ['50:00:e1:11:6c:8d:30:16',]

Please consider adjusting the data structures for the no-flogi and single-flogi cases to match the multi-flogi (NPIV) case.

@samuellay
Copy link
Author

Here is my test case:

---
- name: Collect Interface Info from Brocade Switch
  vars:
    user_name: ansibleuser
    ansible_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        36623134393235616264663036366137396263616533653935356138393261653533373363633235
        6635323930633564323334663335393335386332623266350a343038353462366537623538393334
        62363266346238663131393463616265653730363037393631353166336331383230316630303062
        3439313934636662660a303737656465633761393964616236653430633131616661386539666462
        6331
  hosts: all
  gather_facts: False
  connection: local
  collections:
    -brocade.fos

  tasks:

    - name: set up credentials for login
      ansible.builtin.set_fact:
        credential:
          fos_ip_addr: "{{ inventory_hostname }}"
          fos_user_name: "{{ user_name }}"
          fos_password: "{{ ansible_password }}"
          https: self
      no_log: true
    
    - name: Gather the switch information for Brocade SAN Switch
      brocade.fos.brocade_facts:
        credential: "{{credential}}"
        vfid: -1
        gather_subset:
          - brocade_interface_fibrechannel
      register: switch_facts
      no_log : true
      
    - name: Show me the neighbors
      debug:
        msg: "{{ item.neighbor }}"
      with_items: "{{ switch_facts['ansible_facts']['brocade_interface_fibrechannel'] }}"

@prasad-valmeti-broadcom
Copy link
Collaborator

This issue is addressed in FOS switch release 9.2.1 as shown below:
[NO ENTRIES]
"neighbor": {},

[ONE ENTRY]
"neighbor": {
"wwn": [
"20:10:c4:f5:7c:02:8b:08"
]
},

[TWO ENTRIES]
"neighbor": {
"wwn": [
"20:14:c4:f5:7c:d3:be:ae",
"10:00:00:10:9b:57:00:72"
]
},
Please let us know, what is the switch release at your end.

@prasad-valmeti-broadcom
Copy link
Collaborator

If there are no further issues, please suggest if we can close this issue.

1 similar comment
@prasad-valmeti-broadcom
Copy link
Collaborator

If there are no further issues, please suggest if we can close this issue.

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

2 participants