Firewall rule option 'protocol' does take None through CLI (though the API supports it)

Bug #1217212 reported by Rajesh Mohan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
High
Rajesh Mohan

Bug Description

Fwaas firewall-rule-create does not allow 'None' as 'protocol' option. It only allows tcp/udp/icmp.

In the original design, None was implied (when protocol is not specified). During code-review, this field became mandatory. Since this is mandatory now, there should be a way to specify 'None'.

API already supports 'None'. Only the CLI needs to be updated.

The proposal is to add 'any' as one of the options and map this to 'None' in the backend.

Tags: fwaas
ZhiQiang Fan (aji-zqfan)
affects: neutron → python-neutronclient
Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

in neutron/extensions/firewall.py#L194
        'protocol': {'allow_post': True, 'allow_put': True,
                     'is_visible': True, 'default': None,
                     'convert_to': convert_protocol,
                     'validate': {'type:values': fw_valid_protocol_values}},
in python-neutronclient/neutronclient/neutron/v2_0/fw/firewallrule.py#L104
        parser.add_argument(
            '--protocol', choices=['tcp', 'udp', 'icmp'],
            required=True,
            help='protocol for the firewall rule')

Changed in python-neutronclient:
status: New → Confirmed
assignee: nobody → ZhiQiang Fan (aji-zqfan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/43843

Changed in python-neutronclient:
status: Confirmed → In Progress
Changed in python-neutronclient:
importance: Undecided → High
Revision history for this message
Rajesh Mohan (rajesh.mohan) wrote :

ZhiQiang,

During blueprint review, it was decided that 'protocol' field is mandatory. I was not part of that discussion but it is captured in the mailing list.

Anyway, 'action' is mandatory. I do not see why that needs to be changed.

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

@Rajesh Mohan

as Sumit Naiksatam reminded me in patch review, are you already done with this or working on this, since you're the bug reporter, i'm glad you fix it by your self, or i will upload new patch set to it

thanks

Revision history for this message
Rajesh Mohan (rajesh.mohan) wrote :

ZhiQiang,

I had a fix and send it to Sumit. Then I created this bug. Sumit had some comments. When I was working on it, you posted this patch. Sumit was referring to the patch that I sent him over email.

Anyway, this is a minor change. If you want to fix it, please go ahead and do this. Otherwise, i will address Sumit's comment on my patch and post it. Please feel free to choose whatever works for you best.

Thanks,
-Rajesh Mohan

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote : Re: [Bug 1217212] Re: Firewall rule option 'protocol' does take None through CLI (though the API supports it)

I read this bug thread and find it is not assigned to yourself so i upload
my fix.
Please commit your patch in gerrit, so i can review it (by compare to my
patch set 2 which is not uploaded yet), i will mark my patch as abandonded
soon.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/44200

Changed in python-neutronclient:
assignee: ZhiQiang Fan (aji-zqfan) → Rajesh Mohan (rajesh.mohan)
Revision history for this message
Rajesh Mohan (rajesh.mohan) wrote :

ZhiQiang,

As suggested by you, I have uploaded the patch that I was working on. The change is little more than what I would have expected. Since I wanted to replace 'any' with 'None', there was no easy way to do it during update. I had to override the UpdateCommand.run.

Please note that args2body() will not have these args. And parse_args_to_dict is not a method of "class UpdateCommand".

https://review.openstack.org/44200

Please review the patch and let me know your comments.

Thanks,
-Rajesh Mohan

Changed in python-neutronclient:
milestone: none → 2.2.1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/44200
Committed: http://github.com/openstack/python-neutronclient/commit/f208a893c880b6ef5209b4a13290451bb2328904
Submitter: Jenkins
Branch: master

commit f208a893c880b6ef5209b4a13290451bb2328904
Author: Rajesh Mohan <email address hidden>
Date: Thu Aug 29 17:57:44 2013 -0700

    Allow 'any' option for protocol in the firewall rule

    Closes-Bug: #1217212

    The current allowed values for
    protocol are tcp, udp and icmp. Adding
    'any' as allowed option. Since the
    API expects 'None' value for 'any',
    the 'create' and 'update' changes the
    args to 'None' when 'any' is set.

    Change-Id: I33cdf62244f2217379c40a8cd4c776382935ef17

Changed in python-neutronclient:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
milestone: 2.2.1-2.2.6 → none
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
milestone: none → 2.3.0-2.3.4
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.