[wip] FWaaS v2.0 Rule Create#1768
Conversation
|
Build succeeded.
|
jtopjian
left a comment
There was a problem hiding this comment.
@Elethiomel Thanks for continuing to look into this. Overall this looks good. I've left a few comments. In addition, I'd still like to see some acceptance tests added. It should be pretty easy to mirror the current fwaas tests and modify for fwaasv2 - I'd be happy to help if needed.
Please let me know if you have any questions.
| // CreateOpts contains all the values needed to create a new firewall rule. | ||
| type CreateOpts struct { | ||
| Protocol Protocol `json:"protocol" required:"true"` | ||
| Action string `json:"action" required:"true"` |
There was a problem hiding this comment.
I think we can create a specific type for action: https://github.com/openstack/neutron-fwaas/blob/27906d0acff349c9e5ac7955d203fb2233c295db/neutron_fwaas/db/firewall/v2/firewall_db_v2.py#L80
There was a problem hiding this comment.
Great idea :) I've added this in commit c677015
| DestinationPort string `json:"destination_port,omitempty"` | ||
| Shared bool `json:"shared,omitempty"` | ||
| Enabled bool `json:"enabled,omitempty"` | ||
| PolicyID string `json:"firewall_policy_id"` |
| Shared bool `json:"shared,omitempty"` | ||
| Enabled bool `json:"enabled,omitempty"` | ||
| PolicyID string `json:"firewall_policy_id"` | ||
| Position int `json:"position"` |
There was a problem hiding this comment.
I'm unable to tell how this field is added to the result here: https://github.com/openstack/neutron-fwaas/blob/27906d0acff349c9e5ac7955d203fb2233c295db/neutron_fwaas/db/firewall/v2/firewall_db_v2.py#L269
Can you verify this field is really part of the JSON result?
There was a problem hiding this comment.
Well spotted! I've verified that it's not. Removed in commit f1ad97e
There was a problem hiding this comment.
The JSON result is also returning project_id, so I've added this in commit be00d44
|
Build succeeded.
|
|
@jtopjian commit ee2fb65 introduces an acceptance test for creating a rule, but the test is currently failing with a rather odd error... Any suggestion appreciated :)
|
|
Build succeeded.
|
|
Nice work :) The error is because you're comparing a string "tcp" with the Protocol type "tcp". There are two ways to resolve this: th.AssertEquals(t, rule.Protocol, "tcp")
th.AssertEquals(t, rule.Action, "allow")or th.AssertEquals(t, rule.Protocol, string(rules.ProtocolTCP))
th.AssertEquals(t, rule.Action, string(rules.ActionAllow)) |
|
Build succeeded.
|
|
@jtopjian What's the etiquette here in gophercloud dev land? Should I close off the changes requested or should I leave it to you? |
That's all on me. Sorry for the delay. |
For #514
https://github.com/openstack/neutron-fwaas/blob/27906d0acff349c9e5ac7955d203fb2233c295db/neutron_fwaas/db/firewall/v2/firewall_db_v2.py#L68-L82