BUG-634: introduce netty ChannelFactory wrapper
[controller.git] / opendaylight / md-sal / inventory-manager / src / main / java / org / opendaylight / controller / md / inventory / manager / InventoryMapping.xtend
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  * 
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
7  */
8 package org.opendaylight.controller.md.inventory.manager
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNodeConnector
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
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.FlowCapableNodeBuilder
16
17 class InventoryMapping {
18
19     static def FlowCapableNodeConnector toInventoryAugment(FlowNodeConnector updated) {
20         if (updated instanceof FlowCapableNodeConnector) {
21             return updated as FlowCapableNodeConnector;
22         }
23         val it = new FlowCapableNodeConnectorBuilder();
24         advertisedFeatures = updated.advertisedFeatures
25         configuration = updated.configuration
26         currentFeature = updated.currentFeature
27         currentSpeed = updated.currentSpeed
28         hardwareAddress = updated.hardwareAddress
29         maximumSpeed = updated.maximumSpeed
30         name = updated.name
31         peerFeatures = updated.peerFeatures
32         portNumber = updated.portNumber
33         state = updated.state
34         supported = updated.supported
35         return build();
36     }
37
38     static def FlowCapableNode toInventoryAugment(FlowNode source) {
39         if (source instanceof FlowCapableNode) {
40             return source as FlowCapableNode;
41         }
42         val it = new FlowCapableNodeBuilder(source);
43         return build();
44     }
45
46 }