-
Notifications
You must be signed in to change notification settings - Fork 74
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
NETCONF TCP client #476
NETCONF TCP client #476
Conversation
- add simple tcp proxy server for ConfD - add TCP client tests, update CI scripts
Codecov Report
@@ Coverage Diff @@
## new_python #476 +/- ##
==============================================
+ Coverage 68.12% 68.19% +0.06%
==============================================
Files 98 98
Lines 14424 14461 +37
Branches 2337 2338 +1
==============================================
+ Hits 9827 9862 +35
- Misses 3927 3929 +2
Partials 670 670
Continue to review full report at Codecov.
|
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.
Looks good! Thanks. Just a few comments
sdk/cpp/core/src/netconf_client.hpp
Outdated
@@ -38,7 +39,7 @@ typedef struct capabilities { | |||
namespace ydk | |||
{ | |||
|
|||
class NetconfClient | |||
class NetconfClient : public NetconfClientBase |
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.
To avoid future confusion, can we change names as below?
class NetconfSSHClient : public NetconfClient
and
class NetconfTCPClient : public NetconfClient
class NetconfClientBase | ||
{ | ||
public: | ||
NetconfClientBase() {} |
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.
Can we avoid inlining constructors and destructors? This seems like a good guideline
static void replace(std::string& subject, const std::string& search, const std::string& replace); | ||
|
||
|
||
NetconfTCPClient::NetconfTCPClient(std::string username, std::string password, |
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.
Can these variables be changed from std::string
to const std::string &
to avoid copying?
curl_global_cleanup(); | ||
} | ||
|
||
void NetconfTCPClient::initialize(std::string address, int port) |
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.
Can these variables be changed from std::string to const std::string & to avoid copying?
initialize_curl(address, port); | ||
} | ||
|
||
void NetconfTCPClient::initialize_curl(std::string address, int port) |
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.
Can these variables be changed from std::string to const std::string & to avoid copying?
return ret; | ||
} | ||
|
||
static std::string trim_reply(std::string str) |
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.
Can these variables be changed from std::string to const std::string & to avoid copying?
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.
Falls in the category of RVO, using const
won't help omit copying.
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.
Makes sense for return value. But for arguments, const
is required
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.
with no optimization options
sdk/python/core/python.cpp
Outdated
@@ -485,8 +485,7 @@ PYBIND11_PLUGIN(ydk_) | |||
class_<ydk::NetconfServiceProvider, ydk::path::ServiceProvider>(providers, "NetconfServiceProvider") | |||
.def("__init__", | |||
[](ydk::NetconfServiceProvider &nc_provider, ydk::path::Repository& repo, string address, string username, string password, int port, string protocol) { |
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.
Can these variables be changed here and in netconf_provider.hpp
from std::string to const std::string & to avoid copying?
- rename NetconfClient to NetconfSSHClient - add const declaration - fix simple tcp proxy server recv method
- rename NetconfClient to NetconfSSHClient - add const declaration - fix simple tcp proxy server recv method
Note TCP client does not validate any data as opposed to ssh client(via libnetconf), some exceptions will not be raised.