adding vsg_dataplane test for qct-1
Change-Id: I33e4888d0067f64d8488208f72fcd815cd9e8498
diff --git a/Jenkinsfile-rcord b/Jenkinsfile-rcord
index dce5948..31142f5 100644
--- a/Jenkinsfile-rcord
+++ b/Jenkinsfile-rcord
@@ -31,6 +31,12 @@
sudo ./prerequisites.sh --cord
""")
}
+ stage('Bring up Cord-Test Container') {
+ runHeadNodeCmd("""
+ cd /opt/cord/test/cord-tester/src/test/setup
+ sudo ./cord-test.py setup -m manifest-onf-cord.json
+ """)
+ }
stage('Configure Fabric for E2E testing') {
//FIXME: this only works for PODs with 2 leaf switches
fabricIpPrefix = pod_config.fabric_ip.split(/\.\d+\.\d+\/24/)[0]
@@ -130,6 +136,19 @@
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
+ stage('Dataplane Test') {
+ timeout(10) {
+ try {
+ runHeadNodeCmd("""
+ cd /opt/cord/test/cord-tester/src/test/vsg/
+ rm -r Log/ || true
+ ssh-agent bash
+ ssh-add
+ pybot -L TRACE -d Log -T vsg_dataplane_test.robot
+ """)
+ } catch(error) { currentBuild.result = 'FAILURE' }
+ }
+ }
stage('Publish') {
try {
sh """
@@ -137,6 +156,7 @@
scp -r ${deployment_config.head.user}@${deployment_config.head.ip}:/opt/cord/test/cord-tester/src/test/cord-api/Log/* ./RobotLogs || true
scp -r ${deployment_config.head.user}@${deployment_config.head.ip}:/opt/cord/test/cord-tester/src/test/robot/Log/* ./RobotLogs || true
scp -r ${deployment_config.head.user}@${deployment_config.head.ip}:/opt/cord/test/cord-tester/src/test/diag/Log/* ./RobotLogs || true
+ scp -r ${deployment_config.head.user}@${deployment_config.head.ip}:/opt/cord/test/cord-tester/src/test/vsg/Log/* ./RobotLogs || true
"""
step([$class: 'RobotPublisher',
disableArchiveOutput: false,
diff --git a/src/test/setup/flex_fabric_test_netcfg.json b/src/test/setup/flex_fabric_test_netcfg.json
new file mode 100644
index 0000000..93b3db3
--- /dev/null
+++ b/src/test/setup/flex_fabric_test_netcfg.json
@@ -0,0 +1,100 @@
+{
+ "devices": {
+ "of:0000cc37ab5b6da8": {
+ "segmentrouting": {
+ "name": "device-cc37ab5b6da8",
+ "ipv4NodeSid": 100,
+ "ipv4Loopback": "10.6.0.104",
+ "routerMac": "cc:37:ab:5b:6d:a8",
+ "isEdgeRouter": false,
+ "adjacencySids": []
+ }
+ },
+ "of:0000cc37abd93769": {
+ "segmentrouting": {
+ "name": "device-cc37abd93769",
+ "ipv4NodeSid": 101,
+ "ipv4Loopback": "10.6.0.103",
+ "routerMac": "cc:37:ab:d9:37:69",
+ "isEdgeRouter": true,
+ "adjacencySids": []
+ }
+ },
+ "of:0000cc37abb6b564": {
+ "segmentrouting": {
+ "name": "device-cc37abb6b564",
+ "ipv4NodeSid": 102,
+ "ipv4Loopback": "10.6.0.102",
+ "routerMac": "cc:37:ab:b6:b5:64",
+ "isEdgeRouter": true,
+ "adjacencySids": []
+ }
+ },
+ "of:0000cc37abd9386d": {
+ "segmentrouting": {
+ "name": "device-cc37abd9386d",
+ "ipv4NodeSid": 103,
+ "ipv4Loopback": "10.6.0.101",
+ "routerMac": "cc:37:ab:d9:38:6d",
+ "isEdgeRouter": false,
+ "adjacencySids": []
+ }
+ }
+ },
+ "ports": {
+ "of:0000cc37abb6b564/2": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.2.254/24" ],
+ "vlan-untagged" : 2
+ }
+ ]
+ },
+ "of:0000cc37abd93769/2": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.1.254/24" ],
+ "vlan-untagged" : 1
+ }
+ ]
+ },
+ "of:0000cc37abb6b564/1": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.2.254/24" ],
+ "vlan-untagged" : 2
+ }
+ ]
+ },
+ "of:0000cc37abd93769/1": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.1.254/24" ],
+ "vlan-untagged" : 1
+ }
+ ]
+ }
+ },
+ "apps" : {
+ "org.onosproject.segmentrouting" : {
+ "segmentrouting" : {
+ "vRouterMacs" : [ "a4:23:05:06:01:01" ]
+ },
+ "xconnect": {
+ "of:0000cc37abd93769": [{
+ "vlan": 333,
+ "ports": [1, 2],
+ "name": "vsg-1"
+ },
+ {
+ "vlan": 555,
+ "ports": [1, 2],
+ "name": "vsg-2"},
+ {
+ "vlan": 666,
+ "ports": [1, 2],
+ "name": "vsg-3"}]
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/setup/qct_fabric_test_netcfg.json b/src/test/setup/qct_fabric_test_netcfg.json
new file mode 100644
index 0000000..b839cc0
--- /dev/null
+++ b/src/test/setup/qct_fabric_test_netcfg.json
@@ -0,0 +1,92 @@
+{
+ "devices": {
+ "of:0000480fcfaeee2a": {
+ "segmentrouting": {
+ "name": "device-480fcfaeee2a",
+ "ipv4NodeSid": 100,
+ "ipv4Loopback": "10.6.0.103",
+ "routerMac": "48:0f:cf:ae:ee:2a",
+ "isEdgeRouter": true,
+ "adjacencySids": []
+ }
+ },
+ "of:0000480fcfaede26": {
+ "segmentrouting": {
+ "name": "device-480fcfaede26",
+ "ipv4NodeSid": 101,
+ "ipv4Loopback": "10.6.0.101",
+ "routerMac": "48:0f:cf:ae:de:26",
+ "isEdgeRouter": true,
+ "adjacencySids": []
+ }
+ },
+ "of:0000480fcfae9d58": {
+ "segmentrouting": {
+ "name": "device-480fcfae9d58",
+ "ipv4NodeSid": 102,
+ "ipv4Loopback": "10.6.0.104",
+ "routerMac": "48:0f:cf:ae:9d:58",
+ "isEdgeRouter": false,
+ "adjacencySids": []
+ }
+ },
+ "of:0000480fcfaecc24": {
+ "segmentrouting": {
+ "name": "device-480fcfaecc24",
+ "ipv4NodeSid": 103,
+ "ipv4Loopback": "10.6.0.102",
+ "routerMac": "48:0f:cf:ae:cc:24",
+ "isEdgeRouter": false,
+ "adjacencySids": []
+ }
+ }
+ },
+ "ports": {
+ "of:0000480fcfaeee2a/1": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.2.254/24" ],
+ "vlan-untagged" : 2
+ }
+ ]
+ },
+ "of:0000480fcfaede26/1": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.1.254/24" ],
+ "vlan-untagged" : 1
+ }
+ ]
+ },
+ "of:0000480fcfaede26/2": {
+ "interfaces": [
+ {
+ "ips": [ "10.6.1.254/24" ],
+ "vlan-untagged" : 1
+ }
+ ]
+ }
+ },
+ "apps" : {
+ "org.onosproject.segmentrouting" : {
+ "segmentrouting" : {
+ "vRouterMacs" : [ "a4:23:05:06:01:01" ]
+ },
+ "xconnect": {
+ "of:0000480fcfaede26": [{
+ "vlan": 333,
+ "ports": [1, 2],
+ "name": "vsg-1"
+ },
+ {
+ "vlan": 555,
+ "ports": [1, 2],
+ "name": "vsg-2"},
+ {
+ "vlan": 666,
+ "ports": [1, 2],
+ "name": "vsg-3"}]
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/vsg/vsg_dataplane_test.robot b/src/test/vsg/vsg_dataplane_test.robot
new file mode 100644
index 0000000..c57e795
--- /dev/null
+++ b/src/test/vsg/vsg_dataplane_test.robot
@@ -0,0 +1,82 @@
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Test Timeout 2 minutes
+Documentation Validates external connectivity from Cord-Tester Container through VSG Subscriber
+Library OperatingSystem
+Library SSHLibrary
+Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/utils.py
+Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/onosUtils.py
+Library /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/openstackUtils.py
+Resource /opt/cord/test/cord-tester/src/test/cord-api/Framework/utils/utils.robot
+
+*** Variables ***
+${netcfg_file} qct_fabric_test_netcfg.json
+
+*** Test Cases ***
+Configure X-Connects for 3 Subscribers
+ [Documentation] Configures the cross connect on the fabric switch with s-tags for the subscribers created via control-plane tests on the correct ports
+ ${netcfg_init}= onosUtils.onos_command_execute onos-fabric 8101 netcfg
+ Log ${netcfg_init}
+ Run http -a onos:rocks DELETE http://onos-fabric:8181/onos/v1/network/configuration/
+ Run http -a onos:rocks POST http://onos-fabric:8181/onos/v1/network/configuration/ < /opt/cord/test/cord-tester/src/test/setup/${netcfg_file}
+ Run http -a onos:rocks DELETE http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active
+ Run http -a onos:rocks POST http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active
+ Sleep 5
+ ${netcfg}= onosUtils.onos_command_execute onos-fabric 8101 netcfg
+ Log ${netcfg}
+ Should Contain ${netcfg} vsg-1
+ Should Contain ${netcfg} vsg-2
+ Should Contain ${netcfg} vsg-3
+ Should Contain ${netcfg} "vlan" : 333
+ Should Contain ${netcfg} "vlan" : 555
+ Should Contain ${netcfg} "vlan" : 666
+
+Get VSG Subscriber and Tags
+ [Documentation] Retrieves compute node connected on leaf-1 and s/c tags for that particular subscriber
+ ${cmd}= Set Variable cordvtn-nodes | grep 10.6.1
+ ${cnode}= onosUtils.onos_command_execute onos-cord 8102 ${cmd}
+ @{cnode_on_leaf_1}= Split String ${cnode}
+ ${novalist}= Run . /opt/cord_profile/admin-openrc.sh; nova list --all-tenants | awk '{print $2}' | grep '[a-z]'
+ Log ${novalist}
+ @{nova_ids}= Split To Lines ${novalist}
+ : FOR ${nova_id} IN @{nova_ids}
+ \ ${node}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep :host | awk '{print $4}'
+ \ Run Keyword If '${node}' == '${cnode_on_leaf_1[0]}' Exit For Loop
+ ${mgmt_ip}= Run . /opt/cord_profile/admin-openrc.sh; nova show ${nova_id} | grep management | awk '{print $5}'
+ ## Get s/c tags for vsg
+ Run ssh-agent bash \r
+ Run ssh-add
+ ${result}= Run ssh -A ubuntu@${cnode_on_leaf_1[0]} ssh ubuntu@${mgmt_ip} sudo docker ps | grep vsg- | awk '{print $10}'
+ @{tags}= Split String ${result} -
+ ${s_tag}= Set Variable ${tags[1]}
+ ${c_tag}= Set Variable ${tags[2]}
+ Set Suite Variable ${s_tag}
+ Set Suite Variable ${c_tag}
+
+Execute Dataplane Test
+ [Documentation] Configures interfaces on cord-tester container to connect to vsg instance and validates traffic
+ ${i_num}= Set Variable If
+ ... '${s_tag}' == '333' 1
+ ... '${s_tag}' == '555' 2
+ ... '${s_tag}' == '666' 3
+ ${output}= Run docker exec cord-tester1 bash -c "sudo echo 'nameserver 192.168.0.1' > /etc/resolv.conf"
+ ${output}= Run docker exec cord-tester1 bash -c "sudo dhclient vcpe${i_num}.${s_tag}.${c_tag}"
+ Sleep 5
+ ${output}= Run docker exec cord-tester1 bash -c "sudo route add default gw 192.168.0.1 vcpe${i_num}.${s_tag}.${c_tag}"
+ ${output}= Run docker exec cord-tester1 bash -c "ping -c 3 -I vcpe${i_num}.${s_tag}.${c_tag} 8.8.8.8"
+ Log To Console \n ${output}
+ Should Contain ${output} 64 bytes from 8.8.8.8
+ Should Not Contain ${output} 100% packet loss
\ No newline at end of file