Bug 1547872 - Missing IP address field when adding a router with external gateway
Summary: Missing IP address field when adding a router with external gateway
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: cfme-future
Assignee: Alona Kaplan
QA Contact: Omri Hochman
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-22 07:30 UTC by Mor
Modified: 2020-06-15 09:44 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-11 15:26:33 UTC
Category: ---
Cloudforms Team: RHEVM
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshot (deleted)
2018-02-22 07:30 UTC, Mor
no flags Details
logs (11.74 MB, application/octet-stream)
2018-02-22 07:42 UTC, Mor
no flags Details

Description Mor 2018-02-22 07:30:47 UTC
Description of problem:
When adding a router with external gateway there should be an option to set the IP address. This is mandatory value in 'external_fixed_ips' array as according to the API: https://developer.openstack.org/api-ref/network/v2/#create-router.

Version-Release number of selected component (if applicable):
5.9.0.21.20180214154720_6f2109d 

How reproducible:
100%

Steps to Reproduce:
1. Create network.
2. Create subnet
3. Try to create router with external gateway.

Actual results:
Fixed IPs section does not include IP address.

Expected results:
Should include IP address.

Additional info:
See screenshot attached.

evm.log:
Seek from date [2018-02-22T02:13:10.954452 #2330:a0f140] and below.
 -- : MIQ(network_router_controller-wait_for_task): Unable to create Network Router "router_fixed_ips": undefined method `[]' for nil:NilClass

ovirt-provider-ovn.log:
2018-02-22 09:13:11,277 root ip_address missing in the external gateway information.
Traceback (most recent call last):
  File "/usr/share/ovirt-provider-ovn/handlers/base_handler.py", line 131, in _handle_request
    method, path_parts, content)
  File "/usr/share/ovirt-provider-ovn/handlers/selecting_handler.py", line 175, in handle_request
    return self.call_response_handler(handler, content, parameters)
  File "/usr/share/ovirt-provider-ovn/handlers/neutron.py", line 36, in call_response_handler
    return response_handler(ovn_north, content, parameters)
  File "/usr/share/ovirt-provider-ovn/handlers/neutron_responses.py", line 205, in post_routers
    router = nb_db.add_router(received_router)
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north_mappers.py", line 59, in wrapper
    validate_rest_input(rest_data)
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north_mappers.py", line 565, in validate_add_rest_input
    RouterMapper._validate_external_gateway_info(rest_data)
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north_mappers.py", line 600, in _validate_external_gateway_info
    message.format(key=RouterMapper.REST_ROUTER_IP_ADDRESS)
RestDataError

Comment 2 Mor 2018-02-22 07:42:48 UTC
Created attachment 1399187 [details]
logs

Comment 3 Alona Kaplan 2018-02-22 08:39:46 UTC
When trying to add a router with external gateway to the open stack network manager get the following error.

Unable to create Network Router "trystack_router_gw": (rule:create_router and (rule:create_router:external_gateway_info and (rule:create_router:external_gateway_info:network_id and rule:create_router:external_gateway_info:enable_snat and rule:create_router:external_gateway_info:external_fixed_ips))) on {u'external_gateway_info': {u'network_id': u'eda11c37-395d-47a1-8bf5-03c2b6852ba8', u'enable_snat': False, u'external_fixed_ips': [{u'subnet_id': u'4514076b-41bd-4c55-bf12-e55372a04e67'}]}, u'name': u'trystack_router_gw', 'admin_state_up': True, 'tenant_id': u'c54816540e3a4ee0811862a522c1ca51', 'distributed': <object object at 0x7fb6e4301a80>, 'ha': <object object at 0x7fb6e4301a80>} by {'domain': None, 'project_name': u'facebook106712606521482', 'tenant_name': u'facebook106712606521482', 'project_domain': None, 'timestamp': '2018-02-22 08:37:23.736251', 'auth_token': 'd8258a2897b9431ca75b9d59896f87f8', 'resource_uuid': None, 'is_admin': False, 'user': u'b34df18789fc4e92b941b63b3d3bc49a', 'tenant': u'c54816540e3a4ee0811862a522c1ca51', 'read_only': False, 'project_id': u'c54816540e3a4ee0811862a522c1ca51', 'user_id': u'b34df18789fc4e92b941b63b3d3bc49a', 'show_deleted': False, 'roles': [u'_member_'], 'user_identity': 'b34df18789fc4e92b941b63b3d3bc49a c54816540e3a4ee0811862a522c1ca51 - - -', 'tenant_id': u'c54816540e3a4ee0811862a522c1ca51', 'request_id': 'req-d8e3c37f-3420-4c33-89a7-b0f9844169cb', 'user_domain': None, 'user_name': u'facebook106712606521482'} disallowed by policy

Comment 4 Scott Seago 2018-03-01 15:48:58 UTC
It's unclear from the comments whether this is happening with openstack, ovirt, or both. From the OpenStack API docs, they're somewhat vague on what parameter combinations are valid. With a clear reproducing case for OpenStack from MIQ, I can dig into seeing what exactly OpenStack needs from MIQ. Hopefully that's consistent with what ovirt needs.

Also, the screenshot is gone.

Comment 5 Scott Seago 2018-03-01 18:51:54 UTC
Upon further investigation, with the OpenStack provider the existing UI actually works as-is. I can create a router, select a subnet for the gateway interface, and the OpenStack API call succeeds, creating a router with an interface on that network with OpenStack choosing the IP address. Perhaps the IP address failure only happens with the Ovirt provider? If that's the case, 1) this BZ should probably be taken over by someone who works on maintaining the ovirt provider and 2) whatever fix is put in place needs to take into account that for OpenStack, *not* providing an explicit IP address is a valid use case.

Comment 6 Marcin Mirecki 2018-03-06 09:18:59 UTC
Looking at the Networking API:
    https://developer.openstack.org/api-ref/network/v2/#routers-routers
the definition of "external_fixed_ips" says:
    "Each element of the list is a dictionary of ip_address and subnet_id."
which suggests that both fields are mandatory.

If we want to have the IP optional, the docs should be updated (as is in the case of port fixed_ips for example).
With the current definition, accepting "external_fixed_ips" without "ip_address" seems to be wrong.

Also adding a router port with a random IP is not very useful. The gateway should rather be something that we specify, not that is randomly generated.

Comment 7 Mor 2018-03-06 09:30:12 UTC
I also agree, there should be at least an option to supply IP address in the UI. Otherwise, what is the point of having 'external_fixed_ips' for something that is allocated automatically?

Comment 8 Scott Seago 2018-03-13 14:26:24 UTC
So there are a few things going on here:
1) It's still unclear whether the bug as reported was an ovirt problem or an OpenStack one. I can't reproduce the problem as stated with OpenStack -- it works for me. Perhaps ovirt requires submitting the IP address along with a subnet.

2) For OpenStack at least, the IP address supplied is *not* the gateway forwarding IP address, it is the IP address of the *local* interface on the externally-facing subnet which contains the gateway. If we don't supply it, then OpenStack assigns it, and that IP address is returned from the OpenStack API. It's not randomly generated in MIQ -- it's generated by OpenStack.

3) Regarding the OpenStack docs, I would agree that the docs are misleading here. This would be an OpenStack issue rather than a MIQ one, but it's probably worth submitting it. Either the API should require an IP address for each gateway network in the external_fixed_ips, or the docs should explicitly state that it's not needed.

4) For the OpenStack use case, if supplying a subnet_id without an IP address is valid for router creation (using the returned IP address from openstack), then adding the explicit IP address field (as optional) seems more like an RFE here.

5) If the UI is currently broken for the ovirt use case, then it's a real bug, but the fix needs to reflect the fact that for OpenStack the field is currently not required.

Comment 9 Marcin Mirecki 2018-03-15 11:16:06 UTC
> 1) It's still unclear whether the bug as reported was an ovirt problem or an
> OpenStack one. I can't reproduce the problem as stated with OpenStack -- it
> works for me. Perhaps ovirt requires submitting the IP address along with a
> subnet.

ovirt-provider-ovn does requires submitting the IP address along with a subnet, so this could be a possible cause for the problem indeed.


> 2) For OpenStack at least, the IP address supplied is *not* the gateway
> forwarding IP address, it is the IP address of the *local* interface on the
> externally-facing subnet which contains the gateway. If we don't supply it,
> then OpenStack assigns it, and that IP address is returned from the
> OpenStack API. It's not randomly generated in MIQ -- it's generated by
> OpenStack.

If generating the IP (when not provided) is the desired behaviour, ovirt can be changed to behave the same way. Can you please open a bug for this? 
It would be nice to change the Openstack docs before doing this.

> 
> 3) Regarding the OpenStack docs, I would agree that the docs are misleading
> here. This would be an OpenStack issue rather than a MIQ one, but it's
> probably worth submitting it. Either the API should require an IP address
> for each gateway network in the external_fixed_ips, or the docs should
> explicitly state that it's not needed.

+1 on either option

> 
> 4) For the OpenStack use case, if supplying a subnet_id without an IP
> address is valid for router creation (using the returned IP address from
> openstack), then adding the explicit IP address field (as optional) seems
> more like an RFE here.
> 
> 5) If the UI is currently broken for the ovirt use case, then it's a real
> bug, but the fix needs to reflect the fact that for OpenStack the field is
> currently not required.

Comment 10 Scott Seago 2018-03-15 17:37:01 UTC
Regarding 2) and 3) for OpenStack, in digging into the docs, I'm seeing that the ability to specify subnet and/or IP address in external_fixed_ips for the externa_gateway_info on a router was specified to use the same format as the fixed_ips field for port creation (as found at https://specs.openstack.org/openstack/neutron-specs/specs/kilo/specify-router-ext-ip.html )

Digging into the port fixed_ips API specs, it looks like the correct answer is that either subnet_id or ip_address or both are allowed there:

"The IP addresses for the port. If you would like to assign multiple IP addresses for the port, specify multiple entries in this field. Each entry consists of IP address (ip_address) and the subnet ID from which the IP address is assigned (subnet_id).

    If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the IP address on that subnet to the port.
    If you specify only a subnet ID, OpenStack Networking allocates an available IP from that subnet to the port.
    If you specify only an IP address, OpenStack Networking tries to allocate the IP address if the address is a valid IP for any of the subnets on the specified network."

https://developer.openstack.org/api-ref/network/v2/#create-port


Note You need to log in before you can comment on or make changes to this bug.