2 * Copyright (c) 2014 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
8 package org.opendaylight.controller.md.inventory.manager;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNode;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNodeConnector;
17 public class InventoryMapping {
19 public static FlowCapableNodeConnector toInventoryAugment(final FlowNodeConnector updated) {
20 if ((updated instanceof FlowCapableNodeConnector)) {
21 return ((FlowCapableNodeConnector) updated);
23 final FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
24 builder.setAdvertisedFeatures(updated.getAdvertisedFeatures());
25 builder.setConfiguration(updated.getConfiguration());
26 builder.setCurrentFeature(updated.getCurrentFeature());
27 builder.setCurrentSpeed(updated.getCurrentSpeed());
28 builder.setHardwareAddress(updated.getHardwareAddress());
29 builder.setMaximumSpeed(updated.getMaximumSpeed());
30 builder.setName(updated.getName());
31 builder.setPeerFeatures(updated.getPeerFeatures());
32 builder.setPortNumber(updated.getPortNumber());
33 builder.setState(updated.getState());
34 builder.setSupported(updated.getSupported());
35 return builder.build();
38 public static FlowCapableNode toInventoryAugment(final FlowNode source) {
39 if ((source instanceof FlowCapableNode)) {
40 return ((FlowCapableNode) source);
42 return (new FlowCapableNodeBuilder(source)).build();