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
8 package org.opendaylight.transportpce.olm.util;
10 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
11 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmInput;
12 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutputBuilder;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.OpenroadmNodeVersion;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 public final class OlmUtils {
19 private static final Logger LOG = LoggerFactory.getLogger(OlmUtils.class);
20 private static long DATABROKER_READ_TIMEOUT_SECONDS = 120;
24 * This method retrieves list of current PMs for given nodeId,
25 * resourceType, resourceName and Granularity.Currently vendorExtentions
26 * are excluded but can be added back based on requirement
29 * 1. pmFetch This operation traverse through current PM list and gets PM for
30 * given NodeId and Resource name
33 * Input parameter from the olm yang model get-pm rpc
34 * @param deviceTransactionManager
36 * @param openRoadmVersion
37 * OpenRoadm version number
39 * @return Result of the request list of PM readings
41 public static GetPmOutputBuilder pmFetch(GetPmInput input, DeviceTransactionManager deviceTransactionManager,
42 OpenroadmNodeVersion openRoadmVersion) {
43 LOG.info("Getting PM Data for NodeId: {} ResourceType: {} ResourceName: {}", input.getNodeId(),
44 input.getResourceType(), input.getResourceIdentifier());
45 GetPmOutputBuilder pmOutputBuilder;
46 switch (openRoadmVersion.getIntValue()) {
48 pmOutputBuilder = OlmUtils121.pmFetch(input, deviceTransactionManager);
51 pmOutputBuilder = OlmUtils221.pmFetch(input, deviceTransactionManager);
54 pmOutputBuilder = OlmUtils710.pmFetch(input, deviceTransactionManager);
57 LOG.error("Unrecognized OpenRoadm version");
58 pmOutputBuilder = new GetPmOutputBuilder();
60 return pmOutputBuilder;