-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add bird in Autotest. #264
base: bird-import-proto
Are you sure you want to change the base?
Conversation
std::string confPath; | ||
for (const auto& yamlIter : yamlStep) | ||
{ | ||
confPath = yamlIter.as<std::string>(); | ||
} |
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.
why do we reinitializing that string in a loop?
Maybe just std::string confPath = yamlStep[0].as<std::string>();
is enough?
|
||
std::string resExec = exec(execCommand.c_str()); | ||
|
||
printf("%s", resExec.data()); |
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.
just
printf("%s", resExec.data()); | |
std::cout <<resExec; |
Or use YANET_LOG_
something. Using plain printf
seems strange, after all, we're using C++
std::string command = "birdc "; | ||
for (const auto& yamlIter : yamlStep) | ||
{ | ||
command += yamlIter.as<std::string>() + " "; | ||
} |
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.
Use std::ostringstream
when building strings in a loop. Current approach is not efficient as you will gradually create more and more objects of increasing size.
std::string command = "birdc "; | |
for (const auto& yamlIter : yamlStep) | |
{ | |
command += yamlIter.as<std::string>() + " "; | |
} | |
std::ostringstream command_stream; | |
command_stream << "birdc "; | |
for (const auto& yamlIter : yamlStep) | |
{ | |
command_stream << yamlIter.as<std::string>() << ' '; | |
} | |
const std::string command = command_stream.str(); |
|
||
auto res_birdc = exec(command.c_str()); | ||
|
||
printf("birdc:\n %s\n", res_birdc.data()); |
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.
printf("birdc:\n %s\n", res_birdc.data()); | |
std::cout << "birdc:\n" << res_birdc << '\n'; |
- bird/bird.conf | ||
- birdc: | ||
- show route | ||
- sleep: 20 |
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.
is 20 second sleep absolutely needed? I would like to see a lesser value though if it's necessary, then feel free to ignore
No description provided.