blob: d4eb6162851f709e1c078e900160cbf99a1d2398 [file] [log] [blame]
Jerry Flood775f59f2017-04-01 06:55:19 -04001*** Settings ***
2Documentation Initializes ONAP Test Web Page and Password
3
4Library Collections
5Library OperatingSystem
6Library StringTemplater
7Resource ../resources/openstack/keystone_interface.robot
8Resource ../resources/openstack/nova_interface.robot
9
10
11Test Timeout 1 minutes
12
13*** Variables ***
14${URLS_HTML_TEMPLATE} robot/assets/templates/web/index.html.template
15
16
17${WEB_USER} test
18${WEB_PASSWORD}
19
20${URLS_HTML} html/index.html
21${CREDENTIALS_FILE} /etc/lighttpd/authorization
22#${CREDENTIALS_FILE} authorization
23
24*** Test Cases ***
25Update ONAP Page
26 [Tags] UpdateWebPage
27 Run Keyword If '${WEB_PASSWORD}' == '' Fail "WEB Password must not be empty"
28 Run Openstack Auth Request auth
29 ${server_map}= Get Openstack Servers auth
30 ${oam_ip_map}= Create Dictionary
31 Set To Dictionary ${oam_ip_map} 10.0.0.1=onapdns
32 Set To Dictionary ${oam_ip_map} 10.0.1.1=aai
33 Set To Dictionary ${oam_ip_map} 10.0.2.1=appc
34 Set To Dictionary ${oam_ip_map} 10.0.3.1=sdc
35 Set To Dictionary ${oam_ip_map} 10.0.4.1=dcae_controller
36 Set To Dictionary ${oam_ip_map} 10.0.4.105=dcae_cdap
37 Set To Dictionary ${oam_ip_map} 10.0.4.102=dcae_coll
38 Set To Dictionary ${oam_ip_map} 10.0.5.1=mso
39 Set To Dictionary ${oam_ip_map} 10.0.6.1=policy
40 Set To Dictionary ${oam_ip_map} 10.0.7.1=sdnc
41 Set To Dictionary ${oam_ip_map} 10.0.8.1=vid
42 Set To Dictionary ${oam_ip_map} 10.0.9.1=portal
43 Set To Dictionary ${oam_ip_map} 10.0.10.1=robot
44 Set To Dictionary ${oam_ip_map} 10.0.11.1=message_router
45
46 ${values}= Create Dictionary
47 ${keys}= Get Dictionary Keys ${oam_ip_map}
48 :for ${oam_ip} in @{keys}
49 \ ${value_name}= Get From Dictionary ${oam_ip_map} ${oam_ip}
50 \ Set Public Ip ${server_map} ${oam_ip} ${value_name} ${values}
51 Log ${values}
52 Run Keyword If '${WEB_PASSWORD}' != '' Create File ${CREDENTIALS_FILE} ${WEB_USER}:${WEB_PASSWORD}
53 Create File From Template ${URLS_HTML_TEMPLATE} ${URLS_HTML} ${values}
54
55*** Keywords ***
56Create File From Template
57 [Arguments] ${template} ${file} ${values}
58 ${data} OperatingSystem.Get File ${template}
59 ${data}= Template String ${data} ${values}
60 Create File ${file} ${data}
61
62Set Public Ip
63 [Arguments] ${server_map} ${oam_ip} ${value_name} ${values}
64 ${status} ${public_ip}= Run Keyword And Ignore Error Get Public Ip ${server_map} ${oam_ip}
65 ${public_ip}= Set Variable If '${status}' == 'PASS' ${public_ip} ${oam_ip}
66 Set To Dictionary ${values} ${value_name} ${public_ip}
67
68Get Public Ip
69 [Arguments] ${server_map} ${oam_ip}
70 ${servers} Get Dictionary Values ${server_map}
71 :for ${server} in @{servers}
72 \ ${status} ${public_ip} Run Keyword And Ignore Error Search Addresses ${server} ${oam_ip}
73 \ Return From Keyword If '${status}' == 'PASS' ${public_ip}
74 Fail ${oam_ip} Server Not Found
75
76Search Addresses
77 [Arguments] ${server} ${oam_ip}
78 ${addresses} Get From Dictionary ${server} addresses
79 ${public_ips} Get From Dictionary ${addresses} public
80 ${public_ip}= Get V4 IP ${public_ips}
Jerry Floodb77b6972017-04-04 17:23:17 -040081 ${oam_ips} Get From Dictionary ${addresses} ${GLOBAL_INJECTED_NETWORK}
Jerry Flood775f59f2017-04-01 06:55:19 -040082 ${this_oam_ip}= Get V4 IP ${oam_ips}
83 Return From Keyword If '${this_oam_ip}' == '${oam_ip}' ${public_ip}
84 Fail ${oam_ip} Server Not Found
85
86Get V4 IP
87 [Arguments] ${ipmaps}
88 :for ${ipmap} in @{ipmaps}
89 \ ${ip} Get From Dictionary ${ipmap} addr
90 \ ${version} Get From Dictionary ${ipmap} version
91 \ Return from Keyword if '${version}' == '4' ${ip}
92 Fail No Version 4 IP