From 5524c8910fdcbfaaf525e8a160473042e5ab9dcc Mon Sep 17 00:00:00 2001 From: Vahid Hashemian Date: Thu, 1 Oct 2015 16:08:32 -0700 Subject: [PATCH] Add translation of CSAR archives Add support for translation of CSAR archives and include unit tests to verify their translation and invalid scenarios. This patch also includes minor cleanup of the code. Change-Id: Ibc872d61f41ec68a5eaea737b30b7e92b880801f Implements: blueprint tosca-csar-translation --- translator/tests/data/csar_elk.zip | Bin 0 -> 17488 bytes translator/tests/data/csar_hello_world.zip | Bin 0 -> 936 bytes .../tests/data/csar_metadata_not_yaml.zip | Bin 0 -> 936 bytes translator/tests/data/csar_not_zip.zip | 1 + .../data/csar_single_instance_wordpress.zip | Bin 0 -> 5967 bytes .../csar_wordpress_invalid_import_path.zip | Bin 0 -> 5971 bytes .../csar_wordpress_invalid_script_url.zip | Bin 0 -> 6034 bytes .../tests/data/csar_wrong_metadata_file.zip | Bin 0 -> 873 bytes .../data/hot_output/hot_elk_from_csar.yaml | 555 ++++++++++++++++++ ...a_helloworld.yaml => hot_hello_world.yaml} | 0 ...t_single_instance_wordpress_from_csar.yaml | 200 +++++++ .../tests/test_tosca_hot_translation.py | 214 +++++-- 12 files changed, 913 insertions(+), 57 deletions(-) create mode 100644 translator/tests/data/csar_elk.zip create mode 100644 translator/tests/data/csar_hello_world.zip create mode 100644 translator/tests/data/csar_metadata_not_yaml.zip create mode 100644 translator/tests/data/csar_not_zip.zip create mode 100644 translator/tests/data/csar_single_instance_wordpress.zip create mode 100644 translator/tests/data/csar_wordpress_invalid_import_path.zip create mode 100644 translator/tests/data/csar_wordpress_invalid_script_url.zip create mode 100644 translator/tests/data/csar_wrong_metadata_file.zip create mode 100644 translator/tests/data/hot_output/hot_elk_from_csar.yaml rename translator/tests/data/hot_output/{hot_tosca_helloworld.yaml => hot_hello_world.yaml} (100%) create mode 100644 translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml diff --git a/translator/tests/data/csar_elk.zip b/translator/tests/data/csar_elk.zip new file m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AR2SaNX zTucjFjOV8M$J5arR;wN#zc=Lh#L(;W4$5U;xF&FV5APo3#&B=GK#8`qphiYwYmbIG z-ustar}D(RN8i*|y7gqOF-@K1X1Kym^Apr;y8<$L+x^$&bt{{Fz{n?~v1ct3VZsGu|d{euR$ z5cB|9>vtb*{0#I;NbpZKt_#`qJ?QlhIDQ8IW0~Q=WOfIQ8vOgE#h-(rfq^w%f&H7Z zsjB=8^-2Ta-&|a2;KCOc@n6&*e}VCPJAsedU*E|U_GdeR)t~>G`TV{8z=x=> z?}v);v;Dq4!oS?=$M+0=HC;&mZuJ!x^nCu_0l=qV!481@J?gcY*q_1wE%f(ujeo-f z0G9@piUI)Ziv1<<4`vy@HF@wE$18!Wd{@3f{7R^Q`fNWF_=>9Fqj%Tg3(>#@2B*y5 z^JTxc2l%|&^*v_L!T0#b)Be#3z=yi7qhnx#ql1lj{hsLHQ%u*vy+As=-sSxDOw+G- z{C*Xs_YoYb8Z}YOR3*P^`zDWS_e{FIVX8dfAA1ev` z5vM1)+T-6&-p@d<`~r9%@4DcQ--G_KTEM$l*U=|QzZ3Z%Cw$ps{yo{j8$s96-;#ZY z{(q-8hpKh`*S$@w}yJk1Zp{$I2L9vUTHga2BK`dzaD zuO?p!4T>~=fcnQe0k5E5hnJwwyb}6f*gw8o@Y>sT{DU9i|1Vkr=X(U> zmH1!N^xx$>cpdG!(9=Ia{bQYg*SxOat9-+lz8CtB-7a{s;tKx4mzni@_+M)r29z%X R01TjCGf?3F5`+N&{6B74f*Ak+ literal 0 HcmV?d00001 diff --git a/translator/tests/data/csar_hello_world.zip b/translator/tests/data/csar_hello_world.zip new file mode 100644 index 0000000000000000000000000000000000000000..43ffbbc83003a5b4fa1e04284d080610c9051877 GIT binary patch literal 936 zcmWIWW@Zs#U|`^2XiJlK*F7Nc&47`Cp_GY%L6kv;p(MXJIWayXH76&(JijO>MXxe3 zHzzcNlYu#B!;{cU$Df3jR&X;gvb=@U(4maJG_BymW7dTLBgyp zZ{=FAG`L=N*|__n?cbPN8^e-!s(j4<|1Zgv$vT_sPOz)f!lciQonJSw?DX)lo0cK< z+S}N4vX1tI*hL!C=ah$B%sTL+~Rhv`U0$Q2YGv+BX>@%DjU(Px~E$RHs?W}X`+2pei#+94hlAU_R?AJ=h z9nHQ8jN)1wy(Y7nT%WTz?N1nw5u0P{n!SY^pQ)Z{d)V}2N%8NXZ7*4_tzP)-;`d86 zR?W|^He|&vPTHHHto>HtzSK3wJBzrLd+Hxt*;sot-uctFhV41GQzu(bS}@s4^YPEb zM6vISTk@VouX^=aV_p9=m)*O5i?5%({H@2nf2&;W&hKLk00uu7F!&i5a!cgh!3-$D z4-Ebg|6pfFUEkD_#FWI6M163;&pq)ZbTbg61w6Zt;D_>8VHErhfNTw?RIZFd3#m|`|F@NH$ z$&=&f#ZQ^MD17FO*@syf0=yZSMXxe3 zHzzcNlYu#B!;{d&ZBIf=E4UdLSza>`cnbIL=mavic$(J+{{aN#Qkv54(LjfN}bYbMDks_pr5(5YWBNyzEk zW*;Y>R0|Wgs?Div0j*5y8S|7G_8HENFK3;gmUMpRcGfxeZ1UL$Jl}Z2I2a`t2s}FTbXIs!$jaA~W=)$pJ(B54z?#JYlj7&hk(fVm z*5t|Y^WvvWUKBoa#_Yqa3<2JZOmfV)5}^b*Jb-DEVM`;3i6cp}LXsq!7a&IC3SfxQ z3=9Gce;wJ|4U?aQt1g4?LL66ILRyL4FnSqcWXh1VCFETIy0GTT` AZvX%Q literal 0 HcmV?d00001 diff --git a/translator/tests/data/csar_not_zip.zip b/translator/tests/data/csar_not_zip.zip new file mode 100644 index 00000000..43b7f5f5 --- /dev/null +++ b/translator/tests/data/csar_not_zip.zip @@ -0,0 +1 @@ +This is an invalid CSAR file. \ No newline at end of file diff --git a/translator/tests/data/csar_single_instance_wordpress.zip b/translator/tests/data/csar_single_instance_wordpress.zip new file mode 100644 index 0000000000000000000000000000000000000000..5df7b48333a2480cd6f686e339cb0656fd0d009a GIT binary patch literal 5967 zcmbVQc|6qX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m z3+rZX)o0xO@R{tRH)gC|ozhkkD4A|)3DeGp`(*SVc1czkk!&JvBB@v z3m&PZ83m`?XrAqchhHd+Gj+0g#}6xXDBATlc2oy)nd54TeE4$GvuLfaI=L`aajIib z#T%lH7iOXL>9;<&#k|6@R3y93etYD(@?^N7%kOJl}1h+S6QN^k~u2t9f1K!Dm=$(E+c%^lxxV3@ct$;;wv%h0)Pk5vg z+4^QnJeD<(lrVtGjBmct2Hg04J7TFQ#UffrMRghoY64i~Vj(5DU9qIbBY``?OuMKW zwZkhi(LyzbV9}j;K-gqq_9EP}TH1Yn++Nn>(wR|9L?&$oawtaXZ6_hMyYhj!CBJK? zul!Yqo)2c44a1%2VAdo@E~FD|q(3gfH}K5T9jWTWE#4Qq(u$HgYfiH;$E?mUD++4F zh(u1)`;S0`Z6Sw|OB)mer1Sk}=cY>lOdT%HIP@@cMhQKT z2u-f2#W}8;B1@;kr|HfI-VTRp7Zj$(YdB@1R1Ihjh3IoZA9r-9x*xtZhjhTghRbvrXDiGA1 z)SnqOu;Ie_?0Oomw`usm*G4^x|M2n1VIuSmGG9C{xTg!8a5!KhasFB^D`Tth&^N+C z8e_YZ#V7psH}v$j#JLnrM z9GF-(&4>W#7Q-BQkeeq&@*ul6gObmSKZ9S7dGlmO9`j9LPN1CA07T-Pwj~QBRw<`6 z@_-jNAa0y3e#Y`T{^l8m9AA}|GUDw`G{CM~Of%$XyU`UffXI3JjS=+SHCS5wEC-V7 zSd-d64-N`6donbV2l+WJiF-=FMb1spmbm0KdV7&m`X%xmkU)Arb5GmD|1mR-WcZ{u zxm{)`jS_j>5GGRGB;4&XL*ky&rI7D1v*iwyrFDDkP}&CaJ(_`u{$KV)pR(eEjGGhqod-U_*@^%C56DW?ApigX literal 0 HcmV?d00001 diff --git a/translator/tests/data/csar_wordpress_invalid_import_path.zip b/translator/tests/data/csar_wordpress_invalid_import_path.zip new file mode 100644 index 0000000000000000000000000000000000000000..d6442594363def4ad1dca76b884680e8c375fa15 GIT binary pat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vJkp8me6yun6%1vh4do%@ z+i$cXFa8i`6cwdeB(kWeLI6?|z#=ybDagH=B`F#K+zA%CMYV8FY*?&?T4a|+W9%_e zldp4$Fv}u2*M)I=1-F}*hb`gv>GBW*k+LK8T}h1vO;VNu&iB2P?woC&Hq$BlP>&8| zi*w*XI6{ZIuf=!;TwX4hEz)}Bk=T%&9amo*!pai4KFgvitQ{#9HpAdI#3X9Vq=i`C z;us*De}DFEy9B`G;e^7Wf8qcihtXp*0K|4+iTx07uUa8vnwdg%c)}Owd5W_w9koK} zuLnFQKu=_5B}HpH-ZxS+q}2>E;E`{A{aVdc>)AZQ^>zx6JE(^)n#NyuS+STthx1}C zLtf5fO z+WjX0J`WA5Dgvcpwl5XcbBTrj~7UA^^I>Ku1n; z`;yotYk zjv>caqoZWJx2a~gs7QUnhB^LuFoMW+5(b0*?HVjCc8g(WG%gA>6d4++2iYB$q&;Q7 zMXpWmj=1DGdT-1r`z7)njDhfW>z?+8Pp&hiGSy`Gq%yfzWhfgZa^7srB;F+4y(&Y} zp0Z0J-(h~o9Vk=l-qfLN8_4&l1E%`_s!xi7)I{tJ|Hta9vy$*hrF5_AQ+5mFyszwt z`}68kmVNRaMA&v>{{K;*T%COsxAt$cJvP-R73AHNC%K2R9Fy~hvy=E!V(%>mI(i~+ PZs2zT_+-FA{O|t&l?c`g literal 0 HcmV?d00001 diff --git a/translator/tests/data/csar_wordpress_invalid_script_url.zip b/translator/tests/data/csar_wordpress_invalid_script_url.zip new file mode 100644 index 0000000000000000000000000000000000000000..6014f9230474b680a3d5e5db31287f655bd6cf3c GIT binary patch literal 6034 zcmbVQc|4SB{~lWyJ0p@^vW=~BB*JtoW5(E3W6RKB97bk_vYwF2k~MYELY64Jwk(lS z_Oex$l4Fe!b;@#N`#r;X&&)_({rKFE@yA^E^}X)v{w|Lhl7SHd0)bdS9C_-7;pqn% zj?#lb0gNCJ7$gj`(1+=v^p!~GNY+-YAcnVr49CgK=Nub|j&Xtk1X_Q1S|YvrRM=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?aC!zj{VYs+l21``mc!?9EJ0);fv) zm98Ud literal 0 HcmV?d00001 diff --git a/translator/tests/data/csar_wrong_metadata_file.zip b/translator/tests/data/csar_wrong_metadata_file.zip new file mode 100644 index 0000000000000000000000000000000000000000..85d660a037693b3447038e5bc94732679f3ac8d2 GIT binary patch literal 873 zcmWIWW@Zs#U|`^2XiJlK*F7Nc&47`Cp_GY%L6kv;p(MXJIWayXH76&(JijO>MXxe3 zHzzcNlYu#B!;?@DF0J5ZU}Sm8%)kI9N+%u6J7mDq_P&?6Pt9MccnIw>E|)?^OAi|Nmc-E0c9L*PUQjr-ezM8#}*lVA<*6V>c~B>b1AA z>0}-439*Ybrq3x4xyp6OPDR6D+QNme7{nsB3pE<9l&_g2qo}s$%R#4p#Uvr8bDMpf zcv3A)+^ROGvIVpWU7WNxLs|Q+zBs36+(E=V}5F^l_yG{p{~u_UHJU~~0A=7No6 z1RCdnX{2jjNl~S)OKMtXUS>&VeqOPa0@n1v72wUtB*%;^6-j_S1WZ&6TN*)3tY(CU zutL%lhPOaQ;|d{&(F_a%41XQ#fi_@-7tl~pc;PV=GqjN1djiu? + This TOSCA simple profile deploys nodejs, mongodb, elasticsearch, logstash and + kibana each on a separate server with monitoring enabled for nodejs server where + a sample nodejs application is running. The rsyslog and collectd are installed + on a nodejs server. + +parameters: + github_url: + type: string + description: The URL to download nodejs. + default: http://github.com/paypal/rest-api-sample-app-nodejs.git + + my_cpus: + type: number + description: Number of CPUs for the server. + default: 4 + constraints: + - allowed_values: + - 1 + - 2 + - 4 + - 8 + +resources: + + nodejs_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: nodejs_create_config + server: + get_resource: app_server + + nodejs_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/nodejs/create.sh + group: script + + paypal_pizzastore_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: paypal_pizzastore_configure_config + input_values: + github_url: http://github.com/paypal/rest-api-sample-app-nodejs.git + mongodb_ip: + get_attr: + - mongo_server + - networks + - private + - 0 + server: + get_resource: app_server + depends_on: + - nodejs_create_deploy + - mongo_db_create_deploy + + paypal_pizzastore_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/nodejs/config.sh + group: script + + paypal_pizzastore_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: paypal_pizzastore_start_config + server: + get_resource: app_server + depends_on: + - paypal_pizzastore_configure_deploy + + paypal_pizzastore_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/nodejs/start.sh + group: script + + + mongo_dbms_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mongo_dbms_create_config + server: + get_resource: mongo_server + + mongo_dbms_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/mongodb/create.sh + group: script + + mongo_dbms_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mongo_dbms_configure_config + input_values: + mongodb_ip: + get_attr: + - mongo_server + - networks + - private + - 0 + server: + get_resource: mongo_server + depends_on: + - mongo_dbms_create_deploy + + mongo_dbms_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/mongodb/config.sh + group: script + + mongo_dbms_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mongo_dbms_start_config + server: + get_resource: mongo_server + depends_on: + - mongo_dbms_configure_deploy + + mongo_dbms_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/mongodb/start.sh + group: script + + mongo_db_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mongo_db_create_config + server: + get_resource: mongo_server + depends_on: + - mongo_dbms_start_deploy + + mongo_db_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/mongodb/create_database.sh + group: script + + + app_collectd_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_collectd_create_config + server: + get_resource: app_server + depends_on: + - logstash_start_deploy + + app_collectd_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/collectd/create.sh + group: script + + app_collectd_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_collectd_configure_config + input_values: + logstash_ip: + get_attr: + - logstash_server + - networks + - private + - 0 + server: + get_resource: app_server + depends_on: + - app_collectd_create_deploy + + app_collectd_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Python/collectd/config.py + group: script + + app_collectd_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_collectd_start_config + server: + get_resource: app_server + depends_on: + - app_collectd_configure_deploy + + app_collectd_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/collectd/start.sh + group: script + + app_collectd_logstash_connect_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_collectd_logstash_connect_config + server: + get_resource: logstash_server + depends_on: + - logstash_create_deploy + + app_collectd_logstash_connect_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Python/logstash/configure_collectd.py + group: script + + + app_rsyslog_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_rsyslog_create_config + server: + get_resource: app_server + depends_on: + - logstash_start_deploy + + app_rsyslog_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/rsyslog/create.sh + group: script + + app_rsyslog_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_rsyslog_start_config + server: + get_resource: app_server + depends_on: + - app_rsyslog_configure_deploy + + app_rsyslog_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/rsyslog/start.sh + group: script + + app_rsyslog_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_rsyslog_configure_config + input_values: + logstash_ip: + get_attr: + - logstash_server + - networks + - private + - 0 + server: + get_resource: app_server + depends_on: + - app_rsyslog_create_deploy + + app_rsyslog_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/rsyslog/config.sh + group: script + + app_rsyslog_logstash_connect_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: app_rsyslog_logstash_connect_config + server: + get_resource: logstash_server + depends_on: + - logstash_create_deploy + + app_rsyslog_logstash_connect_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Python/logstash/configure_rsyslog.py + group: script + + + logstash_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: logstash_create_config + server: + get_resource: logstash_server + depends_on: + - elasticsearch_start_deploy + + logstash_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/logstash/create.sh + group: script + + logstash_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: logstash_start_config + server: + get_resource: logstash_server + depends_on: + - logstash_create_deploy + + logstash_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/logstash/start.sh + group: script + + logstash_elasticsearch_connect_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: logstash_elasticsearch_connect_config + input_values: + elasticsearch_ip: + get_attr: + - elasticsearch_server + - networks + - private + - 0 + server: + get_resource: logstash_server + depends_on: + - logstash_create_deploy + + logstash_elasticsearch_connect_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Python/logstash/configure_elasticsearch.py + group: script + + + elasticsearch_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: elasticsearch_create_config + server: + get_resource: elasticsearch_server + + elasticsearch_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/elasticsearch/create.sh + group: script + + elasticsearch_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: elasticsearch_start_config + server: + get_resource: elasticsearch_server + depends_on: + - elasticsearch_create_deploy + + elasticsearch_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/elasticsearch/start.sh + group: script + + + kibana_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: kibana_create_config + server: + get_resource: kibana_server + depends_on: + - elasticsearch_start_deploy + + kibana_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/kibana/create.sh + group: script + + kibana_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: kibana_configure_config + input_values: + elasticsearch_ip: + get_attr: + - elasticsearch_server + - networks + - private + - 0 + kibana_ip: + get_attr: + - kibana_server + - networks + - private + - 0 + server: + get_resource: kibana_server + depends_on: + - kibana_create_deploy + + kibana_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/kibana/config.sh + group: script + + kibana_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: kibana_start_config + server: + get_resource: kibana_server + depends_on: + - kibana_configure_deploy + + kibana_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/kibana/start.sh + group: script + + + app_server: + type: OS::Nova::Server + properties: + flavor: m1.large + image: ubuntu-software-config-os-init + key_name: userkey + user_data_format: SOFTWARE_CONFIG + + mongo_server: + type: OS::Nova::Server + properties: + flavor: m1.large + image: ubuntu-software-config-os-init + key_name: userkey + user_data_format: SOFTWARE_CONFIG + + logstash_server: + type: OS::Nova::Server + properties: + flavor: m1.large + image: ubuntu-software-config-os-init + key_name: userkey + user_data_format: SOFTWARE_CONFIG + + elasticsearch_server: + type: OS::Nova::Server + properties: + flavor: m1.large + image: ubuntu-software-config-os-init + key_name: userkey + user_data_format: SOFTWARE_CONFIG + + kibana_server: + type: OS::Nova::Server + properties: + flavor: m1.large + image: ubuntu-software-config-os-init + key_name: userkey + user_data_format: SOFTWARE_CONFIG + +outputs: + nodejs_url: + description: URL for the nodejs server, http://:3000 + value: + get_attr: + - app_server + - networks + - private + - 0 + + mongodb_url: + description: URL for the mongodb server. + value: + get_attr: + - mongo_server + - networks + - private + - 0 + + logstash_url: + description: URL for the logstash server. + value: + get_attr: + - logstash_server + - networks + - private + - 0 + + elasticsearch_url: + description: URL for the elasticsearch server. + value: + get_attr: + - elasticsearch_server + - networks + - private + - 0 + + kibana_url: + description: URL for the kibana server. + value: + get_attr: + - kibana_server + - networks + - private + - 0 + diff --git a/translator/tests/data/hot_output/hot_tosca_helloworld.yaml b/translator/tests/data/hot_output/hot_hello_world.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_tosca_helloworld.yaml rename to translator/tests/data/hot_output/hot_hello_world.yaml diff --git a/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml b/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml new file mode 100644 index 00000000..60b043b9 --- /dev/null +++ b/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml @@ -0,0 +1,200 @@ +heat_template_version: 2013-05-23 + +description: > + TOSCA simple profile with wordpress, web server and mysql on the same server. + +parameters: + db_name: + type: string + description: The name of the database. + default: wordpress + db_user: + type: string + description: The user name of the DB user. + default: wp_user + db_pwd: + type: string + description: The WordPress database admin account password. + default: wp_pass + cpus: + type: number + description: Number of CPUs for the server. + default: 8 + constraints: + - allowed_values: + - 1 + - 2 + - 4 + - 8 + db_root_pwd: + type: string + description: Root password for MySQL. + default: passw0rd + db_port: + type: number + description: Port for the MySQL database. + default: 3366 + +resources: + + mysql_dbms_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/MYSQLDBMS/install.sh + group: script + + mysql_dbms_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mysql_dbms_create_config + server: + get_resource: server + + mysql_dbms_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/MYSQLDBMS/start.sh + group: script + + mysql_dbms_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mysql_dbms_start_config + server: + get_resource: server + depends_on: + - mysql_dbms_configure_deploy + + mysql_dbms_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/MYSQLDBMS/configure.sh + group: script + + mysql_dbms_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mysql_dbms_configure_config + input_values: + root_password: passw0rd + server: + get_resource: server + depends_on: + - mysql_dbms_create_deploy + + mysql_database_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/MYSQLDatabase/configure.sh + group: script + + mysql_database_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: mysql_database_configure_config + input_values: + db_name: wordpress + db_password: wp_pass + db_root_password: passw0rd + db_user: wp_user + server: + get_resource: server + depends_on: + - mysql_dbms_start_deploy + + webserver_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/WebServer/install.sh + group: script + + webserver_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: webserver_create_config + server: + get_resource: server + + webserver_start_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/WebServer/start.sh + group: script + + webserver_start_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: webserver_start_config + server: + get_resource: server + depends_on: + - webserver_create_deploy + + wordpress_create_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/WordPress/install.sh + group: script + + wordpress_create_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: wordpress_create_config + server: + get_resource: server + depends_on: + - webserver_start_deploy + - mysql_database_configure_deploy + + wordpress_configure_config: + type: OS::Heat::SoftwareConfig + properties: + config: + get_file: ../Scripts/WordPress/configure.sh + group: script + + wordpress_configure_deploy: + type: OS::Heat::SoftwareDeployment + properties: + config: + get_resource: wordpress_configure_config + input_values: + wp_db_name: wordpress + wp_db_password: wp_pass + wp_db_user: wp_user + server: + get_resource: server + depends_on: + - wordpress_create_deploy + + server: + type: OS::Nova::Server + properties: + flavor: m1.xlarge + image: fedora-amd64-heat-config + key_name: userkey + user_data_format: SOFTWARE_CONFIG + +outputs: + website_url: + description: IP address for Wordpress wiki. + value: + get_attr: + - server + - networks + - private + - 0 diff --git a/translator/tests/test_tosca_hot_translation.py b/translator/tests/test_tosca_hot_translation.py index 294937c8..3b3d8908 100644 --- a/translator/tests/test_tosca_hot_translation.py +++ b/translator/tests/test_tosca_hot_translation.py @@ -11,6 +11,9 @@ # under the License. import json + +from toscaparser.common.exception import URLException +from toscaparser.common.exception import ValidationError from translator.common.utils import TranslationUtils from translator.tests.base import TestCase @@ -18,8 +21,7 @@ from translator.tests.base import TestCase class ToscaHotTranslationTest(TestCase): def test_hot_translate_single_server(self): - tosca_file = \ - '../tests/data/tosca_single_server.yaml' + tosca_file = '../tests/data/tosca_single_server.yaml' hot_file = '../tests/data/hot_output/hot_single_server.yaml' params = {'cpus': 1} diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, @@ -49,8 +51,7 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff2, indent=4, separators=(', ', ': '))) def test_hot_translate_wordpress_single_instance(self): - tosca_file = \ - '../tests/data/tosca_single_instance_wordpress.yaml' + tosca_file = '../tests/data/tosca_single_instance_wordpress.yaml' hot_file = '../tests/data/hot_output/' \ 'hot_single_instance_wordpress.yaml' params = {'db_name': 'wordpress', @@ -66,10 +67,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_helloworld(self): - tosca_file = \ - '../tests/data/tosca_helloworld.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_tosca_helloworld.yaml' + tosca_file = '../tests/data/tosca_helloworld.yaml' + hot_file = '../tests/data/hot_output/hot_hello_world.yaml' diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, hot_file, {}) @@ -77,10 +76,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_host_assignment(self): - tosca_file = \ - '../tests/data/test_host_assignment.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_host_assignment.yaml' + tosca_file = '../tests/data/test_host_assignment.yaml' + hot_file = '../tests/data/hot_output/hot_host_assignment.yaml' diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, hot_file, {}) @@ -88,8 +85,7 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_elk(self): - tosca_file = \ - '../tests/data/tosca_elk.yaml' + tosca_file = '../tests/data/tosca_elk.yaml' hot_file = '../tests/data/hot_output/hot_elk.yaml' params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', @@ -101,8 +97,7 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_nodejs_mongodb_two_instances(self): - tosca_file = \ - '../tests/data/tosca_nodejs_mongodb_two_instances.yaml' + tosca_file = '../tests/data/tosca_nodejs_mongodb_two_instances.yaml' hot_file = '../tests/data/hot_output/' \ 'hot_nodejs_mongodb_two_instances.yaml' params = {'github_url': @@ -115,9 +110,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_blockstorage_with_attachment(self): - tosca_file = \ - '../tests/data/storage/' \ - 'tosca_blockstorage_with_attachment.yaml' + tosca_file = '../tests/data/storage/' \ + 'tosca_blockstorage_with_attachment.yaml' hot_file = '../tests/data/hot_output/storage/' \ 'hot_blockstorage_with_attachment.yaml' params = {'cpus': 1, @@ -131,9 +125,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_blockstorage_with_custom_relationship_type(self): - tosca_file = \ - '../tests/data/storage/' \ - 'tosca_blockstorage_with_custom_relationship_type.yaml' + tosca_file = '../tests/data/storage/' \ + 'tosca_blockstorage_with_custom_relationship_type.yaml' hot_file = '../tests/data/hot_output/storage/' \ 'hot_blockstorage_with_custom_relationship_type.yaml' params = {'cpus': 1, @@ -147,9 +140,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_blockstorage_with_relationship_template(self): - tosca_file = \ - '../tests/data/storage/' \ - 'tosca_blockstorage_with_relationship_template.yaml' + tosca_file = '../tests/data/storage/' \ + 'tosca_blockstorage_with_relationship_template.yaml' hot_file = '../tests/data/hot_output/storage/' \ 'hot_blockstorage_with_relationship_template.yaml' params = {'cpus': 1, @@ -162,9 +154,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_blockstorage_with_attachment_notation1(self): - tosca_file = \ - '../tests/data/storage/' \ - 'tosca_blockstorage_with_attachment_notation1.yaml' + tosca_file = '../tests/data/storage/' \ + 'tosca_blockstorage_with_attachment_notation1.yaml' hot_file1 = '../tests/data/hot_output/storage/' \ 'hot_blockstorage_with_attachment_notation1_alt1.yaml' hot_file2 = '../tests/data/hot_output/storage/' \ @@ -188,9 +179,8 @@ class ToscaHotTranslationTest(TestCase): separators=(', ', ': '))) def test_hot_translate_blockstorage_with_attachment_notation2(self): - tosca_file = \ - '../tests/data/storage/' \ - 'tosca_blockstorage_with_attachment_notation2.yaml' + tosca_file = '../tests/data/storage/' \ + 'tosca_blockstorage_with_attachment_notation2.yaml' hot_file1 = '../tests/data/hot_output/storage/' \ 'hot_blockstorage_with_attachment_notation2_alt1.yaml' hot_file2 = '../tests/data/hot_output/storage/' \ @@ -214,9 +204,8 @@ class ToscaHotTranslationTest(TestCase): separators=(', ', ': '))) def test_hot_translate_multiple_blockstorage_with_attachment(self): - tosca_file = \ - '../tests/data/storage/' \ - 'tosca_multiple_blockstorage_with_attachment.yaml' + tosca_file = '../tests/data/storage/' \ + 'tosca_multiple_blockstorage_with_attachment.yaml' hot_file1 = '../tests/data/hot_output/storage/' \ 'hot_multiple_blockstorage_with_attachment_alt1.yaml' hot_file2 = '../tests/data/hot_output/storage/' \ @@ -240,10 +229,8 @@ class ToscaHotTranslationTest(TestCase): separators=(', ', ': '))) def test_hot_translate_single_object_store(self): - tosca_file = \ - '../tests/data/storage/tosca_single_object_store.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_object_store.yaml' + tosca_file = '../tests/data/storage/tosca_single_object_store.yaml' + hot_file = '../tests/data/hot_output/hot_single_object_store.yaml' params = {'objectstore_name': 'myobjstore'} diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, hot_file, @@ -252,8 +239,7 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_one_server_one_network(self): - tosca_file = \ - '../tests/data/network/tosca_one_server_one_network.yaml' + tosca_file = '../tests/data/network/tosca_one_server_one_network.yaml' hot_file = '../tests/data/hot_output/network/' \ 'hot_one_server_one_network.yaml' params = {'network_name': 'private_net'} @@ -276,8 +262,7 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_two_servers_one_network(self): - tosca_file = \ - '../tests/data/network/tosca_two_servers_one_network.yaml' + tosca_file = '../tests/data/network/tosca_two_servers_one_network.yaml' hot_file = '../tests/data/hot_output/network/' \ 'hot_two_servers_one_network.yaml' params = {'network_name': 'my_private_net', @@ -304,8 +289,7 @@ class ToscaHotTranslationTest(TestCase): def test_hot_translate_software_component(self): tosca_file = '../tests/data/tosca_software_component.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_software_component.yaml' + hot_file = '../tests/data/hot_output/hot_software_component.yaml' params = {'cpus': '1', 'download_url': 'http://www.software.com/download'} diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, @@ -370,19 +354,16 @@ class ToscaHotTranslationTest(TestCase): 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} - try: - TranslationUtils.compare_tosca_translation_with_hot( - tosca_file, hot_file, params) - except Exception as err: - self.assertTrue(isinstance(err, ImportError)) - self.assertEqual( - 'Absolute file name /tmp/wordpress.yaml cannot be used for a ' - 'URL-based input https://ibm.box.com/shared/static/' - 'lrgdktp9vw3991y2hlogmghwwvnok3lu.yaml template.', - err.__str__()) - else: - raise Exception( - 'The unit test that was expected to fail did not fail.') + + err = self.assertRaises( + ImportError, + TranslationUtils.compare_tosca_translation_with_hot, + tosca_file, hot_file, params) + self.assertEqual( + 'Absolute file name /tmp/wordpress.yaml cannot be used for a ' + 'URL-based input https://ibm.box.com/shared/static/' + 'lrgdktp9vw3991y2hlogmghwwvnok3lu.yaml template.', + err.__str__()) def test_hot_translate_template_by_url_with_url_import(self): tosca_url = 'https://ibm.box.com/shared/static/' \ @@ -400,3 +381,122 @@ class ToscaHotTranslationTest(TestCase): params) self.assertEqual({}, diff, ' : ' + json.dumps(diff, indent=4, separators=(', ', ': '))) + + def test_translate_hello_world_csar(self): + tosca_file = '../tests/data/csar_hello_world.zip' + hot_file = '../tests/data/hot_output/hot_hello_world.yaml' + diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, + hot_file, + {}) + self.assertEqual({}, diff, ' : ' + + json.dumps(diff, indent=4, separators=(', ', ': '))) + + def test_translate_single_instance_wordpress_csar(self): + tosca_file = '../tests/data/csar_single_instance_wordpress.zip' + hot_file = '../tests/data/hot_output/' \ + 'hot_single_instance_wordpress_from_csar.yaml' + params = {'db_name': 'wordpress', + 'db_user': 'wp_user', + 'db_pwd': 'wp_pass', + 'db_root_pwd': 'passw0rd', + 'db_port': 3366, + 'cpus': 8} + diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, + hot_file, + params) + self.assertEqual({}, diff, ' : ' + + json.dumps(diff, indent=4, separators=(', ', ': '))) + + def test_translate_elk_csar_from_url(self): + tosca_file = 'https://ibm.box.com/shared/static/' \ + 'k9vtus4jes1epl7vfojbcscgsd80inzv.zip' + hot_file = '../tests/data/hot_output/hot_elk_from_csar.yaml' + params = {'github_url': + 'http://github.com/paypal/rest-api-sample-app-nodejs.git', + 'my_cpus': 4} + diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, + hot_file, + params) + self.assertEqual({}, diff, ' : ' + + json.dumps(diff, indent=4, separators=(', ', ': '))) + + def test_translate_csar_not_zip(self): + tosca_file = '../tests/data/csar_not_zip.zip' + hot_file = '' + params = {} + + err = self.assertRaises( + ValidationError, + TranslationUtils.compare_tosca_translation_with_hot, + tosca_file, hot_file, params) + + err_msg = err.__str__() + self.assertIs(True, + err_msg.startswith('The file ') and + err_msg.endswith('../tests/data/csar_not_zip.zip is not ' + 'a valid zip file.')) + + def test_translate_csar_metadata_not_yaml(self): + tosca_file = '../tests/data/csar_metadata_not_yaml.zip' + hot_file = '' + params = {} + + err = self.assertRaises( + ValidationError, + TranslationUtils.compare_tosca_translation_with_hot, + tosca_file, hot_file, params) + + err_msg = err.__str__() + self.assertIs(True, + err_msg.startswith('The file ' + '"TOSCA-Metadata/TOSCA.meta" in ') + and + err_msg.endswith('../tests/data/csar_metadata_not_yaml' + '.zip does not contain valid YAML ' + 'content.')) + + def test_translate_csar_wrong_metadata_file(self): + tosca_file = '../tests/data/csar_wrong_metadata_file.zip' + hot_file = '' + params = {} + + err = self.assertRaises( + ValidationError, + TranslationUtils.compare_tosca_translation_with_hot, + tosca_file, hot_file, params) + + err_msg = err.__str__() + self.assertIs(True, + err_msg.startswith('The file ') and + err_msg.endswith('../tests/data/csar_wrong_metadata_file' + '.zip is not a valid CSAR as it does ' + 'not contain the required file ' + '"TOSCA.meta" in the folder ' + '"TOSCA-Metadata".')) + + def test_translate_csar_wordpress_invalid_import_path(self): + tosca_file = '../tests/data/csar_wordpress_invalid_import_path.zip' + hot_file = '' + params = {} + + err = self.assertRaises( + ImportError, + TranslationUtils.compare_tosca_translation_with_hot, + tosca_file, hot_file, params) + self.assertEqual('Import Definitions/wordpress.yaml is not valid', + err.__str__()) + + def test_translate_csar_wordpress_invalid_script_url(self): + tosca_file = '../tests/data/csar_wordpress_invalid_script_url.zip' + hot_file = '' + params = {} + + err = self.assertRaises( + URLException, + TranslationUtils.compare_tosca_translation_with_hot, + tosca_file, hot_file, params) + self.assertEqual('URLException "The resource at ' + 'https://raw.githubusercontent.com/openstack/' + 'heat-translator/master/translator/tests/data/' + 'custom_types/wordpress1.yaml cannot be accessed".', + err.__str__())