-
Notifications
You must be signed in to change notification settings - Fork 32
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
BgpUtils-fix-for-clean-up-for-FRR #49
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: bmswamy <[email protected]>
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.
Code does not compile.
You did not handle any errors and this will crash in a lot of places.
Please format your code properly like surrounding code. 80 chars per line, 2 spaces to indent, inline {}
braces, etc...
Will do a real review after basics are addressed.
receivedRoutesFormat = kVtyshQuaggaGetBgpReceivedRoutesFormat; | ||
} else /* if (versionOutput.value().rfind("FRRouting", 0) == 0) */ { | ||
|
||
//FRROUTING |
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.
a lot of these new comments are unnecessary... please delete them
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.
Addressed the review comments
for (int i = 0; i < neighborCount; ++i) { | ||
// BGP Headers: | ||
// Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd | ||
// dynamic object for bgpSummary |
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.
delete
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.
Addressed the review comments
// dynamic object for bgpSummary | ||
folly::dynamic bgpSummaryInfo = folly::dynamic::object; | ||
|
||
bgpSummaryInfo = folly::parseJson(bgpSummary)["peers"]; |
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.
You need to handle errors in parseJson()
or else this code will crash.
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.
Addressed the review comments
} | ||
|
||
// Vtysh Bgp Recived Routes Info List |
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.
delete
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.
Addressed the review comments
unsigned int rowStartIdx = 0; | ||
for (int i = 0; i < rowCount; ++i) { | ||
// Skip the first entry on each row since it is the status code | ||
BgpUtils::createVtyshBgpRecivedRouteInfoList(const std::string &recivedRoutes, const std::string &key, const std::string &value) { |
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.
- fix typo "Recived"
- 80 chars per line
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.
Addressed the review comments
} | ||
// Vtysh Bgp Advertised Routes Info List | ||
std::vector<thrift::BgpRouteInfo> | ||
BgpUtils::createVtyshBgpAdvertisedRouteInfoList(const std::string &advertisedRoutes, const std::string &key, const std::string &value) { |
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.
80 chars per line
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.
Addressed the review comments
|
||
/** | ||
/** |
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.
delete extra leading space
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.
Addressed the review comments
* Creates a list of thrift::BgpRouteInfo by taking the 'Network' and | ||
* 'Next Hop' values of the vtysh table entries it receives. | ||
* 'Next Hop' values of the vtysh json entries it Advertised Routes. |
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.
grammar?
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.
Addressed the review comments
std::vector<std::string>& headers, | ||
std::vector<std::string>& entries); | ||
static std::vector<thrift::BgpRouteInfo> createVtyshBgpRecivedRouteInfoList( | ||
(const std::string& recivedRoutesInfo,const std::string& key,const std::string& value); |
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.
extra paren, this code does not compile
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.
sorry for this I made changes while I am doing the alignment it happened
static std::vector<thrift::BgpRouteInfo> createVtyshBgpRouteInfoList( | ||
int numOfRows, const std::vector<std::string>& entries); | ||
static std::vector<thrift::BgpRouteInfo> createVtyshBgpAdvertisedRouteInfoList( | ||
(const std::string& recivedRoutesInfo,const std::string& key,const std::string& value); |
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.
extra paren, this code does not compile
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.
sorry for this while I am doing the alignment it happened
Signed-off-by: bmswamy <[email protected]>
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.
Some comments were not properly addressed and formatting is still all over the place.
try { | ||
bgpSummaryInfo = folly::parseJson(bgpSummary)["peers"]; | ||
} catch (const std::exception& ex) { | ||
throw std::invalid_argument("Could not parse bgp summary "); |
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 do not re-throw an error... it is not caught. It will crash the program.
advertisedRoutesFormat = kVtyshQuaggaGetBgpAdvertisedRoutesFormat; | ||
receivedRoutesFormat = kVtyshQuaggaGetBgpReceivedRoutesFormat; | ||
} else /* if (versionOutput.value().rfind("FRRouting", 0) == 0) */ { | ||
if (versionOutput.value().rfind("FRRouting", 0) == 0) { |
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.
This comment was not addressed.
Signed-off-by: bmswamy <[email protected]>
Signed-off-by: bmswamy <[email protected]>
Signed-off-by: bmswamy [email protected]
Prerequisites
Description
BgpUtils fix for clean up for FRR
Test Plan
Tested the below commands
show bgp ipv6 unicast summary json
show bgp ipv6 unicast neighbor {ip} routes json
show bgp ipv6 unicast neighbor {ip} advertised-routes json
Tested the above commands Json information as per task
I have added the tested logs below :
LOGS :
I1214 17:41:15.980036 3782 Broker.cpp:348] Disconnecting from controller on url
tcp://[2002:db8:0:1::1]:7007
I1214 17:41:15.980118 3782 Broker.cpp:364] Connecting to controller on url
tcp://[2002:db8:0:1::1]:7007
E1214 17:41:16.462097 3793 BgpUtils.cpp:215] bgp summary
E1214 17:41:16.462143 3793 BgpUtils.cpp:220] 2620:10d:c089:603::2
E1214 17:41:16.462155 3793 BgpUtils.cpp:224] 1
E1214 17:41:16.462167 3793 BgpUtils.cpp:228] 65123
E1214 17:41:16.462177 3793 BgpUtils.cpp:232] 01:33:27
E1214 17:41:16.462186 3793 BgpUtils.cpp:236] Established
E1214 17:41:16.462194 3793 BgpUtils.cpp:237] *************************************************************************************************
E1214 17:41:16.935168 3793 BgpUtils.cpp:547] Recived Routes
E1214 17:41:16.935207 3793 BgpUtils.cpp:549] print network:2620:10d:c089:800::/56
E1214 17:41:16.935225 3793 BgpUtils.cpp:557] Next hop printing:2620:10d:c089:603::2
E1214 17:41:16.935236 3793 BgpUtils.cpp:561] ********************************************************************************
E1214 17:41:16.935245 3793 BgpUtils.cpp:547] Recived Routes
E1214 17:41:16.935254 3793 BgpUtils.cpp:549] print network:::/0
E1214 17:41:16.935264 3793 BgpUtils.cpp:557] Next hop printing:2620:10d:c089:603::2
E1214 17:41:16.935274 3793 BgpUtils.cpp:561] ********************************************************************************
E1214 17:41:17.526739 3793 BgpUtils.cpp:582] advertisedRoutes**
E1214 17:41:17.526778 3793 BgpUtils.cpp:585] print network:2620:10d:c089:9520::/60
E1214 17:41:17.526791 3793 BgpUtils.cpp:591] Next hop printing:2620:10d:c089:603::4
E1214 17:41:17.526803 3793 BgpUtils.cpp:594] ********************************************************************************
I1214 17:41:17.527005 3793 StatusApp.cpp:1515] Reporting status to controller