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

Updated ios/ios_facts.py to include lldp and cdp neighbors and vss st… #57334

Open
wants to merge 3 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@sipenat1
Copy link

commented Jun 4, 2019

SUMMARY

Added a VSS State Boolean value.
Added CDP and LLDP Dict objects under interfaces with additional information.
Changed from a single return list "ansible_net_neighbors" to separate CDP "ansible_net_all_cdp_neighbors" and LLDP "ansible_net_all_lldp_neighbors" lists.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

ios\ios_facts.py

ADDITIONAL INFORMATION

Added a VSS State Boolean value.

  • When the selected switch is part of a VSS stack "ansible_net_vss": true
    Added CDP and LLDP Dict objects under interfaces with additional information.
  • CDP and LLDP often provide different information when dealing with different peer types.
  • The CDP dict returns:
    • host:
    • remote_ip:
    • remote_platform:
    • remote_port:
  • The LLDP dict returns:
    • host:
    • remote_ip:
    • remote_port:
      Changed from a single return list "ansible_net_neighbors" to separate CDP "ansible_net_all_cdp_neighbors"
      and LLDP "ansible_net_all_lldp_neighbors" lists to enable the end user to access both fact sets and variables.
Example of VSS State:
   "ansible_net_vss": true

Example of interface output:

"TenGigabitEthernet1/1/25": {
    "bandwidth": 10000000,
    "cdp": {
        "host": "host.domain.net",
        "remote_ip": null,
        "remote_platform": "VMware ESX,  Capabilities: Switch ",
        "remote_port": "vmnic4"
    },
    "description": "HOSTNAME vmnic4",
    "duplex": null,
    "ipv4": [],
    "lineprotocol": null,
    "lldp": {
        "host": null,
        "remote_ip": "10.0.0.0",
        "remote_port": "Embedded ALOM, Port 1"
    },
    "macaddress": "removed",
    "mediatype": "10GBase-SR",
    "mtu": 1500,
    "operstatus": "up",
    "type": "Ten Gigabit Ethernet Port"
}
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

The test ansible-test sanity --test pep8 [explain] failed with 177 errors:

lib/ansible/modules/network/ios/ios_facts.py:177:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:179:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:184:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:187:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:193:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:197:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:202:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:203:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:204:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:209:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:211:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:214:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:216:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:218:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:221:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:223:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:226:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:230:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:232:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:235:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:237:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:239:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:248:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:249:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:260:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:265:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:269:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:270:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:274:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:276:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:281:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:282:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:284:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:287:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:291:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:292:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:296:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:297:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:305:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:307:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:311:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:314:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:319:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:327:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:337:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:338:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:342:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:343:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:347:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:348:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:355:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:356:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:363:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:364:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:366:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:369:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:370:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:371:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:372:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:373:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:374:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:375:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:376:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:377:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:378:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:379:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:382:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:384:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:385:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:386:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:387:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:388:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:390:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:391:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:397:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:399:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:401:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:404:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:405:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:406:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:411:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:413:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:415:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:417:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:419:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:420:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:422:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:425:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:428:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:431:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:433:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:434:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:441:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:443:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:444:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:446:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:449:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:452:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:455:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:457:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:458:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:466:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:469:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:473:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:475:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:477:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:480:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:481:11: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:484:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:487:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:489:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:492:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:494:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:497:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:498:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:500:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:503:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:505:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:508:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:510:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:513:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:515:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:518:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:520:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:523:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:525:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:528:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:530:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:533:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:535:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:538:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:540:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:543:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:545:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:548:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:550:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:553:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:555:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:558:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:560:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:563:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:565:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:568:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:570:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:573:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:575:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:578:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:594:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:596:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:600:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:602:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:605:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:607:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:608:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:610:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:612:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:613:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:616:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:617:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:620:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:622:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:625:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:628:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:630:7: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:632:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:635:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:636:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:638:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:639:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:641:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:642:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:645:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:649:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:650:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:654:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:656:3: E111 indentation is not a multiple of four
lib/ansible/modules/network/ios/ios_facts.py:660:3: E111 indentation is not a multiple of four

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:119:1: E313 RETURN is not valid YAML

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:119:1: error RETURN: syntax error: could not find expected ':'

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

@sipenat1, just so you are aware we have a dedicated Working Group for network.
You can find other people interested in this in #ansible-network on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:119:1: E313 RETURN is not valid YAML

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:119:1: error RETURN: syntax error: could not find expected ':'

click here for bot help

@ansibot ansibot added the stale_ci label Jun 12, 2019

Change regex to match IOS-XE in show version with literal spaces to m…
…atch IOS-XE on 3560 and 4500x series switches.

@ansibot ansibot removed the stale_ci label Jun 13, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:195:5: E124 closing bracket does not match visual indentation

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:119:1: error RETURN: syntax error: could not find expected ':'

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_facts.py:119:1: E313 RETURN is not valid YAML

click here for bot help

@ansible-zuul

This comment has been minimized.

Copy link

commented Jun 13, 2019

Build succeeded (third-party-check pipeline).

@pabelanger
Copy link
Contributor

left a comment

Thanks for the PR, I'd like to see us also update tests/integration/targets/ios_facts to also confirm lldp / cdp info is now properly collected. We'll also be able to start validating this with our network integration tests.

@sipenat1

This comment has been minimized.

Copy link
Author

commented Jun 18, 2019

Thanks for the PR, I'd like to see us also update tests/integration/targets/ios_facts to also confirm lldp / cdp info is now properly collected. We'll also be able to start validating this with our network integration tests.
Thank you for the comment. I would be happy to add the information for the test environment. But I need some help in figuring out how to do that. Is there a doc the specifically addresses updating the test environment?

@pabelanger

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

Great question, our docs are pretty minimal right now. Something that we should improve for new users, but the basic idea would be, update the following tests, to include the new logic you are adding here:

https://github.com/ansible/ansible/tree/devel/test/integration/targets/ios_facts/tests/cli

You'd add a new ios_facts task, and setup ansible_net_vss, then assert the data was collected. Hopefully the code above providers a good example.

@ansibot ansibot removed the ci_verified label Jun 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.