2 Documentation Resource for L2switch workflows. TODO: Refactor KWs once this test works in public.
4 Library RequestsLibrary
7 Resource MininetKeywords.robot
8 Resource ../variables/Variables.robot
16 Workflow Single Switch Multiple Hosts
17 [Documentation] Workflow to bring a Linear topology of ${switches} switches, push flows, hold for ${sustain_time} seconds, delete flows and stop topology.
18 ... This KW returns workflow state (PASS/FAIL), error message and topology discover time.
19 [Arguments] ${hosts} ${sustain_time}=0
20 # Define required variables
21 ${error_message} BuiltIn.Set Variable Test has completed
22 ${host_discover_time} BuiltIn.Set Variable ${0}
24 BuiltIn.Log to console ${\n}
25 BuiltIn.Log To Console Starting mininet with one switch and ${hosts} hosts
26 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
27 ... MininetKeywords.Start Mininet Multiple Hosts
29 ... mininet_timeout=${hosts}
30 IF '${status}' == 'FAIL'
31 RETURN ${status} Fail starting mininet ${host_discover_time}
33 BuiltIn.Log To Console Check 1 switch
34 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
35 ... Wait Until Keyword Succeeds
38 ... FlowLib.Check Switches In Inventory
40 IF '${status}' == 'FAIL'
41 RETURN ${status} Fail checking switch ${host_discover_time}
43 BuiltIn.Log To Console Ping all hosts
44 @{host_list} MininetKeywords.Get Mininet Hosts
45 ${start_time} DateTime.Get Current Date result_format=timestamp
46 ${status} MininetKeywords.Ping All Hosts @{host_list}
48 RETURN ${status} Ping test fails ${host_discover_time}
50 BuiltIn.Log To Console Verify controller is OK
51 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
52 ... Utils.Verify Controller Is Not Dead
54 IF '${status}' == 'FAIL'
55 RETURN ${status} Controller is dead ${host_discover_time}
57 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
58 ... Utils.Verify Controller Has No Null Pointer Exceptions
60 IF '${status}' == 'FAIL'
61 RETURN ${status} Controller has NPE ${host_discover_time}
63 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
64 ... Utils.Verify Controller Has No Runtime Exceptions
66 IF '${status}' == 'FAIL'
67 RETURN ${status} Controller has RuntimeException ${topology_discover_time}
69 Log To Console Check number of hosts in topology is ${hosts}
70 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
71 ... Wait Until Keyword Succeeds
74 ... FlowLib.Check Number Of Hosts
76 IF '${status}' == 'FAIL'
77 RETURN ${status} Fail checking hosts ${host_discover_time}
79 ${end_time} DateTime.Get Current Date result_format=timestamp
80 ${host_discover_time} DateTime.Subtract Date From Date ${end_time} ${start_time}
81 BuiltIn.Log To Console Host Discovery Time = ${host_discover_time} seconds
82 BuiltIn.Log To Console Sleep for ${sustain_time} seconds
83 BuiltIn.Sleep ${sustain_time}
84 BuiltIn.Log To Console Stopping Mininet
85 ${status} ${result} BuiltIn.Run Keyword And Ignore Error MininetKeywords.Stop Mininet And Exit
86 IF '${status}' == 'FAIL'
89 ... Fail stopping mininet
90 ... ${host_discover_time}
92 BuiltIn.Log To Console Checking No Switches
93 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
94 ... Wait Until Keyword Succeeds
97 ... FlowLib.Check No Switches In Inventory
99 IF '${status}' == 'FAIL'
100 RETURN ${status} Fail checking no switch ${host_discover_time}
102 BuiltIn.Log To Console Checking no hosts are present in operational database
103 ${status} ${result} BuiltIn.Run Keyword And Ignore Error
104 ... Wait Until Keyword Succeeds
107 ... FlowLib.Check No Hosts
108 IF '${status}' == 'FAIL'
109 RETURN ${status} Hosts are present ${host_discover_time}
111 ${max-hosts} BuiltIn.Convert To String ${hosts}
112 RETURN PASS ${error_message} ${host_discover_time}
115 RequestsLibrary.Create Session
117 ... http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
119 ... headers=${HEADERS_XML}
120 BuiltIn.Wait Until Keyword Succeeds
123 ... KarafKeywords.Issue Command On Karaf Console
124 ... log:set ${log_level}
127 [Documentation] Cleanup when workflow is interrupt
128 Utils.Clean Mininet System
129 RequestsLibrary.Delete All Sessions