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
20 import java.io.IOException
26 class NetconfExecutionRequest {
27 lateinit var requestId: String
28 val action: String? = null
29 val source: String? = null
30 val loginKey: String? = null
31 val loginAccount: String? = null
32 val targetIP: String? = null
34 val connectionTimeoutSec: Int = 0
35 val implementationScript: String? = null
36 val context: MutableMap<String, Any> = mutableMapOf()
39 class DeviceResponse {
40 lateinit var deviceInfo: DeviceInfo
41 lateinit var status: String
42 var errorMessage: String? = null
43 var responseMessage: String? = null
44 var requestMessage: String? = null
45 var subDeviceResponse: MutableMap<Any, Any>? = null
47 fun addSubDeviceResponse(key: String, subDeviceResponse: DeviceResponse) {
48 if (this.subDeviceResponse == null) {
49 this.subDeviceResponse = hashMapOf()
51 this.subDeviceResponse!![key] = subDeviceResponse
55 class NetconfExecutionResponse {
56 val status: String? = null
57 val errorMessage: String? = null
58 val responseData: Any = Any()
62 class NetconfDeviceOutputEvent {
64 private var type: NetconfDeviceOutputEvent.Type
65 private var messagePayload: String? = null
66 private var messageID: String? = null
67 private var deviceInfo: DeviceInfo? = null
68 private var subject: Any? = null
69 private var time: Long = 0
72 * Type of device related events.
83 * Creates an event of a given type and for the specified subject and the current time.
85 * @param type event type
86 * @param subject event subject
87 * @param payload message from the device
88 * @param msgID id of the message related to the event
89 * @param netconfDeviceInfo device of event
91 constructor(type: Type, subject: String, payload: String, msgID: Optional<String>, netconfDeviceInfo: DeviceInfo) {
93 this.subject = subject
94 this.messagePayload = payload
95 this.deviceInfo = netconfDeviceInfo
96 this.messageID = msgID.get()
100 * Creates an event of a given type and for the specified subject and time.
102 * @param type event type
103 * @param subject event subject
104 * @param payload message from the device
105 * @param msgID id of the message related to the event
106 * @param netconfDeviceInfo device of event
107 * @param time occurrence time
109 constructor(type: Type, subject: Any, payload: String, msgID: String, netconfDeviceInfo: DeviceInfo, time: Long) {
111 this.subject = subject
113 this.messagePayload = payload
114 this.deviceInfo = netconfDeviceInfo
115 this.messageID = msgID
119 * return the message payload of the reply form the device.
123 fun getMessagePayload(): String? {
124 return messagePayload
128 * Event-related device information.
130 * @return information about the device
132 fun getDeviceInfo(): DeviceInfo? {
141 fun getMessageID(): String? {