blob: f0d98a02f1b31ca144594e2baef476463ea6c1a6 [file] [log] [blame]
Sithara Punnasseryff114552017-01-10 11:40:55 -08001/*
2 * Copyright 2016-present Open Networking Laboratory
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 */
16package org.onosproject.config;
17
Sithara Punnassery06208792017-02-10 16:25:29 -080018import com.google.common.annotations.Beta;
Sithara Punnassery4b091dc2017-03-02 17:22:40 -080019import org.onosproject.yang.model.DataNode;
Sithara Punnasseryff114552017-01-10 11:40:55 -080020
21/**
22 * Abstraction for RPC output.
23 */
Sithara Punnassery06208792017-02-10 16:25:29 -080024@Beta
Sithara Punnasseryff114552017-01-10 11:40:55 -080025public class RpcOutput {
26 public enum Status {
27 /**
28 * RPC execution was successful.
29 */
30 RPC_SUCCESS,
31 /**
32 * RPC execution failed.
33 */
34 RPC_FAILURE,
35 /**
36 * RPC execution don't have any output data.
37 */
38 RPC_NODATA,
39 /**
40 * Failed to receive a response from the receiver, within the broker specified timeout.
41 */
42 RPC_TIMEOUT,
43 }
44
45 /**
46 * Status of RPC execution.
47 */
48 Status status;
49 /**
50 * Output data from the RPC execution.
51 */
52 DataNode output;
53
54 /**
55 * Creates an instance of RpcOutput.
56 *
57 * @param status of RPC execution
58 * @param output of RPC execution
59 */
60 public RpcOutput(Status status, DataNode output) {
61 this.status = status;
62 this.output = output;
63 }
64
65 /**
66 * Returns RPC status.
67 *
68 * @return Status
69 */
70 public RpcOutput.Status status() {
71 return this.status;
72 }
73
74 /**
75 * Returns RPC output.
76 *
77 * @return DataNode
78 */
79 public DataNode output() {
80 return this.output;
81 }
82}