private boolean verifyIntent() { if (intent.getId() == null) { LOG.warn("Intent ID is not specified {}", intent); return false; } if (intent.getActions() == null || intent.getActions().size() > NUM_OF_SUPPORTED_ACTION) { LOG.warn("Intent's action is either null or there is more than {} action {}" , NUM_OF_SUPPORTED_ACTION, intent); return false; } if (intent.getSubjects() == null || intent.getSubjects().size() > NUM_OF_SUPPORTED_EPG) { LOG.warn("Intent's subjects is either null or there is more than {} subjects {}" , NUM_OF_SUPPORTED_EPG, intent); return false; } return true; }
/** * To get the action from the intent. * * @return action type. */ private String getAction(Intent intent) { Action action = intent.getActions().get(0).getAction(); String actionType = null; if (action instanceof Allow) { actionType = "allow"; } else if (action instanceof Block) { actionType = "block"; } else { throw new IntentElementNotFoundException("VTN Renderer supports only allow or block: {}" + intent.getId()); } return actionType; } }
for (Actions actions : intent.getActions()) { Action action = actions.getAction(); sb.append(String.format(" Order: %d\n", actions.getOrder()));
if (!Objects.equals(_actions, other.getActions())) { return false;
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()); } } }
org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intent.actions.Action actionContainer = (org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intent.actions.Action) intent.getActions().get(0).getAction(); Set<Endpoint> sources; Set<Endpoint> destinations;
private Contract getDefaultContract() { ContractBuilder contractBuilder = new ContractBuilder().setId(new ContractId(this.contractId)); Subject subject = null; Action action = intent.getActions().get(0).getAction(); if (action instanceof Block) { subject = this.getBlockSubject(); } else if (action instanceof Allow) { subject = this.getAllowSubject(); } else { LOG.warn("The specified action is not recognized {}", action); } List<SubjectName> subjectNames = new ArrayList<>(); subjectNames.add(subject.getName()); contractBuilder.setSubject(ImmutableList.of(subject)); contractBuilder.setClause(ImmutableList.of(new ClauseBuilder() .setName(new ClauseName(DEFAULT_CONTRACT)) .setSubjectRefs(subjectNames) .build())); return contractBuilder.build(); }
if (other.getActions() != null) { return false; } else if(!_actions.equals(other.getActions())) { return false;
this._id = _key.getId(); this._actions = base.getActions(); this._conditions = base.getConditions(); this._constraints = base.getConstraints();
/** * To set the ingress and egress data to redirect cache * @param intent :intent */ private void addSfcNodeInfoToCache(Intent intent) { String intentId = intent.getId().getValue(); RedirectNodeData redirectNodeData = redirectNodeCache.get(intentId); if (redirectNodeData == null) { addIntentToCache(intent); redirectNodeData = redirectNodeCache.get(intentId); } Redirect actionContainer = (Redirect) intent.getActions().get(0).getAction(); org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.intent.actions.action.redirect.Redirect redirectForService = actionContainer.getRedirect(); String serviceName = redirectForService.getServiceName(); String[] redirectSfcDataList = readRedirectSfcData(serviceName); redirectNodeData.setIngressNodeId(redirectSfcDataList[0]); redirectNodeData.setEgressNodeId(redirectSfcDataList[1]); deleteArpFlow(new NodeId(extractTopologyNodeId(redirectSfcDataList[0]).getValue())); deleteArpFlow(new NodeId(extractTopologyNodeId(redirectSfcDataList[1]).getValue())); }
public static BandwidthOnDemandParameters parseBandwidthOnDemand(Intent intent) { List<Actions> actions = intent.getActions(); Action action = !actions.isEmpty() ? actions.get(0).getAction() : null;