blob: d034f3e590e50e7b76c1696186df75eb0b2b756b [file] [log] [blame]
hirokif4ed5212018-05-26 22:39:38 -07001/*
2 * Copyright 2018-present Open Networking Foundation
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
17package org.onosproject.odtn.utils.tapi;
18
hirokid8fd7862018-10-09 15:24:24 +090019import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.Uuid;
hirokif4ed5212018-05-26 22:39:38 -070020import org.onosproject.yang.model.ModelObject;
21import org.onosproject.yang.model.ModelObjectId;
22import org.onosproject.yang.model.RpcInput;
23
24/**
25 * Utility abstract class to deal with TAPI RPC input with DCS.
26 *
27 * @param <T> RPCInput modelObject to be dealt with
28 */
29public abstract class TapiRpcInputHandler<T extends ModelObject> extends TapiObjectHandler<T> {
30
31 // Uuid getter is not needed for RPC input
32 @Override
33 protected Uuid getIdDetail() {
34 return null;
35 }
36
37 // Uuid getter is not needed for RPC input
38 @Override
39 protected void setIdDetail(Uuid uuid) {
40 }
41
42 // Root modelObjectId must be used
43 @Override
44 public ModelObjectId getParentModelObjectId() {
45 return ModelObjectId.builder().build();
46 }
47
48 // Cannot set InputRpc modelObject into DCS
49 @Override
50 public final void add() {
51 }
52
53 // Cannot remove InputRpc modelObject into DCS
54 @Override
55 public final void remove() {
56 }
57
58 /**
59 * Set RPCInput modelObject.
60 *
61 * @param input Tapi RpcInput modelObject
62 */
63 public void setRpcInput(RpcInput input) {
64 obj = toModelObject(input.data(), input.id());
65 }
66}