Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b
Signed-off-by: Michael Lando <ml636r@att.com>
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb
new file mode 100644
index 0000000..9313aa8
--- /dev/null
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb
@@ -0,0 +1,49 @@
+cluster_name = ''
+cluster_name = node['cassandra'][:cluster_name]+node.chef_environment
+
+cas_ips=''
+cas_ips=node['Nodes'][:CS]
+
+interface = node['interfaces']['application']
+application_host = ''
+node['network']['interfaces'][interface][:addresses].each do | addr , details |
+ if details['family'] == ('inet')
+ application_host = addr
+ end
+end
+
+
+template "cassandra-yaml-config" do
+ path "/etc/cassandra/cassandra.yaml"
+ source "cassandra.yaml.erb"
+ owner "cassandra"
+ group "cassandra"
+ mode "0755"
+ variables ({
+ :cassandra_cluster => cluster_name,
+ :cassandra_data_dir => node['cassandra'][:data_dir],
+ :cassandra_commitlog_dir => node['cassandra'][:commitlog_dir],
+ :cassandra_cache_dir => node['cassandra'][:cache_dir],
+ :seeds_address => cas_ips,
+ :listen_address => application_host,
+ :broadcast_address => application_host,
+ :broadcast_rpc_address => application_host,
+ :rpc_address => "0.0.0.0",
+ :num_tokens => node['cassandra'][:num_tokens],
+ :internode_encryption => "none",
+ :cassandra_truststore_dir => "/etc/cassandra/cs_trust"
+ })
+end
+
+rackNum=1
+template "cassandra-rackdc.properties" do
+ path "/etc/cassandra/cassandra-rackdc.properties"
+ source "cassandra-rackdc.properties.erb"
+ owner "cassandra"
+ group "cassandra"
+ mode "0755"
+ variables ({
+ :dc => "DC-"+node.chef_environment,
+ :rack => "Rack"+"#{rackNum}-"+node.chef_environment
+ })
+end
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb
new file mode 100644
index 0000000..627bd6f
--- /dev/null
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb
@@ -0,0 +1,8 @@
+template "/tmp/create_cassandra_user.sh" do
+ source "create_cassandra_user.sh.erb"
+ mode 0755
+ variables({
+ :cassandra_ip => "HOSTIP"
+ })
+end
+
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb
new file mode 100644
index 0000000..92a81eb
--- /dev/null
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb
@@ -0,0 +1,8 @@
+template "/tmp/create_dox_keyspace.sh" do
+ source "create_dox_keyspace.sh.erb"
+ mode 0755
+ variables({
+ :cassandra_ip => "HOSTIP"
+ })
+end
+
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb
new file mode 100644
index 0000000..7c40c50
--- /dev/null
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb
@@ -0,0 +1,35 @@
+cookbook_file "/tmp/sdctool.tar" do
+ source "sdctool.tar"
+ mode 0755
+end
+
+## extract sdctool.tar
+bash "install tar" do
+ cwd "/tmp"
+ code <<-EOH
+ /bin/tar xvf /tmp/sdctool.tar -C /tmp
+ EOH
+end
+
+
+template "/tmp/sdctool/config/configuration.yaml" do
+ source "configuration.yaml.erb"
+ mode 0755
+ variables({
+ :host_ip => node['HOST_IP'],
+ :catalog_port => node['BE'][:http_port],
+ :ssl_port => node['BE'][:https_port],
+ :cassandra_ip => node['Nodes']['CS'],
+ :rep_factor => 1,
+ :dc1 => "DC-"+node.chef_environment
+ })
+end
+
+template "/tmp/sdctool/config/elasticsearch.yml" do
+ source "elasticsearch.yml.erb"
+ mode 0755
+ variables({
+ :elastic_ip => "HOSTIP"
+ })
+end
+