blob: 3e7d4b3206b6fd11adbc680065579547081cd47a [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
18import org.onosproject.config.model.DataNode;
19
20/**
21 * Abstraction for RPC output.
22 */
23public class RpcOutput {
24 public enum Status {
25 /**
26 * RPC execution was successful.
27 */
28 RPC_SUCCESS,
29 /**
30 * RPC execution failed.
31 */
32 RPC_FAILURE,
33 /**
34 * RPC execution don't have any output data.
35 */
36 RPC_NODATA,
37 /**
38 * Failed to receive a response from the receiver, within the broker specified timeout.
39 */
40 RPC_TIMEOUT,
41 }
42
43 /**
44 * Status of RPC execution.
45 */
46 Status status;
47 /**
48 * Output data from the RPC execution.
49 */
50 DataNode output;
51
52 /**
53 * Creates an instance of RpcOutput.
54 *
55 * @param status of RPC execution
56 * @param output of RPC execution
57 */
58 public RpcOutput(Status status, DataNode output) {
59 this.status = status;
60 this.output = output;
61 }
62
63 /**
64 * Returns RPC status.
65 *
66 * @return Status
67 */
68 public RpcOutput.Status status() {
69 return this.status;
70 }
71
72 /**
73 * Returns RPC output.
74 *
75 * @return DataNode
76 */
77 public DataNode output() {
78 return this.output;
79 }
80}