71f8cef605fd6767edf09b134931c6697c13119b
[policy/drools-applications.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * aai
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.policy.aai;
21
22 import static org.junit.Assert.*;
23
24 import java.util.LinkedList;
25
26 import org.junit.AfterClass;
27 import org.junit.BeforeClass;
28 import org.junit.Test;
29 import org.onap.policy.aai.util.Serialization;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
32
33 public class AAINQInventoryResponseItemTest {
34         private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemTest.class);
35         @BeforeClass
36         public static void setUpBeforeClass() throws Exception {
37         }
38
39         @AfterClass
40         public static void tearDownAfterClass() throws Exception {
41         }
42
43         @Test
44         public void test() {
45                 AAINQInventoryResponseItem aaiNQInventoryResponseItem = new AAINQInventoryResponseItem();
46                 aaiNQInventoryResponseItem.setModelName("service-instance");
47                 AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); 
48                 aaiNQCloudRegion.setCloudOwner("OWNER");
49                 aaiNQCloudRegion.setCloudRegionId("REGIONID");
50                 aaiNQCloudRegion.setCloudRegionVersion("2.5");
51                 aaiNQCloudRegion.setComplexName("COMPLEXNAME");
52                 aaiNQCloudRegion.setResourceVersion("1485365988");
53                 aaiNQInventoryResponseItem.setCloudRegion(aaiNQCloudRegion);
54                 AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties();
55                 aaiNQExtraProperties.setExtraProperty(new LinkedList<>());
56                 aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf"));
57                 aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
58                 aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
59                 aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
60                 aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
61                 aaiNQInventoryResponseItem.setExtraProperties(aaiNQExtraProperties);
62                 AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF();
63                 aaiNQGenericVNF.setVnfID("dhv-test-gvnf");
64                 aaiNQGenericVNF.setVnfName("dhv-test-gvnf-name");
65                 aaiNQGenericVNF.setVnfName2("dhv-test-gvnf-name2");
66                 aaiNQGenericVNF.setVnfType("SW");
67                 aaiNQGenericVNF.setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
68                 aaiNQGenericVNF.setProvStatus("PREPROV");
69                 aaiNQGenericVNF.setOperationalState("dhv-test-operational-state");
70                 aaiNQGenericVNF.setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
71                 aaiNQGenericVNF.setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
72                 aaiNQGenericVNF.setInMaint(false);
73                 aaiNQGenericVNF.setIsClosedLoopDisabled(false);
74                 aaiNQGenericVNF.setResourceVersion("1485366450");
75                 aaiNQGenericVNF.setEncrypedAccessFlag(true);
76                 aaiNQGenericVNF.setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
77                 aaiNQGenericVNF.setPersonaModelVersion("1.0");
78                 aaiNQInventoryResponseItem.setGenericVNF(aaiNQGenericVNF);
79                 AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems();
80         AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem();
81         serviceItem.setModelName("service-instance");
82         serviceItem.setServiceInstance(new AAINQServiceInstance());
83         serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
84         serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
85         serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
86         serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
87         serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
88         serviceItem.getServiceInstance().setResourceVersion("1485366092");
89         serviceItem.setExtraProperties(new AAINQExtraProperties());
90         serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance"));
91         serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
92         serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
93         serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
94         serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
95
96             AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem();
97             vfModuleItem.setModelName("vf-module");
98             vfModuleItem.setVfModule(new AAINQVfModule());
99             vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
100             vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
101             vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
102             vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
103             vfModuleItem.getVfModule().setIsBaseVfModule(true);
104             vfModuleItem.getVfModule().setResourceVersion("1485366450");
105             vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
106             vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
107             vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
108             vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
109             vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
110             vfModuleItem.setExtraProperties(new AAINQExtraProperties());
111             vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module"));
112             vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
113             vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
114             vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
115             vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
116                 
117                 aaiNQInventoryResponseItems.getInventoryResponseItems().add(serviceItem);
118                 aaiNQInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem);
119                 aaiNQInventoryResponseItem.setItems(aaiNQInventoryResponseItems);
120                 aaiNQInventoryResponseItem.setModelName("model-name");
121                 AAINQServiceInstance serviceInstance = new AAINQServiceInstance();
122         serviceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
123         serviceInstance.setServiceInstanceName("dhv-test-service-instance-name1");
124         serviceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
125         serviceInstance.setPersonaModelVersion("1.0");
126         serviceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
127         serviceInstance.setResourceVersion("1485366092");
128                 aaiNQInventoryResponseItem.setServiceInstance(serviceInstance);
129                 AAINQTenant aaiNQTenant = new AAINQTenant();
130                 aaiNQTenant.setTenantId("dhv-test-tenant");
131                 aaiNQTenant.setTenantName("dhv-test-tenant-name");
132                 aaiNQTenant.setResourceVersion("1485366334");
133                 aaiNQInventoryResponseItem.setTenant(aaiNQTenant);
134                 AAINQVfModule aaiNQVfModule = new AAINQVfModule();
135                 aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261");
136                 aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074");
137                 aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300");
138                 aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523");
139                 aaiNQVfModule.setIsBaseVfModule(true);
140                 aaiNQVfModule.setResourceVersion("1485366450");
141                 aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
142                 aaiNQVfModule.setPersonaModelVersion("1.0");
143                 aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571");
144                 aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317");
145                 aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
146                 aaiNQInventoryResponseItem.setVfModule(aaiNQVfModule);
147                 AAINQVServer aaiNQVServer = new AAINQVServer();
148                 aaiNQVServer.setVserverId("dhv-test-vserver");
149                 aaiNQVServer.setVserverName("dhv-test-vserver-name");
150                 aaiNQVServer.setVserverName2("dhv-test-vserver-name2");
151                 aaiNQVServer.setProvStatus("PREPROV");
152                 aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink");
153                 aaiNQVServer.setInMaint(false);
154                 aaiNQVServer.setIsClosedLoopDisabled(false);
155                 aaiNQVServer.setResourceVersion("1485366417");
156                 aaiNQInventoryResponseItem.setVserver(aaiNQVServer);
157                 assertNotNull(aaiNQInventoryResponseItem);
158                 
159         logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItem));
160         }
161
162 }