2 * Copyright (c) 2018 Orange and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package io.fd.honeycomb.transportpce.device.rpcs;
18 import io.fd.honeycomb.rpc.RpcService;
20 import java.util.Arrays;
21 import java.util.concurrent.CompletableFuture;
22 import java.util.concurrent.CompletionStage;
24 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus;
25 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailInput;
26 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailOutput;
27 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailOutputBuilder;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.get.connection.port.trail.output.Ports;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.get.connection.port.trail.output.PortsBuilder;
30 import org.opendaylight.yangtools.yang.common.QName;
31 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
36 * Class to simulate get-connection-port-trail rpc.
38 * @author Martial COULIBALY ( mcoulibaly.ext@orange.com ) on behalf of Orange
40 public class ConnectionPortTrailService implements RpcService<GetConnectionPortTrailInput, GetConnectionPortTrailOutput> {
41 private static final Logger LOG = LoggerFactory.getLogger(ConnectionPortTrailService.class);
42 private static final String localName = "get-connection-port-trail";
43 private static final QName name = QName.create(GetConnectionPortTrailInput.QNAME, localName);
44 private static final SchemaPath schemaPath = SchemaPath.ROOT.createChild(name);
47 public SchemaPath getManagedNode() {
52 * @see io.fd.honeycomb.rpc.RpcService#invoke(org.opendaylight.yangtools.yang.binding.DataObject)
55 public CompletionStage<GetConnectionPortTrailOutput> invoke(GetConnectionPortTrailInput arg0) {
56 LOG.info("RPC GetConnectionPortTrail request received !");
57 Ports port = new PortsBuilder()
58 .setCircuitPackName("2/0")
61 GetConnectionPortTrailOutput output = new GetConnectionPortTrailOutputBuilder()
62 .setStatusMessage("OK")
63 .setStatus(RpcStatus.Successful)
64 .setPorts(Arrays.asList(port))
66 CompletableFuture<GetConnectionPortTrailOutput> result = new CompletableFuture<>();
67 result.complete(output);