blob: ecb07f1f9c51dfa78ac14bbe44c62f956dd9294d [file] [log] [blame]
hirokiec18d3a2018-05-16 15:27:37 -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
19import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.Uuid;
20import org.onosproject.yang.model.DefaultModelObjectData;
21import org.onosproject.yang.model.ModelObject;
22import org.onosproject.yang.model.ModelObjectData;
23import org.onosproject.yang.model.ModelObjectId;
24
25/**
26 * Utility builder class for TAPI modelobject creation with DCS.
27 */
28public abstract class TapiInstanceBuilder {
29
30 public static final String ONOS_CP = "onos-cp";
31
32 public static final String DEVICE_ID = "device_id";
33
34 /**
35 * Generate DCS modelObjectData.
36 * @return ModelObjectData to be built
37 */
38 public abstract ModelObjectData build();
39
40 /**
41 * Get modelObject instance.
42 * @return ModelObject of build target
43 */
44 public abstract ModelObject getModelObject();
45
46 /**
47 * Get modelObject uuid.
48 * @return Uuid of build target
49 */
50 public abstract Uuid getUuid();
51
52
53 ModelObjectData getModelObjectData(ModelObject obj, ModelObjectId objId) {
54 return DefaultModelObjectData.builder()
55 .addModelObject(obj)
56 .identifier(objId)
57 .build();
58 }
59}