2 * Copyright (c) 2014 Red Hat, 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 * Authors : Madhu Venugopal
10 package org.opendaylight.ovsdb.plugin;
12 import java.io.IOException;
13 import java.util.HashMap;
15 import java.util.Properties;
17 import org.opendaylight.controller.sal.connection.ConnectionConstants;
18 import org.opendaylight.controller.sal.core.Node;
19 import org.opendaylight.controller.sal.utils.ServiceHelper;
21 public abstract class OvsdbTestBase {
22 private final static String identifier = "TEST";
24 public Node getTestConnection() throws IOException {
25 IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class,
27 Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
28 Properties props = System.getProperties();
29 params.put(ConnectionConstants.ADDRESS,
30 props.getProperty("ovsdbserver.ipaddress"));
31 params.put(ConnectionConstants.PORT,
32 props.getProperty("ovsdbserver.port", "6640"));
34 Node node = connectionService.connect(identifier, params);
36 throw new IOException("Failed to connect to the ovsdb server");