/** * 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); } }
private void updateMdsal(Hostconfig hostConfig, Action action) { boolean result; InstanceIdentifier<Hostconfig> hostConfigId; if (hostConfig == null) { return; } switch (action) { case ADD: case UPDATE: hostConfigId = createInstanceIdentifier(hostConfig); result = mdsalUtils.put(LogicalDatastoreType.OPERATIONAL, hostConfigId, hostConfig); LOG.trace("Add Node: result: {}", result); break; case DELETE: hostConfigId = createInstanceIdentifier(hostConfig); result = mdsalUtils.delete(LogicalDatastoreType.OPERATIONAL, hostConfigId); LOG.trace("Delete Node: result: {}", result); break; } }
Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeNodeIid); if (bridgeNode == null) { LOG.info("setBridgeController could not find bridge in configuration {}", bridgeNodeIid); nodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, augBuilder.build()); InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(ovsdbNode.getKey(), bridgeName); return mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, nodeBuilder.build());
/** * 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 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 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 boolean addOvsdbNode(final ConnectionInfo connectionInfo, long timeout) { boolean result = mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, createInstanceIdentifier(connectionInfo), createNode(connectionInfo)); if (timeout != 0) { try { Thread.sleep(timeout); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting after adding OVSDB node {}", connectionInfoToString(connectionInfo), e); } } return result; }
public boolean deleteBridge(final ConnectionInfo connectionInfo, final String bridgeName, long timeout) { boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName))); if (timeout != 0) { try { Thread.sleep(timeout); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting after deleting bridge {}", bridgeName, e); } } return result; }
LOG.debug("Built with the intent to store bridge data {}", ovsdbBridgeAugmentationBuilder.toString()); boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, bridgeNodeBuilder.build()); if (timeout != 0) {
public Node getOvsdbNode(final ConnectionInfo connectionInfo) { return mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, createInstanceIdentifier(connectionInfo)); }
public NeutronQosPolicyChangeListener(final DataBroker dataBroker, final OdlInterfaceRpcService odlInterfaceRpcService) { this.dataBroker = dataBroker; this.odlInterfaceRpcService = odlInterfaceRpcService; this.mdsalUtils = new MdsalUtils(dataBroker); }
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build()); return mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build());
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; }
/** * 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 NetvirtItUtils instance. * @param dataBroker md-sal data broker */ public NetvirtItUtils(DataBroker dataBroker) { this.dataBroker = dataBroker; mdsalUtils = new MdsalUtils(dataBroker); southboundUtils = new SouthboundUtils(mdsalUtils); }
public Boolean addTerminationPoint(Node bridgeNode, String bridgeName, String portName, String type, Map<String, String> options) { InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier( bridgeNode, portName); OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(); tpAugmentationBuilder.setName(portName); if (type != null) { tpAugmentationBuilder.setInterfaceType(OVSDB_INTERFACE_TYPE_MAP.get(type)); } List<Options> optionsList = new ArrayList<>(); for (Map.Entry<String, String> entry : options.entrySet()) { OptionsBuilder optionsBuilder = new OptionsBuilder(); optionsBuilder.setKey(new OptionsKey(entry.getKey())); optionsBuilder.setOption(entry.getKey()); optionsBuilder.setValue(entry.getValue()); optionsList.add(optionsBuilder.build()); } tpAugmentationBuilder.setOptions(optionsList); TerminationPointBuilder tpBuilder = new TerminationPointBuilder(); tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid)); tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build()); /* TODO SB_MIGRATION should this be merge or mdsalUtils.put */ return mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); }
public Node readOvsdbNode(Node bridgeNode) { Node ovsdbNode = null; OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue(); ovsdbNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid); }else{ LOG.debug("readOvsdbNode: Provided node is not a bridge node : {}",bridgeNode); } return ovsdbNode; }
/** * 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 Boolean addTerminationPoint(Node bridgeNode, String bridgeName, String portName, String type) { InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier(bridgeNode, portName); OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(); tpAugmentationBuilder.setName(portName); if (type != null) { tpAugmentationBuilder.setInterfaceType(OVSDB_INTERFACE_TYPE_MAP.get(type)); } TerminationPointBuilder tpBuilder = new TerminationPointBuilder(); tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid)); tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build()); return mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); }