import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
+import javax.inject.Inject;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
+import org.opendaylight.netvirt.it.NetvirtITConstants.DefaultFlow;
+import org.opendaylight.netvirt.utils.netvirt.it.utils.FlowITUtil;
import org.opendaylight.netvirt.utils.netvirt.it.utils.NetITUtil;
-import org.opendaylight.netvirt.vpnmanager.VpnserviceProvider;
import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
import org.opendaylight.ovsdb.utils.ovsdb.it.utils.DockerOvs;
import org.opendaylight.ovsdb.utils.ovsdb.it.utils.NodeInfo;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.util.Filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static OvsdbItUtils itUtils;
private static MdsalUtils mdsalUtils = null;
private static SouthboundUtils southboundUtils;
+ private static FlowITUtil flowITUtil;
private static String addressStr;
private static String portStr;
private static String connectionType;
private static String controllerStr;
private static AtomicBoolean setup = new AtomicBoolean(false);
- private static DataBroker dataBroker = null;
private static final String NETVIRT_TOPOLOGY_ID = "netvirt:1";
+ @Inject @Filter(timeout=60000)
+ private static DataBroker dataBroker = null;
@Override
public String getModuleName() {
Thread.sleep(10*1000);
getProperties();
- // get the dataBroker
- dataBroker = VpnserviceProvider.getDataBroker();
assertNotNull("dataBroker should not be null", dataBroker);
itUtils = new OvsdbItUtils(dataBroker);
mdsalUtils = new MdsalUtils(dataBroker);
assertNotNull("mdsalUtils should not be null", mdsalUtils);
southboundUtils = new SouthboundUtils(mdsalUtils);
assertTrue("Did not find " + NETVIRT_TOPOLOGY_ID, this.getNetvirtTopology());
-
-// TODO: need to implement new pipelineOrchestrator for the vpnservice pipeline
+ flowITUtil = new FlowITUtil(dataBroker);
setup.set(true);
}
return found;
}
+ private void validateDefaultFlows(long datapathId, int timeout){
+ LOG.info("Validating default flows");
+ for (DefaultFlow defaultFlow : DefaultFlow.values()){
+ try {
+ flowITUtil.verifyFlowByFields(datapathId, defaultFlow.getFlowId(), defaultFlow.getTableId(), timeout);
+ } catch (Exception e){
+ LOG.error("Failed to verify flow id : {}", defaultFlow.getFlowId());
+ fail();
+ }
+ }
+ }
/**
* Test for basic southbound events to netvirt.
NodeInfo nodeInfo = itUtils.createNodeInfo(connectionInfo, null);
nodeInfo.connect();
+ //validate default flows
+ validateDefaultFlows(nodeInfo.datapathId, 60*1000);
+
LOG.info("testNetVirt: should be connected: {}", nodeInfo.ovsdbNode.getNodeId());
southboundUtils.addTerminationPoint(nodeInfo.bridgeNode, NetvirtITConstants.PORT_NAME,
NodeInfo nodeInfo = itUtils.createNodeInfo(connectionInfo, null);
nodeInfo.connect();
- // waiting for the default flows to be installed before adding the ports
- Thread.sleep(20*100);
+ //validate default flows
+ validateDefaultFlows(nodeInfo.datapathId, 60*1000);
//create the neutron objects
NetITUtil net = new NetITUtil(ovs, southboundUtils, mdsalUtils);
String port1 = net.createPort(nodeInfo.bridgeNode);
String port2 = net.createPort(nodeInfo.bridgeNode);
-// TODO - need to add pipeline validation
-
Thread.sleep(1000);
//ovs interface configuration for running the ping test