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

Added support for multiple entities for Go #768

Merged
24 commits merged into from
Apr 27, 2018
Merged

Conversation

ygorelik
Copy link
Collaborator

Added support for multiple entities for Go

@codecov
Copy link

codecov bot commented Apr 24, 2018

Codecov Report

Merging #768 into master will increase coverage by 0.06%.
The diff coverage is 88.06%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
sdk/go/core/ydk/entity_lookup.go 100% <100%> (+28.57%) ⬆️
ydkgen/printer/go/class_printer.py 95.87% <100%> (ø) ⬆️
sdk/cpp/core/src/ydk.cpp 25.65% <16.66%> (ø) ⬆️
sdk/go/core/ydk/services/services.go 63.75% <25%> (-0.85%) ⬇️
sdk/cpp/core/src/path/netconf_session.cpp 86.28% <50%> (+0.04%) ⬆️
sdk/python/core/ydk/entity_utils/entity_utils.py 74.48% <60%> (-7.24%) ⬇️
sdk/go/core/ydk/path/path.go 89.82% <90.81%> (-1.2%) ⬇️
sdk/go/core/ydk/types/types.go 79.14% <91.25%> (+10.49%) ⬆️
... and 2 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 1b81b90...f9b017a. Read the comment docs.

Copy link
Contributor

@ylil93 ylil93 left a 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")
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Collaborator Author

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
Copy link
Contributor

@ylil93 ylil93 Apr 24, 2018

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

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.
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

}

Copy link
Contributor

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

Copy link
Collaborator Author

@ygorelik ygorelik Apr 26, 2018

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.

Parent Entity
}

func (e *CommonEntityData) GetPath() string {
Copy link
Contributor

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

Copy link
Collaborator Author

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.");
Copy link

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?

Copy link
Collaborator Author

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:
Copy link

Choose a reason for hiding this comment

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

default cases should be avoided. Suggest removing this or adding cases for all the members of the enum

Copy link
Collaborator Author

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:
Copy link

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

Copy link
Collaborator Author

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
Copy link

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@@ -36,6 +32,8 @@

sys.path.append(os.path.abspath(ydk_root+'/sphinxexts'))
extensions = [ 'godomain' ]
print(extensions, sys.path)
Copy link

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?

Copy link
Collaborator Author

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.

@ghost ghost merged commit 6a6827c into CiscoDevNet:master Apr 27, 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.

2 participants