diff options
author | Ulas Kozat <ulas.kozat@gmail.com> | 2016-07-12 10:45:43 -0700 |
---|---|---|
committer | Ulas Kozat <ulas.kozat@gmail.com> | 2016-07-12 10:45:43 -0700 |
commit | 2ce4ce233e1f99c0c79eef3ab8df0d237d737b92 (patch) | |
tree | 7bb07bfd53e9f4f3629de708809f8bf13f8efba8 | |
parent | 1689ad9e0da4386e7b3a2318ba2e90a5f2e0ebfb (diff) |
add new multi node test script and deployment ssh keys
Change-Id: I7b258c2b440211d03a07c89c70e90c62a29a6718
Signed-off-by: Ulas Kozat <ulas.kozat@gmail.com>
-rwxr-xr-x | tests/run_multinode.sh | 169 | ||||
-rw-r--r-- | tests/testkeys/id_rsa | 27 | ||||
-rw-r--r-- | tests/testkeys/id_rsa.pub | 1 | ||||
-rw-r--r-- | tests/testkeys/old/id_rsa | 30 | ||||
-rw-r--r-- | tests/testkeys/old/id_rsa.pub | 1 |
5 files changed, 228 insertions, 0 deletions
diff --git a/tests/run_multinode.sh b/tests/run_multinode.sh new file mode 100755 index 0000000..4647899 --- /dev/null +++ b/tests/run_multinode.sh @@ -0,0 +1,169 @@ +#!/bin/bash -ex + +#Copyright 2016 Open Platform for NFV Project, Inc. and its contributors +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +USERNAME=ubuntu +SSH_KEY_PATH=/home/opnfv/.ssh/id_rsa +DOMINO_CODE_PATH=/home/opnfv/repos/domino +CONTROLLER_NODE_1=192.168.2.165 +CONTROLLER_NODE_2=192.168.2.180 +CONTROLLER_NODE_3=192.168.2.181 + +CLIENT1_PORT=9091 +CLIENT2_PORT=9092 +CLIENT1_CLIPORT=9100 +CLIENT2_CLIPORT=9200 +LOGLEVEL=DEBUG + +toscafile_test1=./tosca-templates/tosca_helloworld_nfv.yaml +test1_reffile1=./tests/refdata/test1_client1.ref +test1_reffile2=./tests/refdata/test1_client2.ref +client1_log=./tests/logdata/client1.log +client2_log=./tests/logdata/client2.log +server_log=./tests/logdata/server.log + +install_dependency() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" 'sudo pip install tosca-parser' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" 'sudo pip install heat-translator' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" 'sudo pip install tosca-parser' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" 'sudo pip install heat-translator' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" 'sudo pip install tosca-parser' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" 'sudo pip install heat-translator' +} + +remove_codes(){ + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" 'rm -rf domino' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" 'rm -rf domino' + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" 'rm -rf domino' +} + +deploy_codes(){ + scp -i "$SSH_KEY_PATH" -r "$DOMINO_CODE_PATH" "$USERNAME"@"$CONTROLLER_NODE_1":. + scp -i "$SSH_KEY_PATH" -r "$DOMINO_CODE_PATH" "$USERNAME"@"$CONTROLLER_NODE_2":. + scp -i "$SSH_KEY_PATH" -r "$DOMINO_CODE_PATH" "$USERNAME"@"$CONTROLLER_NODE_3":. +} + +start_server() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" 'pgrep -f "python DominoServer.py"' && return 0 + ssh -f -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" "sh -c 'cd ./domino; nohup python DominoServer.py --log "$LOGLEVEL" > "$server_log" > /dev/null 2>&1 &'" +} + +start_client1() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" 'pgrep -f "python DominoClient.py"' && return 0 + ssh -f -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd ./domino; nohup python DominoClient.py -p $CLIENT1_PORT --cliport $CLIENT1_CLIPORT --ipaddr $CONTROLLER_NODE_1 --log "$LOGLEVEL" > "$client1_log" > /dev/null 2>&1 &'" +} + +start_client2() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" 'pgrep -f "python DominoClient.py"' && return 0 + ssh -f -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" "sh -c 'cd ./domino; nohup python DominoClient.py -p $CLIENT2_PORT --cliport $CLIENT2_CLIPORT --ipaddr $CONTROLLER_NODE_1 --log "$LOGLEVEL" > "$client2_log" > /dev/null 2>&1 &'" +} + +stop_server() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" 'pgrep -f "python DominoServer.py"' || return 0 + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" 'kill $(pgrep -f "python DominoServer.py")' +} + +stop_client1() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" 'pgrep -f "python DominoClient.py"' || return 0 + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" 'kill $(pgrep -f "python DominoClient.py")' +} + +stop_client2() { + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" 'pgrep -f "python DominoClient.py"' || return 0 + ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" 'kill $(pgrep -f "python DominoClient.py")' +} + +cleanup() { + set +e + echo "cleanup..." + + echo "Stopping Domino Clients..." + stop_client1 + stop_client2 + + echo "Stopping Domino Server..." + stop_server + sleep 1 +} + +prepare_testenv() { + install_dependency + remove_codes + deploy_codes +} + +launch_domino() { + echo "Launching Domino Server..." + start_server + sleep 1 + echo "Launching Domino Client 1..." + start_client1 + sleep 1 + echo "Launching Domino Client 2..." + start_client2 + sleep 1 +} + +echo "domino/tests/run_multinode.sh has been executed." + +trap cleanup EXIT + +cleanup +prepare_testenv +launch_domino + + +echo "Test Heartbeat" +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT heartbeat' +sleep 1 + +echo "Test Subscribe API" +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe -t hot \ + -l tosca.policies.Placement:properties:region:nova-1' +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE' +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE' +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe \ + -l tosca.policies.Placement:properties:region:nova-2' +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe \ + -l tosca.policies.Placement:properties:region:nova-3 \ + --lop OVERWRITE' +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe \ + -l tosca.policies.Placement:properties:region:nova-3 \ + --lop DELETE' +sleep 1 + +echo "Test Publish API" +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT publish -t "$toscafile_test1"' + +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_1" \ + 'python domino-cli.py $CLIENT1_CLIPORT subscribe \ + -l tosca.policies.Placement.Geolocation:properties:region:us-west-1' +sleep 1 +ssh -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" \ + 'python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"' + +echo "done" + diff --git a/tests/testkeys/id_rsa b/tests/testkeys/id_rsa new file mode 100644 index 0000000..2b8996f --- /dev/null +++ b/tests/testkeys/id_rsa @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAz3sCcPXs6a4iDU3ZTqi5waoevJ7SJduhdA4ReinT2Q7Dw1Rb +1GeR8SVdbd8gakOSab1Dd3OyhB/sMZBHIX5Gq0y+3pCL1BfkP9M45irQUIrXq7ZX +MkEqbHPM7rwNodmGJyVq5ArfqG16FsTdgEL9Xn5K6/i0Lha/Y+/TkXacAe0tndsg +wsDndEfMcaRHzG4isDRljADQ55Ta/QqAmIVNSSBOIvcVK2yKA07X2KlSQVaOI2W+ +qsfRCmOEq89oRKC9Ye8Tjhtl1FYUOdBSOlyueNENV2uVV1tfhUD4PXsO7shtb0eE +sFkQZReAg4klsaPqlxvxC4KLBaLnD7K4kp0ZRQIDAQABAoIBAGVE8SgZoQ1eBRjh +SpPuHty8IEyIaKI51VBEHZu3FsP3RO3uGvRNqRo+1p9uLPAxEyGxU2DWg+ehfTOj +7FQYwn2R9AfGHbnj/3B3tGoDs7HcUvBpC55n2EEfNIPCHhVFiwlIZifwdsJKzTCX +3lVgXTLmCcOrnKZyS/CHeoihj/wP2rrz1yptcbjzptdnBvsB2k+5dC4bEuSzrCbn +3XA1iX/bdtf29LFkunmkzgkVwkFVxEoo2BTLkmZmdYm7qoNIMXYruMmTrAfNj8fT +5WnreOIFcbuwjgc8+dNddhDwma3ozYOO1sOKlFO79KQdba5IRfKQNARexj8zaerT +eBUqoHECgYEA9E9C/zipI5MQ+HW+sTT2gMf74WG8FYq+tfGeTicfmnXJvpGYNAom +xyy4nr2M6jAOthPR/iqlLMLCXrVHtOav3E7dGOfK+pVjMVw06oHHTssQuW1SFUFX +bL5xZu4tEpemE6V2CH2Px6jnYjP05YSmF8L+Pv4+GQ3D/K4YbVrJ868CgYEA2WiZ +dWSJsdZ6qcSIem/UbLj5EbnIxf4PeKvd3nFfmkLcOKjqxECZ016UXnLjt/HYPLUJ +wyT3yLnHBNxuP8ev21uBAUw6irfIBoQScqeT+YxofSMH2RS+L4hccOT4r0ylef1S +oo/NaitMo1oolHc2MeGsAA98YZgkPp5ySZzE20sCgYEAzvuoI1r50a3zns0C9leM +0Kad++E13HpkAPnnyQbUe6R3fAEWFmDTYcO91p95F6AHlrNMIi43KqkGy/6B9f3L +2LboEwWuroaKN3OLUXMKTPM2BCNee6uUSgk/QplfjnT0u4hfa+oVOm8bOdQTE7FC +lrcZeH0mV0uWVCmbgGp+1vkCgYAIkLxrCZj7Lq4Kfjm6SSmfVvJJJn6ofkfxwyOs +nd7cXwH6IX2OWdU1pKZHylL6bkbMrX1C+PPiLp+Oq3iUfrOI+uPsPyqXSIJS72Ui +q0ODM2rycyzd+pk7mi26LOs3TNfAJKDa0ruPEUGltemfX8r80B1Mq0+FMM9MwEVU +bR68XQKBgEJbgmlPzgBgQSj2V7yQ2xFiN9PQ58qgIOcfAKX4zO3WipQWwPpg5ePS +6JSI68hvaqnY7825Qw9pAwqAQmBMNHe8Tis85Hk9L4XbeGR10/2quS1/zKB6cE0s +ixWytAw5fxdU6KIvhdR9stATikcXOqEBgc95pZIsNeey6yjNOFM6 +-----END RSA PRIVATE KEY----- diff --git a/tests/testkeys/id_rsa.pub b/tests/testkeys/id_rsa.pub new file mode 100644 index 0000000..0a282b7 --- /dev/null +++ b/tests/testkeys/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPewJw9ezpriINTdlOqLnBqh68ntIl26F0DhF6KdPZDsPDVFvUZ5HxJV1t3yBqQ5JpvUN3c7KEH+wxkEchfkarTL7ekIvUF+Q/0zjmKtBQitertlcyQSpsc8zuvA2h2YYnJWrkCt+obXoWxN2AQv1efkrr+LQuFr9j79ORdpwB7S2d2yDCwOd0R8xxpEfMbiKwNGWMANDnlNr9CoCYhU1JIE4i9xUrbIoDTtfYqVJBVo4jZb6qx9EKY4Srz2hEoL1h7xOOG2XUVhQ50FI6XK540Q1Xa5VXW1+FQPg9ew7uyG1vR4SwWRBlF4CDiSWxo+qXG/ELgosFoucPsriSnRlF kozat@Kozat-MacBook-Pro.local diff --git a/tests/testkeys/old/id_rsa b/tests/testkeys/old/id_rsa new file mode 100644 index 0000000..646c190 --- /dev/null +++ b/tests/testkeys/old/id_rsa @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,16BD7B6B8BF0F8D0E954397B477C7BC1 + +NmwVRQcPKJQLDS5Ainwf718QUZqMfzuTKldc4d0MFbA/fB9tYBxk5Mge0ftv3T0f +zrn2KfqB2cbLO/Ncxge4OpfHUeT7mJsOiqsarZF+OKqs7S38iRRIY2LNw9gjHXON +kqtf8YbMuqKT3P6Bd1wdApKp+N6WAq59whPO+FG2q7KISWx9xVr4vpnMRFaVUafx +LoOuP0AHevbBmdh7wqI/cPnr/VnRFmT0GkMzeXpA6IKzkIu29hLosSqyOuL8KCLa +Yi0Re9oxahdxvQga2qEmh1P6LfEvEpZasdBUXUXeXgJWdfUDfZMU0cHHmfbBZ3xK +vPDsdvatcXS5Gx5EAFitWmo9yrpNnAUblDu5xaex4eE22tfzaZCMVih9u0YqkQIS +YDxIjSqqjfvd46mwog1fSu0qRgy+hxvh/ZRa3NYcPKl6GxjN9MOuEEhYH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qnXnAjqwzL37NXEklwPt70E4VPdmjZigOQDV3FKRTqAfjonhprRaCwUW +AwwydAYd0u+wd3TZSiJ4mwpB9OfxfZ8LHwG+4X416YG91V+vMaXzvq8oLtljFN7h +-----END RSA PRIVATE KEY----- diff --git a/tests/testkeys/old/id_rsa.pub b/tests/testkeys/old/id_rsa.pub new file mode 100644 index 0000000..62faf79 --- /dev/null +++ b/tests/testkeys/old/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZyMY7XtH1tvGwIYbGiolWvrH5CXlJEk29O/FMlZvI3dKrvn+AotItUUwyv9pdGy+XAknubIvnixxaWjyXzmpZfTmoYB9UpoY4X5f2A4zyhS6zTAoZO0FrD5ssGL6peao/2dt/DGGSovXqEdiNDq5y+BbozrEhaJl6z2iEjfEOyyt3opqzc3k1Cqq7GFlIfEbJQHVRuEZ+U3fP9JDvRosDEH2m6ZSobwyswhXL+n2c68KoCQeykMQ2NuK77WqF6+FdQ5pCcpGhVbJioO2/c3I/rMQ1DlHIne9VkislPGR+2d/ENBke76FQJX5eV6GMdoLt9L0vuOlQ/FZyHSQPlKCn kozat@Kozat-MacBook-Pro.local |