From 9641684f3084e3e6a0ce8b8594258c25c1092c2d Mon Sep 17 00:00:00 2001 From: "Hockla, Ali (ah999m)" Date: Tue, 5 Sep 2017 14:01:04 -0500 Subject: Added changes for vDNS Use Case - MSO Interface Rebased and fixed merge conflicts Issue-ID: POLICY-102 Change-Id: Icc36a2cf6391aa9137593bc04f0d4543798b7ccd Signed-off-by: Ali Hockla Signed-off-by: Hockla, Ali (ah999m) Signed-off-by: HOCKLA Signed-off-by: Hockla, Ali (ah999m) --- .../java/org/onap/policy/guard/PolicyGuard.java | 8 +++ .../org/onap/policy/guard/impl/VNFTargetLock.java | 84 ++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java (limited to 'controlloop/common/guard/src/main') diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java index fabc48511..b35ec5a9f 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java @@ -26,6 +26,7 @@ import java.util.UUID; import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.guard.impl.PNFTargetLock; import org.onap.policy.guard.impl.VMTargetLock; +import org.onap.policy.guard.impl.VNFTargetLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,6 +79,13 @@ public class PolicyGuard { // lock = new VMTargetLock(targetType, targetInstance, requestID, callback); break; + case VNF: + // + // Create the Lock object + // + lock = new VNFTargetLock(targetType, targetInstance, requestID, callback); + break; + default: return LockResult.createLockResult(GuardResult.LOCK_EXCEPTION, null); } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java new file mode 100644 index 000000000..1350d5c54 --- /dev/null +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * guard + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.guard.impl; + +import java.io.Serializable; +import java.util.UUID; + +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.guard.LockCallback; +import org.onap.policy.guard.TargetLock; + +public class VNFTargetLock implements TargetLock, Serializable { + + /** + * + */ + private static final long serialVersionUID = 2335897394577202732L; + + private final UUID lockID; + private final TargetType targetType; + private final String target; + private final UUID requestID; + private final LockCallback callback; + + public VNFTargetLock (TargetType type, String target, UUID requestID, LockCallback callback) { + this.lockID = UUID.randomUUID(); + this.targetType = type; + this.target = target; + this.requestID = requestID; + this.callback = callback; + } + + @Override + public UUID getLockID() { + return this.lockID; + } + + + @Override + public TargetType getTargetType() { + return targetType; + } + + @Override + public String getTargetInstance() { + return target; + } + + @Override + public UUID getRequestID() { + return this.requestID; + } + + public LockCallback getCallback() { + return this.callback; + } + + @Override + public String toString() { + return "VNFTargetLock [lockID=" + lockID + ", targetType=" + targetType + ", target=" + target + ", requestID=" + + requestID + "]"; + } + + + +} -- cgit 1.2.3-korg