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

Fix #98 #99

Merged
merged 7 commits into from
Dec 23, 2016
Merged

Fix #98 #99

merged 7 commits into from
Dec 23, 2016

Conversation

bewing
Copy link
Member

@bewing bewing commented Dec 2, 2016

Fix for #98

@bewing bewing changed the title Fix 98 Fix #98 Dec 2, 2016
@bewing
Copy link
Member Author

bewing commented Dec 2, 2016

Looking at the test case I broke.

@dbarrosop
Copy link
Member

It's the mocked data what it broke. As you changed what the method does internally you have to adapt it. But wait for now as we might decide to leave this one as it is or deprecate it and write a new method for checking the FIB.

@coveralls
Copy link

coveralls commented Dec 2, 2016

Coverage Status

Coverage decreased (-0.3%) to 79.484% when pulling af8eafc on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@mirceaulinic
Copy link
Member

But wait for now as we might decide to leave this one as it is

Yes, I think we should leave it as is + start discussion about a new method for checking the FIB, if possible aligned with OC format.

@mirceaulinic
Copy link
Member

Yes, I think we should leave it as is

With this doesn't mean we can leave the bug :)

But let's not change the behaviour.

@mirceaulinic mirceaulinic modified the milestones: 0.5.1, 0.5.2 Dec 2, 2016
@coveralls
Copy link

coveralls commented Dec 5, 2016

Coverage Status

Coverage decreased (-0.2%) to 79.509% when pulling fe36508 on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@bewing
Copy link
Member Author

bewing commented Dec 5, 2016

Need to expand testing on this method.

@coveralls
Copy link

coveralls commented Dec 5, 2016

Coverage Status

Coverage decreased (-0.2%) to 79.509% when pulling 28a43ef on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@coveralls
Copy link

coveralls commented Dec 5, 2016

Coverage Status

Coverage decreased (-0.2%) to 79.509% when pulling 3fd1b1e on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@@ -985,16 +985,20 @@ def get_mac_address_table(self):
def get_route_to(self, destination='', protocol=''):
routes = dict()

if protocol.lower() not in ['', 'bgp', 'connected', 'isis', 'ospf', 'rip', 'static']:
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this.

Copy link
Member Author

Choose a reason for hiding this comment

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

More than happy to, was just trying to match up closer to the junos reference spec. Do we want to try to throw a special UnknownProtocol exception or let the command parser raise an exception when an unknown protocol is passed in, instead?

Copy link
Member

Choose a reason for hiding this comment

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

That would be the most optimal, but for the moment let's just raise TypeError.
And do check only if the protocol is specified, otherwise will return all possible route.s

Copy link
Member

Choose a reason for hiding this comment

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

Can you add in that list also direct and when user requests direct to rewrite the value of the protocol var to connected?

Copy link
Member

Choose a reason for hiding this comment

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

Eeerm... I know I'll contradict ourselves (did we discuss that before?) but I think we should remove this line completely. I don't see any reason why we'd limit to some certain protocols only. I will make the necessary adjustment on the other drivers in order to avoid this limitation!

Copy link
Member Author

Choose a reason for hiding this comment

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

My approach was to enumerate ALL protocols supported by the driver, and raise TypeError for a bad one, instead of having the underlying driver pyeapi raise a CommandError. Either way works for me

try:
ipv = ''
if IPNetwork(destination).version == 6:
ipv = 'v6'
except AddrFormatError:
return 'Please specify a valid destination!'

command = 'show ip{ipv} route {destination} detail'.format(
command = 'show ip{ipv} route {destination} {protocol} detail'.format(
Copy link
Member

Choose a reason for hiding this comment

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

Here should be specify the protocol only if requested by the user. Otherwise return all possible routes.

Copy link
Member Author

Choose a reason for hiding this comment

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

If protocol arg is blank, all routes are returned, so this is already occurring

@@ -985,16 +985,20 @@ def get_mac_address_table(self):
def get_route_to(self, destination='', protocol=''):
routes = dict()

if protocol.lower() not in ['', 'bgp', 'connected', 'isis', 'ospf', 'rip', 'static']:
Copy link
Member

Choose a reason for hiding this comment

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

That would be the most optimal, but for the moment let's just raise TypeError.
And do check only if the protocol is specified, otherwise will return all possible route.s

@coveralls
Copy link

coveralls commented Dec 21, 2016

Coverage Status

Coverage decreased (-0.2%) to 79.587% when pulling cdab265 on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@mirceaulinic
Copy link
Member

Looks good - I'll test tomorrow!

@mirceaulinic
Copy link
Member

Tested and looks good: just please allow also the equivalence direct <-> connected and ready to merge.

However I have noticed few other weird stuff, but they are not related to #98 so they will be fixed later.

@coveralls
Copy link

coveralls commented Dec 22, 2016

Coverage Status

Coverage decreased (-0.2%) to 79.587% when pulling 5d85712 on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 79.587% when pulling 5d85712 on bewing:iss_98 into 96f8bb1 on napalm-automation:develop.

@mirceaulinic mirceaulinic merged commit 8986fa4 into napalm-automation:develop Dec 23, 2016
@mirceaulinic
Copy link
Member

Thanks @bewing!

@mirceaulinic mirceaulinic modified the milestones: 0.5.1, 0.5.2 Dec 23, 2016
@bewing bewing deleted the iss_98 branch January 3, 2017 19:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants