blob: fa4a903120197f3912541f27a6e499988344cdc2 [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
hirokieec31ef2018-05-21 07:34:25 -070032 public static final String DEVICE_ID = "device-id";
33
34 public static final String ODTN_PORT_TYPE = "odtn-port-type";
hirokiec18d3a2018-05-16 15:27:37 -070035
36 /**
37 * Generate DCS modelObjectData.
38 * @return ModelObjectData to be built
39 */
40 public abstract ModelObjectData build();
41
42 /**
43 * Get modelObject instance.
44 * @return ModelObject of build target
45 */
46 public abstract ModelObject getModelObject();
47
48 /**
49 * Get modelObject uuid.
50 * @return Uuid of build target
51 */
52 public abstract Uuid getUuid();
53
54
55 ModelObjectData getModelObjectData(ModelObject obj, ModelObjectId objId) {
56 return DefaultModelObjectData.builder()
57 .addModelObject(obj)
58 .identifier(objId)
59 .build();
60 }
61}