+++ /dev/null
-/*
- * Copyright (c) 2015 Red Hat, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.ovsdb.southbound.it;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility class for mdsal transactions.
- *
- * @author Sam Hague (shague@redhat.com)
- */
-public class MdsalUtils {
- private static final Logger LOG = LoggerFactory.getLogger(MdsalUtils.class);
- private DataBroker databroker = null;
-
- /**
- * Class constructor setting the data broker.
- *
- * @param dataBroker the {@link DataBroker}
- */
- public MdsalUtils(DataBroker dataBroker) {
- this.databroker = dataBroker;
- }
-
- /**
- * Executes delete as a blocking transaction.
- *
- * @param store {@link LogicalDatastoreType} which should be modified
- * @param path {@link InstanceIdentifier} to read from
- * @param <D> the data object type
- * @return the result of the request
- */
- public <D extends org.opendaylight.yangtools.yang.binding.DataObject> boolean delete(
- final LogicalDatastoreType store, final InstanceIdentifier<D> path) {
- boolean result = false;
- final WriteTransaction transaction = databroker.newWriteOnlyTransaction();
- transaction.delete(store, path);
- CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
- try {
- future.checkedGet();
- result = true;
- } catch (TransactionCommitFailedException e) {
- LOG.warn("Failed to delete {} ", path, e);
- }
- return result;
- }
-
- /**
- * Executes merge as a blocking transaction.
- *
- * @param logicalDatastoreType {@link LogicalDatastoreType} which should be modified
- * @param path {@link InstanceIdentifier} for path to read
- * @param <D> the data object type
- * @return the result of the request
- */
- public <D extends org.opendaylight.yangtools.yang.binding.DataObject> boolean merge(
- final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data) {
- boolean result = false;
- final WriteTransaction transaction = databroker.newWriteOnlyTransaction();
- transaction.merge(logicalDatastoreType, path, data, true);
- CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
- try {
- future.checkedGet();
- result = true;
- } catch (TransactionCommitFailedException e) {
- LOG.warn("Failed to merge {} ", path, e);
- }
- return result;
- }
-
- /**
- * Executes put as a blocking transaction.
- *
- * @param logicalDatastoreType {@link LogicalDatastoreType} which should be modified
- * @param path {@link InstanceIdentifier} for path to read
- * @param <D> the data object type
- * @return the result of the request
- */
- public <D extends org.opendaylight.yangtools.yang.binding.DataObject> boolean put(
- final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data) {
- boolean result = false;
- final WriteTransaction transaction = databroker.newWriteOnlyTransaction();
- transaction.put(logicalDatastoreType, path, data, true);
- CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
- try {
- future.checkedGet();
- result = true;
- } catch (TransactionCommitFailedException e) {
- LOG.warn("Failed to put {} ", path, e);
- }
- return result;
- }
-
- /**
- * Executes read as a blocking transaction.
- *
- * @param store {@link LogicalDatastoreType} to read
- * @param path {@link InstanceIdentifier} for path to read
- * @param <D> the data object type
- * @return the result as the data object requested
- */
- public <D extends org.opendaylight.yangtools.yang.binding.DataObject> D read(
- final LogicalDatastoreType store, final InstanceIdentifier<D> path) {
- D result = null;
- final ReadOnlyTransaction transaction = databroker.newReadOnlyTransaction();
- Optional<D> optionalDataObject;
- CheckedFuture<Optional<D>, ReadFailedException> future = transaction.read(store, path);
- try {
- optionalDataObject = future.checkedGet();
- if (optionalDataObject.isPresent()) {
- result = optionalDataObject.get();
- } else {
- LOG.debug("{}: Failed to read {}",
- Thread.currentThread().getStackTrace()[1], path);
- }
- } catch (ReadFailedException e) {
- LOG.warn("Failed to read {} ", path, e);
- }
- transaction.close();
- return result;
- }
-}
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.vmOption;
-import static org.ops4j.pax.exam.CoreOptions.when;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import org.opendaylight.ovsdb.southbound.SouthboundMapper;
import org.opendaylight.ovsdb.southbound.SouthboundProvider;
import org.opendaylight.ovsdb.southbound.SouthboundUtil;
+import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
+import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbFailModeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbPortInterfaceAttributes.VlanMode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
private static MdsalUtils mdsalUtils = null;
private static Node ovsdbNode;
- // TODO Constants copied from AbstractConfigTestBase, need to be removed (see TODO below)
- private static final String PAX_EXAM_UNPACK_DIRECTORY = "target/exam";
- private static final String KARAF_DEBUG_PORT = "5005";
- private static final String KARAF_DEBUG_PROP = "karaf.debug";
- private static final String KEEP_UNPACK_DIRECTORY_PROP = "karaf.keep.unpack";
-
@Inject
private BundleContext bundleContext;
@Configuration
public Option[] config() {
- // TODO Figure out how to use the parent Karaf setup, then just use super.config()
- Option[] options = new Option[] {
- when(Boolean.getBoolean(KARAF_DEBUG_PROP))
- .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),
- karafDistributionConfiguration().frameworkUrl(getKarafDistro())
- .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY))
- .useDeployFolder(false),
- when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
- // Works only if we don't specify the feature repo and name
- getLoggingOption()};
+ Option[] options = super.config();
Option[] propertyOptions = getPropertiesOptions();
Option[] otherOptions = getOtherOptions();
Option[] combinedOptions = new Option[options.length + propertyOptions.length + otherOptions.length];
@Override
public String getFeatureName() {
- return "odl-ovsdb-southbound-impl-ui";
+ return "odl-ovsdb-southbound-test";
}
protected String usage() {
mdsalUtils = new MdsalUtils(dataBroker);
final ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
- final InstanceIdentifier<Node> iid = createInstanceIdentifier(connectionInfo);
+ final InstanceIdentifier<Node> iid = SouthboundUtils.createInstanceIdentifier(connectionInfo);
dataBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
iid, CONFIGURATION_LISTENER, AsyncDataBroker.DataChangeScope.SUBTREE);
dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
return connectionInfo;
}
- private static String connectionInfoToString(final ConnectionInfo connectionInfo) {
- return String.valueOf(
- connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
- }
-
@Test
public void testNetworkTopology() throws InterruptedException {
NetworkTopology networkTopology = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION,
topology);
}
- private static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo connectionInfo) {
- return InstanceIdentifier
- .create(NetworkTopology.class)
- .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
- .child(Node.class,
- createNodeKey(connectionInfo.getRemoteIp(), connectionInfo.getRemotePort()));
- }
-
private Node connectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
- final InstanceIdentifier<Node> iid = createInstanceIdentifier(connectionInfo);
- Assert.assertTrue(mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, iid, createNode(connectionInfo)));
+ final InstanceIdentifier<Node> iid = SouthboundUtils.createInstanceIdentifier(connectionInfo);
+ Assert.assertTrue(
+ mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, iid, SouthboundUtils.createNode(connectionInfo)));
waitForOperationalCreation(iid);
Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, iid);
Assert.assertNotNull(node);
- LOG.info("Connected to {}", connectionInfoToString(connectionInfo));
+ LOG.info("Connected to {}", SouthboundUtils.connectionInfoToString(connectionInfo));
return node;
}
}
private static void disconnectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
- final InstanceIdentifier<Node> iid = createInstanceIdentifier(connectionInfo);
+ final InstanceIdentifier<Node> iid = SouthboundUtils.createInstanceIdentifier(connectionInfo);
Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid));
waitForOperationalDeletion(iid);
Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, iid);
Assert.assertNull(node);
- LOG.info("Disconnected from {}", connectionInfoToString(connectionInfo));
+ LOG.info("Disconnected from {}", SouthboundUtils.connectionInfoToString(connectionInfo));
}
@Test
LOG.info("dp type is {}", dpTypeStr);
if (dpTypeStr.equals(NETDEV_DP_TYPE)) {
LOG.info("Found a DPDK node; adding a corresponding netdev device");
- InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(connectionInfo,
+ InstanceIdentifier<Node> bridgeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo,
new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME));
- NodeId bridgeNodeId = createManagedNodeId(bridgeIid);
+ NodeId bridgeNodeId = SouthboundUtils.createManagedNodeId(bridgeIid);
try (TestBridge testBridge = new TestBridge(connectionInfo, bridgeIid,
SouthboundITConstants.BRIDGE_NAME, bridgeNodeId, false, null, true, dpType, null, null,
null)) {
private static void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
final ConnectionInfo connectionInfo) {
- InstanceIdentifier<Node> connectionNodePath = createInstanceIdentifier(connectionInfo);
+ InstanceIdentifier<Node> connectionNodePath = SouthboundUtils.createInstanceIdentifier(connectionInfo);
ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath));
}
this.bridgeName = bridgeName;
NodeBuilder bridgeNodeBuilder = new NodeBuilder();
if (bridgeIid == null) {
- bridgeIid = createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
+ bridgeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
}
if (bridgeNodeId == null) {
bridgeNodeId = SouthboundMapper.createManagedNodeId(bridgeIid);
@Override
public void close() {
final InstanceIdentifier<Node> iid =
- createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
+ SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid));
try {
Thread.sleep(OVSDB_UPDATE_TIMEOUT);
*/
private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName, LogicalDatastoreType store) {
InstanceIdentifier<Node> bridgeIid =
- createInstanceIdentifier(connectionInfo,
- new OvsdbBridgeName(bridgeName));
+ SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
return mdsalUtils.read(store, bridgeIid);
}
}
private InstanceIdentifier<Node> getTpIid(ConnectionInfo connectionInfo, OvsdbBridgeAugmentation bridge) {
- return createInstanceIdentifier(connectionInfo,
- bridge.getBridgeName());
+ return SouthboundUtils.createInstanceIdentifier(connectionInfo, bridge.getBridgeName());
}
/**
OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
Assert.assertNotNull(bridge);
LOG.info("bridge: {}", bridge);
- NodeId nodeId = SouthboundMapper.createManagedNodeId(createInstanceIdentifier(
+ NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundUtils.createInstanceIdentifier(
connectionInfo, bridge.getBridgeName()));
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
createGenericOvsdbTerminationPointAugmentationBuilder();
try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) {
OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
Assert.assertNotNull(bridge);
- NodeId nodeId = createManagedNodeId(createInstanceIdentifier(
+ NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier(
connectionInfo, bridge.getBridgeName()));
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
createGenericOvsdbTerminationPointAugmentationBuilder();
}
// UPDATE- Not Applicable. From the OpenVSwitch documentation:
- // "A client should ideally set this column’s value in the same database transaction that it uses to create
-
- // the interface. "
+ // "A client should ideally set this column’s value in the same database transaction that it uses to
+ // create the interface. "
// DELETE handled by TestBridge
}
try (TestBridge testBridge = new TestBridge(connectionInfo, null, testBridgeAndPortName, null, true,
SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null, null,
null)) {
- NodeId testBridgeNodeId = createManagedNodeId(createInstanceIdentifier(
- connectionInfo, new OvsdbBridgeName(testBridgeAndPortName)));
+ NodeId testBridgeNodeId = SouthboundUtils.createManagedNodeId(
+ SouthboundUtils.createInstanceIdentifier(connectionInfo,
+ new OvsdbBridgeName(testBridgeAndPortName)));
OvsdbTerminationPointAugmentationBuilder tpCreateAugmentationBuilder =
createGenericOvsdbTerminationPointAugmentationBuilder();
tpCreateAugmentationBuilder.setName(testBridgeAndPortName);
helper.writeValues(tpUpdateAugmentationBuilder, updateToTestCase.inputValues);
InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(testBridgeNodeId);
NodeBuilder portUpdateNodeBuilder = new NodeBuilder();
- NodeId portUpdateNodeId = createManagedNodeId(portIid);
+ NodeId portUpdateNodeId = SouthboundUtils.createManagedNodeId(portIid);
portUpdateNodeBuilder.setNodeId(portUpdateNodeId);
TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder();
tpUpdateBuilder.setKey(new TerminationPointKey(new TpId(testBridgeAndPortName)));
try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) {
OvsdbBridgeAugmentation bridge = getBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME);
Assert.assertNotNull(bridge);
- NodeId nodeId = createManagedNodeId(createInstanceIdentifier(
+ NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier(
connectionInfo, bridge.getBridgeName()));
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
createGenericOvsdbTerminationPointAugmentationBuilder();
tpUpdateAugmentationBuilder.setVlanTag(new VlanId(UPDATED_VLAN_ID));
InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(testBridgeNodeId);
NodeBuilder portUpdateNodeBuilder = new NodeBuilder();
- NodeId portUpdateNodeId = createManagedNodeId(portIid);
+ NodeId portUpdateNodeId = SouthboundUtils.createManagedNodeId(portIid);
portUpdateNodeBuilder.setNodeId(portUpdateNodeId);
TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder();
tpUpdateBuilder.setKey(new TerminationPointKey(new TpId(portName)));
try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) {
OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
Assert.assertNotNull(bridge);
- NodeId nodeId = createManagedNodeId(createInstanceIdentifier(
+ NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier(
connectionInfo, bridge.getBridgeName()));
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
createGenericOvsdbTerminationPointAugmentationBuilder();
tpUpdateAugmentationBuilder.setVlanMode(UPDATED_VLAN_MODE);
InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(testBridgeNodeId);
NodeBuilder portUpdateNodeBuilder = new NodeBuilder();
- NodeId portUpdateNodeId = createManagedNodeId(portIid);
+ NodeId portUpdateNodeId = SouthboundUtils.createManagedNodeId(portIid);
portUpdateNodeBuilder.setNodeId(portUpdateNodeId);
TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder();
tpUpdateBuilder.setKey(new TerminationPointKey(new TpId(portName)));
try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) {
OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
Assert.assertNotNull(bridge);
- NodeId nodeId = createManagedNodeId(createInstanceIdentifier(
- connectionInfo, bridge.getBridgeName()));
+ NodeId nodeId = SouthboundUtils.createManagedNodeId(connectionInfo, bridge.getBridgeName());
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
createGenericOvsdbTerminationPointAugmentationBuilder();
String portName = "testTerminationPointVlanTrunks" + testCase;
tpUpdateAugmentationBuilder.setTrunks(UPDATED_TRUNKS);
InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(testBridgeNodeId);
NodeBuilder portUpdateNodeBuilder = new NodeBuilder();
- NodeId portUpdateNodeId = createManagedNodeId(portIid);
+ NodeId portUpdateNodeId = SouthboundUtils.createManagedNodeId(portIid);
portUpdateNodeBuilder.setNodeId(portUpdateNodeId);
TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder();
tpUpdateBuilder.setKey(new TerminationPointKey(new TpId(portName)));
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, topologyPath);
- InstanceIdentifier<Node> expectedNodeIid = createInstanceIdentifier(connectionInfo);
+ InstanceIdentifier<Node> expectedNodeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo);
NodeId expectedNodeId = expectedNodeIid.firstKeyOf(Node.class, NodeKey.class).getNodeId();
Node foundNode = null;
Assert.assertNotNull("Expected to find topology: " + topologyPath, topology);
// CREATE: Create the test bridge
final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName(testBridgeName);
- final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(connectionInfo, ovsdbBridgeName);
+ final InstanceIdentifier<Node> bridgeIid =
+ SouthboundUtils.createInstanceIdentifier(connectionInfo, ovsdbBridgeName);
final NodeId bridgeNodeId = SouthboundMapper.createManagedNodeId(bridgeIid);
final NodeBuilder bridgeCreateNodeBuilder = new NodeBuilder();
bridgeCreateNodeBuilder.setNodeId(bridgeNodeId);
new BridgeExternalIdsSouthboundHelper());
}
- public static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo key,OvsdbBridgeName bridgeName) {
- return SouthboundMapper.createInstanceIdentifier(createManagedNodeId(key, bridgeName));
- }
-
- public static NodeId createManagedNodeId(ConnectionInfo key, OvsdbBridgeName bridgeName) {
- return createManagedNodeId(key.getRemoteIp(), key.getRemotePort(), bridgeName);
- }
-
- public static NodeId createManagedNodeId(IpAddress ip, PortNumber port, OvsdbBridgeName bridgeName) {
- return new NodeId(createNodeId(ip,port).getValue()
- + "/" + SouthboundConstants.BRIDGE_URI_PREFIX + "/" + bridgeName.getValue());
- }
-
- public static NodeId createNodeId(IpAddress ip, PortNumber port) {
- String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
- + String.valueOf(ip.getValue()) + ":" + port.getValue();
- Uri uri = new Uri(uriString);
- return new NodeId(uri);
- }
-
- public static NodeKey createNodeKey(IpAddress ip, PortNumber port) {
- return new NodeKey(createNodeId(ip,port));
- }
-
- public static Node createNode(ConnectionInfo key) {
- NodeBuilder nodeBuilder = new NodeBuilder();
- nodeBuilder.setNodeId(createNodeId(key.getRemoteIp(),key.getRemotePort()));
- nodeBuilder.addAugmentation(OvsdbNodeAugmentation.class, createOvsdbAugmentation(key));
- return nodeBuilder.build();
- }
-
- public static OvsdbNodeAugmentation createOvsdbAugmentation(ConnectionInfo key) {
- OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = new OvsdbNodeAugmentationBuilder();
- ovsdbNodeBuilder.setConnectionInfo(key);
- return ovsdbNodeBuilder.build();
- }
-
- public static NodeId createManagedNodeId(InstanceIdentifier<Node> iid) {
- NodeKey nodeKey = iid.firstKeyOf(Node.class, NodeKey.class);
- return nodeKey.getNodeId();
- }
-
/**
* <p>
* Representation of a southbound test case. Each test case has a name, a list of input values and a list of