private void addWaiters() { ovsdbWaiter = new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, NotifyingDataChangeListener.BIT_CREATE, ovsdbIid, waitList); ovsdbWaiter.registerDataChangeListener(itUtils.dataBroker); bridgeWaiter = new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, NotifyingDataChangeListener.BIT_CREATE, bridgeIid, waitList); bridgeWaiter.registerDataChangeListener(itUtils.dataBroker); }
/** * Class constructor setting the MdsalUtils instance. * * @param dataBroker the {@link org.opendaylight.controller.md.sal.binding.api.DataBroker} */ public ClusterAwareMdsalUtils(DataBroker dataBroker) { mdsalUtils = new MdsalUtils(dataBroker); }
/** * Wrapper method to executes read as a blocking transaction. * Read is open for all instances to execute their normal * control flow. Because with current implementation all the * net-virt instances execute in similar way, because they want * to build their local caches so that all the instances has same * state of internal cache. * * @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) { return mdsalUtils.read(store,path); } }
/** * Remove integration bridge and teardown connection. Contains assertions for unexpected states. * @throws InterruptedException if interrupted while waiting for disconnect to complete */ public void disconnect() throws Exception { ovsdbWaiter.setMask(NotifyingDataChangeListener.BIT_DELETE); bridgeWaiter.setMask(NotifyingDataChangeListener.BIT_DELETE); assertTrue(itUtils.southboundUtils.deleteBridge(connectionInfo, INTEGRATION_BRIDGE_NAME, 0)); bridgeWaiter.waitForDeletion(); Node bridgeNode = itUtils.mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); assertNull("Bridge should not be found", bridgeNode); assertTrue(itUtils.southboundUtils.disconnectOvsdbNode(connectionInfo, 0)); ovsdbWaiter.waitForDeletion(); Node ovsdbNode = itUtils.mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, ovsdbIid); assertNull("Ovsdb node should not be found", ovsdbNode); closeWaiters(); }
/** * Wrapper method to 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) { if (NetvirtProvider.isMasterProviderInstance()) { return mdsalUtils.delete(store,path); } return true; }
/** * Wrapper method to executes put as a blocking transaction. * * @param logicalDatastoreType {@link LogicalDatastoreType} which should be modified * @param path {@link InstanceIdentifier} for path to read * @param data object of type D * @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) { if (NetvirtProvider.isMasterProviderInstance()) { return mdsalUtils.put(logicalDatastoreType,path, data); } return true; }
/** * Wrapper method to executes merge as a blocking transaction. * * @param logicalDatastoreType {@link LogicalDatastoreType} which should be modified * @param path {@link InstanceIdentifier} for path to read * @param data object of type D * @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) { if (NetvirtProvider.isMasterProviderInstance()) { return mdsalUtils.merge(logicalDatastoreType,path, data); } return true; }
public NeutronQosPolicyChangeListener(final DataBroker dataBroker, final OdlInterfaceRpcService odlInterfaceRpcService) { this.dataBroker = dataBroker; this.odlInterfaceRpcService = odlInterfaceRpcService; this.mdsalUtils = new MdsalUtils(dataBroker); }
public Node getOvsdbNode(final ConnectionInfo connectionInfo) { return mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, createInstanceIdentifier(connectionInfo)); }
public boolean deleteOvsdbNode(final ConnectionInfo connectionInfo, long timeout) { boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, createInstanceIdentifier(connectionInfo)); if (timeout != 0) { try { Thread.sleep(timeout); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting after deleting OVSDB node {}", connectionInfoToString(connectionInfo), e); } } return result; }
/** * Create a new NetvirtItUtils instance. * @param dataBroker md-sal data broker */ public NetvirtItUtils(DataBroker dataBroker) { this.dataBroker = dataBroker; mdsalUtils = new MdsalUtils(dataBroker); southboundUtils = new SouthboundUtils(mdsalUtils); }
/** * Extract the node contents from <code>store</code> type data store for the * bridge identified by <code>bridgeName</code>. * * @param connectionInfo address for the node * @param bridgeName name of the bridge * @param store defined by the <code>LogicalDatastoreType</code> enumeration * @return <code>store</code> type data store contents */ public Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName, LogicalDatastoreType store) { InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName)); return mdsalUtils.read(store, bridgeIid); }
/** * Create a new OvsdbItUtils instance. * @param dataBroker md-sal data broker */ public OvsdbItUtils(DataBroker dataBroker) { this.dataBroker = dataBroker; mdsalUtils = new MdsalUtils(dataBroker); southboundUtils = new SouthboundUtils(mdsalUtils); }
public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(node.getKey(), bridge); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } return ovsdbBridgeAugmentation; }
public NeutronHostConfigChangeListener(final DataBroker dataBroker){ super(Node.class); this.dataBroker = dataBroker; this.mdsalUtils = new MdsalUtils(dataBroker); this.southboundUtils = new SouthboundUtils(mdsalUtils); }
/** * Get all OVSDB nodes from topology. * @return a list of nodes or null if the topology could not found */ public List<Node> getOvsdbNodes() { InstanceIdentifier<Topology> inst = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID)); Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, inst); return topology != null ? topology.getNode() : null; }
/** * Construct a new ElanBridgeManager. * @param dataBroker DataBroker */ public ElanBridgeManager(DataBroker dataBroker) { //TODO: ClusterAware!!!?? this.mdsalUtils = new MdsalUtils(dataBroker); this.southboundUtils = new SouthboundUtils(mdsalUtils); this.random = new Random(System.currentTimeMillis()); }
public Node readBridgeNode(Node node, String name) { Node ovsdbNode = node; if (extractNodeAugmentation(ovsdbNode) == null) { ovsdbNode = readOvsdbNode(node); if (ovsdbNode == null) { return null; } } Node bridgeNode = null; ConnectionInfo connectionInfo = getConnectionInfo(ovsdbNode); if (connectionInfo != null) { InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(node.getKey(), name); bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); } return bridgeNode; }
public TransportZoneNotificationUtil(DataBroker dbx, NeutronvpnManager nvManager) { this.dataBroker = dbx; this.nvManager = nvManager; this.mdsalUtils = new MdsalUtils(dbx); southBoundUtils = new SouthboundUtils(mdsalUtils); this.neutronvpnConfig = nvManager.getNeutronvpnConfig(); }