Skip to content
This repository has been archived by the owner on Feb 10, 2018. It is now read-only.

Support get_mac_address_table() on L2NG switches #199

Closed
wants to merge 0 commits into from

Conversation

bkeifer
Copy link
Contributor

@bkeifer bkeifer commented Aug 9, 2017

Newer Juniper switches (Including EX2300, EX4300, EX4600, EX9200 and QFX series) use the L2NG configuration syntax. As a result, their XML output for get-ethernet-switching-table-information is also slightly different. This was causing get_mac_address_table() to return an empty set on our EX2300 and EX4300 switches.

This PR adds another table structure and view for these switches and updates the logic in get_mac_address_table() to identify these new switches using the switch_style fact.

@bkeifer
Copy link
Contributor Author

bkeifer commented Aug 9, 2017

So, Travis wants the XML test file to be named get-bridge-mac-table.xml, but the RPC command isn't get-bridge-mac-table, it's get-ethernet-switching-table.

Maintainers, what's your preferred way to proceed (assuming this is a PR you're interested in)?

@mirceaulinic mirceaulinic added this to the UNDER REVIEW milestone Aug 9, 2017
Copy link
Member

@mirceaulinic mirceaulinic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bkeifer - thanks for your addition!

So, Travis wants the XML test file to be named get-bridge-mac-table.xml, but the RPC command isn't get-bridge-mac-table, it's get-ethernet-switching-table.

As in your code you're checking the switch_style field from the junos-eznc facts, i.e. if self.device.facts.get('switch_style', '') in ['VLAN_L2NG']:, you need to specify a way in the new test case. You should be able to do this by simply defining a file called facts.yml under the new test case, having the following content:

switch_style: VLAN_L2NG

Other than the missing static field, you might have a lint error, then should be good. Cheers!

fields:
interface: {l2ng-l2-mac-logical-interface: unicode}
mac: {l2ng-l2-mac-address: unicode}
vlan: {l2ng-l2-vlan-id: int}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the static field here, please see above.

@bkeifer
Copy link
Contributor Author

bkeifer commented Aug 10, 2017

It looks like the only error we're getting now is that Travis wants me to rename the .xml test file:

> raise IOError("Couldn't find file with mocked data: {}".format(full_path)) E IOError: Couldn't find file with mocked data: /home/travis/build/napalm-automation/napalm-junos/test/unit/mocked_data/test_get_mac_address_table/l2ng/get-bridge-mac-table.xml

Unless I'm reading things incorrectly, and I might be since I don't have access to much of the other Juniper gear that these tests are geared towards, it looks like these files in the other directories are named after the rpc command that produces the output.

So I'm back to my original question. Should I rename my get-ethernet-switching-table.xml file to get-bridge-mac-table.xml or is there a way to tell Travis to look for a different file name in the test_get_mac_address_table/l2ng directory?

(This is the first project on which I'm really working with test cases, so I wholeheartedly thank you for your patience!)

@mirceaulinic
Copy link
Member

@bkeifer FYI I closed this PR and included your commits into #203

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants