3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.protocol_plugin.openflow.internal;
12 import java.util.List;
14 import org.openflow.protocol.statistics.OFDescriptionStatistics;
15 import org.openflow.protocol.statistics.OFStatistics;
17 import org.opendaylight.controller.sal.reader.NodeDescription;
20 * Utility class for converting openflow description statistics
21 * into SAL NodeDescription object
26 public class DescStatisticsConverter {
27 NodeDescription hwDesc;
28 OFDescriptionStatistics ofDesc;
30 public DescStatisticsConverter(List<OFStatistics> statsList) {
32 this.ofDesc = (OFDescriptionStatistics) statsList.get(0);
35 public NodeDescription getHwDescription() {
36 if (hwDesc == null && ofDesc != null) {
37 hwDesc = new NodeDescription();
38 hwDesc.setManufacturer(ofDesc.getManufacturerDescription());
39 hwDesc.setHardware(ofDesc.getHardwareDescription());
40 hwDesc.setSoftware(ofDesc.getSoftwareDescription());
41 hwDesc.setDescription(ofDesc.getDatapathDescription());
42 hwDesc.setSerialNumber(ofDesc.getSerialNumber());