diff options
Diffstat (limited to 'aai/src')
25 files changed, 1458 insertions, 0 deletions
diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAIGETResponse.java b/aai/src/main/java/org/openecomp/policy/aai/AAIGETResponse.java new file mode 100644 index 000000000..c5100cb5b --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAIGETResponse.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAIGETResponse implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7311418432051756161L; + + @SerializedName("relationship-list") + public RelationshipList relationshipList; + + public AAIGETResponse() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199CloudRegion.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199CloudRegion.java new file mode 100644 index 000000000..62737df9c --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199CloudRegion.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199CloudRegion implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -897231529157222683L; + + @SerializedName("cloud-owner") + public String cloudOwner; + + @SerializedName("cloud-region-id") + public String cloudRegionId; + + @SerializedName("cloud-region-version") + public String cloudRegionVersion; + + @SerializedName("complex-name") + public String complexName; + + @SerializedName("resource-version") + public String resourceVersion; + + public AAINQF199CloudRegion() { + } +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ExtraProperties.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ExtraProperties.java new file mode 100644 index 000000000..8151a2d71 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ExtraProperties.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199ExtraProperties implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 4109625574744702319L; + + @SerializedName("extra-property") + public List<AAINQF199ExtraProperty> extraProperty = new LinkedList<AAINQF199ExtraProperty>(); + + public AAINQF199ExtraProperties() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ExtraProperty.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ExtraProperty.java new file mode 100644 index 000000000..d3c4a7c8f --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ExtraProperty.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199ExtraProperty implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3861240617222397736L; + + @SerializedName("property-name") + public String propertyName; + + @SerializedName("property-value") + public String propertyValue; + + public AAINQF199ExtraProperty() { + } + + public AAINQF199ExtraProperty(String propertyName, String propertyValue) { + this.propertyName = propertyName; + this.propertyValue = propertyValue; + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199GenericVNF.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199GenericVNF.java new file mode 100644 index 000000000..09359c1a9 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199GenericVNF.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199GenericVNF implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 834322706248060559L; + + @SerializedName("vnf-id") + public String vnfID; + + @SerializedName("vnf-name") + public String vnfName; + + @SerializedName("vnf-name2") + public String vnfName2; + + @SerializedName("vnf-type") + public String vnfType; + + @SerializedName("service-id") + public String serviceId; + + @SerializedName("prov-status") + public String provStatus; + + @SerializedName("operational-state") + public String operationalState; + + @SerializedName("ipv4-oam-address") + public String ipv4OamAddress; + + @SerializedName("ipv4-loopback0-address") + public String ipv4Loopback0Address; + + @SerializedName("in-maint") + public Boolean inMaint; + + @SerializedName("is-closed-loop-disabled") + public Boolean isClosedLoopDisabled; + + @SerializedName("resource-version") + public String resourceVersion; + + @SerializedName("encrypted-access-flag") + public Boolean encrypedAccessFlag; + + @SerializedName("persona-model-id") + public String personaModelId; + + @SerializedName("persona-model-version") + public String personaModelVersion; + + public AAINQF199GenericVNF() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InstanceFilters.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InstanceFilters.java new file mode 100644 index 000000000..58b6ad1ef --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InstanceFilters.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199InstanceFilters implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8993824591338121185L; + + @SerializedName("instance-filter") + public List<Map<String, Map<String, String>>> instanceFilter = new LinkedList<Map<String, Map<String, String>>>(); + + public AAINQF199InstanceFilters() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InventoryResponseItem.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InventoryResponseItem.java new file mode 100644 index 000000000..9174f4f91 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InventoryResponseItem.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199InventoryResponseItem implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7142072567154675183L; + + @SerializedName("model-name") + public String modelName; + + @SerializedName("vf-module") + public AAINQF199VfModule vfModule; + + @SerializedName("service-instance") + public AAINQF199ServiceInstance serviceInstance; + + @SerializedName("vserver") + public AAINQF199VServer vserver; + + @SerializedName("tenant") + public AAINQF199Tenant tenant; + + @SerializedName("cloud-region") + public AAINQF199CloudRegion cloudRegion; + + @SerializedName("generic-vnf") + public AAINQF199GenericVNF genericVNF; + + @SerializedName("extra-properties") + public AAINQF199ExtraProperties extraProperties; + + @SerializedName("inventory-response-items") + public AAINQF199InventoryResponseItems items; + + public AAINQF199InventoryResponseItem() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InventoryResponseItems.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InventoryResponseItems.java new file mode 100644 index 000000000..2ce43fc84 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199InventoryResponseItems.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199InventoryResponseItems implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7602807659381179004L; + + @SerializedName("inventory-response-item") + public List<AAINQF199InventoryResponseItem> inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + + public AAINQF199InventoryResponseItems() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Manager.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Manager.java new file mode 100644 index 000000000..00110e8ca --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Manager.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.openecomp.policy.aai.AAIGETResponse; +import org.openecomp.policy.aai.util.Serialization; +import org.openecomp.policy.rest.RESTManager; +import org.openecomp.policy.rest.RESTManager.Pair; + +import com.google.gson.JsonSyntaxException; + +public final class AAINQF199Manager { + + public static AAINQF199Response postQuery(String url, String username, String password, AAINQF199Request request, UUID requestID) { + + Map<String, String> headers = new HashMap<String, String>(); + headers.put("X-FromAppId", "POLICY"); + headers.put("X-TransactionId", requestID.toString()); + headers.put("Accept", "application/json"); + + url = url + "/aai/search/named-query"; + + Pair<Integer, String> httpDetails = RESTManager.post(url, username, password, headers, "application/json", Serialization.gsonPretty.toJson(request)); + + if (httpDetails == null) { + System.out.println("AAI POST Null Response to " + url); + return null; + } + + System.out.println(url); + System.out.println(httpDetails.a); + System.out.println(httpDetails.b); + if (httpDetails.a == 200) { + try { + AAINQF199Response response = Serialization.gsonPretty.fromJson(httpDetails.b, AAINQF199Response.class); + return response; + } catch (JsonSyntaxException e) { + System.err.println("Failed to deserialize into AAIResponse" + e.getLocalizedMessage()); + } + } + + return null; + } + + public static AAIGETResponse getQuery(String urlGet, String username, String password, UUID requestID, String vnfId) { + + Map<String, String> headers = new HashMap<String, String>(); + headers.put("X-FromAppId", "POLICY"); + headers.put("X-TransactionId", requestID.toString()); + headers.put("Accept", "application/json"); + + urlGet = urlGet + "/aai/v8/network/generic-vnfs/generic-vnf/" + vnfId; + + int attemptsLeft = 3; + AAIGETResponse responseGet = null; + + while(attemptsLeft-- > 0){ + + Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers); + if (httpDetailsGet == null) { + System.out.println("AAI GET Null Response to " + urlGet); + return null; + } + + System.out.println(urlGet); + System.out.println(httpDetailsGet.a); + System.out.println(httpDetailsGet.b); + + if (httpDetailsGet.a == 200) { + try { + responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETResponse.class); + return responseGet; + } catch (JsonSyntaxException e) { + System.err.println("Failed to deserialize into AAIResponse" + e.getLocalizedMessage()); + } + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) {} + + } + + return null; + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199NamedQuery.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199NamedQuery.java new file mode 100644 index 000000000..61bad5f17 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199NamedQuery.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; +import java.util.UUID; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199NamedQuery implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3277980060302645333L; + + @SerializedName("named-query-uuid") + public UUID namedQueryUUID; + + public AAINQF199NamedQuery() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199QueryParameters.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199QueryParameters.java new file mode 100644 index 000000000..113a3d17e --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199QueryParameters.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199QueryParameters implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -4291227193197126982L; + + @SerializedName("named-query") + public AAINQF199NamedQuery namedQuery; + + public AAINQF199QueryParameters() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Request.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Request.java new file mode 100644 index 000000000..6b504640d --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Request.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + + +/* + * + * { + "query-parameters": { + "named-query": { + "named-query-uuid": "f199cb88-5e69-4b1f-93e0-6f257877d066" + } + }, + "instance-filters": { + "instance-filter": [ + { + "vserver": { + "vserver-name": "dfw1lb01lb01" + } + } + ] + } +} + + * + */ + +public class AAINQF199Request implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("query-parameters") + public AAINQF199QueryParameters queryParameters; + @SerializedName("instance-filters") + public AAINQF199InstanceFilters instanceFilters; + + public AAINQF199Request() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199RequestWrapper.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199RequestWrapper.java new file mode 100644 index 000000000..651d6750f --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199RequestWrapper.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.util.UUID; + +public class AAINQF199RequestWrapper { + + public UUID requestID; + public AAINQF199Request aainqf199request; + + public AAINQF199RequestWrapper() { + + } + + public AAINQF199RequestWrapper(UUID requestID, AAINQF199Request aainqf199request){ + this.requestID = requestID; + this.aainqf199request = aainqf199request; + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Response.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Response.java new file mode 100644 index 000000000..c85e942c7 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Response.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199Response implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8411407444051746101L; + + @SerializedName("inventory-response-item") + public List<AAINQF199InventoryResponseItem> inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + + public AAINQF199Response() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ResponseWrapper.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ResponseWrapper.java new file mode 100644 index 000000000..908b57d11 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ResponseWrapper.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.util.UUID; + +import org.openecomp.policy.aai.AAINQF199.AAINQF199Response; + +public class AAINQF199ResponseWrapper { + + public UUID requestID; + public AAINQF199Response aainqf199response; + + public AAINQF199ResponseWrapper() { + + } + + public AAINQF199ResponseWrapper(UUID requestID, AAINQF199Response aainqf199response){ + this.requestID = requestID; + this.aainqf199response = aainqf199response; + } +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ServiceInstance.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ServiceInstance.java new file mode 100644 index 000000000..6e7c008e3 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199ServiceInstance.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199ServiceInstance implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8000944396593889586L; + + @SerializedName("service-instance-id") + public String serviceInstanceID; + + @SerializedName("service-instance-name") + public String serviceInstanceName; + + @SerializedName("persona-model-id") + public String personaModelId; + + @SerializedName("persona-model-version") + public String personaModelVersion; + + @SerializedName("service-instance-location-id") + public String serviceInstanceLocationId; + + @SerializedName("resource-version") + public String resourceVersion; + + public AAINQF199ServiceInstance() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Tenant.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Tenant.java new file mode 100644 index 000000000..473cb9e7a --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199Tenant.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199Tenant implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 4702784101671984364L; + + @SerializedName("tenant-id") + public String tenantId; + + @SerializedName("tenant-name") + public String tenantName; + + @SerializedName("resource-version") + public String resourceVersion; + + public AAINQF199Tenant() { + } +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199VServer.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199VServer.java new file mode 100644 index 000000000..9704b4b83 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199VServer.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199VServer { + + @SerializedName("vserver-id") + public String vserverId; + + @SerializedName("vserver-name") + public String vserverName; + + @SerializedName("vserver-name2") + public String vserverName2; + + @SerializedName("prov-status") + public String provStatus; + + @SerializedName("vserver-selflink") + public String vserverSelflink; + + @SerializedName("in-maint") + public Boolean inMaint; + + @SerializedName("is-closed-loop-disabled") + public Boolean isClosedLoopDisabled; + + @SerializedName("resource-version") + public String resourceVersion; + + public AAINQF199VServer() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199VfModule.java b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199VfModule.java new file mode 100644 index 000000000..d03f8daf2 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/AAINQF199/AAINQF199VfModule.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.AAINQF199; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQF199VfModule implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8019133081429638231L; + + @SerializedName("vf-module-id") + public String vfModuleId; + + @SerializedName("vf-module-name") + public String vfModuleName; + + @SerializedName("heat-stack-id") + public String heatStackId; + + @SerializedName("orchestration-status") + public String orchestrationStatus; + + @SerializedName("is-base-vf-module") + public Boolean isBaseVfModule; + + @SerializedName("resource-version") + public String resourceVersion; + + @SerializedName("persona-model-id") + public String personaModelId; + + @SerializedName("persona-model-version") + public String personaModelVersion; + + @SerializedName("widget-model-id") + public String widgetModelId; + + @SerializedName("widget-model-version") + public String widgetModelVersion; + + @SerializedName("contrail-service-instance-fqdn") + public String contrailServiceInstanceFqdn; + + public AAINQF199VfModule() { + } +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/RelatedToPropertyItem.java b/aai/src/main/java/org/openecomp/policy/aai/RelatedToPropertyItem.java new file mode 100644 index 000000000..6a6a4a6bc --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/RelatedToPropertyItem.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai; + +import com.google.gson.annotations.SerializedName; + +public class RelatedToPropertyItem { + + @SerializedName("property-key") + public String propertyKey; + @SerializedName("property-value") + public String propertyValue; + + public RelatedToPropertyItem() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/RelationshipItem.java b/aai/src/main/java/org/openecomp/policy/aai/RelationshipItem.java new file mode 100644 index 000000000..dd057d6d4 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/RelationshipItem.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai; + +import java.util.List; +import java.util.LinkedList; + +import com.google.gson.annotations.SerializedName; + +public class RelationshipItem { + + @SerializedName("related-to-property") + public List<RelatedToPropertyItem> relatedToProperty = new LinkedList<RelatedToPropertyItem>(); + + public RelationshipItem() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/RelationshipList.java b/aai/src/main/java/org/openecomp/policy/aai/RelationshipList.java new file mode 100644 index 000000000..1f7658df9 --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/RelationshipList.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai; + +import java.util.List; +import java.util.LinkedList; + +import com.google.gson.annotations.SerializedName; + +public class RelationshipList { + + @SerializedName("relationship") + public List<RelationshipItem> relationship = new LinkedList<RelationshipItem>(); + + public RelationshipList() { + } + +} diff --git a/aai/src/main/java/org/openecomp/policy/aai/util/Serialization.java b/aai/src/main/java/org/openecomp/policy/aai/util/Serialization.java new file mode 100644 index 000000000..d7a10db2d --- /dev/null +++ b/aai/src/main/java/org/openecomp/policy/aai/util/Serialization.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai.util; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public final class Serialization { + + final static public Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() + .setPrettyPrinting() +// .registerTypeAdapter(AAIQueryParameters.class, new notificationTypeAdapter()) + .create(); +} diff --git a/aai/src/test/java/org/openecomp/policy/aai/TestDemo.java b/aai/src/test/java/org/openecomp/policy/aai/TestDemo.java new file mode 100644 index 000000000..f2fb24702 --- /dev/null +++ b/aai/src/test/java/org/openecomp/policy/aai/TestDemo.java @@ -0,0 +1,240 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * 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.openecomp.policy.aai; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.UUID; + +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.policy.aai.AAINQF199.AAINQF199CloudRegion; +import org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperties; +import org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperty; +import org.openecomp.policy.aai.AAINQF199.AAINQF199GenericVNF; +import org.openecomp.policy.aai.AAINQF199.AAINQF199VServer; +import org.openecomp.policy.aai.AAINQF199.AAINQF199VfModule; +import org.openecomp.policy.aai.AAINQF199.AAINQF199InstanceFilters; +import org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItem; +import org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItems; +import org.openecomp.policy.aai.AAINQF199.AAINQF199Manager; +import org.openecomp.policy.aai.AAINQF199.AAINQF199NamedQuery; +import org.openecomp.policy.aai.AAINQF199.AAINQF199QueryParameters; +import org.openecomp.policy.aai.AAINQF199.AAINQF199Response; +import org.openecomp.policy.aai.AAINQF199.AAINQF199ServiceInstance; +import org.openecomp.policy.aai.AAINQF199.AAINQF199Tenant; +import org.openecomp.policy.aai.AAINQF199.AAINQF199Request; +import org.openecomp.policy.aai.util.Serialization; + +public class TestDemo { + + @Test + public void test() { + + // + // Test AAINQF199Request + // + AAINQF199Request request = new AAINQF199Request(); + request.queryParameters = new AAINQF199QueryParameters(); + request.queryParameters.namedQuery = new AAINQF199NamedQuery(); + request.queryParameters.namedQuery.namedQueryUUID = UUID.fromString("f199cb88-5e69-4b1f-93e0-6f257877d066"); + request.instanceFilters = new AAINQF199InstanceFilters(); + Map<String, Map<String, String>> vserver = new HashMap<String, Map<String, String>>(); + Map<String, String> values = new HashMap<String, String>(); + values.put("vserver-name", "dfw1lb01lb01"); + vserver.put("vserver", values); + request.instanceFilters.instanceFilter.add(vserver); + + String body = Serialization.gsonPretty.toJson(request); + + System.out.println(body); + + System.out.println(); + + +/* + AAINQF199InventoryResponseItem serviceItem = new AAINQF199InventoryResponseItem(); + serviceItem.serviceInstance = new AAINQF199ServiceInstance(); + serviceItem.serviceInstance.serviceInstanceID = "service-instance-id-Manisha-01"; + + AAINQF199InventoryResponseItem genericVNFItem = new AAINQF199InventoryResponseItem(); + genericVNFItem.genericVNF = new AAINQF199GenericVNF(); + genericVNFItem.genericVNF.vnfID = "generic-vnf-id-Manisha-01"; + genericVNFItem.items = new AAINQF199InventoryResponseItems(); + genericVNFItem.items.inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + genericVNFItem.items.inventoryResponseItems.add(serviceItem); + + AAINQF199InventoryResponseItem vserverItem = new AAINQF199InventoryResponseItem(); + vserverItem.vserver = new AAINQF199VServer(); + vserverItem.vserver.vserverId = "vserver-id-Manisha-01"; + vserverItem.vserver.vserverName = "vserver-name-16102016-aai3255-data-11-1"; + vserverItem.items = new AAINQF199InventoryResponseItems(); + vserverItem.items.inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + vserverItem.items.inventoryResponseItems.add(genericVNFItem); +*/ + + + // + // Test AAINQF199Response + // + AAINQF199InventoryResponseItem serviceItem = new AAINQF199InventoryResponseItem(); + serviceItem.modelName = "service-instance"; + serviceItem.serviceInstance = new AAINQF199ServiceInstance(); + serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; + serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; + serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + serviceItem.serviceInstance.personaModelVersion = "1.0"; + serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; + serviceItem.serviceInstance.resourceVersion = "1485366092"; + serviceItem.extraProperties = new AAINQF199ExtraProperties(); + serviceItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-name", "service-instance")); + serviceItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-type", "widget")); + serviceItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-version", "1.0")); + serviceItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + + + AAINQF199InventoryResponseItem vfModuleItem = new AAINQF199InventoryResponseItem(); + vfModuleItem.modelName = "vf-module"; + vfModuleItem.vfModule = new AAINQF199VfModule(); + vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; + vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; + vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; + vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; + vfModuleItem.vfModule.isBaseVfModule = true; + vfModuleItem.vfModule.resourceVersion = "1485366450"; + vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; + vfModuleItem.vfModule.personaModelVersion = "1.0"; + vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; + vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; + vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + vfModuleItem.extraProperties = new AAINQF199ExtraProperties(); + vfModuleItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-name", "vf-module")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-type", "widget")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-version", "1.0")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + + + AAINQF199InventoryResponseItem genericVNFItem = new AAINQF199InventoryResponseItem(); + genericVNFItem.modelName = "generic-vnf"; + genericVNFItem.genericVNF = new AAINQF199GenericVNF(); + genericVNFItem.genericVNF.vnfID = "dhv-test-gvnf"; + genericVNFItem.genericVNF.vnfName = "dhv-test-gvnf-name"; + genericVNFItem.genericVNF.vnfName2 = "dhv-test-gvnf-name2"; + genericVNFItem.genericVNF.vnfType = "SW"; + genericVNFItem.genericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; + genericVNFItem.genericVNF.provStatus = "PREPROV"; + genericVNFItem.genericVNF.operationalState = "dhv-test-operational-state"; + genericVNFItem.genericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; + genericVNFItem.genericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; + genericVNFItem.genericVNF.inMaint = false; + genericVNFItem.genericVNF.isClosedLoopDisabled = false; + genericVNFItem.genericVNF.resourceVersion = "1485366450"; + genericVNFItem.genericVNF.encrypedAccessFlag = true; + genericVNFItem.genericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; + genericVNFItem.genericVNF.personaModelVersion = "1.0"; + genericVNFItem.extraProperties = new AAINQF199ExtraProperties(); + genericVNFItem.extraProperties.extraProperty = new LinkedList<AAINQF199ExtraProperty>(); + genericVNFItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-type", "widget")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-version", "1.0")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQF199ExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.items = new AAINQF199InventoryResponseItems(); + genericVNFItem.items.inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + genericVNFItem.items.inventoryResponseItems.add(serviceItem); + genericVNFItem.items.inventoryResponseItems.add(vfModuleItem); + + + AAINQF199InventoryResponseItem cloudItem = new AAINQF199InventoryResponseItem(); + cloudItem.cloudRegion = new AAINQF199CloudRegion(); + cloudItem.cloudRegion.cloudOwner = "OWNER"; + cloudItem.cloudRegion.cloudRegionId = "REGIONID"; + cloudItem.cloudRegion.cloudRegionVersion = "2.5"; + cloudItem.cloudRegion.complexName = "COMPLEXNAME"; + cloudItem.cloudRegion.resourceVersion = "1485365988"; + + + AAINQF199InventoryResponseItem tenantItem = new AAINQF199InventoryResponseItem(); + tenantItem.tenant = new AAINQF199Tenant(); + tenantItem.tenant.tenantId = "dhv-test-tenant"; + tenantItem.tenant.tenantName = "dhv-test-tenant-name"; + tenantItem.tenant.resourceVersion = "1485366334"; + tenantItem.items = new AAINQF199InventoryResponseItems(); + tenantItem.items.inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + tenantItem.items.inventoryResponseItems.add(cloudItem); + + + AAINQF199InventoryResponseItem vserverItem = new AAINQF199InventoryResponseItem(); + vserverItem.vserver = new AAINQF199VServer(); + vserverItem.vserver.vserverId = "dhv-test-vserver"; + vserverItem.vserver.vserverName = "dhv-test-vserver-name"; + vserverItem.vserver.vserverName2 = "dhv-test-vserver-name2"; + vserverItem.vserver.provStatus = "PREPROV"; + vserverItem.vserver.vserverSelflink = "dhv-test-vserver-selflink"; + vserverItem.vserver.inMaint = false; + vserverItem.vserver.isClosedLoopDisabled = false; + vserverItem.vserver.resourceVersion = "1485366417"; + vserverItem.items = new AAINQF199InventoryResponseItems(); + vserverItem.items.inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>(); + vserverItem.items.inventoryResponseItems.add(genericVNFItem); + vserverItem.items.inventoryResponseItems.add(tenantItem); + + + AAINQF199Response aaiResponse = new AAINQF199Response(); + aaiResponse.inventoryResponseItems.add(vserverItem); + + body = Serialization.gsonPretty.toJson(aaiResponse); + + System.out.println(body); + + + } + + @Ignore + @Test + public void testHttp() { + AAINQF199Request request = new AAINQF199Request(); + request.queryParameters = new AAINQF199QueryParameters(); + request.queryParameters.namedQuery = new AAINQF199NamedQuery(); + request.queryParameters.namedQuery.namedQueryUUID = UUID.fromString("f199cb88-5e69-4b1f-93e0-6f257877d066"); + request.instanceFilters = new AAINQF199InstanceFilters(); + Map<String, Map<String, String>> vserver = new HashMap<String, Map<String, String>>(); + Map<String, String> values = new HashMap<String, String>(); + values.put("vserver-name", "dfw1lb01lb01"); + vserver.put("vserver", values); + request.instanceFilters.instanceFilter.add(vserver); + + String body = Serialization.gsonPretty.toJson(request); + + System.out.println(body); + + AAINQF199Response response = AAINQF199Manager.postQuery("http://localhost:8080/TestREST/Test", "POLICY", "POLICY", request, UUID.randomUUID()); + + body = Serialization.gsonPretty.toJson(response); + + System.out.println(body); + + } + +} diff --git a/aai/src/test/resources/response.json b/aai/src/test/resources/response.json new file mode 100644 index 000000000..3d7a2c1f0 --- /dev/null +++ b/aai/src/test/resources/response.json @@ -0,0 +1,69 @@ +{ + "inventory-response-item": [{ + "vserver": { + "vserver-id": "vserver-id-Manisha-01", + "vserver-name": "vserver-name-16102016-aai3255-data-11-1", + "vserver-name2": "example-vserver-name2-val-68608", + "prov-status": "example-prov-status-val-59118", + "vserver-selflink": "example-vserver-selflink-val-10902", + "in-maint": true, + "is-closed-loop-disabled": true, + "resource-version": "1477946963" + }, + "extra-properties": {}, + "inventory-response-items": { + "inventory-response-item": [{ + "generic-vnf": { + "vnf-id": "generic-vnf-id-Manisha-01", + "vnf-name": "bpsx0001v-16102016-aai3255-data-11", + "vnf-name2": "example-vnf-name2-val-8204", + "vnf-type": "my-vnf-type", + "service-id": "c7611ebe-c324-48f1-8085-94aef0c6ef3d", + "regional-resource-zone": "example-regional-resource-zone-val-8204", + "prov-status": "ACTIVE", + "operational-state": "example-operational-state-val-3289", + "license-key": "example-license-key-val-3289", + "equipment-role": "example-equipment-role-val-3289", + "orchestration-status": "example-orchestration-status-val-3289", + "heat-stack-id": "example-heat-stack-id-val-3289", + "mso-catalog-key": "example-mso-catalog-key-val-3289", + "management-option": "example-management-option-val-8204", + "ipv4-oam-address": "example-ipv4-oam-address-val-8204", + "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-8204", + "nm-lan-v6-address": "example-nm-lan-v6-address-val-8204", + "management-v6-address": "example-management-v6-address-val-8204", + "vcpu": 7957, + "vcpu-units": "example-vcpu-units-val-8204", + "vmemory": 168, + "vmemory-units": "example-vmemory-units-val-8204", + "vdisk": 3227, + "vdisk-units": "example-vdisk-units-val-8204", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1477946966" + }, + "extra-properties": {}, + "inventory-response-items": { + "inventory-response-item": [{ + "service-instance": { + "service-instance-id": "service-instance-id-Manisha-01", + "service-instance-name": "example-service-instance-name-val-5008-1", + "widget-model-id": "example-widget-model-id-val-52958", + "widget-model-version": "example-widget-model-version-val-42840", + "bandwidth-total": "example-bandwidth-total-val-99587", + "bandwidth-up-wan1": "example-bandwidth-up-wan1-val-73709", + "bandwidth-down-wan1": "example-bandwidth-down-wan1-val-20007", + "bandwidth-up-wan2": "example-bandwidth-up-wan2-val-16857", + "bandwidth-down-wan2": "example-bandwidth-down-wan2-val-95839", + "vhn-portal-url": "example-vhn-portal-url-val-21541", + "operational-status": "example-operational-status-val-48090", + "service-instance-location-id": "example-service-instance-location-id-val-9684", + "resource-version": "1477946961" + }, + "extra-properties": {} + }] + } + }] + } + }] +} |