import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
Assert.assertNotEquals(ovsRow.getVersion(), originalVersion);
}
- // Note: The openFlow version is now determined by configuration's getProperty("ovsdb.of.version", "1.3").
- // Thus, the ovs version attribute (returned by ovs' OpenVSwitch table) is not used to determine what is
- // the openFlow version chosen by netVirtConfigurationService.
- // See: https://git.opendaylight.org/gerrit/#/c/11084/
- // https://github.com/opendaylight/ovsdb/commit/2bc58c9cca16dc3e389cdfc18593578748fd52d5
- @Ignore("netVirtConfigurationService.getOpenflowVersion(node) is not dependent on Constants.OPENFLOW13_SUPPORTED")
@Test
public void testGetOpenflowVersion() throws Exception {
Thread.sleep(5000);
Version ovsVersion = this.getOvsVersion();
-
- if (ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) < 0) {
- Assert.assertEquals(Constants.OPENFLOW10, netVirtConfigurationService.getOpenflowVersion(node));
- } else {
- Assert.assertEquals(Constants.OPENFLOW13, netVirtConfigurationService.getOpenflowVersion(node));
- }
+ Assert.assertTrue(ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) >= 0);
+ Assert.assertEquals(Constants.OPENFLOW13, netVirtConfigurationService.getOpenflowVersion(node));
}
@Test
import java.net.InetAddress;
import java.util.Map;
-import java.util.Set;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.lib.notation.Version;
import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
@Override
public String getOpenflowVersion(Node node) {
-
- String configuredVersion = ConfigProperties.getProperty(this.getClass(), "ovsdb.of.version", "1.3");
- if (configuredVersion != null){
- switch (configuredVersion){
- case "1.0":
- return Constants.OPENFLOW10;
- case "1.3":
- //fall through
- default:
- return Constants.OPENFLOW13;
-
- }
- }
-
- Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
- ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
-
- if (ovsRows == null) {
- logger.info("The OVS node {} has no Open_vSwitch rows", node.toString());
- return null;
- }
-
- Version ovsVersion = null;
- // While there is only one entry in the HashMap, we can't access it by index...
- for (Row row : ovsRows.values()) {
- OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
- Set<String> versionSet = ovsRow.getOvsVersionColumn().getData();
- if (versionSet != null && versionSet.iterator().hasNext()) {
- ovsVersion = Version.fromString(versionSet.iterator().next());
- }
- }
-
- if (ovsVersion == null || ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) < 0) {
- return Constants.OPENFLOW10;
- }
-
return Constants.OPENFLOW13;
}