Fix license header violations in utils
[ovsdb.git] / utils / mdsal-node / src / main / java / org / opendaylight / ovsdb / utils / mdsal / node / NodeUtils.java
1 /*
2  * Copyright (c) 2015 Red Hat, 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
9 package org.opendaylight.ovsdb.utils.mdsal.node;
10
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
15
16 public class NodeUtils {
17
18     public static String getId (String identifier) {
19         String id = identifier;
20
21         String[] pair = identifier.split("\\|");
22         if ((pair.length > 1) && (pair[0].equals("OVS"))) {
23             id = pair[1];
24         }
25         return id;
26     }
27
28     public static Node getOpenFlowNode (String identifier) {
29         NodeId nodeId = new NodeId(identifier);
30         NodeKey nodeKey = new NodeKey(nodeId);
31
32         return new NodeBuilder()
33                 .setId(nodeId)
34                 .setKey(nodeKey)
35                 .build();
36     }
37 }