Skip to content
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

Open
wants to merge 1 commit into
base: bird-import-proto
Choose a base branch
from

Conversation

Markuu-s
Copy link

No description provided.

Comment on lines +2022 to +2026
std::string confPath;
for (const auto& yamlIter : yamlStep)
{
confPath = yamlIter.as<std::string>();
}
Copy link
Collaborator

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());
Copy link
Collaborator

Choose a reason for hiding this comment

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

just

Suggested change
printf("%s", resExec.data());
std::cout <<resExec;

Or use YANET_LOG_something. Using plain printf seems strange, after all, we're using C++

Comment on lines +2043 to +2047
std::string command = "birdc ";
for (const auto& yamlIter : yamlStep)
{
command += yamlIter.as<std::string>() + " ";
}
Copy link
Collaborator

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.

Suggested change
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());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
printf("birdc:\n %s\n", res_birdc.data());
std::cout << "birdc:\n" << res_birdc << '\n';

- bird/bird.conf
- birdc:
- show route
- sleep: 20
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants