2 Documentation Test suite to verify SFC configuration and packet flows.
3 Suite Setup Suite Setup
4 Suite Teardown OpenStackOperations.OpenStack Suite Teardown
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Teardown BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
7 ... AND OpenStackOperations.Get Test Teardown Debugs For SFC
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../libraries/DevstackUtils.robot
12 Resource ../../../libraries/OpenStackOperations.robot
13 Resource ../../../libraries/SetupUtils.robot
14 Resource ../../../libraries/Utils.robot
15 Resource ../../../libraries/KarafKeywords.robot
18 ${SECURITY_GROUP} sg-sfc
20 @{SUBNETS} l2_subnet_1
21 @{NET_1_VMS} sf1 sf2 sf3 source_vm dest_vm
22 @{SUBNET_CIDRS} 30.0.0.0/24
23 @{PORTS} p1in p1out p2in p2out p3in p3out source_vm_port
27 Create Flow Classifiers
28 [Documentation] Create SFC Flow Classifier for TCP traffic between source VM and destination VM
29 OpenStackOperations.Create SFC Flow Classifier FC_http @{NET1_VM_IPS}[3] @{NET1_VM_IPS}[4] tcp 80 source_vm_port
32 [Documentation] Create SFC Port Pairs
33 OpenStackOperations.Create SFC Port Pair PP1 p1in p1out
34 OpenStackOperations.Create SFC Port Pair PP2 p2in p2out
35 OpenStackOperations.Create SFC Port Pair PP3 p3in p3out
37 Create Port Pair Groups
38 [Documentation] Create SFC Port Pair Groups
39 OpenStackOperations.Create SFC Port Pair Group With Two Pairs PG1 PP1 PP2
40 OpenStackOperations.Create SFC Port Pair Group PG2 PP3
43 [Documentation] Create SFC Port Chain using two port groups an classifier created previously
44 OpenStackOperations.Create SFC Port Chain PC1 PG1 PG2 FC_http
46 Start Web Server On Destination VM
47 [Documentation] Start a simple web server on the destination VM
48 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[4] while true; do echo -e "HTTP/1.0 200 OK\r\nContent-Length: 21\r\n\r\nWelcome to web-server" | sudo nc -l -p 80 ; done &
50 Add Static Routing On Service Function VMs
51 [Documentation] Enable eth1 and add static routing between the ports on the SF VMs
52 : FOR ${index} IN RANGE 0 2
53 \ OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[${index}] sudo sh -c 'echo "auto eth1" >> /etc/network/interfaces'
54 \ OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[${index}] sudo sh -c 'echo "iface eth1 inet dhcp" >> /etc/network/interfaces'
55 \ OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[${index}] sudo /etc/init.d/S40network restart
56 \ OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[${index}] sudo sh -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
57 \ OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[${index}] sudo ip route add @{NET1_VM_IPS}[3] dev eth0
58 \ OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[${index}] sudo ip route add @{NET1_VM_IPS}[4] dev eth1
60 Connectivity Tests From Vm Instance1 In net_1
61 [Documentation] Login to the source VM instance, and send a HTTP GET using curl to the destination VM instance
62 # FIXME need to somehow verify it goes through SFs (flows?)
63 ${DEST_VM_LIST} BuiltIn.Create List @{NET1_VM_IPS}[4]
64 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_VM_IPS}[3] ${DEST_VM_LIST}
65 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[3] curl http://@{NET1_VM_IPS}[4]
68 [Documentation] Delete all elements that were created in the test case section. These are done
69 ... in a local keyword so this can be called as part of the Suite Teardown. When called as part
70 ... of the Suite Teardown, all steps will be attempted. This prevents robot framework from bailing
71 ... on the rest of a test case if one step intermittently has trouble and fails. The goal is to attempt
72 ... to leave the test environment as clean as possible upon completion of this suite.
73 : FOR ${vm} IN @{NET_1_VMS}
74 \ OpenStackOperations.Delete Vm Instance ${vm}
75 OpenStackOperations.Delete SFC Port Chain PC1
76 OpenStackOperations.Delete SFC Port Pair Group PG1
77 OpenStackOperations.Delete SFC Port Pair Group PG2
78 OpenStackOperations.Delete SFC Port Pair PP1
79 OpenStackOperations.Delete SFC Port Pair PP2
80 OpenStackOperations.Delete SFC Port Pair PP3
81 OpenStackOperations.Delete SFC Flow Classifier FC_http
82 : FOR ${port} IN @{PORTS}
83 \ OpenStackOperations.Delete Port ${port}
84 OpenStackOperations.Delete SubNet l2_subnet_1
85 : FOR ${network} IN @{NETWORKS}
86 \ OpenStackOperations.Delete Network ${network}
87 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
91 OpenStackOperations.OpenStack Suite Setup
92 OpenStackOperations.Create Network @{NETWORKS}[0]
93 OpenStackOperations.Create SubNet @{NETWORKS}[0] @{SUBNETS}[0] @{SUBNET_CIDRS}[0]
94 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
95 : FOR ${port} IN @{PORTS}
96 \ OpenStackOperations.Create Port @{NETWORKS}[0] ${port} sg=${SECURITY_GROUP}
97 Create Vm Instance With Ports p1in p1out sf1 sg=${SECURITY_GROUP}
98 Create Vm Instance With Ports p2in p2out sf2 sg=${SECURITY_GROUP}
99 Create Vm Instance With Ports p3in p3out sf3 sg=${SECURITY_GROUP}
100 Create Vm Instance With Port source_vm_port source_vm sg=${SECURITY_GROUP}
101 Create Vm Instance With Port dest_vm_port dest_vm sg=${SECURITY_GROUP}
102 @{NET1_VM_IPS} ${NET1_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_1_VMS}
103 BuiltIn.Set Suite Variable @{NET1_VM_IPS}
104 BuiltIn.Should Not Contain ${NET1_VM_IPS} None
105 BuiltIn.Should Not Contain ${NET1_DHCP_IP} None
106 OpenStackOperations.Show Debugs @{NET_1_VMS}
107 OpenStackOperations.Get Suite Debugs