Bug 1426268

Summary: [RFE] Routers do not allow you to set/clear external network gateway
Product: Red Hat CloudForms Management Engine Reporter: Ido Ovadia <iovadia>
Component: ProvidersAssignee: Gilles Dubreuil <gdubreui>
Status: CLOSED CURRENTRELEASE QA Contact: Ido Ovadia <iovadia>
Severity: high Docs Contact:
Priority: high    
Version: 5.7.0CC: cpelland, iovadia, jfrey, jhardy, obarenbo, simaishi, tzumainn
Target Milestone: GAKeywords: FutureFeature, TestOnly, ZStream
Target Release: 5.8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: openstack:sdn
Fixed In Version: 5.8.0.7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1434549 (view as bug list) Environment:
Last Closed: 2017-06-12 17:40:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Openstack Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1434549    

Description Ido Ovadia 2017-02-23 15:07:39 UTC
Description of problem:
=======================
After a router was created there should be an option to Set/Clear External Network Gateway.

* It could be helpful to have the option to set the External GW also on creating the router  



Version-Release number of selected component:
=============================================
5.7.1.3

Comment 4 Gilles Dubreuil 2017-03-10 06:11:14 UTC
There are actually three points to look after here.

1 - Clear External gateway
The configuration button need to have such option to clear any gateway attached to a router

2 - The gateway should be automatically set up when a cloud network is selected.
During creation, when a network is selected (after choosing the network provider), the selected cloud network should be attached to as the gateway. This is actually Neutron default to enable Source NAT and adds to the list of fixed IP addresses the first subnet attached to the cloud network. This is shown by the following work-flow example.


(neutron) router-list
+--------------------------------------+-----------------+-----------------------+-------------+-------+
| id                                   | name            | external_gateway_info | distributed | ha    |
+--------------------------------------+-----------------+-----------------------+-------------+-------+
| a64d381d-7b63-4e9c-9665-e0c87fa0b62f | internal_router | null                  | False       | False |
+--------------------------------------+-----------------+-----------------------+-------------+-------+


(neutron) net-list                                                                                                              
+--------------------------------------+---------------+---------------------------------------------------+
| id                                   | name          | subnets                                           |
+--------------------------------------+---------------+---------------------------------------------------+
| caa9d574-77d6-405a-af30-f13e49304654 | external      | 45180b69-8bb8-4518-b104-6fdfc3e45d21 192.0.2.0/24 |
|                                      |               | ad310937-1d60-4a06-a8bd-8bda155fd866 192.0.4.0/24 |
+--------------------------------------+---------------+---------------------------------------------------+
(neutron) subnet-list
+--------------------------------------+------------------+--------------+------------------------------------------------+
| id                                   | name             | cidr         | allocation_pools                               |
+--------------------------------------+------------------+--------------+------------------------------------------------+
| 45180b69-8bb8-4518-b104-6fdfc3e45d21 | external_subnet  | 192.0.2.0/24 | {"start": "192.0.2.210", "end": "192.0.2.230"} |
| ad310937-1d60-4a06-a8bd-8bda155fd866 | external_subnet3 | 192.0.4.0/24 | {"start": "192.0.4.210", "end": "192.0.4.230"} |
+--------------------------------------+------------------+--------------+------------------------------------------------+

(neutron) router-gateway-set internal_router external 
Set gateway for router internal_router

(neutron) router-list
+--------------------------------------+-----------------+-----------------------------------------------+-------------+-------+
| id                                   | name            | external_gateway_info                         | distributed | ha    |
+--------------------------------------+-----------------+-----------------------------------------------+-------------+-------+
| a64d381d-7b63-4e9c-9665-e0c87fa0b62f | internal_router | {"network_id": "caa9d574-77d6-405a-           | False       | False |
|                                      |                 | af30-f13e49304654", "enable_snat": true,      |             |       |
|                                      |                 | "external_fixed_ips": [{"subnet_id":          |             |       |
|                                      |                 | "45180b69-8bb8-4518-b104-6fdfc3e45d21",       |             |       |
|                                      |                 | "ip_address": "192.0.2.214"}]}                |             |       |
+--------------------------------------+-----------------+-----------------------------------------------+-------------+-------+

