X Tutup
Skip to content

Added Trunk APIs and tests#52

Closed
kashyapjha wants to merge 10 commits intoopenstack4j:masterfrom
kashyapjha:master
Closed

Added Trunk APIs and tests#52
kashyapjha wants to merge 10 commits intoopenstack4j:masterfrom
kashyapjha:master

Conversation

@kashyapjha
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@olivergondza olivergondza left a comment

Choose a reason for hiding this comment

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

The code looks good to me in general. I have added several comments where is can be improved, they are mostly cosmetic.

/**
* @return a list of subports associated with the trunk
*/
List<NeutronSubPort> getSubPorts();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The interface method should not be returning an implementation, type but its interface instead.

@kashyapjha
Copy link
Copy Markdown
Contributor Author

Hi Oliver,
I added the changes you requested, could you please review them?

Copy link
Copy Markdown
Member

@olivergondza olivergondza left a comment

Choose a reason for hiding this comment

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

Thanks. I have made a second round of review.

* the ID of the trunk to update
* @return
*/
Trunk updateTrunk(Trunk trunk, String trunkId);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not quire familiar with the OpenStack trunk service, but the contract of this method got my attention. It would be cleaner if the trunkId is passed in inside the trunk. Is there any reason for not doing it that way?

@kashyapjha
Copy link
Copy Markdown
Contributor Author

Hi Oliver,
The type change from NeutronTrunkSubPort to TrunkSubPort had much more effect than I imagined, please run the tests once.

@olivergondza
Copy link
Copy Markdown
Member

Great, did you have a chance to have a look at #52 (comment)?

@kashyapjha
Copy link
Copy Markdown
Contributor Author

Oh sorry I totally forgot to reply to that one. So basically I just followed how the existing resources do it to maintain consistency.

@olivergondza
Copy link
Copy Markdown
Member

@kashyapjha, you are correct this is being done that way sometimes, but it is generally inconsistent all over the codebase. But there are cases when this is done the simple way[1]. Also the method conventions suggest to use name update when Trunk is updated by TrunkService.

[1]

@kashyapjha
Copy link
Copy Markdown
Contributor Author

Also the updateTrunk method takes in a builder built trunk object to update that's why the id is passed in separately

@olivergondza
Copy link
Copy Markdown
Member

@kashyapjha, that is my point exactly. We wrap 7 input values in one argument, but we pass the 8th separately. Is there a reason for the ID not being part of the builder and entity?

@kashyapjha
Copy link
Copy Markdown
Contributor Author

The ID is used to retrieve the current trunk object from openstack and the trunk object which can have all attributes except ID is passed in as the object to update because we cant/shouldnt change a resource ID

@olivergondza
Copy link
Copy Markdown
Member

Yes, I understand that's what you are proposing. Though what I suggest is to change that to be aligned with other implementations providing cleaner API for clients. The ID in the Trunk will be used as the resource identifier.

[1]

return patch(KeystoneUser.class, PATH_USERS, "/", user.getId()).entity(user).execute();

@kashyapjha
Copy link
Copy Markdown
Contributor Author

Okay I see what you mean. I'll try to implement that way and let you know if it's possible.

@kashyapjha
Copy link
Copy Markdown
Contributor Author

Hi Oliver,

I've updated it.

Copy link
Copy Markdown
Member

@olivergondza olivergondza left a comment

Choose a reason for hiding this comment

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

Great, thanks. I will consult the test results and merge towards the next release.

@olivergondza
Copy link
Copy Markdown
Member

@kashyapjha, I have no idea why, but travis needed a manual rebuild to report test results here. Unfortunately, there are some failing tests.

@kashyapjha
Copy link
Copy Markdown
Contributor Author

I'm sorry I got a mess of repos and branches so I made a new pull request. All changes you requested are there and unit tests are passing as well

@olivergondza
Copy link
Copy Markdown
Member

Closing in favor of #53.

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

X Tutup