a113405af0396381deb953a6ce3edf27edb3331e
[vfc/nfvo/driver/vnfm/svnfm.git] /
1 /*
2  * Copyright 2016-2017, Nokia Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct;
18
19 import com.nokia.cbam.lcm.v32.model.VnfInfo;
20 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.IGrantManager;
21 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.spring.Conditions;
22 import org.onap.vnfmdriver.model.GrantVNFResponseVim;
23 import org.onap.vnfmdriver.model.VnfHealRequest;
24 import org.onap.vnfmdriver.model.VnfScaleRequest;
25 import org.slf4j.Logger;
26 import org.springframework.context.annotation.Conditional;
27 import org.springframework.stereotype.Component;
28
29 import static org.slf4j.LoggerFactory.getLogger;
30
31 /**
32  * Responsible for handling granting before the execution of a VNF operation in case of direct integration
33  */
34 @Component
35 @Conditional(value = Conditions.UseForDirect.class)
36 public class GrantlessGrantManager implements IGrantManager {
37     private static Logger logger = getLogger(GrantlessGrantManager.class);
38
39     @Override
40     public void requestGrantForHeal(String vnfmId, String vnfId, String vimId, String onapCsarId, VnfHealRequest request, String jobId) {
41         noGrantRequested();
42     }
43
44     @Override
45     public void requestGrantForScale(String vnfmId, String vnfId, String vimId, String onapCsarId, VnfScaleRequest request, String jobId) {
46         noGrantRequested();
47     }
48
49     @Override
50     public void requestGrantForTerminate(String vnfmId, String vnfId, String vimId, String onapVnfdId, VnfInfo vnf, String jobId) {
51         noGrantRequested();
52     }
53
54     @Override
55     public GrantVNFResponseVim requestGrantForInstantiate(String vnfmId, String vnfId, String vimId, String onapVnfdId, String instantiationLevelId, String cbamVnfdContent, String jobId) {
56         noGrantRequested();
57         GrantVNFResponseVim grantResponse = new GrantVNFResponseVim();
58         grantResponse.setVimId(vimId);
59         return grantResponse;
60     }
61
62     private void noGrantRequested() {
63         logger.info("No grant is requested in direct mode");
64     }
65 }