Skip to content

Commit

Permalink
Introduce UI for Nuage events
Browse files Browse the repository at this point in the history
With the introduction of Nuage event catcher, users need to be able to
configure the AMQP connection for their Nuage network manager. This
patch adds a secondary tab for the Events allowing users to opt-in and
create authentication for the AMQP. Complete validation of all
credentials is supported.

Signed-off-by: Gregor Berginc <gregor.berginc@xlab.si>
  • Loading branch information
gberginc committed Sep 19, 2017
1 parent ac02d7b commit 2844384
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Expand Up @@ -394,6 +394,10 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', '
if ($scope.emsCommonModel.emstype === 'openstack') {
$scope.emsCommonModel.tenant_mapping_enabled = false;
}
} else if ($scope.emsCommonModel.emstype === 'nuage_network') {
$scope.emsCommonModel.default_api_port = $scope.getDefaultApiPort($scope.emsCommonModel.emstype);
$scope.emsCommonModel.event_stream_selection = "none";
$scope.emsCommonModel.amqp_security_protocol = 'non-ssl';
} else if ($scope.emsCommonModel.emstype === 'scvmm') {
$scope.emsCommonModel.default_security_protocol = 'ssl';
} else if ($scope.emsCommonModel.emstype === 'rhevm') {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/ems_common.rb
Expand Up @@ -482,7 +482,7 @@ def retrieve_vmware_cloud_api_versions
end

def retrieve_nuage_api_versions
[['Version 3.2', 'v3_2'], ['Version 4.0', 'v4_0']]
[['Version 3.2', 'v3_2'], ['Version 4.0', 'v4_0'], ['Version 5.0', 'v5.0']]
end

def retrieve_security_protocols
Expand Down
1 change: 1 addition & 0 deletions app/controllers/mixins/ems_common_angular.rb
Expand Up @@ -499,6 +499,7 @@ def set_ems_record_vars(ems, mode = nil)

if ems.kind_of?(ManageIQ::Providers::Nuage::NetworkManager)
default_endpoint = {:role => :default, :hostname => hostname, :port => port, :security_protocol => ems.security_protocol}
amqp_endpoint = {:role => :amqp, :hostname => amqp_hostname, :port => amqp_port, :security_protocol => amqp_security_protocol}
end

if ems.kind_of?(ManageIQ::Providers::Lenovo::PhysicalInfraManager)
Expand Down
Expand Up @@ -28,8 +28,9 @@
"prefix" => prefix.to_s,
"reset-validation-status" => "#{prefix}_auth_status")
.col-md-8{"ng-if" => "emsCommonModel.emstype == 'nuage_network'"}
- prefix == "amqp" ? security_protocols = @amqp_security_protocols : security_protocols = @nuage_security_protocols
= select_tag("#{prefix}_security_protocol",
options_for_select([["<#{_('Choose')}>", nil]] + @nuage_security_protocols, :disabled => ["<#{_('Choose')}>", nil]),
options_for_select([["<#{_('Choose')}>", nil]] + security_protocols, :disabled => ["<#{_('Choose')}>", nil]),
"ng-model" => "#{ng_model}.#{prefix}_security_protocol",
"checkchange" => "",
"required" => defined?(security_protocol_not_required) ? false : true,
Expand Down
14 changes: 10 additions & 4 deletions app/views/layouts/angular/_multi_auth_credentials.html.haml
Expand Up @@ -33,6 +33,10 @@
= _("Web Services")
= miq_tab_header('ipmi', nil, {'ng-click' => "changeAuthTab('ipmi')"}) do
= _("IPMI")
- elsif %w(ems_network).include?(controller_name)
= miq_tab_header('amqp', nil, {'ng-click' => "changeAuthTab('amqp')"}) do
%i{"error-on-tab" => "amqp", :style => "color:#cc0000"}
= _("Events")

.tab-content
= miq_tab_content('default', 'default') do
Expand Down Expand Up @@ -141,7 +145,7 @@
%span{:style => "color:black"}
= _("Required. Used to gather Utilization data.")

- if %w(ems_cloud ems_infra).include?(params[:controller])
- if %w(ems_cloud ems_infra ems_network).include?(params[:controller])
= miq_tab_content('metrics', 'default') do
.form-group
.col-md-12{"ng-if" => "#{ng_model}" == "emsCommonModel" && "#{ng_model}.emstype == 'rhevm'"}
Expand Down Expand Up @@ -171,8 +175,8 @@
= _("Used to gather Capacity & Utilization metrics.")
= miq_tab_content('amqp', 'default') do
.form-group
.col-md-12{"ng-if" => "#{ng_model}" == "emsCommonModel" && "#{ng_model}.emstype == 'openstack' || #{ng_model}.emstype == 'openstack_infra' || #{ng_model}.emstype == 'vmware_cloud'"}
%label.radio-inline.control-label{"for" => "none_radio", "ng-show" => "#{ng_model}.emstype == 'vmware_cloud'"}
.col-md-12{"ng-if" => "#{ng_model}" == "emsCommonModel" && "#{ng_model}.emstype == 'openstack' || #{ng_model}.emstype == 'openstack_infra' || #{ng_model}.emstype == 'vmware_cloud' || #{ng_model}.emstype == 'nuage_network'"}
%label.radio-inline.control-label{"for" => "none_radio", "ng-show" => "#{ng_model}.emstype == 'vmware_cloud' || #{ng_model}.emstype == 'nuage_network'"}
%input{:type => "radio",
:name => "event_stream_selection",
:id => "none_radio",
Expand Down Expand Up @@ -218,7 +222,7 @@
:prefix => "amqp",
:basic_info_needed => true}
.form-group
.col-md-12{"ng-if" => "#{ng_model}" == "emsCommonModel" && "#{ng_model}.emstype == 'openstack' || #{ng_model}.emstype == 'openstack_infra'"}
.col-md-12{"ng-if" => "#{ng_model}" == "emsCommonModel" && "#{ng_model}.emstype == 'openstack' || #{ng_model}.emstype == 'openstack_infra' || #{ng_model}.emstype == 'nuage_network'"}
%span{:style => "color:black"}
%div{"ng-if" => "emsCommonModel.event_stream_selection == 'amqp'"}
= _("Used to authenticate with OpenStack AMQP Messaging Bus for event handling. Configure AMQP if eventing is not enabled on Ceilometer.")
Expand Down Expand Up @@ -408,6 +412,8 @@
$('#auth_tabs').show();
%div{"ng-if" => "#{ng_model}.emstype == 'nuage_network'"}
:javascript
miq_tabs_show_hide("#amqp_tab", true);
miq_tabs_show_hide("#metrics_tab", false);
miq_tabs_init('#auth_tabs');
$('#auth_tabs').show();
%div{"ng-if" => "#{ng_model}.ems_controller == 'ems_container'"}
Expand Down

0 comments on commit 2844384

Please sign in to comment.