-
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
Added support for multiple entities for Go #768
Conversation
Codecov Report
@@ Coverage Diff @@
## master #768 +/- ##
==========================================
+ Coverage 80.7% 80.77% +0.06%
==========================================
Files 171 171
Lines 16549 16756 +207
Branches 1493 1495 +2
==========================================
+ Hits 13356 13534 +178
- Misses 2828 2847 +19
- Partials 365 375 +10
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.
Thanks for the update Yan!
@@ -328,30 +328,3 @@ TEST_CASE("ietf_get_rpc") | |||
cout << "Exception while executing RPC: " << ex.what() << endl; | |||
} | |||
} | |||
|
|||
TEST_CASE("get_config_openconfig_interfaces_and_bgp") |
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 there a reason for deleting this test case?
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.
It exposes issue 727. I will put it back after fixing the issue.
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.
I see. It's probably better to comment it out with that explanation rather than deleting everything.
See this example:
https://github.com/ygorelik/ydk-gen/blob/715bed51b22bf3cb9e1e8d69aee23f9ee2d9544e/sdk/cpp/tests/test_netconf_service.cpp#L40
@@ -268,44 +268,172 @@ These are how YANG types are represented in Go. | |||
|
|||
An interface type that represents a basic container in YANG | |||
|
|||
.. function:: GetEntityData() | |||
.. function:: GetEntityData() Entity |
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 function doesn't return Entity; it returns *CommonEntityData. The line should be
.. function:: GetEntityData() *CommonEntityData
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.
Fixed
.. function:: GetEntityData() | ||
.. function:: GetEntityData() Entity | ||
|
||
The :ref:`Entity <types-entity>` interface function |
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 is confusing. Instead say something like
Implements :ref:`Entity ` interface
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.
Fixed.
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.
I did not see the change in your latest push - bumping this comment so it doesn't get buried
|
||
.. function:: GetEntityData() *CommonEntityData | ||
|
||
Implements Entity interface. |
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.
I think it's better to include the link to to the Entity interface:
Implements :ref:`Entity ` interface
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.
Fixed.
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.
I did not see the change in your latest push - bumping this comment so it doesn't get buried
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.
It is in my fork: ygorelik@d227bd9
@@ -3,7 +3,8 @@ package test | |||
import ( | |||
"fmt" | |||
ysanity "github.com/CiscoDevNet/ydk-go/ydk/models/ydktest/sanity" | |||
// "github.com/CiscoDevNet/ydk-go/ydk/models/ietf/interfaces" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Done
sdk/go/core/ydk/path/path.go
Outdated
} | ||
|
||
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 indentation should be deleted
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.
Deleted. Will check-in with next commit due to code overlapping with project in work.
sdk/go/core/ydk/types/types.go
Outdated
Parent Entity | ||
} | ||
|
||
func (e *CommonEntityData) GetPath() 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.
Is this method necessary? For the purpose of extracting the segment path from an Entity struct, this method exists
https://github.com/ygorelik/ydk-gen/blob/715bed51b22bf3cb9e1e8d69aee23f9ee2d9544e/sdk/go/core/ydk/types/types.go#L316
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.
Deleted. Will check-in with next commit due to code overlapping with project in work.
@@ -489,8 +489,9 @@ static string get_filter_payload(path::Rpc & ydk_rpc) | |||
{ | |||
auto entity = ydk_rpc.get_input_node().find("filter"); | |||
if(entity.empty()){ | |||
YLOG_ERROR("Failed to get entity node."); | |||
throw(YInvalidArgumentError{"Failed to get entity node"}); | |||
YLOG_WARN("Failed to get filter node for RPC; it then will be skipped."); |
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 is this changed to warning?
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.
It is not an error when filter is not present. In this case the whole device configuration will be fetched.
case JSON: | ||
return ydk::EncodingFormat::JSON; | ||
case XML: | ||
default: |
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.
default
case
s should be avoided. Suggest removing this or adding cases for all the members of the enum
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.
The compiler logged warning message pointing that 'default' case is missing. I was taught always include 'default' case. If not included the 'switch' must be re-factored to if-else statements.
case Restconf: | ||
return ydk::Protocol::restconf; | ||
case Netconf: | ||
default: |
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.
Same as above. Better to avoid default switch cases
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.
The compiler logged warning message pointing that 'default' case is missing. I was taught always include 'default' case. If not included the 'switch' must be re-factored to if-else statements.
sdk/go/README.md
Outdated
@@ -64,6 +64,16 @@ $ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.7.1/libydk-0.7 | |||
|
|||
``` | |||
|
|||
Golang |
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 this be made to a heading? Something like
### Golang version
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.
Fixed.
sdk/go/core/docsgen/conf.py
Outdated
@@ -36,6 +32,8 @@ | |||
|
|||
sys.path.append(os.path.abspath(ydk_root+'/sphinxexts')) | |||
extensions = [ 'godomain' ] | |||
print(extensions, sys.path) |
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 this print statement be removed?
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.
It is leftover from debug session. Removed.
Added support for multiple entities for Go