a764f85f00f82da1632447e2c6febe38d33a9e05
[ccsdk/apps.git] / sdnr / wireless-transport / code-Carbon-SR1 / apps / route / impl / src / main / java / com / highstreet / technologies / odl / app / impl / delegates / LtpInOdlCreator.java
1 /*
2  * Copyright © 2015 ZTE 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 com.highstreet.technologies.odl.app.impl.delegates;
9
10 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
11 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp;
12 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.ltp.path.rev170526.ltp.path.ltp.path.list.LogicalTerminationPointList;
13 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.ltp.path.rev170526.ltp.path.ltp.path.list.LogicalTerminationPointListBuilder;
14 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.ltp.path.rev170526.ltp.path.ltp.path.list.LogicalTerminationPointListKey;
15
16 /**
17  * Created by odl on 17-5-30.
18  */
19 public class LtpInOdlCreator
20 {
21     public LtpInOdlCreator()
22     {
23     }
24
25     private int index = 0;
26
27     public LogicalTerminationPointList create(String neName, String clientLtpName, Ltp serverLtp)
28     {
29         LogicalTerminationPointListBuilder builder = new LogicalTerminationPointListBuilder();
30         builder.setPhysicalPortReference(
31                 serverLtp.getPhysicalPortReference() == null ? null : serverLtp.getPhysicalPortReference().get(0));
32         builder.setNodeReference(new UniversalId(neName));
33         builder.setLtpIndex(String.valueOf(index++));
34         builder.setKey(new LogicalTerminationPointListKey(builder.getLtpIndex()));
35         builder.setLtpReference(new UniversalId(clientLtpName));
36         return builder.build();
37     }
38 }