Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | *** Settings *** |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 16 | Suite Setup Setup |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 17 | Suite Teardown Teardown |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 18 | Test Timeout 10 minutes |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 19 | Documentation Validates external connectivity from Cord-Tester Container through VSG Subscriber |
| 20 | Library OperatingSystem |
| 21 | Library SSHLibrary |
| 22 | Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/utils.py |
| 23 | Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/onosUtils.py |
| 24 | Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/openstackUtils.py |
| 25 | Resource /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/utils.robot |
| 26 | |
| 27 | *** Variables *** |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 28 | ${pod} qct-pod1.yml |
Kailash Khalasi | d34f58a | 2018-03-01 21:27:17 -0800 | [diff] [blame] | 29 | ${vsg_data_file} /opt/cord/test/cord-tester/src/test/cord-api/Tests/data/Ch_Subscriber.json |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 30 | |
| 31 | *** Test Cases *** |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 32 | Validate Instances are ACTIVE |
| 33 | [Documentation] Validates that all instances are ACTIVE |
| 34 | Wait Until Keyword Succeeds 300s 5s Instances ACTIVE |
| 35 | |
| 36 | Validate Connectivity to All VSGs via Mgmt Interface |
| 37 | [Documentation] Validates that all given vsg instances are reachable through the mgmt interfaces |
| 38 | ##Loop through nova ids, get mgmt ips + compute nodes, ssh into compute node, and validate ping to mgmt_ip |
| 39 | : FOR ${nova_id} IN @{nova_ids} |
| 40 | \ ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}' |
| 41 | \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}' |
| 42 | \ ${ping_result}= Run ssh ubuntu@${node} ping -c 1 ${mgmt_ip} |
| 43 | \ Should Contain ${ping_result} 64 bytes from ${mgmt_ip} |
| 44 | \ Should Not Contain ${ping_result} 100% packet loss |
| 45 | |
| 46 | Validate VSG External Connectivity |
| 47 | [Documentation] Validates that the given vsg instances have external connectivity |
| 48 | : FOR ${nova_id} IN @{nova_ids} |
| 49 | \ ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}' |
| 50 | \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}' |
| 51 | \ Wait Until Keyword Succeeds 300s 5s Validate Ext Connectivity ${node} ${mgmt_ip} |
| 52 | |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 53 | Configure X-Connects for 3 Subscribers |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 54 | [Documentation] Configures the cross connect on the fabric switch with s-tags for the subscribers created via control-plane tests on the correct ports |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 55 | [Tags] xconnect dataplane |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 56 | ${netcfg_init}= onosUtils.onos_command_execute onos-fabric 8101 netcfg |
| 57 | Log ${netcfg_init} |
| 58 | Run http -a onos:rocks DELETE http://onos-fabric:8181/onos/v1/network/configuration/ |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 59 | Sleep 15 |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 60 | Run http -a onos:rocks POST http://onos-fabric:8181/onos/v1/network/configuration/ < /opt/cord/test/cord-tester/src/test/setup/${netcfg_file} |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 61 | Sleep 15 |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 62 | Run http -a onos:rocks DELETE http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 63 | Sleep 15 |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 64 | Run http -a onos:rocks POST http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 65 | Sleep 15 |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 66 | ${netcfg}= onosUtils.onos_command_execute onos-fabric 8101 netcfg |
| 67 | Log ${netcfg} |
| 68 | Should Contain ${netcfg} vsg-1 |
| 69 | Should Contain ${netcfg} vsg-2 |
| 70 | Should Contain ${netcfg} vsg-3 |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 71 | Should Contain ${netcfg} "vlan" : ${s_tags[0]} |
| 72 | Should Contain ${netcfg} "vlan" : ${s_tags[1]} |
| 73 | Should Contain ${netcfg} "vlan" : ${s_tags[2]} |
| 74 | |
| 75 | Validate VSG External Connectivity Again |
| 76 | [Documentation] Validates that the given vsg instances have external connectivity even after onos-fabric has been re-configured |
| 77 | : FOR ${nova_id} IN @{nova_ids} |
| 78 | \ ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}' |
| 79 | \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}' |
| 80 | \ Wait Until Keyword Succeeds 300s 5s Validate Ext Connectivity ${node} ${mgmt_ip} |
| 81 | |
| 82 | Validate VCPE Containers |
| 83 | [Documentation] Validates that vcpes containers are up in each vsg instance |
| 84 | : FOR ${nova_id} IN @{nova_ids} |
| 85 | \ ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}' |
| 86 | \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}' |
| 87 | \ Wait Until Keyword Succeeds 800s 5s Validate VCPE Container is Up ${node} ${mgmt_ip} |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 88 | |
| 89 | Get VSG Subscriber and Tags |
| 90 | [Documentation] Retrieves compute node connected on leaf-1 and s/c tags for that particular subscriber |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 91 | [Tags] dataplane |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 92 | ${cmd}= Set Variable cordvtn-nodes | grep 10.6.1 |
| 93 | ${cnode}= onosUtils.onos_command_execute onos-cord 8102 ${cmd} |
| 94 | @{cnode_on_leaf_1}= Split String ${cnode} |
| 95 | ${novalist}= Run . /opt/cord_profile/admin-openrc.sh; nova list --all-tenants | awk '{print $2}' | grep '[a-z]' |
| 96 | Log ${novalist} |
| 97 | @{nova_ids}= Split To Lines ${novalist} |
| 98 | : FOR ${nova_id} IN @{nova_ids} |
| 99 | \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}' |
| 100 | \ Run Keyword If '${node}' == '${cnode_on_leaf_1[0]}' Exit For Loop |
| 101 | ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}' |
| 102 | ## Get s/c tags for vsg |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 103 | ${result}= Run ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu ${cnode_on_leaf_1[0]}" ubuntu@${mgmt_ip} "sudo docker ps|grep 'vsg\\|vcpe'" | awk '{print $10}' |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 104 | @{tags}= Split String ${result} - |
| 105 | ${s_tag}= Set Variable ${tags[1]} |
| 106 | ${c_tag}= Set Variable ${tags[2]} |
| 107 | Set Suite Variable ${s_tag} |
| 108 | Set Suite Variable ${c_tag} |
| 109 | |
| 110 | Execute Dataplane Test |
| 111 | [Documentation] Configures interfaces on cord-tester container to connect to vsg instance and validates traffic |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 112 | [Tags] dataplane |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 113 | ${i_num}= Set Variable If |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 114 | ... '${s_tag}' == '${s_tags[0]}' 1 |
| 115 | ... '${s_tag}' == '${s_tags[1]}' 2 |
| 116 | ... '${s_tag}' == '${s_tags[2]}' 3 |
Kailash Khalasi | ecf3014 | 2018-01-24 15:16:45 -0800 | [diff] [blame] | 117 | ${output}= Run docker exec cord-tester1 bash -c "sudo echo 'nameserver 192.168.0.1' > /etc/resolv.conf" |
| 118 | ${output}= Run docker exec cord-tester1 bash -c "sudo dhclient vcpe${i_num}.${s_tag}.${c_tag}" |
| 119 | Sleep 5 |
| 120 | ${output}= Run docker exec cord-tester1 bash -c "sudo route add default gw 192.168.0.1 vcpe${i_num}.${s_tag}.${c_tag}" |
| 121 | ${output}= Run docker exec cord-tester1 bash -c "ping -c 3 -I vcpe${i_num}.${s_tag}.${c_tag} 8.8.8.8" |
| 122 | Log To Console \n ${output} |
| 123 | Should Contain ${output} 64 bytes from 8.8.8.8 |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 124 | Should Not Contain ${output} 100% packet loss |
| 125 | |
| 126 | *** Keywords *** |
| 127 | Setup |
| 128 | [Documentation] Gets global vars for test suite |
| 129 | @{s_tags}= Create List |
| 130 | @{c_tags}= Create List |
| 131 | ${netcfg_file}= Set Variable If |
| 132 | ... '${pod}' == 'qct-pod1.yml' qct_fabric_test_netcfg.json |
| 133 | ... '${pod}' == 'flex-pod1.yml' flex_fabric_test_netcfg.json |
| 134 | ... '${pod}' == 'calix-pod1.yml' calix_fabric_test_netcfg.json |
| 135 | Set Suite Variable ${netcfg_file} |
Kailash Khalasi | d34f58a | 2018-03-01 21:27:17 -0800 | [diff] [blame] | 136 | ${subscriberList} = utils.jsonToList ${vsg_data_file} SubscriberInfo |
| 137 | Set Suite Variable ${slist} ${subscriberList} |
| 138 | ${voltTenantList} = Get Variable Value ${slist} |
| 139 | ${vsg_count}= Get Length ${slist} |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 140 | Set Suite Variable ${vsg_count} |
| 141 | : FOR ${INDEX} IN RANGE 0 ${vsg_count} |
Kailash Khalasi | d34f58a | 2018-03-01 21:27:17 -0800 | [diff] [blame] | 142 | \ ${s_tag}= Get From Dictionary ${slist[${INDEX}]} s_tag |
| 143 | \ ${c_tag}= Get From Dictionary ${slist[${INDEX}]} c_tag |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 144 | \ Append To List ${s_tags} ${s_tag} |
| 145 | \ Append To List ${c_tags} ${c_tag} |
| 146 | @{nova_ids}= Wait Until Keyword Succeeds 120s 5s Validate Number of VSGs ${vsg_count} |
| 147 | Set Suite Variable @{nova_ids} |
| 148 | Set Suite Variable ${s_tags} |
| 149 | Set Suite Variable ${c_tags} |
| 150 | |
Kailash Khalasi | 29ffe5e | 2018-02-09 13:34:31 -0800 | [diff] [blame] | 151 | Teardown |
| 152 | ${cmd}= Set Variable log:display |
| 153 | ${onos_logs}= onosUtils.onos_command_execute onos-fabric 8101 ${cmd} |
| 154 | Log ${onos_logs} |
| 155 | |
Kailash Khalasi | 9b31109 | 2018-02-08 11:26:37 -0800 | [diff] [blame] | 156 | Validate Number of VSGs |
| 157 | [Arguments] ${count} |
| 158 | ${novalist}= Run . /opt/cord_profile/admin-openrc.sh; nova list --all-tenants | awk '{print $2}' | grep '[a-z]' |
| 159 | Log ${novalist} |
| 160 | @{nova_ids}= Split To Lines ${novalist} |
| 161 | ${vsgCount}= Get Length ${nova_ids} |
| 162 | Should Be Equal ${vsgCount} ${count} |
| 163 | [Return] @{nova_ids} |
| 164 | |
| 165 | Instances ACTIVE |
| 166 | : FOR ${nova_id} IN @{nova_ids} |
| 167 | \ ${status}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep status | awk '{print $4}' |
| 168 | \ Should Be Equal ${status} ACTIVE |
| 169 | |
| 170 | Validate Ext Connectivity |
| 171 | [Arguments] ${compute_node} ${vsg_ip} |
| 172 | ${ping_ext_result}= Run ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu ${compute_node}" ubuntu@${vsg_ip} "ping -c 3 8.8.8.8" |
| 173 | Should Contain ${ping_ext_result} 64 bytes from 8.8.8.8 |
| 174 | Should Not Contain ${ping_ext_result} 100% packet loss |
| 175 | |
| 176 | Validate VCPE Container is Up |
| 177 | [Arguments] ${compute_node} ${vsg_ip} |
| 178 | ${docker_containers}= Run ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu ${compute_node}" ubuntu@${vsg_ip} sudo docker ps | wc -l |
Kailash Khalasi | d34f58a | 2018-03-01 21:27:17 -0800 | [diff] [blame] | 179 | Should Not Contain ${docker_containers} 0 |