Ray Milkey
Committed by Gerrit Code Review

Fix up drivers test to not shut down all of ONOS

Change-Id: Id72aa88e9f7bda14324d448232a6677dd8ff3ba1
...@@ -11,38 +11,34 @@ if len(sys.argv) < 3: ...@@ -11,38 +11,34 @@ if len(sys.argv) < 3:
11 11
12 node = sys.argv[1] 12 node = sys.argv[1]
13 13
14 -cfgRequest = requests.get('http://' + node + ':8181/onos/v1/network/configuration', 14 +cfgRequest = requests.get('http://' + node +
15 + ':8181/onos/v1/network/configuration/apps/org.onosproject.dhcp',
15 auth=HTTPBasicAuth('onos', 'rocks')) 16 auth=HTTPBasicAuth('onos', 'rocks'))
16 17
18 +print cfgRequest.text
19 +
17 if cfgRequest.status_code != 200: 20 if cfgRequest.status_code != 200:
18 - print cfgRequest.text
19 sys.exit(1) 21 sys.exit(1)
20 22
21 cfgJson = cfgRequest.json() 23 cfgJson = cfgRequest.json()
22 -appFound = False
23 -
24 24
25 for index in range(2, len(sys.argv)): 25 for index in range(2, len(sys.argv)):
26 pair = sys.argv[index].split("=") 26 pair = sys.argv[index].split("=")
27 - for app in cfgJson["apps"]:
28 - if app == "org.onosproject.dhcp":
29 - dhcp = cfgJson["apps"][app]["dhcp"]
30 - appFound = True
31 27
32 - name = pair[0] 28 + dhcp = cfgJson["dhcp"]
33 - value = pair[1] 29 + appFound = True
30 +
31 + name = pair[0]
32 + value = pair[1]
33 +
34 + if dhcp[name] != value:
35 + print name + " differs: expected " + value + " but found " + dhcp[name]
36 + print cfgJson
37 + sys.exit(1)
34 38
35 - if dhcp[name] != value:
36 - print name + " differs: expected " + value + " but found " + dhcp[name]
37 - print cfgJson
38 - sys.exit(1)
39 39
40 -if appFound: 40 +sys.exit(0)
41 - sys.exit(0)
42 41
43 -print "DHCP app not found"
44 -print cfgJson
45 -sys.exit(2)
46 42
47 43
48 44
......
...@@ -17,47 +17,46 @@ ...@@ -17,47 +17,46 @@
17 description="Driver CLI activate/deactivate test"> 17 description="Driver CLI activate/deactivate test">
18 <group name="Drivers-Test"> 18 <group name="Drivers-Test">
19 19
20 - <!-- Check initial state of select drivers --> 20 + <!-- Check initial state of the Fujitsu driver -->
21 - <step name="DriversTest.FindCelesticaCorsa" 21 + <step name="DriversTest.FindFujitsuInitial"
22 - exec="onos-find-driver ${OC1} celestica celestica" /> 22 + exec="onos-find-driver ${OC1} fujitsu-netconf fujitsu" env="!"/>
23 - <step name="DriversTest.CheckCelesticaCorsa" requires="^" 23 +
24 - exec="test '${celesticaDriver}' != ''"/> 24 + <!-- Activate Fujitsu driver app -->
25 - <step name="DriversTest.Default" requires="^" 25 + <!--
26 - exec="onos-find-driver ${OC1} default default" /> 26 + <step name="DriversTest.ActivateNetconfApp" requires="^"
27 - <step name="DriversTest.CheckDefault" requires="^" 27 + exec="onos ${OCI} onos:app activate org.onosproject.netconf"/>
28 - exec="test '${defaultDriver}' != ''"/> 28 + <step name="DriversTest.ActivateFujitsuDriverApp" requires="^"
29 - 29 + exec="onos ${OCI} onos:app activate org.onosproject.drivers.fujitsu"/>
30 - <!-- Deactivate openfow app - prevents spawning multiple controllers --> 30 + -->
31 - <step name="DriversTest.DeactivateOpenflowApp" requires="^" 31 +
32 - exec="onos ${OCI} onos:app deactivate org.onosproject.openflow"/> 32 + <!-- Check that the activation was successful -->
33 - 33 + <!--
34 - <!-- Deactivate drivers app --> 34 + <group name="DriversTest.Check-Fujitsu-App-Activated" requires="DriversTest.ActivateFujitsuDriverApp">
35 - <step name="DriversTest.DeactivateDriversApp" requires="^" 35 + <parallel var="${OC#}">
36 - exec="onos ${OCI} onos:app deactivate org.onosproject.drivers"/> 36 + <step name="DriversTest.Check-Fujitsu-App-Activated-${#}"
37 - 37 + exec="onos-check-apps ${OC#} drivers,openflow,proxyarp,dhcp,fujitsu includes"/>
38 - <!-- Check that drivers are no longer present --> 38 + </parallel>
39 - <step name="DriversTest.AfterDeactivateFindCelesticaCorsa" requires="^" 39 + </group>
40 - exec="onos-find-driver ${OC1} celestica celesticaInactive" env="!"/> 40 + -->
41 - <step name="DriversTest.AfterDeactivateFindDefault" requires="^" 41 +
42 - exec="onos-find-driver ${OC1} default defaultInactive" env="!"/> 42 + <!-- Check that Fujitsu driver is active. -->
43 - 43 + <!--
44 - <!-- Reactivate openflow apps --> 44 + <step name="DriversTest.FindFujitsuAfterActivate" requires="^"
45 - <step name="DriversTest.ActivateOpenflowApp" requires="^" 45 + exec="onos-find-driver ${OC1} fujitsu-netconf fujitsu" />
46 - exec="onos ${OCI} onos:app activate org.onosproject.openflow"/> 46 + <step name="DriversTest.CheckFujitsuAfterActivate" requires="^"
47 - 47 + exec="test '${fujitsuDriver}' != ''"/>
48 - <!-- Reactivate all drivers --> 48 + -->
49 - <step name="DriversTest.ActivateDriversApp" requires="^" 49 +
50 - exec="onos ${OCI} onos:app activate org.onosproject.drivers"/> 50 + <!-- Deactivate Fujitsu driver app -->
51 - 51 + <!--
52 - <!-- Check reactivated state of drivers --> 52 + <step name="DriversTest.DeactivateFujitsuDriverApp" requires="^"
53 - <step name="DriversTest.ReactivatedFindCelesticaCorsa" requires="^" 53 + exec="onos ${OCI} onos:app deactivate org.onosproject.drivers.fujitsu"/>
54 - exec="onos-find-driver ${OC1} celestica celestica" /> 54 + -->
55 - <step name="DriversTest.ReactivatedCheckCelesticaCorsa" requires="^" 55 +
56 - exec="test '${celesticaDriver}' != ''"/> 56 + <!-- Check that Fujitsu driver is no longer present -->
57 - <step name="DriversTest.ReactivatedDefault" requires="^" 57 + <step name="DriversTest.AfterDeactivateFindFujitsu" requires="^"
58 - exec="onos-find-driver ${OC1} default default" /> 58 + exec="onos-find-driver ${OC1} fujitsu fujitsuInactive" env="!"/>
59 - <step name="DriversTest.ReactivatedCheckDefault" requires="^" 59 +
60 - exec="test '${defaultDriver}' != ''"/>
61 60
62 </group> 61 </group>
63 </scenario> 62 </scenario>
......
...@@ -22,8 +22,16 @@ ...@@ -22,8 +22,16 @@
22 <step name="Netcfg.Activate-Dhcp" 22 <step name="Netcfg.Activate-Dhcp"
23 exec="onos ${OC1} app activate org.onosproject.dhcp"/> 23 exec="onos ${OC1} app activate org.onosproject.dhcp"/>
24 24
25 + <!-- Check that the activation was successful -->
26 + <group name="Netcfg.Check-Dhcp-App-Activated" requires="Netcfg.Activate-Dhcp">
27 + <parallel var="${OC#}">
28 + <step name="Netcfg.Check-Dhcp-App-Activated-${#}" delay="2"
29 + exec="onos-check-apps ${OC#} drivers,openflow,proxyarp,dhcp includes"/>
30 + </parallel>
31 + </group>
32 +
25 <!-- Upload the first set of config changes --> 33 <!-- Upload the first set of config changes -->
26 - <step name="Netcfg.Post-1" requires="^" 34 + <step name="Netcfg.Post-1" requires="Netcfg.Check-Dhcp-App-Activated"
27 exec="post-netcfg.py ${OC1} ${ONOS_SCENARIOS}/netcfg-test/dhcp-cfg1.json"/> 35 exec="post-netcfg.py ${OC1} ${ONOS_SCENARIOS}/netcfg-test/dhcp-cfg1.json"/>
28 36
29 <group name="Query1" requires="Netcfg.Post-1"> 37 <group name="Query1" requires="Netcfg.Post-1">
......