db4e45f230f4bb058e4d6da22cd26c343f106ff1
[bgpcep.git] / programming / tunnel-api / src / main / java / org / opendaylight / bgpcep / programming / tunnel / TunnelProgrammingUtil.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.bgpcep.programming.tunnel;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.BaseTunnelInput;
11 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
12 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
13 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15
16 import com.google.common.base.Preconditions;
17
18 /**
19  *
20  */
21 public final class TunnelProgrammingUtil {
22         private TunnelProgrammingUtil() {
23
24         }
25
26         public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final BaseTunnelInput input) {
27                 Preconditions.checkNotNull(input.getLinkId());
28                 return InstanceIdentifier.builder(topology).child(Link.class, new LinkKey(input.getLinkId())).toInstance();
29         }
30 }