Implement serviceType handling for E2E network slicing
[externalapi/nbi.git] / src / main / java / org / onap / nbi / apis / serviceorder / utils / E2EServiceUtils.java
1 /**
2  * Copyright (c) 2018 Huawei
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11  * specific language governing permissions and limitations under the License.
12  */
13
14 package org.onap.nbi.apis.serviceorder.utils;
15
16 import java.util.Map;
17
18 import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderItemInfo;
19
20 public class E2EServiceUtils {
21
22     public static boolean isE2EService(ServiceOrderItemInfo serviceOrderItemInfo) {
23         Map<String, Object> sdcInfos = serviceOrderItemInfo.getCatalogResponse();
24         boolean e2eService = false;
25         if (sdcInfos.get("category") != null) {
26             String category = ((String) sdcInfos.get("category")).toLowerCase();
27             // Until SO comes up with one consolidated API for Service CRUD, ExtAPI has to be handle SO (serviceInstance
28             // and e2eServiceInstances )APIs for service CRUD
29             // All E2E Services are required to be created in SDC under category "E2E Services" until SO fixes the
30             // multiple API issue.
31             if (category.startsWith("e2e") || category.startsWith("CST")) {
32                 e2eService = true;
33             }
34         }
35         return e2eService;
36     }
37
38 }