blob: c57e7953a62d9ee13cf1ab3db9d6377120ffb6d0 [file] [log] [blame]
Kailash Khalasiecf30142018-01-24 15:16:45 -08001# 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 ***
16Test Timeout 2 minutes
17Documentation Validates external connectivity from Cord-Tester Container through VSG Subscriber
18Library OperatingSystem
19Library SSHLibrary
20Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/utils.py
21Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/onosUtils.py
22Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/openstackUtils.py
23Resource /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/utils.robot
24
25*** Variables ***
26${netcfg_file} qct_fabric_test_netcfg.json
27
28*** Test Cases ***
29Configure X-Connects for 3 Subscribers
30 [Documentation] Configures the cross connect on the fabric switch with s-tags for the subscribers created via control-plane tests on the correct ports
31 ${netcfg_init}= onosUtils.onos_command_execute onos-fabric 8101 netcfg
32 Log ${netcfg_init}
33 Run http -a onos:rocks DELETE http://onos-fabric:8181/onos/v1/network/configuration/
34 Run http -a onos:rocks POST http://onos-fabric:8181/onos/v1/network/configuration/ < /opt/cord/test/cord-tester/src/test/setup/${netcfg_file}
35 Run http -a onos:rocks DELETE http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active
36 Run http -a onos:rocks POST http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active
37 Sleep 5
38 ${netcfg}= onosUtils.onos_command_execute onos-fabric 8101 netcfg
39 Log ${netcfg}
40 Should Contain ${netcfg} vsg-1
41 Should Contain ${netcfg} vsg-2
42 Should Contain ${netcfg} vsg-3
43 Should Contain ${netcfg} "vlan" : 333
44 Should Contain ${netcfg} "vlan" : 555
45 Should Contain ${netcfg} "vlan" : 666
46
47Get VSG Subscriber and Tags
48 [Documentation] Retrieves compute node connected on leaf-1 and s/c tags for that particular subscriber
49 ${cmd}= Set Variable cordvtn-nodes | grep 10.6.1
50 ${cnode}= onosUtils.onos_command_execute onos-cord 8102 ${cmd}
51 @{cnode_on_leaf_1}= Split String ${cnode}
52 ${novalist}= Run . /opt/cord_profile/admin-openrc.sh; nova list --all-tenants | awk '{print $2}' | grep '[a-z]'
53 Log ${novalist}
54 @{nova_ids}= Split To Lines ${novalist}
55 : FOR ${nova_id} IN @{nova_ids}
56 \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}'
57 \ Run Keyword If '${node}' == '${cnode_on_leaf_1[0]}' Exit For Loop
58 ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}'
59 ## Get s/c tags for vsg
60 Run ssh-agent bash \r
61 Run ssh-add
62 ${result}= Run ssh -A ubuntu@${cnode_on_leaf_1[0]} ssh ubuntu@${mgmt_ip} sudo docker ps | grep vsg- | awk '{print $10}'
63 @{tags}= Split String ${result} -
64 ${s_tag}= Set Variable ${tags[1]}
65 ${c_tag}= Set Variable ${tags[2]}
66 Set Suite Variable ${s_tag}
67 Set Suite Variable ${c_tag}
68
69Execute Dataplane Test
70 [Documentation] Configures interfaces on cord-tester container to connect to vsg instance and validates traffic
71 ${i_num}= Set Variable If
72 ... '${s_tag}' == '333' 1
73 ... '${s_tag}' == '555' 2
74 ... '${s_tag}' == '666' 3
75 ${output}= Run docker exec cord-tester1 bash -c "sudo echo 'nameserver 192.168.0.1' > /etc/resolv.conf"
76 ${output}= Run docker exec cord-tester1 bash -c "sudo dhclient vcpe${i_num}.${s_tag}.${c_tag}"
77 Sleep 5
78 ${output}= Run docker exec cord-tester1 bash -c "sudo route add default gw 192.168.0.1 vcpe${i_num}.${s_tag}.${c_tag}"
79 ${output}= Run docker exec cord-tester1 bash -c "ping -c 3 -I vcpe${i_num}.${s_tag}.${c_tag} 8.8.8.8"
80 Log To Console \n ${output}
81 Should Contain ${output} 64 bytes from 8.8.8.8
82 Should Not Contain ${output} 100% packet loss