dbbebe528a36b01e695191204d83e0a6dc4c5863
[ccsdk/apps.git] /
1 /*
2  *  Copyright © 2018 IBM.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 @file:Suppress("unused") //TODO remove this line!
17
18
19 import com.fasterxml.jackson.databind.node.ObjectNode
20 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers
21 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader
22 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
23 import org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor.RestconfComponentFunction
24 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
25 import org.slf4j.LoggerFactory
26
27 open class EditConfigure : RestconfComponentFunction() {
28
29     val log = LoggerFactory.getLogger(EditConfigure::class.java)!!
30
31     override fun getName(): String {
32         return "EditConfigure"
33     }
34
35     override fun process(executionRequest: ExecutionServiceInput) {
36         //val webClientService = restClientService("odlparent")
37         TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
38     }
39
40     override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
41         TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
42     }
43 }
44
45 open class MountNEditConfigure : RestconfComponentFunction() {
46
47     val log = LoggerFactory.getLogger(MountNEditConfigure::class.java)!!
48
49     override fun getName(): String {
50         return "MountNEditConfigure"
51     }
52
53     override fun process(executionRequest: ExecutionServiceInput) {
54         val webClientService = restClientService("odlparent")
55         println("foi?")
56         TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
57     }
58
59     override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
60         TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
61     }
62
63
64 }
65
66 /**
67  * This is for used for Testing only
68  */
69 open class TestRestconfConfigure : RestconfComponentFunction() {
70
71     val log = LoggerFactory.getLogger(TestRestconfConfigure::class.java)!!
72
73     override fun getName(): String {
74         return "TestRestconfConfigure"
75     }
76
77     override fun process(executionRequest: ExecutionServiceInput) {
78         log.info("processing request..")
79     }
80
81     override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
82         log.info("recovering..")
83     }
84 }
85
86
87
88 println("zzzzzzzzzzzzz")
89 val x = MountNEditConfigure()
90 println(x.getName())
91 val executionServiceInput = ExecutionServiceInput().apply {
92     commonHeader = CommonHeader().apply {
93         requestId = "1234"
94     }
95     actionIdentifiers = ActionIdentifiers().apply {
96         actionName = "activate"
97     }
98     payload = JacksonUtils.jsonNode("{}") as ObjectNode
99 }
100 x.process(executionServiceInput);