Remove testplans and suites for openstack
[integration/test.git] / tools / deployment / openstack_ha / libraries / OpenStackInstallUtils.robot
1 *** Settings ***
2 Documentation       Openstack library. This library is useful for tests to create network, subnet, router and vm instances
3
4 Library             Collections
5 Library             SSHLibrary
6 Library             OperatingSystem
7 Resource            SystemUtils.robot
8 Resource            ../variables/Variables.robot
9 Resource            ../variables/netvirt/Variables.robot
10 Variables           ../variables/netvirt/Modules.py
11
12
13 *** Keywords ***
14 Setup Basic Ssh
15     [Documentation]    Open SSh Connection and disable selinux
16     [Arguments]    ${node_ip}    ${user_name}    ${password}    ${prompt}
17     ${connection}=    Get Ssh Connection    ${node_ip}    ${user_name}    ${password}    ${prompt}
18     Disable SeLinux Tempororily    ${connection}
19     RETURN    ${connection}
20
21 Get All Ssh Connections
22     [Documentation]    Open All SSH Connections.
23     IF    0 < ${NUM_CONTROL_NODES}
24         Setup Basic Ssh    ${OS_CONTROL_1_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
25     END
26     IF    2 < ${NUM_CONTROL_NODES}
27         Setup basic Ssh    ${OS_CONTROL_2_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
28     END
29     IF    2 < ${NUM_CONTROL_NODES}
30         Setup basic Ssh    ${OS_CONTROL_3_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
31     END
32     IF    3 < ${NUM_CONTROL_NODES}
33         Setup basic Ssh    ${OS_CONTROL_4_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
34     END
35     IF    4 < ${NUM_CONTROL_NODES}
36         Setup basic Ssh    ${OS_CONTROL_5_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
37     END
38     IF    2 < ${NUM_CONTROL_NODES}
39         Setup basic Ssh    ${HAPROXY_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
40     END
41     IF    0 < ${NUM_COMPUTE_NODES}
42         Setup basic Ssh    ${OS_COMPUTE_1_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
43     END
44     IF    1 < ${NUM_COMPUTE_NODES}
45         Setup basic Ssh    ${OS_COMPUTE_2_IP}    ${OS_USER}    ${OS_USER_PASSWORD}    ${OS_NODE_PROMPT}
46     END
47
48 Enable Live Migration In A Node
49     [Arguments]    ${compute_cxn}
50     Switch Connection    ${compute_cxn}
51     Crudini Edit    ${compute_cxn}    /etc/libvirt/libvirtd.conf    ''    listen_tls    0
52     Crudini Edit    ${compute_cxn}    /etc/libvirt/libvirtd.conf    ''    listen_tcp    0
53     Crudini Edit    ${compute_cxn}    /etc/libvirt/libvirtd.conf    ''    auth_tcp    '"none"'
54     Crudini Edit
55     ...    ${compute_cxn}
56     ...    /etc/nova/nova.conf
57     ...    DEFAULT
58     ...    instances_path
59     ...    '/var/lib/nova/instances_live_migration'
60     Restart Service    ${compute_cxn}    openstack-nova-compute libvirtd
61
62 Enable Live Migration In All Compute Nodes
63     [Documentation]    Enables Live Migration in all computes
64     ${compute_1_cxn}=    Setup Basic Ssh    ${OS_COMPUTE_1_IP}    jenkins    ''    '>'
65     Enable Live Migration In A Node    ${compute_1_cxn}
66     ${compute_2_cxn}=    Setup Basic Ssh    ${OS_COMPUTE_2_IP}    jenkins    ''    '>'
67     Enable Live Migration In A Node    ${compute_2_cxn}
68
69 Activate Control Node
70     [Arguments]    ${control_node_cxn}
71     Enable Service    ${control_node_cxn}    httpd
72     Start Service    ${control_node_cxn}    httpd
73     Start Service    ${control_node_cxn}    openstack-glance-api openstack-glance-registry
74     Start Service
75     ...    ${control_node_cxn}
76     ...    openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.servi
77     ...    ce openstack-nova-novncproxy.service
78     Run Command
79     ...    ${os_node_cxn}
80     ...    sudo ovs-vsctl set-manager tcp:${OS_CONTROL_1_IP}:6640 tcp:${OS_CONTROL_2_IP}:6640 tcp:${OS_CONTROL_3_IP}:6640 tcp:${OS_CONTROL_4_IP}:6640 tcp:${OS_CONTROL_5_IP}:6640
81     Start Service
82     ...    ${control_node_cxn}
83     ...    neutron-server.service neutron-dhcp-agent.service neutron-metadata-agent.service