2 * Copyright © 2017-2018 AT&T Intellectual Property.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.data
19 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.interfaces.DeviceInfo
23 class DeviceResponse {
24 lateinit var deviceInfo: DeviceInfo
25 lateinit var status: String
26 var errorMessage: String? = null
27 var responseMessage: String? = null
28 var requestMessage: String? = null
29 var subDeviceResponse: MutableMap<Any, Any>? = null
31 fun addSubDeviceResponse(key: String, subDeviceResponse: DeviceResponse) {
32 if (this.subDeviceResponse == null) {
33 this.subDeviceResponse = hashMapOf()
35 this.subDeviceResponse!![key] = subDeviceResponse
39 class NetconfDeviceOutputEvent {
41 private var type: NetconfDeviceOutputEvent.Type
42 private var messagePayload: String? = null
43 private var messageID: String? = null
44 private var deviceInfo: DeviceInfo? = null
45 private var subject: Any? = null
46 private var time: Long = 0
49 * Type of device related events.
60 * Creates an event of a given type and for the specified subject and the current time.
62 * @param type event type
63 * @param subject event subject
64 * @param payload message from the device
65 * @param msgID id of the message related to the event
66 * @param netconfDeviceInfo device of event
68 constructor(type: Type, subject: String, payload: String, msgID: Optional<String>, netconfDeviceInfo: DeviceInfo) {
70 this.subject = subject
71 this.messagePayload = payload
72 this.deviceInfo = netconfDeviceInfo
73 this.messageID = msgID.get()
77 * Creates an event of a given type and for the specified subject and time.
79 * @param type event type
80 * @param subject event subject
81 * @param payload message from the device
82 * @param msgID id of the message related to the event
83 * @param netconfDeviceInfo device of event
84 * @param time occurrence time
86 constructor(type: Type, subject: Any, payload: String, msgID: String, netconfDeviceInfo: DeviceInfo, time: Long) {
88 this.subject = subject
90 this.messagePayload = payload
91 this.deviceInfo = netconfDeviceInfo
92 this.messageID = msgID
96 * return the message payload of the reply form the device.
100 fun getMessagePayload(): String? {
101 return messagePayload
105 * Event-related device information.
107 * @return information about the device
109 fun getDeviceInfo(): DeviceInfo? {
118 fun getMessageID(): String? {