aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-os-chef
diff options
context:
space:
mode:
authorAreli, Fuss (af732p) <af732p@intl.att.com>2018-04-24 13:59:00 +0300
committerAreli, Fuss (af732p) <af732p@att.com>2018-04-24 14:59:09 +0300
commitc033cdce906efc3b6ccd1d2f45544af47e328ed4 (patch)
tree40c4657a73d9a52f5f2784cff9a3dcb1833467ce /sdc-os-chef
parentc175a0de2f05d37c1c774684318a525eb96bb59b (diff)
Add cluster resiliance support
Add configuration support for CS/ES cluster and add truststore default files to support ssl connection Change-Id: Icc2831704e8a3c55ce9b380a39001891ce8d41ab Issue-ID: SDC-1254 Signed-off-by: Areli, Fuss (af732p) <af732p@intl.att.com>
Diffstat (limited to 'sdc-os-chef')
-rw-r--r--sdc-os-chef/environments/Template.json10
-rw-r--r--sdc-os-chef/scripts/k8s/kubernetes_run.sh8
-rw-r--r--sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb10
-rw-r--r--sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb4
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb11
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb7
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb7
-rw-r--r--sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb9
8 files changed, 45 insertions, 21 deletions
diff --git a/sdc-os-chef/environments/Template.json b/sdc-os-chef/environments/Template.json
index 9073f2c562..dae0860861 100644
--- a/sdc-os-chef/environments/Template.json
+++ b/sdc-os-chef/environments/Template.json
@@ -35,12 +35,16 @@
"fqdn": ["10.0.11.1", "10.0.11.1"]
},
"Nodes": {
- "CS": "yyy",
+ "CS": [
+ "yyy"
+ ],
"BE": "yyy",
"ONBOARDING_BE": "yyy",
"FE": "yyy",
- "ES": "yyy",
- "KB": "yyy"
+ "ES": [
+ "yyy"
+ ],
+ "KB": "yyy"
},
"Plugins": {
"DCAE": {
diff --git a/sdc-os-chef/scripts/k8s/kubernetes_run.sh b/sdc-os-chef/scripts/k8s/kubernetes_run.sh
index 7a73c2af3b..41797fcdca 100644
--- a/sdc-os-chef/scripts/k8s/kubernetes_run.sh
+++ b/sdc-os-chef/scripts/k8s/kubernetes_run.sh
@@ -90,7 +90,7 @@ status $?
# SDC LOGS Tree #
####################
print_header "SDC - Deploy Pods ..."
-mkdir -p /dockerdata-nfs/onap/sdc/logs//BE/SDC/SDC-BE
-mkdir -p /dockerdata-nfs/onap/sdc/logs/FE/SDC/SDC-FE
-mkdir -p /dockerdata-nfs/onap/sdc/logs/ONBOARD/SDC/ONBOARD-BE
-chmod -R 777 /dockerdata-nfs/onap/sdc/logs/*
+sudo mkdir -p /dockerdata-nfs/onap/sdc/logs//BE/SDC/SDC-BE
+sudo mkdir -p /dockerdata-nfs/onap/sdc/logs/FE/SDC/SDC-FE
+sudo mkdir -p /dockerdata-nfs/onap/sdc/logs/ONBOARD/SDC/ONBOARD-BE
+sudo chmod -R 777 /dockerdata-nfs/onap/sdc/logs/*
diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb
index 68c1154ec6..f32e736f53 100644
--- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb
+++ b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb
@@ -1,3 +1,10 @@
+elasticsearch_list = ''
+
+node['Nodes']['ES'].each do |item|
+ elasticsearch_list += "- " + item + ":9300\n"
+end
+
+
template "/usr/share/elasticsearch/config/elasticsearch.yml" do
source "ES-elasticsearch.yml.erb"
owner "elasticsearch"
@@ -6,7 +13,8 @@ template "/usr/share/elasticsearch/config/elasticsearch.yml" do
variables({
:cluster_name => node['elasticsearch'][:cluster_name]+node.chef_environment,
:node_name => node[:hostname],
- :ES_IP => node['Nodes']['ES'],
+ :es_ip_list => "#{elasticsearch_list}",
+ :es_ip_list_XXX => node['Nodes']['ES'],
:num_of_shards => node['elasticsearch'][:num_of_shards],
:num_of_replicas => node['elasticsearch'][:num_of_replicas]
})
diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb
index 613e6b046b..0a2057dca6 100644
--- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb
+++ b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb
@@ -1,14 +1,14 @@
network.host: 0.0.0.0
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.enabled: true
-#discovery.zen.ping.unicast.hosts: <%= @ES_IP %>
+#discovery.zen.ping.unicast.hosts: <%= @es_ip_list_XXXXX %>
cluster.name: <%= @cluster_name %>
node.name: <%= @node_name %>
elasticSearch.transportclient: true
transport.client.initial_nodes:
- - <%= @ES_IP %>:9300
+<%= @es_ip_list %>
index.number_of_shards: <%= @num_of_shards %>
index.number_of_replicas: <%= @num_of_replicas %>
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb
index 35bf49fb6d..8ee4087325 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -233,13 +236,13 @@ bash "create audit mapping" do
},
"_all": { "enabled": true } }
},
- "aliases": { "last_3_months": {}}}' http://#{node['Nodes']['ES']}:9200/_template/audit_template
+ "aliases": { "last_3_months": {}}}' http://#{es_node}:9200/_template/audit_template
EOH
end
bash "set default index for Kibana" do
code <<-EOH
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}'
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}'
+ curl -XPUT http://#{es_node}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}'
+ curl -XPUT http://#{es_node}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}'
EOH
end
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb
index d35b81293e..11b8c9d060 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -32,6 +35,6 @@ bash "create resources mapping" do
"_all": { "enabled": true }
}
}
- }' http://#{node['Nodes']['ES']}:9200/_template/resources_template
+ }' http://#{es_node}:9200/_template/resources_template
EOH
end \ No newline at end of file
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb
index 02b20f8cce..685b468e7a 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -48,6 +51,6 @@ bash "create monitoring mapping" do
}
},
"aliases": { "last_3_months": {} }
- }' http://#{node['Nodes']['ES']}:9200/_template/monitoring_template
+ }' http://#{es_node}:9200/_template/monitoring_template
EOH
end
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb
index 08c3fac613..53497133f5 100644
--- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb
+++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb
@@ -1,8 +1,11 @@
+# Get the first es node in the list
+es_node = node['Nodes']['ES'].first
+
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
- curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
+ curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
@@ -25,7 +28,7 @@ bash "create Kibana dashboard" do
for file in /root/chef-solo/cookbooks/sdc-init-elasticsearch/files/default/dashboard_*.json; do
name=`basename $file .json | awk -F"_" '{print $2}'`
echo "Loading dashboard $name:"
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/dashboard/$name -d @$file || exit 1
+ curl -XPUT http://#{es_node}:9200/.kibana/dashboard/$name -d @$file || exit 1
echo
done
EOH
@@ -36,7 +39,7 @@ bash "create Kibana visualization" do
for file in /root/chef-solo/cookbooks/sdc-init-elasticsearch/files/default/visualization_*.json; do
name=`basename $file .json | awk -F"_" '{print $2}'`
echo "Loading visualization $name:"
- curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/visualization/$name -d @$file || exit 1
+ curl -XPUT http://#{es_node}:9200/.kibana/visualization/$name -d @$file || exit 1
echo
done
EOH
pan class="p">} ${scenario} ${test_suite_name} ${test_case_name} ${pnf} ${secured_package} ${onboarding_package_name}= Run Keyword If "${secured_package}"=='FALSE' Catenate ${package_folder}.csar ... ELSE Catenate ${package_folder}.zip ${result}= Run VNFSDK Validate Request ${onboarding_package_name} ${onboarding_package_path} ${scenario} ${test_suite_name} ${test_case_name} ${pnf} Log ${result.json()} ${json}= Set Variable ${result.json()} ${status}= Set Variable ${json[0]['results']['criteria']} Should Be Equal As Strings ${status} PASS Run VNFSDK Validate Request [Arguments] ${onboarding_package_name} ${onboarding_package_path} ${scenario} ${test_suite_name} ${test_case_name} ${pnf} ${arguments}= Create Dictionary scenario=${scenario} onboarding_package_path=${onboarding_package_path} test_suite_name=${test_suite_name} test_case_name=${test_case_name} pnf=${pnf} file_name=${onboarding_package_name} Templating.Create Environment vnfsdk ${GLOBAL_TEMPLATE_FOLDER} ${executions}= Templating.Apply Template vnfsdk ${VNFSDK_TEST} ${arguments} ${fileData}= Get Binary File ${onboarding_package_path} ${fileDir} ${fileName}= Split Path ${onboarding_package_path} ${file_part}= Create List ${fileName} ${fileData} application/octet-stream ${executions_parts}= Create List ${executions} ${fileParts}= Create Dictionary Set to Dictionary ${fileParts} file=${file_part} Set to Dictionary ${fileParts} executions=${executions} ${resp}= Run VNFSDK Post Request /onapapi/vnfsdk-marketplace/v1/vtp/executions ${fileParts} [Return] ${resp} Validate Not Valid Onboarding Package [Arguments] ${package_folder} ${onboarding_package_path} ${scenario} ${test_suite_name} ${test_case_name} ${pnf} ${failed_req_list} ${secured_package} ${onboarding_package_name}= Run Keyword If "${secured_package}"=='FALSE' Catenate ${package_folder}.csar ... ELSE Catenate ${package_folder}.zip ${result}= Run VNFSDK Validate Request ${onboarding_package_name} ${onboarding_package_path} ${scenario} ${test_suite_name} ${test_case_name} ${pnf} Log ${result.json()} ${json}= Set Variable ${result.json()} ${status}= Set Variable ${json[0]['results']['criteria']} Should Be Equal As Strings ${status} FAILED ${status_req_list}= Set Variable ${json[0]['results']['results']} ${failed_req_from_test_run}= Create List :FOR ${status_req} IN @{status_req_list} \ ${req_status}= Get From Dictionary ${status_req} passed \ Run Keyword If "${req_status}"=='False' Add Failed Requirement To List ${status_req} ${failed_req_from_test_run} vnfreqName Log ${failed_req_from_test_run} Lists Should Be Equal ${failed_req_from_test_run} ${failed_req_list} Add Failed Requirement To List [Arguments] ${status_req} ${failed_req} ${param_name} ${req}= Get From Dictionary ${status_req} ${param_name} Append To List ${failed_req} ${req} Get And Comapre Error Responses From SDC API [Arguments] ${resp} ${sdc_response} ${json}= Set Variable ${resp.json()} ${sdc_response_list} Set Variable ${json['errors']['uploadFile']} ${failed_req_from_test_run}= Create List :FOR ${message_item} IN @{sdc_response_list} \ ${req_status}= Get From Dictionary ${message_item} level \ Run Keyword If "${req_status}"=='ERROR' Add Failed Requirement To List ${message_item} ${failed_req_from_test_run} message Log ${failed_req_from_test_run} Lists Should Be Equal ${failed_req_from_test_run} ${sdc_response} Validate Onboarding Package In SDC [Arguments] ${onboarding_package_path} ${package_folder} ${sdc_validation} ${negative_test_case} ${sdc_response} ${sdc_cert} ${license_model_id} ${license_model_version_id}= Add SDC License Model ${license_temp_date}= Get Current Date ${license_start_date}= Get Current Date result_format=%m/%d/%Y ${license_end_date}= Add Time To Date ${license_temp_date} 365 days result_format=%m/%d/%Y ${key_group_id}= Add SDC License Group ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date} ${pool_id}= Add SDC Entitlement Pool ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date} ${feature_group_id}= Add SDC Feature Group ${license_model_id} ${key_group_id} ${pool_id} ${license_model_version_id} ${license_agreement_id}= Add SDC License Agreement ${license_model_id} ${feature_group_id} ${license_model_version_id} Submit SDC License Model ${license_model_id} ${license_model_version_id} ${license_model_resp}= Get SDC License Model ${license_model_id} ${license_model_version_id} ${software_product_id} ${software_product_version_id}= Add SDC Software Product ${license_agreement_id} ${feature_group_id} ${license_model_resp['vendorName']} ${license_model_id} ${license_model_version_id} ${package_folder} ${resp}= Upload SDC Heat Package ${software_product_id} ${onboarding_package_path} ${software_product_version_id} Run Keyword If "${negative_test_case}"=='TRUE' or "${sdc_cert}"=='sdc-invalid' Get And Comapre Error Responses From SDC API ${resp} ${sdc_response} ... ELSE Validate SDC Software Product ${software_product_id} ${software_product_version_id}