blob: 1384ab3c5582ffae917c67c3b941a545c710dce4 [file] [log] [blame]
hirokifca084b2018-06-02 08:29:42 -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
hiroki96ab3c22018-12-11 14:10:52 -080019import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint;
20import org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.node.OwnedNodeEdgePoint;
21import org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.topology.Node;
22import org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.topologycontext.Topology;
hirokifca084b2018-06-02 08:29:42 -070023
24/**
25 * Util class to create TapiXXXRef class instances using classes auto-generated by onos-yang-tool compiler.
26 */
27public final class DcsBasedTapiObjectRefFactory {
28
29 private DcsBasedTapiObjectRefFactory() {
30 }
31
32 /**
33 * Factory method to create {@link TapiNodeRef}.
34 *
35 * @param topology ModelObject context/topology
36 * @param node ModelObject context/topology/node
37 * @return node reference instance
38 */
39 public static TapiNodeRef create(Topology topology, Node node) {
40 return TapiNodeRef.create(topology.uuid().toString(), node.uuid().toString());
41 }
42
43 /**
44 * Factory method to create {@link TapiNepRef}.
45 *
46 * @param topology ModelObject context/topology
47 * @param node ModelObject context/topology/node
48 * @param nep ModelObject context/topology/node/ownedNodeEdgePoint
49 * @return nep reference instance
50 */
51 public static TapiNepRef create(Topology topology, Node node, OwnedNodeEdgePoint nep) {
52 return TapiNepRef.create(topology.uuid().toString(), node.uuid().toString(), nep.uuid().toString());
53 }
54
55 /**
56 * Factory method to create {@link TapiCepRef}.
57 *
58 * @param cep ModelObject context/connection/connectionEndPoint
59 * @return cep reference instance
60 */
61 public static TapiCepRef create(ConnectionEndPoint cep) {
hirokid8fd7862018-10-09 15:24:24 +090062 return TapiCepRef.create(cep.topologyUuid().toString(), cep.nodeUuid().toString(),
63 cep.nodeEdgePointUuid().toString(), cep.connectionEndPointUuid().toString());
hirokifca084b2018-06-02 08:29:42 -070064 }
65
66}