2 * Copyright (c) 2013 Cisco Systems, Inc. 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.controller.protocol_plugin.openflow.internal;
11 import java.util.List;
13 import org.opendaylight.controller.sal.reader.NodeDescription;
14 import org.openflow.protocol.statistics.OFDescriptionStatistics;
15 import org.openflow.protocol.statistics.OFStatistics;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Utility class for converting openflow description statistics into SAL
21 * NodeDescription object
26 public class DescStatisticsConverter {
27 private static final Logger log = LoggerFactory
28 .getLogger(DescStatisticsConverter.class);
29 NodeDescription hwDesc;
30 OFDescriptionStatistics ofDesc;
32 public DescStatisticsConverter(List<OFStatistics> statsList) {
34 this.ofDesc = (OFDescriptionStatistics) statsList.get(0);
37 public NodeDescription getHwDescription() {
38 if (hwDesc == null && ofDesc != null) {
39 hwDesc = new NodeDescription();
40 hwDesc.setManufacturer(ofDesc.getManufacturerDescription());
41 hwDesc.setHardware(ofDesc.getHardwareDescription());
42 hwDesc.setSoftware(ofDesc.getSoftwareDescription());
43 hwDesc.setDescription(ofDesc.getDatapathDescription());
44 hwDesc.setSerialNumber(ofDesc.getSerialNumber());
46 log.trace("OFDescriptionStatistics: {}", ofDesc);
47 log.trace("NodeDescription: {}", hwDesc);