3 - Editing the router
The previous workflow can be re-applied when editing a router. So the edit page to offer the same feature.
Neutron allows to modify a router's gateway. There is no need to reset the gateway and even recreate a router to change the gateway, as shown by here:

(neutron) router-list
+--------------------------------------+-----------------+-----------------------------------------------+-------------+-------+
| id                                   | name            | external_gateway_info                         | distributed | ha    |
+--------------------------------------+-----------------+-----------------------------------------------+-------------+-------+
| a64d381d-7b63-4e9c-9665-e0c87fa0b62f | internal_router | {"network_id": "caa9d574-77d6-405a-           | False       | False |
|                                      |                 | af30-f13e49304654", "enable_snat": true,      |             |       |
|                                      |                 | "external_fixed_ips": [{"subnet_id":          |             |       |
|                                      |                 | "45180b69-8bb8-4518-b104-6fdfc3e45d21",       |             |       |
|                                      |                 | "ip_address": "192.0.2.214"}]}                |             |       |
+--------------------------------------+-----------------+-----------------------------------------------+-------------+-------+

(neutron) router-gateway-set internal_router external  --fixed-ip subnet_id=ad310937-1d60-4a06-a8bd-8bda155fd866
Set gateway for router internal_router

(neutron) router-list
+--------------------------------------+------------------+----------------------------------------------+-------------+-------+
| id                                   | name             | external_gateway_info                        | distributed | ha    |
+--------------------------------------+------------------+----------------------------------------------+-------------+-------+
| a64d381d-7b63-4e9c-9665-e0c87fa0b62f | internal_router  | {"network_id": "caa9d574-77d6-405a-          | False       | False |
|                                      |                  | af30-f13e49304654", "enable_snat": true,     |             |       |
|                                      |                  | "external_fixed_ips": [{"subnet_id":         |             |       |
|                                      |                  | "ad310937-1d60-4a06-a8bd-8bda155fd866",      |             |       |
|                                      |                  | "ip_address": "192.0.4.212"}]}               |             |       |
+--------------------------------------+------------------+----------------------------------------------+-------------+-------+

 
4 - Multiple "External Fixed IPs" can be assigned
I believe another RFE to be created for the feature to add multiple subnets

Comment 5 Gilles Dubreuil 2017-03-17 10:07:21 UTC
Pull request for master branch is now available:

https://github.com/ManageIQ/manageiq-ui-classic/pull/716

Comment 6 Gilles Dubreuil 2017-03-21 00:05:49 UTC
Patch has been merged on master branch.
Back port to follow.

Comment 8 CFME Bot 2017-03-27 16:55:54 UTC
New commit detected on ManageIQ/manageiq/euwe:
https://github.com/ManageIQ/manageiq/commit/7ff8f11e2c5d4b7d1e70eb0d6727fd118c351752

commit 7ff8f11e2c5d4b7d1e70eb0d6727fd118c351752
Author:     Gilles Dubreuil <gilles>
AuthorDate: Wed Mar 22 10:36:24 2017 +1100
Commit:     Gilles Dubreuil <gilles>
CommitDate: Thu Mar 23 11:32:31 2017 +1100

    [EUWE] Network router gateway setup
    
    The external gateway information wasn't fully handled.
    Now external gateway values are correctly set up allowing to add reset
    ("clear") the gateway.
    
    https://github.com/ManageIQ/manageiq-ui-classic/pull/716
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1426268

 .../network_router_form_controller.js              | 60 +++++++++++---
 app/controllers/network_router_controller.rb       | 92 ++++++++++++++++++++--
 app/views/network_router/_common_new_edit.haml     | 76 ++++++++++++++++++
 .../network_router/add_interface_select.html.haml  |  1 -
 app/views/network_router/edit.html.haml            | 14 +---
 app/views/network_router/new.html.haml             | 37 ++-------
 .../remove_interface_select.html.haml              |  1 -
 config/routes.rb                                   |  1 +
 spec/controllers/network_router_controller_spec.rb |  2 +-
 9 files changed, 219 insertions(+), 65 deletions(-)
 create mode 100644 app/views/network_router/_common_new_edit.haml

Comment 9 Ido Ovadia 2017-03-30 09:03:25 UTC
Verified
========
CFME 5.8.0.7
RHOS 10