Merge "Add model of graceful-restart capability"
[bgpcep.git] / pcep / tunnel-provider / src / main / java / org / opendaylight / bgpcep / pcep / tunnel / provider / TunnelProgramming.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.pcep.tunnel.provider;
9
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 import org.opendaylight.bgpcep.pcep.topology.spi.AbstractTopologyProgrammingExecutor;
15 import org.opendaylight.bgpcep.programming.spi.InstructionExecutor;
16 import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
17 import org.opendaylight.bgpcep.programming.spi.SuccessfulRpcResult;
18 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
19 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.classtype.object.ClassTypeBuilder;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.AddressFamily;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4Builder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv6Builder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObjBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobjects;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectsBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.LspaBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.submit.instruction.output.result.FailureBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.submit.instruction.output.result.failure.Failure;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.AddLspInputBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.AddLspOutput;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.NetworkTopologyPcepService;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.OperationResult;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.RemoveLspInputBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.RemoveLspOutput;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.UpdateLspInputBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.UpdateLspOutput;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.add.lsp.args.ArgumentsBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.programming.rev131102.TopologyInstructionInput;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.p2p.rev130819.tunnel.p2p.path.cfg.attributes.ExplicitHops;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepCreateP2pTunnelInput;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepCreateP2pTunnelOutput;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepCreateP2pTunnelOutputBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepDestroyTunnelInput;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepDestroyTunnelOutput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepDestroyTunnelOutputBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepUpdateTunnelInput;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepUpdateTunnelOutput;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepUpdateTunnelOutputBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.TopologyTunnelPcepProgrammingService;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.AdministrativeStatus;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.ExplicitHops1;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.Link1;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.SupportingNode1;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.BaseTunnelInput;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.TpReference;
61 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
62 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
63 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
64 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
65 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
66 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey;
67 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
68 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
69 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
70 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
71 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode;
72 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1;
73 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.TerminationPointType;
74 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.termination.point.type.Ip;
75 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
76 import org.opendaylight.yangtools.yang.common.RpcResult;
77 import org.slf4j.Logger;
78 import org.slf4j.LoggerFactory;
79
80 import com.google.common.base.Function;
81 import com.google.common.base.Preconditions;
82 import com.google.common.util.concurrent.Futures;
83 import com.google.common.util.concurrent.ListenableFuture;
84
85 final class TunnelProgramming implements TopologyTunnelPcepProgrammingService {
86         private static final Logger LOG = LoggerFactory.getLogger(TunnelProgramming.class);
87         private final NetworkTopologyPcepService topologyService;
88         private final DataProviderService dataProvider;
89         private final InstructionScheduler scheduler;
90
91         TunnelProgramming(final InstructionScheduler scheduler, final DataProviderService dataProvider,
92                         final NetworkTopologyPcepService topologyService) {
93                 this.scheduler = Preconditions.checkNotNull(scheduler);
94                 this.dataProvider = Preconditions.checkNotNull(dataProvider);
95                 this.topologyService = Preconditions.checkNotNull(topologyService);
96         }
97
98         private static final class TpReader {
99                 private final DataModificationTransaction t;
100                 private final InstanceIdentifier<Node> nii;
101                 private final InstanceIdentifier<TerminationPoint> tii;
102
103                 TpReader(final DataModificationTransaction t, final InstanceIdentifier<Topology> topo, final TpReference ref) {
104                         this.t = Preconditions.checkNotNull(t);
105
106                         nii = InstanceIdentifier.builder(topo).node(Node.class, new NodeKey(ref.getNode())).toInstance();
107                         tii = InstanceIdentifier.builder(nii).node(TerminationPoint.class, new TerminationPointKey(ref.getTp())).toInstance();
108                 }
109
110                 private Node getNode() {
111                         return (Node) t.readOperationalData(nii);
112                 }
113
114                 private TerminationPoint getTp() {
115                         return (TerminationPoint) t.readOperationalData(tii);
116                 }
117         }
118
119         private AddressFamily buildAddressFamily(final TerminationPoint sp, final TerminationPoint dp) {
120                 // We need the IGP augmentation -- it has IP addresses
121                 final TerminationPoint1 sp1 = Preconditions.checkNotNull(sp.getAugmentation(TerminationPoint1.class));
122                 final TerminationPoint1 dp1 = Preconditions.checkNotNull(dp.getAugmentation(TerminationPoint1.class));
123
124                 // Get the types
125                 final TerminationPointType spt = sp1.getIgpTerminationPointAttributes().getTerminationPointType();
126                 final TerminationPointType dpt = dp1.getIgpTerminationPointAttributes().getTerminationPointType();
127
128                 // The types have to match
129                 Preconditions.checkArgument(spt.getImplementedInterface().equals(dpt.getImplementedInterface()));
130
131                 // And they have to actually be Ip
132                 final Ip sips = (Ip) spt;
133                 final Ip dips = (Ip) dpt;
134
135                 /*
136                  * Now a bit of magic. We need to find 'like' addresses, e.g. both
137                  * IPv4 or both IPv6. We are in IPv6-enabled world now, so let's
138                  * prefer that.
139                  */
140                 AddressFamily ret = findIpv6(sips.getIpAddress(), dips.getIpAddress());
141                 if (ret == null) {
142                         ret = findIpv4(sips.getIpAddress(), dips.getIpAddress());
143                 }
144
145                 // We need to have a ret now
146                 Preconditions.checkArgument(ret != null, "Failed to find like Endpoint addresses");
147
148                 return ret;
149         }
150
151         private AddressFamily findIpv4(final List<IpAddress> srcs, final List<IpAddress> dsts) {
152                 for (final IpAddress sc : srcs) {
153                         if (sc.getIpv4Address() != null) {
154                                 for (final IpAddress dc : dsts) {
155                                         if (dc.getIpv4Address() != null) {
156                                                 return new Ipv4Builder().
157                                                                 setSourceIpv4Address(sc.getIpv4Address()).
158                                                                 setDestinationIpv4Address(dc.getIpv4Address()).build();
159                                         }
160                                 }
161                         }
162                 }
163
164                 return null;
165         }
166
167         private AddressFamily findIpv6(final List<IpAddress> srcs, final List<IpAddress> dsts) {
168                 for (final IpAddress sc : srcs) {
169                         if (sc.getIpv6Address() != null) {
170                                 for (final IpAddress dc : dsts) {
171                                         if (dc.getIpv6Address() != null) {
172                                                 return new Ipv6Builder().
173                                                                 setSourceIpv6Address(sc.getIpv6Address()).
174                                                                 setDestinationIpv6Address(dc.getIpv6Address()).build();
175                                         }
176                                 }
177                         }
178                 }
179
180                 return null;
181         }
182
183         private NodeId supportingNode(final DataModificationTransaction t, final Node node) {
184                 for (SupportingNode n : node.getSupportingNode()) {
185                         final SupportingNode1 n1 = n.getAugmentation(SupportingNode1.class);
186                         if (n1 != null && n1.getPathComputationClient().isControlling()) {
187                                 return n.getKey().getNodeRef();
188                         }
189                 }
190
191                 return null;
192         }
193
194         private Ero buildEro(final List<ExplicitHops> explicitHops) {
195                 final EroBuilder b = new EroBuilder();
196
197                 if (!explicitHops.isEmpty()) {
198                         final List<Subobjects> subobjs = new ArrayList<>(explicitHops.size());
199                         for (ExplicitHops h : explicitHops) {
200
201                                 final ExplicitHops1 h1 = h.getAugmentation(ExplicitHops1.class);
202                                 if (h1 != null) {
203                                         final SubobjectsBuilder sb = new SubobjectsBuilder();
204                                         sb.fieldsFrom(h1);
205                                         sb.setLoose(h.isLoose());
206                                         subobjs.add(sb.build());
207                                 } else {
208                                         LOG.debug("Ignoring unhandled explicit hop {}", h);
209                                 }
210                         }
211                         b.setSubobjects(subobjs);
212                 }
213                 return b.build();
214         }
215
216         @Override
217         public ListenableFuture<RpcResult<PcepCreateP2pTunnelOutput>> pcepCreateP2pTunnel(final PcepCreateP2pTunnelInput input) {
218                 final InstructionExecutor e = new AbstractTopologyProgrammingExecutor() {
219                         @Override
220                         protected ListenableFuture<OperationResult> executeImpl() {
221                                 final InstanceIdentifier<Topology> tii = topologyIdentifier(input);
222
223                                 final DataModificationTransaction t = dataProvider.beginTransaction();
224
225
226                                 final TpReader dr = new TpReader(t, tii, input.getDestination());
227                                 final TpReader sr = new TpReader(t, tii, input.getSource());
228
229                                 final Node sn = Preconditions.checkNotNull(sr.getNode());
230                                 final TerminationPoint sp = Preconditions.checkNotNull(sr.getTp());
231                                 final TerminationPoint dp = Preconditions.checkNotNull(dr.getTp());
232
233                                 final AddLspInputBuilder ab = new AddLspInputBuilder();
234                                 ab.setNode(Preconditions.checkNotNull(supportingNode(t, sn)));
235                                 ab.setName(Preconditions.checkNotNull(input.getSymbolicPathName()));
236
237                                 // The link has to be non-existent
238                                 final InstanceIdentifier<Link> lii = NodeChangedListener.linkIdentifier(tii, ab.getNode(), ab.getName());
239                                 Preconditions.checkState(t.readOperationalData(lii) == null);
240
241                                 final ArgumentsBuilder args = new ArgumentsBuilder();
242                                 args.setAdministrative(input.getAdministrativeStatus() == AdministrativeStatus.Active);
243                                 args.setBandwidth(new BandwidthBuilder().setBandwidth(input.getBandwidth()).build());
244                                 args.setClassType(new ClassTypeBuilder().setClassType(input.getClassType()).build());
245                                 args.setEndpointsObj(new EndpointsObjBuilder().setAddressFamily(buildAddressFamily(sp, dp)).build());
246                                 args.setEro(buildEro(input.getExplicitHops()));
247                                 args.setLspa(new LspaBuilder(input).build());
248
249                                 ab.setArguments(args.build());
250
251                                 return Futures.transform(
252                                                 (ListenableFuture<RpcResult<AddLspOutput>>) topologyService.addLsp(ab.build()),
253                                                 new Function<RpcResult<AddLspOutput>, OperationResult>() {
254                                                         @Override
255                                                         public OperationResult apply(final RpcResult<AddLspOutput> input) {
256                                                                 return input.getResult();
257                                                         }
258                                                 });
259                         }
260                 };
261
262                 final Failure f = this.scheduler.submitInstruction(input, e);
263                 final PcepCreateP2pTunnelOutputBuilder b = new PcepCreateP2pTunnelOutputBuilder();
264                 if (f != null) {
265                         b.setResult(new FailureBuilder().setFailure(f).build());
266                 }
267
268                 final RpcResult<PcepCreateP2pTunnelOutput> res = SuccessfulRpcResult.create(b.build());
269                 return Futures.immediateFuture(res);
270         }
271
272         // FIXME: topology programming utility class
273         private InstanceIdentifier<Topology> topologyIdentifier(final TopologyInstructionInput input) {
274                 return InstanceIdentifier.builder().
275                                 node(NetworkTopology.class).node(Topology.class, new TopologyKey(input.getTopologyId())).toInstance();
276         }
277
278         // FIXME: tunnel programming utility class
279         private InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final BaseTunnelInput input) {
280                 return InstanceIdentifier.builder(topology).
281                                 node(Link.class, new LinkKey(Preconditions.checkNotNull(input.getLinkId()))).toInstance();
282         }
283
284         private Node sourceNode(final DataModificationTransaction t, final InstanceIdentifier<Topology> topology, final Link link) {
285                 final InstanceIdentifier<Node> nii = InstanceIdentifier.builder(topology).
286                                 node(Node.class, new NodeKey(link.getSource().getSourceNode())).toInstance();
287                 return (Node) t.readOperationalData(nii);
288         }
289
290         @Override
291         public ListenableFuture<RpcResult<PcepDestroyTunnelOutput>> pcepDestroyTunnel(final PcepDestroyTunnelInput input) {
292                 final InstructionExecutor e = new AbstractTopologyProgrammingExecutor() {
293                         @Override
294                         protected ListenableFuture<OperationResult> executeImpl() {
295                                 final InstanceIdentifier<Topology> tii = topologyIdentifier(input);
296                                 final InstanceIdentifier<Link> lii = linkIdentifier(tii, input);
297
298                                 final DataModificationTransaction t = dataProvider.beginTransaction();
299
300                                 // The link has to exist
301                                 final Link link = (Link) t.readOperationalData(lii);
302                                 Preconditions.checkState(link != null);
303
304                                 // The source node has to exist
305                                 final Node node = sourceNode(t, tii, link);
306                                 Preconditions.checkState(node != null);
307
308                                 final RemoveLspInputBuilder ab = new RemoveLspInputBuilder();
309                                 ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
310                                 ab.setNode(node.getSupportingNode().get(0).getKey().getNodeRef());
311
312                                 return Futures.transform(
313                                                 (ListenableFuture<RpcResult<RemoveLspOutput>>) topologyService.removeLsp(ab.build()),
314                                                 new Function<RpcResult<RemoveLspOutput>, OperationResult>() {
315                                                         @Override
316                                                         public OperationResult apply(final RpcResult<RemoveLspOutput> input) {
317                                                                 return input.getResult();
318                                                         }
319                                                 });
320                         }
321                 };
322
323                 final Failure f = this.scheduler.submitInstruction(input, e);
324                 final PcepDestroyTunnelOutputBuilder b = new PcepDestroyTunnelOutputBuilder();
325                 if (f != null) {
326                         b.setResult(new FailureBuilder().setFailure(f).build());
327                 }
328
329                 final RpcResult<PcepDestroyTunnelOutput> res = SuccessfulRpcResult.create(b.build());
330                 return Futures.immediateFuture(res);
331         }
332
333         @Override
334         public ListenableFuture<RpcResult<PcepUpdateTunnelOutput>> pcepUpdateTunnel(final PcepUpdateTunnelInput input) {
335                 final InstructionExecutor e = new AbstractTopologyProgrammingExecutor() {
336                         @Override
337                         protected ListenableFuture<OperationResult> executeImpl() {
338                                 final InstanceIdentifier<Topology> tii = topologyIdentifier(input);
339                                 final InstanceIdentifier<Link> lii = linkIdentifier(tii, input);
340
341                                 final DataModificationTransaction t = dataProvider.beginTransaction();
342
343                                 // The link has to exist
344                                 final Link link = (Link) t.readOperationalData(lii);
345                                 Preconditions.checkState(link != null);
346
347                                 // The source node has to exist
348                                 final Node node = sourceNode(t, tii, link);
349                                 Preconditions.checkState(node != null);
350
351                                 final UpdateLspInputBuilder ab = new UpdateLspInputBuilder();
352                                 ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
353                                 ab.setNode(Preconditions.checkNotNull(supportingNode(t, node)));
354
355                                 final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder args =
356                                                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder();
357
358                                 args.setAdministrative(input.getAdministrativeStatus() == AdministrativeStatus.Active);
359                                 args.setBandwidth(new BandwidthBuilder().setBandwidth(input.getBandwidth()).build());
360                                 args.setClassType(new ClassTypeBuilder().setClassType(input.getClassType()).build());
361                                 args.setEro(buildEro(input.getExplicitHops()));
362                                 args.setLspa(new LspaBuilder(input).build());
363
364                                 ab.setArguments(args.build());
365
366                                 return Futures.transform(
367                                                 (ListenableFuture<RpcResult<UpdateLspOutput>>) topologyService.updateLsp(ab.build()),
368                                                 new Function<RpcResult<UpdateLspOutput>, OperationResult>() {
369                                                         @Override
370                                                         public OperationResult apply(final RpcResult<UpdateLspOutput> input) {
371                                                                 return input.getResult();
372                                                         }
373                                                 });
374                         }
375                 };
376
377                 final Failure f = this.scheduler.submitInstruction(input, e);
378                 final PcepUpdateTunnelOutputBuilder b = new PcepUpdateTunnelOutputBuilder();
379                 if (f != null) {
380                         b.setResult(new FailureBuilder().setFailure(f).build());
381                 }
382
383                 final RpcResult<PcepUpdateTunnelOutput> res = SuccessfulRpcResult.create(b.build());
384                 return Futures.immediateFuture(res);
385         }
386 }