Cisco Cisco Prime Home 6.3 Entwickleranleitung

Seite von 78
Cisco Prime Home – Integration Guide
 
 
OL-28557-01   v5.0.1
 
59 
 
and("a new SSID for the wireless interface") 
val ssid = "life-cycle-use-case-ssid" 
 
then("set the data in the WIFI application's dto") 
deviceData.setApplicationDTO("WIFI","Settings.WLANConfiguration
s.1.SSID", ssid) 
and("PUT the device data back to the server") 
deviceService.putDeviceData(deviceId, deviceData) 
 
then("get the device actions") 
val deviceActions = deviceService.getDeviceActions(deviceId) 
 
and("mark 'WIFI' as needing to be synced") 
deviceActions.setApplicationPendingSync("WIFI", true) 
 
and("PUT the device actions back to the server") 
deviceService.putDeviceActions(deviceId, deviceActions) 

scenario("Termination: Replace a broken device") { 
given("an existing device") 
val brokenDeviceOui = deviceOui 
val brokenDeviceSerialNumber = deviceSerialNumber 
and("an oui/serial number for a device to replace with") 
val replacementDeviceOui = "001A2B" 
val replacementDeviceSerialNumber = "001A2B99998" 
 
then("set the 'rmaFor' oui / serial number in the 
replacement device to the original device") 
val (replacementDeviceId, replacementDeviceData) = { 
val caql = "device with oui: %s and serialNumber:  
%s".format(replacementDeviceOui, replacementDeviceSerialNumber) 
val deviceSearchResults = searchService.query(caql) 
if (deviceSearchResults.resultCount == 0) { 
given("that the device does not pre-exist in the system") 
then("create the device with a serial number, oui, and 
subscriber code") 
val replacementDevice =deviceService.createDevice  
(replacementDeviceOui,replacementDeviceSerialNumber, 
subscriberCode) 
(replacementDevice.getDeviceId, replacementDevice) 
} else { 
given("that the device is already in the system") 
val deviceId = deviceSearchResults.first.getLong("deviceId") 
(deviceId, deviceService.getDeviceData(deviceId)) 

replacementDeviceData.setRMA(brokenDeviceSerialNumber, 
brokenDeviceOui, "BROKEN") 
 
and("PUT the replacement device data back to the server") 
deviceService.putDeviceData(replacementDeviceId,replacementDevic
eData) 
 
and("find the old device id by oui / serial number") 
val brokenDeviceId = { 
val caql = "device with oui: %s and serialNumber: 
%s".format(brokenDeviceOui, brokenDeviceSerialNumber) 
val deviceSearchResults = searchService.query(caql) 
deviceSearchResults.first.getLong("deviceId") 

 
and("DELETE the old device") 
deviceService.deleteDevice(brokenDeviceId)