diff options
author | Joseph Chou <jc2555@att.com> | 2017-09-06 16:54:33 -0400 |
---|---|---|
committer | Joseph Chou <jc2555@att.com> | 2017-09-12 17:15:44 -0400 |
commit | 5bd93f34b7221c8c141785574082253fcb61d276 (patch) | |
tree | 7d39dc59ed0118f56de79634f078476020fb078c /controlloop/common/model-impl/aai/src/test | |
parent | 045198cd1a5a73ffe6630e6833e1d021585fb82f (diff) |
ONAP code for AAI, consolidate name and get query
Adding AAI GET query feature to support ONAP project (1 commit)
Issue-ID: POLICY-103
Change-Id: I0a55f41c3edd7a0bc0562ae4e12a19f262a50d74
Signed-off-by: Joseph Chou <jc2555@att.com>
Diffstat (limited to 'controlloop/common/model-impl/aai/src/test')
2 files changed, 177 insertions, 0 deletions
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java new file mode 100644 index 000000000..3b489155c --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java @@ -0,0 +1,89 @@ +/*- + * ============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.onap.policy.aai; + +import static org.junit.Assert.*; +import java.util.List; +import java.util.LinkedList; +import org.onap.policy.aai.RelationshipDataItem; +import org.onap.policy.aai.RelationshipData; +import org.onap.policy.aai.RelatedToPropertyItem; +import org.onap.policy.aai.Relationship; +import org.onap.policy.aai.RelatedToProperty; +import org.onap.policy.aai.RelationshipList; +import org.onap.policy.aai.util.Serialization; +import org.onap.policy.aai.AAIGETVnfResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.junit.Test; + +public class AAIGETVnfResponseTest { + private static final Logger logger = LoggerFactory.getLogger(AAIGETVnfResponseTest.class); + + @Test + public void test() { + AAIGETVnfResponse response = new AAIGETVnfResponse(); + + response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491"; + response.vnfName = "lll_vnf_010317"; + response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1"; + response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; + response.orchestrationStatus = "Created"; + response.inMaint = "false"; + response.isClosedLoopDisabled = "false"; + response.resourceVersion = "1494001988835"; + response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa"; + + RelationshipList relationshipList = new RelationshipList(); + Relationship relationship = new Relationship(); + RelationshipData relationshipData = new RelationshipData(); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + + relationshipDataItem.relationshipKey = "customer.global-customer-id"; + relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipData.relationshipData.add(relationshipDataItem); + + relationshipDataItem.relationshipKey = "service-subscription.service-type"; + relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipData.relationshipData.add(relationshipDataItem); + + relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; + relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipData.relationshipData.add(relationshipDataItem); + + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem item = new RelatedToPropertyItem(); + item.propertyKey = "service-instance.service-instance-name"; + item.propertyValue = "lll_svc_010317"; + relatedToProperty.relatedTo.add(item); + + relationship.relatedTo = "service-instance"; + relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationship.relationshipData = relationshipData; + relationship.relatedToProperty = relatedToProperty; + + relationshipList.relationshipList.add(relationship); + response.relationshipList = relationshipList; + + logger.info(Serialization.gsonPretty.toJson(response)); + } +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java new file mode 100644 index 000000000..b24826576 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java @@ -0,0 +1,88 @@ +/*- + * ============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.onap.policy.aai; + +import static org.junit.Assert.*; +import java.util.List; +import java.util.LinkedList; +import org.onap.policy.aai.RelationshipDataItem; +import org.onap.policy.aai.RelationshipData; +import org.onap.policy.aai.RelatedToPropertyItem; +import org.onap.policy.aai.Relationship; +import org.onap.policy.aai.RelatedToProperty; +import org.onap.policy.aai.RelationshipList; +import org.onap.policy.aai.util.Serialization; +import org.onap.policy.aai.AAIGETVserverResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.junit.Test; + +public class AAIGETVserverResponseTest { + private static final Logger logger = LoggerFactory.getLogger(AAIGETVserverResponseTest.class); + + @Test + public void test() { + AAIGETVserverResponse response = new AAIGETVserverResponse(); + + response.vserverID = "d0668d4f-c25e-4a1b-87c4-83845c01efd8"; + response.vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0"; + response.vserverName2 = "vjunos0"; + response.vserverSelflink = "https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"; + response.inMaint = "false"; + response.isClosedLoopDisabled = "false"; + response.resourceVersion = "1494001931513"; + + RelationshipList relationshipList = new RelationshipList(); + Relationship relationship = new Relationship(); + RelationshipData relationshipData = new RelationshipData(); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + + relationshipDataItem.relationshipKey = "customer.global-customer-id"; + relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipData.relationshipData.add(relationshipDataItem); + + relationshipDataItem.relationshipKey = "service-subscription.service-type"; + relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipData.relationshipData.add(relationshipDataItem); + + relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; + relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipData.relationshipData.add(relationshipDataItem); + + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem item = new RelatedToPropertyItem(); + item.propertyKey = "service-instance.service-instance-name"; + item.propertyValue = "lll_svc_010317"; + relatedToProperty.relatedTo.add(item); + + relationship.relatedTo = "service-instance"; + relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationship.relationshipData = relationshipData; + relationship.relatedToProperty = relatedToProperty; + + relationshipList.relationshipList.add(relationship); + response.relationshipList = relationshipList; + + logger.info(Serialization.gsonPretty.toJson(response)); + } + +}
\ No newline at end of file |