/** * Check that the netvirt topology is in the operational mdsal. * @return true if the netvirt topology was successfully retrieved */ public Boolean getNetvirtTopology() { LOG.info("getNetvirtTopology: looking for {}...", ItConstants.NETVIRT_TOPOLOGY_ID); final TopologyId topologyId = new TopologyId(new Uri(ItConstants.NETVIRT_TOPOLOGY_ID)); InstanceIdentifier<Topology> path = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId)); NotifyingDataChangeListener waitForIt = new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, path, null); waitForIt.registerDataChangeListener(dataBroker); try { waitForIt.waitForCreation(60 * 1000); } catch (InterruptedException e) { LOG.info("getNetvirtTopology: InterruptedException while wait(ing)ForCreation"); } boolean found = null != mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path); LOG.info("getNetvirtTopology: found {} == {}", ItConstants.NETVIRT_TOPOLOGY_ID, found); return found; }
/** * Connect to the OVSDB node, wait for the connection to be established and for the integration bridge * to be successfully created. Contains assertions for unexpected states * @throws InterruptedException if interrupted while waiting for connection */ public void connect() throws Exception { addWaiters(); assertNotNull("connection failed", itUtils.southboundUtils.addOvsdbNode(connectionInfo, 0)); ovsdbWaiter.waitForCreation(); ovsdbNode = itUtils.southboundUtils.getOvsdbNode(connectionInfo); assertNotNull("node is not connected", ovsdbNode); bridgeWaiter.waitForCreation(); assertTrue("Controller " + SouthboundUtils.connectionInfoToString(connectionInfo) + " is not connected", itUtils.isControllerConnected(connectionInfo)); bridgeNode = itUtils.southboundUtils.getBridgeNode(ovsdbNode, INTEGRATION_BRIDGE_NAME); assertNotNull("bridge " + INTEGRATION_BRIDGE_NAME + " was not found", bridgeNode); datapathId = itUtils.southboundUtils.getDataPathId(bridgeNode); String datapathIdString = itUtils.southboundUtils.getDatapathId(bridgeNode); LOG.info("NodeInfo.connect: bridgeNode: {}, datapathId: {} - {}", bridgeNode, datapathIdString, datapathId); assertNotEquals("datapathId was not found", datapathId, 0); }
NotifyingDataChangeListener.BIT_CREATE, iid, null); waitForIt.registerDataChangeListener(dataBroker); waitForIt.waitForCreation(FLOW_WAIT); NotifyingDataChangeListener.BIT_CREATE, iid, null); waitForIt.registerDataChangeListener(dataBroker); waitForIt.waitForCreation(FLOW_WAIT);
NotifyingDataChangeListener.BIT_CREATE, iid, null); waitForIt.registerDataChangeListener(dataBroker); waitForIt.waitForCreation(10000);