2 Documentation Test suite to verify packet flows between vm instances.
3 Suite Setup OpenStackInstallUtils.Get All Ssh Connections
4 Suite Teardown Close All Connections
6 Library OperatingSystem
7 Library RequestsLibrary
8 Resource ../libraries/OpenStackInstallUtils.robot
9 Resource ../libraries/SystemUtils.robot
10 Resource ../libraries/Utils.robot
14 Run Keyword If 2 > ${NUM_CONTROL_NODES} Install RabbitMQ ${OS_CONTROL_1_IP}
15 Run Keyword If 2 > ${NUM_CONTROL_NODES} Start RabbitMQ ${OS_CONTROL_1_IP}
16 Run Keyword If 2 > ${NUM_CONTROL_NODES} Add Openstack MQ ${OS_CONTROL_1_IP} openstack rabbit
17 Run Keyword If 2 < ${NUM_CONTROL_NODES} Install RabbitMQ ${OS_CONTROL_1_IP}
18 Run Keyword If 2 < ${NUM_CONTROL_NODES} Start Stop And Copy Cookie File ${OS_CONTROL_1_IP} rabbit rabbit
19 Run Keyword If 2 < ${NUM_CONTROL_NODES} Install RabbitMQ ${OS_CONTROL_2_IP}
20 Run Keyword If 2 < ${NUM_CONTROL_NODES} Install RabbitMQ ${OS_CONTROL_3_IP}
21 Run Keyword If 3 < ${NUM_CONTROL_NODES} Install RabbitMQ ${OS_CONTROL_4_IP}
22 Run Keyword If 4 < ${NUM_CONTROL_NODES} Install RabbitMQ ${OS_CONTROL_5_IP}
23 Run Keyword If 2 < ${NUM_CONTROL_NODES} Setup RabbitMQ Cluster ${OS_CONTROL_2_IP} rabbit ${OS_CONTROL_1_HOSTNAME}
24 Run Keyword If 2 < ${NUM_CONTROL_NODES} Setup RabbitMQ Cluster ${OS_CONTROL_3_IP} rabbit ${OS_CONTROL_1_HOSTNAME}
25 Run Keyword If 3 < ${NUM_CONTROL_NODES} Setup RabbitMQ Cluster ${OS_CONTROL_4_IP} rabbit ${OS_CONTROL_1_HOSTNAME}
26 Run Keyword If 4 < ${NUM_CONTROL_NODES} Setup RabbitMQ Cluster ${OS_CONTROL_5_IP} rabbit ${OS_CONTROL_1_HOSTNAME}
27 Run Keyword If 2 < ${NUM_CONTROL_NODES} Generic HAProxy Entry ${HAPROXY_IP} ${HAPROXY_IP} 5672 rabbitmq
31 [Arguments] ${os_node_cxn}
32 Run Keyword If '${OS_APPS_PRE_INSTALLED}' == 'no' Install Rpm Package ${os_node_cxn} rabbitmq-server
33 Enable Service ${os_node_cxn} rabbitmq-server
36 [Arguments] ${os_node_cxn}
37 Enable Service ${os_node_cxn} rabbitmq-server
38 Start Service ${os_node_cxn} rabbitmq-server
40 Start Stop And Copy Cookie File
41 [Arguments] ${os_node_cxn} ${rabbit_user} ${rabbit_pass}
42 Enable Service ${os_node_cxn} rabbitmq-server
43 Start Service ${os_node_cxn} rabbitmq-server
44 Add Openstack MQ ${os_node_cxn} openstack rabbit
45 Get RabbitMQ Cookie File ${os_node_cxn}
48 [Arguments] ${os_node_cxn} ${rabbit_user} ${rabbit_pass}
49 Add Rabbitmq User ${os_node_cxn} ${rabbit_user} ${rabbit_pass}
50 Enable Access to Rabbitmq vhost ${os_node_cxn} ${rabbit_user}
52 Setup RabbitMQ Cluster
53 [Arguments] ${os_node_cxn} ${rabbit_user} ${src_hostname}
54 Copy RabbitMQ Cookie File ${os_node_cxn} ${rabbit_user} ${src_hostname}
57 [Arguments] ${os_node_cxn} ${rabbit_user} ${rabbit_pass}
58 [Documentation] Add a user to Rabbit MQ
59 Switch Connection ${os_node_cxn}
60 ${output} ${rc}= Execute Command sudo rabbitmqctl add_user ${rabbit_user} ${rabbit_pass} return_rc=True return_stdout=True
62 #Should Not Be True ${rc}
65 Change Rabbitmq Password
66 [Arguments] ${os_node_cxn} ${rabbit_user} ${rabbit_pass}
67 [Documentation] Add a user to Rabbit MQ
68 Switch Connection ${os_node_cxn}
69 ${output} ${rc}= Execute Command sudo rabbitmqctl change_password ${rabbit_user} ${rabbit_pass} return_rc=True return_stdout=True
71 Should Not Be True ${rc}
74 Enable Access to Rabbitmq vhost
75 [Arguments] ${os_node_cxn} ${rabbit_user}
76 [Documentation] Add a user to Rabbit MQ
77 Switch Connection ${os_node_cxn}
78 ${output} ${rc}= Execute Command rabbitmqctl set_permissions ${rabbit_user} ".*" ".*" ".*" return_rc=True return_stdout=True
80 Should Not Be True ${rc}
84 [Arguments] ${os_node_cxn}
85 [Documentation] Stop the RabbitMQ user
86 Switch Connection ${os_node_cxn}
87 ${output} ${rc}= Execute Command rabbitmqctl stop_app return_rc=True return_stdout=True
89 Should Not Be True ${rc}
92 Get RabbitMQ Cookie File
93 [Arguments] ${os_node_cxn}
94 [Documentation] Get the Cookie file from the primary node
95 Switch Connection ${os_node_cxn}
96 ${output} ${rc}= Execute Command rabbitmqctl stop_app return_rc=True return_stdout=True
98 Should Not Be True ${rc}
99 SSHLibrary.Get File /var/lib/rabbitmq/.erlang.cookie /tmp/
100 ${output} ${rc}= Execute Command rabbitmqctl start_app return_rc=True return_stdout=True
102 Should Not Be True ${rc}
103 ${output} ${rc}= Execute Command rabbitmqctl cluster_status return_rc=True return_stdout=True
105 Should Not Be True ${rc}
107 Copy RabbitMQ Cookie File
108 [Arguments] ${os_node_cxn} ${rabbit_user} ${src_hostname}
109 [Documentation] Copy the rabbit cookie file to other servers to join the cluster
110 Switch Connection ${os_node_cxn}
111 SSHLibrary.Put File /tmp/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie
112 ${output} ${rc}= Execute Command chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie return_rc=True return_stdout=True
114 Should Not Be True ${rc}
115 ${output} ${rc}= Execute Command chmod 400 /var/lib/rabbitmq/.erlang.cookie return_rc=True return_stdout=True
117 Should Not Be True ${rc}
118 Enable Service ${os_node_cxn} rabbitmq-server
119 Start Service ${os_node_cxn} rabbitmq-server
120 ${output} ${rc}= Execute Command rabbitmqctl stop_app return_rc=True return_stdout=True
122 Should Not Be True ${rc}
123 ${output} ${rc}= Execute Command rabbitmqctl join_cluster --ram ${rabbit_user}@${src_hostname} return_rc=True return_stdout=True
125 Should Not Be True ${rc}
126 ${output} ${rc}= Execute Command rabbitmqctl start_app return_rc=True return_stdout=True
128 Should Not Be True ${rc}
129 ${output} ${rc}= Execute Command rabbitmqctl cluster_status return_rc=True return_stdout=True
131 Should Not Be True ${rc}
132 Run Command ${os_node_cxn} sudo rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}'