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

Introduced multiple entities in filter for CRUD and Netconf dervices #713

Merged
11 commits merged into from
Mar 16, 2018

Conversation

ygorelik
Copy link
Collaborator

Introduced multiple entities in filter for CRUD and Netconf dervices.

@codecov
Copy link

codecov bot commented Mar 15, 2018

Codecov Report

Merging #713 into master will increase coverage by 0.34%.
The diff coverage is 89.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #713      +/-   ##
==========================================
+ Coverage    78.8%   79.14%   +0.34%     
==========================================
  Files         171      172       +1     
  Lines       15785    15918     +133     
  Branches     1431     1431              
==========================================
+ Hits        12439    12599     +160     
+ Misses       3003     2975      -28     
- Partials      343      344       +1
Impacted Files Coverage Δ
sdk/cpp/core/src/path/netconf_model_provider.cpp 93.75% <ø> (ø) ⬆️
...dk/python/core/tests/test_sanity_service_errors.py 92.07% <ø> (ø) ⬆️
sdk/python/core/ydk/services/crud_service.py 100% <ø> (ø) ⬆️
sdk/cpp/core/src/executor_service.cpp 97.91% <ø> (+7.53%) ⬆️
sdk/cpp/core/src/types.hpp 94.11% <ø> (ø) ⬆️
sdk/python/core/tests/test_sanity_netconf.py 96.44% <100%> (+4.67%) ⬆️
sdk/cpp/core/src/path/root_schema_node.cpp 88.95% <100%> (+0.27%) ⬆️
sdk/cpp/core/tests/core_test.cpp 100% <100%> (ø) ⬆️
sdk/cpp/core/src/path/repository.cpp 87.69% <100%> (ø) ⬆️
sdk/cpp/core/src/path/netconf_session.cpp 86.25% <100%> (-0.06%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01689ee...8b26d0d. Read the comment docs.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thanks, @ygorelik for this change!

#include "xml_subtree_codec.hpp"

using namespace std;
using namespace ydk;
Copy link

Choose a reason for hiding this comment

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

I think these functions need to be inside the ydk namespace as that is the convention being followed in the rest of the code. So this line can be removed and the below line can be used:
namespace ydk {

//
//////////////////////////////////////////////////////////////////

#include "common_utilities.hpp"
Copy link

Choose a reason for hiding this comment

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

Thanks for creating this utilities file!

return false;
}

string replace_xml_escape_sequences(const string& xml)
Copy link

Choose a reason for hiding this comment

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

According to the codecov report, this function is not being tested. Can you please add a test case for this?

#include "service_provider.hpp"

using namespace std;
using namespace ydk;
Copy link

@ghost ghost Mar 15, 2018

Choose a reason for hiding this comment

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

As mentioned below, these functions should be inside the ydk namespace.
namespace ydk {

#include "logger.hpp"
#include "service_provider.hpp"

using namespace std;
Copy link

Choose a reason for hiding this comment

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

Better to avoid having using namespace statements in header (.hpp) files. It is ok in .cpp files. See this link for why: https://stackoverflow.com/a/5849668

@@ -34,6 +34,8 @@
#include "netconf_provider.hpp"
#include "types.hpp"

using namespace std;
Copy link

Choose a reason for hiding this comment

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

Suggest not to add using namespace statements in .hpp files. See above comment.

YLOG_ERROR("Failed to get entity node.");
throw(YInvalidArgumentError{"Failed to get entity node"});
return string{};
// YLOG_ERROR("Failed to get entity node.");
Copy link

Choose a reason for hiding this comment

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

It may not be safe to comment out this exception. If the entity is empty, is it may be better to raise an exception instead of silently returning empty string?

std::free(buffer);
}

/*auto cdata_start = ret.find("<![CDATA[");
Copy link

Choose a reason for hiding this comment

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

Suggest removing these lines instead of commenting out


// Encode results
xml = s.encode(*read_result, ydk::EncodingFormat::XML, true);
// cout << endl << "===== XML after encoding multiple entities:" << endl << xml << endl;
Copy link

Choose a reason for hiding this comment

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

Do these commented lines need to be removed?

// Print after decoding
// vector<shared_ptr<ydk::path::DataNode>> data_nodes = data_node->get_children();
// for (auto dn : data_nodes) {
// print_data_node(dn);
Copy link

Choose a reason for hiding this comment

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

Do these commented lines need to be removed?

@ghost
Copy link

ghost commented Mar 15, 2018

Also, codacy has some comments: https://app.codacy.com/app/ydk/ydk-gen/pullRequest?prid=1434270

@ghost ghost merged commit 6172a9a into CiscoDevNet:master Mar 16, 2018
This pull request was closed.
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.

None yet

1 participant