-
Notifications
You must be signed in to change notification settings - Fork 4
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
migrate node network list functionality into esisdk #5
Conversation
esi/lib/node.py
Outdated
None, None, None, None, None]) | ||
|
||
return ["Node", "MAC Address", "Port", "Network", "Fixed IP", | ||
"Floating Network", "Floating IP"], data |
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'll take a closer look tomorrow, but one thing sticks out: we want to return data
, and not the column headers. I'd consider the headers part of the formatting, and that belongs in python-esiclient
. Another way to think of this, is if you want to use this function in the UI, you're only going to want data
.
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.
Taking that one step forward, I wonder if this might be best returned as a list of dictionaries, where each dictionary is something like:
{
"node": <node object>,
"ports": [{
"baremetal_port": <baremetal port object>,
"neutron_port": <neutron port object>,
"floating_ip": <floating ip information>
},
<additional ports>
]
}
Then the client gets to interpret the information however they'd like.
This would imply that some of the functions in utils.py
that do formatting - like get_network_display_name
- would still belong in python-esileapclient
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.
Good start! I've left comments inline.
Looks pretty good! A few last things:
|
The python-esiclient PR doesn't have fully updated test cases, only the source code, but I'll update it right now |
Thanks for the update! After testing, I've noted three differences in output. They could all very well be due to presentation
|
1b06247
to
7786956
Compare
these should be fixed now |
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 looks really good! The one thing missing is in the test cases, which should have assert_called
and assert_not_called
(as in https://github.com/CCI-MOC/esi-leap/blob/master/esi_leap/tests/api/controllers/v1/test_utils.py#L262). The reason is that this is often a way to ensure that conditional branches are followed correctly.
Once that's included, I think this will be ready to merge!
Originally, this functionality existed in python-esiclient. We moved it into esisdk so that multiple projects can reuse the same package, and to centralize the logic in one place.
Looks good - thanks! |
The python-esiclient and esi-ui packages depend on the same functionality. This PR starts to centralize that logic so no code repetition is done. The first function to be added is
openstack esi node network list
.