Adjust to yangtools-2.0.0/odlparent-3.0.0 changes
[netconf.git] / netconf / tools / netconf-testtool / src / main / java / org / opendaylight / netconf / test / tool / TestToolUtils.java
1 /*
2  * Copyright (c) 2015 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
9 package org.opendaylight.netconf.test.tool;
10
11 import java.io.InputStream;
12
13 public final class TestToolUtils {
14     private TestToolUtils() {
15
16     }
17
18     public static String getMac(long mac) {
19         final StringBuilder builder = new StringBuilder(Long.toString(mac, 16));
20         for (int i = builder.length(); i < 12; i++) {
21             builder.insert(0, "0");
22         }
23         for (int j = builder.length() - 2; j >= 2; j -= 2) {
24             builder.insert(j, ":");
25         }
26         return builder.toString();
27     }
28
29     public static InputStream getDataAsStream(final String path) {
30         return TestToolUtils.class.getClassLoader().getResourceAsStream(path);
31     }
32
33 }