-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[frrcfgd][bgpcfgd] Add portchannel support #8911
Conversation
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
@@ -183,7 +183,10 @@ def __ne__(self, other): | |||
def __hash__(self): | |||
return hash((self.af, self.blackhole, self.ip, self.interface, self.distance, self.nh_vrf)) | |||
def is_zero_ip(self): | |||
return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 | |||
if self.ip.startswith('PortChannel'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't overload this function. You can write a new function as "is_portchannel" and update the caller to treat this valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote a new function and wrapped it in zero_ip() in try-exception because the string is being processed in inet_pton() which throws an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, please add unittests
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
This pull request introduces 2 alerts when merging cdcb9fc into 3426739 - view on LGTM.com new alerts:
|
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
This pull request introduces 2 alerts when merging 4dd4c17 into 3855ce2 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the LGTM warning. Other parts look good to me.
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
* To add portchannel support in frrcfgd and bgpcfgd * Update is_zero_ip() to handle portchannel name Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
Why I did it
To add portchannel support in frrcfgd and bgpcfgd.
fix #8907
How I did it
Added handling of the portchannel name as an IP address by adding check in is_zero_ip() to prevent parsing portchannel name with socket.inet_pton().
How to verify it