Merge "Refactor ConvertORTopoToTapiTopoTest"
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / provisiondevice / DeviceRenderingResult.java
1 /*
2  * Copyright © 2017 AT&T 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.transportpce.renderer.provisiondevice;
9
10 import java.util.Collections;
11 import java.util.List;
12 import org.opendaylight.transportpce.common.OperationResult;
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.link.tp.LinkTp;
14 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterface;
15 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.optical.renderer.nodes.Nodes;
16
17 public final class DeviceRenderingResult extends OperationResult {
18
19     private final List<Nodes> olmList;
20     private final List<NodeInterface> renderedNodeInterfaces;
21     private final List<LinkTp> otnLinkTps;
22
23     private DeviceRenderingResult(boolean success, String message, List<Nodes> olmList,
24             List<NodeInterface> renderedNodeInterfaces, List<LinkTp> otnLinkTps) {
25         super(success, message);
26         this.olmList =
27             olmList == null
28                 ? Collections.emptyList()
29                 : Collections.unmodifiableList(olmList);
30         this.renderedNodeInterfaces =
31             renderedNodeInterfaces == null
32                 ? Collections.emptyList()
33                 : Collections.unmodifiableList(renderedNodeInterfaces);
34         this.otnLinkTps =
35             otnLinkTps == null
36                 ? Collections.emptyList()
37                 : Collections.unmodifiableList(otnLinkTps);
38     }
39
40     public List<Nodes> getOlmList() {
41         return this.olmList;
42     }
43
44     public List<NodeInterface> getRenderedNodeInterfaces() {
45         return this.renderedNodeInterfaces;
46     }
47
48     public List<LinkTp> getOtnLinkTps() {
49         return this.otnLinkTps;
50     }
51
52     public static DeviceRenderingResult failed(String message) {
53         return new DeviceRenderingResult(false, message, null, null, null);
54     }
55
56     public static DeviceRenderingResult ok(List<Nodes> olmNodeList, List<NodeInterface> renderedNodeInterfaces,
57             List<LinkTp> otnLinkTps) {
58         return new DeviceRenderingResult(true, "", olmNodeList, renderedNodeInterfaces, otnLinkTps);
59     }
60
61 }