Mutator.INSERT,bridge.getProtocolsColumn().getData()) .where(bridge.getNameColumn().getSchema().opEqual(bridge.getNameColumn().getData())) .build()); LOG.info("Updated ProtocolEntry : {} for OVSDB Bridge : {} ", protocolString, bridge.getName());
transaction.add(op.delete(qos.getSchema()) .where(qos.getUuidColumn().getSchema().opEqual(new UUID(qosUuid.getValue()))) .build()); LOG.info("Removed QoS Uuid : {} for node : {} ", origQosEntry.getQosId(), ovsdbNodeIid);
.where(queue.getUuidColumn().getSchema().opEqual( new UUID(queueUuid.getValue()))) .build()); LOG.info("Deleted queue Uuid : {} for the Ovsdb Node : {}", queueUuid, operNode); } else {
public static void stampInstanceIdentifier(TransactionBuilder transaction, InstanceIdentifier <OvsdbTerminationPointAugmentation> iid, String interfaceName) { Port port = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Port.class); port.setName(interfaceName); port.setExternalIds(Collections.<String,String>emptyMap()); Mutate mutate = TransactUtils.stampInstanceIdentifierMutation(transaction, iid, port.getSchema(), port.getExternalIdsColumn().getSchema()); transaction.add(mutate .where(port.getNameColumn().getSchema().opEqual(interfaceName)) .build()); }
transactionBuilder.add(op.update(tableSchema, row) .where(_uuid.opEqual(rowUuid)) .build());
private void stampInstanceIdentifier(TransactionBuilder transaction,InstanceIdentifier<Node> iid, String bridgeName) { Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class); bridge.setName(bridgeName); bridge.setExternalIds(Collections.<String,String>emptyMap()); Mutate mutate = TransactUtils.stampInstanceIdentifierMutation(transaction, iid, bridge.getSchema(), bridge.getExternalIdsColumn().getSchema()); transaction.add(mutate .where(bridge.getNameColumn().getSchema().opEqual(bridgeName)) .build()); }
private void execute(TransactionBuilder transaction, BridgeOperationalState state, Set<InstanceIdentifier<OvsdbBridgeAugmentation>> removed, Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> originals) { for (InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbManagedNodeIid: removed) { LOG.debug("Received request to delete ovsdb node : {}", ovsdbManagedNodeIid); OvsdbBridgeAugmentation original = originals.get(ovsdbManagedNodeIid); Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class,null); Optional<OvsdbBridgeAugmentation> ovsdbAugmentationOptional = state .getOvsdbBridgeAugmentation(ovsdbManagedNodeIid); if (ovsdbAugmentationOptional.isPresent() && ovsdbAugmentationOptional.get().getBridgeUuid() != null) { UUID bridgeUuid = new UUID(ovsdbAugmentationOptional.get().getBridgeUuid().getValue()); OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class,null); transaction.add(op.delete(bridge.getSchema()) .where(bridge.getUuidColumn().getSchema().opEqual(bridgeUuid)).build()); transaction.add(op.comment("Bridge: Deleting " + original.getBridgeName())); transaction.add(op.mutate(ovs.getSchema()) .addMutation(ovs.getBridgesColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(bridgeUuid))); transaction.add(op.comment("Open_vSwitch: Mutating " + original.getBridgeName() + " " + bridgeUuid)); LOG.info("Bridge Deleted: {}", ovsdbManagedNodeIid); } else { LOG.warn("Unable to delete bridge {} because it was not found in the operational store, " + "and thus we cannot retrieve its UUID", ovsdbManagedNodeIid); } } } }
bridge.getControllerColumn().getData()) .where(bridge.getNameColumn().getSchema().opEqual(bridge.getNameColumn().getData())) .build());
private void processDeleteTransaction(OvsdbClient client, String databaseName, String childTable, String parentTable, String parentColumn, String uuid, TransactionBuilder transactionBuilder) { DatabaseSchema dbSchema = client.getDatabaseSchema(databaseName); TableSchema<GenericTableSchema> childTableSchema = dbSchema.table(childTable, GenericTableSchema.class); if (parentColumn != null) { TableSchema<GenericTableSchema> parentTableSchema = dbSchema.table(parentTable, GenericTableSchema.class); ColumnSchema<GenericTableSchema, UUID> parentColumnSchema = parentTableSchema.column(parentColumn, UUID.class); transactionBuilder .add(op.mutate(parentTableSchema) .addMutation(parentColumnSchema, Mutator.DELETE, new UUID(uuid)) .where(parentColumnSchema.opIncludes(new UUID(uuid))) .build()); } ColumnSchema<GenericTableSchema, UUID> _uuid = childTableSchema.column("_uuid", UUID.class); transactionBuilder.add(op.delete(childTableSchema) .where(_uuid.opEqual(new UUID(uuid))) .build()); }
extraQueue.getUuidColumn().setData(uuid); transaction.add(op.update(queue) .where(extraQueue.getUuidColumn().getSchema().opEqual(uuid)).build()); LOG.info("Updated queue entries: {} for Ovsdb Node : {}", queue, operNode);
.where(port.getUuidColumn().getSchema().opEqual(portUuid)).build()); transaction.add(op.comment("Port: Deleting " + original.getName() + " attached to " + bridgeName)); .addMutation(bridge.getPortsColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(portUuid)) .where(bridge.getNameColumn().getSchema().opEqual(bridgeName)).build());
transaction.add(op.update(ovsInterface) .where(extraInterface.getNameColumn().getSchema().opEqual(terminationPoint.getName())) .build()); transaction.add(op.update(port) .where(extraPort.getNameColumn().getSchema().opEqual(terminationPoint.getName())) .build()); LOG.info("Updated Termination Point : {} with Uuid : {}", terminationPoint.getName(), terminationPoint.getPortUuid());
Mutator.INSERT, bridge.getPortsColumn().getData()) .where(bridge.getNameColumn().getSchema() .opEqual(bridge.getNameColumn().getData())).build());
transaction.add(op.update(bridge) .where(extraBridge.getNameColumn().getSchema().opEqual(existingBridgeName)) .build()); stampInstanceIdentifier(transaction, iid.firstIdentifierOf(Node.class),existingBridgeName);
private void deleteAutoAttach(TransactionBuilder transaction, InstanceIdentifier<OvsdbNodeAugmentation> ovsdbNodeIid, Uuid autoattachUuid) { LOG.debug("Received request to delete Autoattach entry {}", autoattachUuid); final OvsdbBridgeAugmentation bridgeAugmentation = getBridge(ovsdbNodeIid, autoattachUuid); if (autoattachUuid != null && bridgeAugmentation != null) { final UUID uuid = new UUID(autoattachUuid.getValue()); final AutoAttach autoattach = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), AutoAttach.class, null); transaction.add(op.delete(autoattach.getSchema()) .where(autoattach.getUuidColumn().getSchema().opEqual(uuid)) .build()); transaction.add(op.comment("AutoAttach: Deleting {} " + uuid + " attached to " + bridgeAugmentation.getBridgeName().getValue())); final Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class,null); transaction.add(op.mutate(bridge.getSchema()) .addMutation(bridge.getAutoAttachColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(uuid)) .where(bridge.getNameColumn().getSchema() .opEqual(bridgeAugmentation.getBridgeName().getValue())).build()); transaction.add(op.comment("Bridge: Mutating " + bridgeAugmentation.getBridgeName().getValue() + " to remove autoattach column " + uuid)); } else { LOG.debug("Unable to delete AutoAttach {} for node {} because it was not found in the operational store, " + "and thus we cannot retrieve its UUID", autoattachUuid, ovsdbNodeIid); } }
extraQos.getUuidColumn().setData(uuid); transaction.add(op.update(qos) .where(extraQos.getUuidColumn().getSchema().opEqual(uuid)).build()); LOG.info("Updated QoS Uuid : {} for node : {} ", operQosUuid, operNode.getConnectionInfo());
private void processInsertTransaction(OvsdbClient client, String databaseName, String childTable, String parentTable, UUID parentUuid, String parentColumn, String namedUuid, Row<GenericTableSchema> row, TransactionBuilder transactionBuilder) { // Insert the row as the first transaction entry DatabaseSchema dbSchema = client.getDatabaseSchema(databaseName); TableSchema<GenericTableSchema> childTableSchema = dbSchema.table(childTable, GenericTableSchema.class); transactionBuilder.add(op.insert(childTableSchema, row) .withId(namedUuid)); // Followed by the Mutation if (parentColumn != null) { TableSchema<GenericTableSchema> parentTableSchema = dbSchema.table(parentTable, GenericTableSchema.class); ColumnSchema<GenericTableSchema, UUID> parentColumnSchema = parentTableSchema.column(parentColumn, UUID.class); ColumnSchema<GenericTableSchema, UUID> _uuid = parentTableSchema.column("_uuid", UUID.class); transactionBuilder .add(op.mutate(parentTableSchema) .addMutation(parentColumnSchema, Mutator.INSERT, new UUID(namedUuid)) .where(_uuid.opEqual(parentUuid)) .build()); } }