* Wait up to 10s for our configured module to come up
*/
private static final int MODULE_TIMEOUT = 10000;
+ private static int configTimes = 0;
+ private static boolean extras = false;
public abstract String getModuleName();
public abstract String getInstanceName();
+ public abstract boolean setExtras();
+
public abstract MavenUrlReference getFeatureRepo();
public abstract String getFeatureName();
- public Option[] getLoggingOptions() {
+ public Option[] getLoggingOptions(boolean extras) {
Option[] options = new Option[] {
editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
logConfiguration(AbstractConfigTestBase.class),
return "log4j.logger." + klazz.getPackage().getName();
}
- public Option[] getFeaturesOptions() {
+ public Option[] getFeaturesOptions(boolean extras) {
return new Option[]{};
}
- public Option[] getPropertiesOptions() {
+ public Option[] getPropertiesOptions(boolean extras) {
return new Option[]{};
}
@Configuration
public Option[] config() {
+ LOG.info("Calling config, configTimes: {}", configTimes);
+ configTimes++;
+ extras = setExtras();
Option[] options = new Option[] {
// KarafDistributionOption.debugConfiguration("5005", true),
karafDistributionConfiguration()
keepRuntimeFolder(),
//features(getFeatureRepo() , getFeatureName())
};
- options = ObjectArrays.concat(options, getFeaturesOptions(), Option.class);
- options = ObjectArrays.concat(options, getLoggingOptions(), Option.class);
- options = ObjectArrays.concat(options, getPropertiesOptions(), Option.class);
+ options = ObjectArrays.concat(options, getFeaturesOptions(extras), Option.class);
+ options = ObjectArrays.concat(options, getLoggingOptions(extras), Option.class);
+ options = ObjectArrays.concat(options, getPropertiesOptions(extras), Option.class);
return options;
}
import javax.inject.Inject;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
private static String addressStr;
private static String portStr;
private static String connectionType;
+ private static String extrasStr;
private static Boolean setup = false;
private static MdsalUtils mdsalUtils = null;
- private static String extras = "false";
+ //private static String extras = "false";
private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt";
private static final String NETVIRTPROVIDERS = "org.opendaylight.ovsdb.openstack.net-virt-providers";
@Override
public String getFeatureName() {
- setExtras();
+ //setExtras();
return "odl-ovsdb-southbound-impl-ui";
}
}
@Override
- public Option[] getFeaturesOptions() {
- if (extras.equals("true")) {
+ public Option[] getFeaturesOptions(boolean extras) {
+ if (extras == true) {
Option[] options = new Option[] {
features("mvn:org.opendaylight.ovsdb/features-ovsdb/1.1.0-SNAPSHOT/xml/features",
"odl-ovsdb-openstack-sb")};
}
@Override
- public Option[] getLoggingOptions() {
+ public Option[] getLoggingOptions(boolean extras) {
Option[] options = new Option[] {
/*editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
"log4j.logger.org.opendaylight.ovsdb",
LogLevelOption.LogLevel.DEBUG.name())
};
- if (extras.equals("true")) {
+ if (extras == true) {
Option[] extraOptions = new Option[] {
editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
"log4j.logger.org.opendaylight.ovsdb",
options = ObjectArrays.concat(options, extraOptions, Option.class);
}
- options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
+ options = ObjectArrays.concat(options, super.getLoggingOptions(extras), Option.class);
return options;
}
@Override
- public Option[] getPropertiesOptions() {
+ public Option[] getPropertiesOptions(boolean extras) {
Properties props = new Properties(System.getProperties());
String addressStr = props.getProperty(SouthboundITConstants.SERVER_IPADDRESS,
SouthboundITConstants.DEFAULT_SERVER_IPADDRESS);
SouthboundITConstants.DEFAULT_SERVER_PORT);
String connectionType = props.getProperty(SouthboundITConstants.CONNECTION_TYPE,
SouthboundITConstants.CONNECTION_TYPE_ACTIVE);
+ String extrasStr = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
+ SouthboundITConstants.DEFAULT_SERVER_EXTRAS);
- LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
- connectionType, addressStr, portStr);
+ LOG.info("getPropertiesOptions: Using the following properties: mode= {}, ip:port= {}:{}, extras= {}",
+ connectionType, addressStr, portStr, extrasStr);
Option[] options = new Option[] {
editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
SouthboundITConstants.SERVER_PORT, portStr),
editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
- SouthboundITConstants.CONNECTION_TYPE, connectionType)
+ SouthboundITConstants.CONNECTION_TYPE, connectionType),
+ editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+ SouthboundITConstants.SERVER_EXTRAS, extrasStr)
};
return options;
}
- private void setExtras() {
+
+ public boolean setExtras() {
Properties props = new Properties(System.getProperties());
- extras = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
- SouthboundITConstants.DEFAULT_SERVER_EXTRAS);
- LOG.info("extras: {}", extras);
- System.out.println("extras: " + extras);
+ boolean extras = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
+ SouthboundITConstants.DEFAULT_SERVER_EXTRAS).equals("true");
+ LOG.info("setExtras: {}", extras);
+ return extras;
}
@Before
addressStr = bundleContext.getProperty(SouthboundITConstants.SERVER_IPADDRESS);
portStr = bundleContext.getProperty(SouthboundITConstants.SERVER_PORT);
connectionType = bundleContext.getProperty(SouthboundITConstants.CONNECTION_TYPE);
+ extrasStr = bundleContext.getProperty(SouthboundITConstants.SERVER_EXTRAS);
- LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
- connectionType, addressStr, portStr);
+ LOG.info("setUp: Using the following properties: mode= {}, ip:port= {}:{}, extras= {}",
+ connectionType, addressStr, portStr, extrasStr);
if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_ACTIVE)) {
if (addressStr == null) {
fail(usage());
mdsalUtils = new MdsalUtils(dataBroker);
setup = true;
- if (extras.equals("true")) {
+ if (extrasStr.equals("true")) {
isBundleReady(bundleContext, NETVIRT);
isBundleReady(bundleContext, NETVIRTPROVIDERS);
}
private boolean disconnectOvsdbNode(ConnectionInfo connectionInfo) throws InterruptedException {
Assert.assertTrue(deleteOvsdbNode(connectionInfo));
Node node = getOvsdbNode(connectionInfo);
- //Assert.assertNull(node);
- Assume.assumeNotNull(node);
+ Assert.assertNull(node);
+ //Assume.assumeNotNull(node); // Using assumeNotNull because there is no assumeNull
LOG.info("Disconnected from {}", connectionInfoToString(connectionInfo));
return true;
}
public void testAddDeleteOvsdbNode() throws InterruptedException {
ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
Node ovsdbNode = connectOvsdbNode(connectionInfo);
- //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
- Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+ Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+ //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
}
@Test
public void testOvsdbNodeOvsVersion() throws InterruptedException {
ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
Node ovsdbNode = connectOvsdbNode(connectionInfo);
- OvsdbNodeAugmentation augment = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
- assertNotNull(augment.getOvsVersion());
- Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+ OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
+ Assert.assertNotNull(ovsdbNodeAugmentation);
+ assertNotNull(ovsdbNodeAugmentation.getOvsVersion());
+ Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+ //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
}
@Test
ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
Node ovsdbNode = connectOvsdbNode(connectionInfo);
OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
- assertNotNull(ovsdbNodeAugmentation);
+ Assert.assertNotNull(ovsdbNodeAugmentation);
List<OpenvswitchOtherConfigs> otherConfigsList = ovsdbNodeAugmentation.getOpenvswitchOtherConfigs();
if (otherConfigsList != null) {
for (OpenvswitchOtherConfigs otherConfig : otherConfigsList) {
} else {
LOG.info("other_config is not present");
}
- //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
- Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+ Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+ //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
}
private void setManagedBy(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
new OvsdbTerminationPointAugmentationBuilder();
ovsdbTerminationPointAugmentationBuilder.setInterfaceType(
new InterfaceTypeEntryBuilder()
- .setInterfaceType(
- SouthboundMapper.createInterfaceType("internal"))
+ .setInterfaceType(
+ SouthboundMapper.createInterfaceType("internal"))
.build().getInterfaceType());
return ovsdbTerminationPointAugmentationBuilder;
}
}
private boolean addBridge(ConnectionInfo connectionInfo, String bridgeName) throws InterruptedException {
- //Node node = SouthboundMapper.createNode(connectionInfo);
NodeBuilder bridgeNodeBuilder = new NodeBuilder();
InstanceIdentifier<Node> bridgeIid =
SouthboundMapper.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
Assert.assertTrue(deleteBridge(connectionInfo));
- //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
- Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+ Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+ //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
}
private InstanceIdentifier<Node> getTpIid(ConnectionInfo connectionInfo, OvsdbBridgeAugmentation bridge) {