2 * Copyright IBM Corporation, 2013. 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.hosttracker;
10 import java.net.InetAddress;
12 import org.opendaylight.controller.sal.packet.address.DataLinkAddress;
15 * Class used to generate a key based on the scheme choosen for hostsdb storage in hosttracker.
16 * @author Deepak Udapudi
18 public class HostIdFactory {
19 public static final String DEFAULT_IP_KEY_SCHEME = "IP";
20 public static final String IP_MAC_KEY_SCHEME = "IP+MAC";
21 private static String scheme = null;
23 scheme = System.getProperty("hosttracker.keyscheme");
26 public static String getScheme() {
30 public static IHostId create(InetAddress ip, DataLinkAddress mac) {
31 IHostId ipHostId = new IPHostId(ip);
35 case DEFAULT_IP_KEY_SCHEME:
37 case IP_MAC_KEY_SCHEME:
38 IHostId ipMacHostId = new IPMacHostId(ip, mac);