blob: e1d1889588755e7c64ea054cf624b5bdbe4e9ec1 [file] [log] [blame]
/*
* Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.odtn.utils.tapi;
import org.onosproject.yang.gen.v1.tapiconnectivity.rev20180307.tapiconnectivity.connection.ConnectionEndPoint;
import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.node.OwnedNodeEdgePoint;
import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.topology.Node;
import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.topologycontext.Topology;
/**
* Util class to create TapiXXXRef class instances using classes auto-generated by onos-yang-tool compiler.
*/
public final class DcsBasedTapiObjectRefFactory {
private DcsBasedTapiObjectRefFactory() {
}
/**
* Factory method to create {@link TapiNodeRef}.
*
* @param topology ModelObject context/topology
* @param node ModelObject context/topology/node
* @return node reference instance
*/
public static TapiNodeRef create(Topology topology, Node node) {
return TapiNodeRef.create(topology.uuid().toString(), node.uuid().toString());
}
/**
* Factory method to create {@link TapiNepRef}.
*
* @param topology ModelObject context/topology
* @param node ModelObject context/topology/node
* @param nep ModelObject context/topology/node/ownedNodeEdgePoint
* @return nep reference instance
*/
public static TapiNepRef create(Topology topology, Node node, OwnedNodeEdgePoint nep) {
return TapiNepRef.create(topology.uuid().toString(), node.uuid().toString(), nep.uuid().toString());
}
/**
* Factory method to create {@link TapiCepRef}.
*
* @param cep ModelObject context/connection/connectionEndPoint
* @return cep reference instance
*/
public static TapiCepRef create(ConnectionEndPoint cep) {
return TapiCepRef.create(cep.topologyId().toString(), cep.nodeId().toString(),
cep.ownedNodeEdgePointId().toString(), cep.connectionEndPointId().toString());
}
}