-
Notifications
You must be signed in to change notification settings - Fork 510
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
Vpnaas: Update Service #784
Conversation
Build succeeded.
|
@jtopjian This is ready for review |
Build succeeded.
|
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.
@simonre I've left a few comments here. Let me know if you have any questions. :)
// UpdateOpts contains the values used when updating a VPN service | ||
type UpdateOpts struct { | ||
// Name is the human readable name of the service. | ||
Name string `json:"name,omitempty"` |
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 it possible to not have a Name? If so, let's say a user originally set a name but then wants to remove the name. By having the field configured like the above, that's not possible because an empty string is string
's zero-value and with omitempty
, it won't be sent.
So we'll need to do:
Name *string `json:"name,omitempty"`
That way a pointer to an empty string will be sent and successfully clear the name.
Name string `json:"name,omitempty"` | ||
|
||
// Description is the human readable description of the service. | ||
Description string `json:"description,omitempty"` |
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.
"name": "updatedname", | ||
"admin_state_up": false, | ||
"subnet_id": null, | ||
"tenant_id": "10039663455a446d8ba2cbb058b0f578", |
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 odd. So in this test fixture project_id
is not here...
Ignoring the API docs, because they can sometimes have old or incorrect information, what are you seeing in your working environment? You can view the raw API request/response by calling neutron with neutron --debug
.
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 API is returning 'project_id' in the response in my working environment when running
neutron --debug vpn-service-list
. Should I include it as a field in the result then?
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.
Yes please. We always prefer actual API output over API references.
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.
Ok. I was under the impression that I should only include the fields reference in the source code here.
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.
Yeah, sometimes there's a lot of mystery and investigation to this.
You're absolutely right: if the service code is showing fields, that's confident confirmation that the fields are valid.
If the API references are showing fields that the aren't in the code, then there are two possibilities:
- The API reference is wrong (it happens frequently enough)
- The field is being added somewhere else in the service code. This happens a lot with Neutron, specifically with
project_id
andtenant_id
. So the next source of confident information is the API interaction between you and your OpenStack environment.
For fields like project_id
, created_at
, or some other "meta" field, we can be fairly confident that they're somewhere in Neutron and as long as you're seeing them in your API interaction, that's good enough for me. But let's say your API interaction was also showing something like router_id
. Then we'll really want to dig into the Neutron code (by either grepping the entire code for router_id
or using the github search box) and figuring out where it's coming from. That's ugly work, but it makes sure Gophercloud is correct.
With regard to test fixtures, please always use fixtures generated yourself rather than fixtures from the API references. We (gophercloud) agreed to enforce this a while back but I occasionally forget to check. Using "real" fixtures helps us make sure the data is correct.
Let me know if all of that makes sense.
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.
Yes, that does make a lot of sense. I'll keep that in mind from now on. Thanks for the explanation!
@simonre Also, this file is a good resource to determine which fields can be used in both Create ( edit: Duh. I forgot to link to the file: https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/extensions/vpnaas.py |
@jtopjian I put the state of this back to [WIP] because I noticed a problem with writing acceptance tests for this. A VPN service can only be updated after its state has been set to
|
@simonre Good catch. Let's go with Option 2. I would prefer to merge the VPN suite in order of functionality. If it's not possible to Update a connection entirely through Gophercloud, let's hold off until it is. |
@jtopjian I've been working on implementing this but there are some obstacles. I can create the two sides of the connection without a problem entirely through gophercloud but unless I'm missing something there doesn't seem to be an easy way to send data through the connection turning its state to |
@simonre Makes sense to me - thank you for the detailed explanation. This sounds like a pretty complex test fixture. I'm sure there's some way to do it, but I'm not immediately sure how.
This is good enough for me. You've done some great work with the other acceptance tests and if this is the only test omitted in the entire VPNaaS suite, I think that is acceptable. :) The pieces will be in place for either you or someone else to add this in the future. |
It would actually be one of two tests omitted in the suite. The other one would be for the update function for ipsec site connections. Updating a site connection has the exact same issue(Can't be updated while the state is One other solution I could think of would be to somehow get the connection state to either For now I'll omit both tests if that's ok. |
Yes, that sounds good to me. |
af21f84
to
23dc8ba
Compare
30db80a
to
3b8ddac
Compare
@jtopjian This is ready for review |
Build succeeded.
|
@simonre Looks good to me! |
Add "openstack_networking_qos_dscp_marking_rule_v2" resource with tests and website documentation.
For #723
Links to the line numbers/files in the OpenStack source code that support the
code in this PR:
https://github.com/openstack/neutron-vpnaas/blob/058469e1b99b647537a5228c6a384d93df5484df/neutron_vpnaas/db/vpn/vpn_db.py#L502
API:
https://developer.openstack.org/api-ref/network/v2/#update-vpn-service