2 * Copyright © 2017 AT&T and others. All rights reserved.
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
9 package org.opendaylight.transportpce.renderer.openroadminterface;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
13 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceBuilder;
14 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceKey;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOtu;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.OTU4;
20 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.OtuAttributes.Fec;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
23 public class OpenRoadmOtu4Interface extends OpenRoadmInterfaces {
25 public OpenRoadmOtu4Interface(DataBroker db, MountPointService mps, String nodeId, String logicalConnPoint,
27 super(db, mps, nodeId, logicalConnPoint, serviceName);
32 * This methods creates an OTU interface on the given termination point.
35 * @return Name of the interface if successful, otherwise return null.
38 public String createInterface(String supportOchInterface) {
39 // Create generic interface
40 InterfaceBuilder otuInterfaceBldr = getIntfBuilder(portMap);
41 otuInterfaceBldr.setType(OtnOtu.class);
42 otuInterfaceBldr.setSupportingInterface(supportOchInterface);
43 otuInterfaceBldr.setName(logicalConnPoint + "-OTU");
44 otuInterfaceBldr.setKey(new InterfaceKey(logicalConnPoint + "-OTU"));
46 // OTU interface specific data
47 OtuBuilder otuIfBuilder = new OtuBuilder();
48 otuIfBuilder.setFec(Fec.Scfec);
49 otuIfBuilder.setRate(OTU4.class);
51 // Create Interface1 type object required for adding as augmentation
52 Interface1Builder otuIf1Builder = new Interface1Builder();
53 otuInterfaceBldr.addAugmentation(Interface1.class, otuIf1Builder.setOtu(otuIfBuilder.build()).build());
55 // Post interface on the device
56 if (postInterface(otuInterfaceBldr)) {
57 return otuInterfaceBldr.getName();