private IntentImpl(IntentBuilder base) { if (base.getKey() == null) { this._key = new IntentKey( base.getId() ); this._id = base.getId(); } else { this._key = base.getKey(); this._id = _key.getId(); } this._actions = base.getActions(); this._conditions = base.getConditions(); this._constraints = base.getConstraints(); this._detailedStatusMessage = base.getDetailedStatusMessage(); this._status = base.getStatus(); this._subjects = base.getSubjects(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_actions == null) ? 0 : _actions.hashCode()); result = prime * result + ((_conditions == null) ? 0 : _conditions.hashCode()); result = prime * result + ((_constraints == null) ? 0 : _constraints.hashCode()); result = prime * result + ((_detailedStatusMessage == null) ? 0 : _detailedStatusMessage.hashCode()); result = prime * result + ((_id == null) ? 0 : _id.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_status == null) ? 0 : _status.hashCode()); result = prime * result + ((_subjects == null) ? 0 : _subjects.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
public void removeIntent(Uuid id) { try { InstanceIdentifier<Intent> iid = InstanceIdentifier.create(Intents.class) .child(Intent.class, new IntentKey(id)); // Removes default config data in data store tree WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); tx.delete(LogicalDatastoreType.CONFIGURATION, iid); // Perform the tx.submit synchronously tx.submit(); } catch (Exception e) { LOG.info("RemoveIntent: failed: {}", e); } }
/** * * @param intentKey * @return the user that created this intent */ private static UserId getUserId(IntentKey intentKey) { // for this release, assume userId to be the same as the NIC intent ID return new UserId(intentKey.getId().getValue()); }
return false; } else if(!_key.equals(other.getKey())) { return false;
@Override public Intent getIntent(Uuid id) { Intent intent = null; try { InstanceIdentifier<Intent> iid = InstanceIdentifier .create(Intents.class).child(Intent.class, new IntentKey(id)); ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction(); intent = tx.read(LogicalDatastoreType.CONFIGURATION, iid).checkedGet().get(); if (intent == null) { intent = tx.read(LogicalDatastoreType.OPERATIONAL, iid).checkedGet().get(); } } catch (Exception e) { LOG.error("getIntent: failed: {}", e); return null; } LOG.info("getIntent: Intent retrieved sucessfully"); return intent; }
Intent lclIntent = (Intent) originalDataObject.get(instanceIdentifier); IntentKey lclIntentKey = lclIntent.getKey(); Uuid uuid = lclIntentKey.getId(); LOG.trace(" Intent Deleted :{} ", uuid.getValue()); String encodeUUID = vtnRendererUtility.encodeUUID(uuid.getValue());
private IntentImpl(IntentBuilder base) { if (base.getKey() == null) { this._key = new IntentKey( base.getId() ); this._id = base.getId(); } else { this._key = base.getKey(); this._id = _key.getId(); } this._actions = base.getActions(); this._conditions = base.getConditions(); this._constraints = base.getConstraints(); this._detailedStatusMessage = base.getDetailedStatusMessage(); this._qosConfig = base.getQosConfig(); this._state = base.getState(); this._status = base.getStatus(); this._subjects = base.getSubjects(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
@Override public boolean removeIntent(Uuid id) { try { InstanceIdentifier<Intent> iid = InstanceIdentifier .create(Intents.class).child(Intent.class, new IntentKey(id)); // Removes default config data in data store tree WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); tx.delete(LogicalDatastoreType.CONFIGURATION, iid); // Perform the tx.submit synchronously tx.submit(); } catch (Exception e) { LOG.info("RemoveIntent: failed: {}", e); return false; } return true; }
public IntentBuilder(Intent base) { if (base.getKey() == null) { this._key = new IntentKey( base.getId() ); this._id = base.getId(); } else { this._key = base.getKey(); this._id = _key.getId(); } this._actions = base.getActions(); this._conditions = base.getConditions(); this._constraints = base.getConstraints(); this._detailedStatusMessage = base.getDetailedStatusMessage(); this._status = base.getStatus(); this._subjects = base.getSubjects(); if (base instanceof IntentImpl) { IntentImpl impl = (IntentImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intents.Intent>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
/** * Delete an intent information from the OPERATIONAL data store. * * @param intent The intent to be deleted from the OPERATIONAL data store. * * @return {@code true} if the intent is deleted successfully. */ public boolean deleteIntent(Intent intent) { MdsalUtils mdsal = new MdsalUtils(dataBroker); InstanceIdentifier<Intent> identifier = InstanceIdentifier.builder(Intents.class) .child(Intent.class, new IntentKey(intent.getId())) .build(); return mdsal.delete(LogicalDatastoreType.OPERATIONAL, identifier); }
/** * Put an operational information of an intent into the OPERATIONAL data store. * * @param intent The intent to be added into the OPERATIONAL data store. * @param status The intent status. * * @return {@code true} if the intent is added successfully. */ public boolean addIntent(Intent intent, Status status) { MdsalUtils mdsal = new MdsalUtils(dataBroker); InstanceIdentifier<Intent> identifier = InstanceIdentifier.builder(Intents.class) .child(Intent.class, new IntentKey(intent.getId())) .build(); Intent operationalIntent = new IntentBuilder(intent).setStatus(status).build(); return mdsal.put(LogicalDatastoreType.OPERATIONAL, identifier, operationalIntent); }