aboutsummaryrefslogtreecommitdiffstats
path: root/graph-inventory/aai-client/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'graph-inventory/aai-client/src/main')
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java51
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java200
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java35
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIFluentTypeReverseLookup.java6
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java55
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java13
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java2
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java13
8 files changed, 88 insertions, 287 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
index 998aea9065..ee06fa4be8 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
@@ -22,63 +22,12 @@ package org.onap.aaiclient.client.aai;
import java.io.Serializable;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
-import org.onap.so.constants.Defaults;
import com.google.common.base.CaseFormat;
public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable {
private static final long serialVersionUID = 5312713297525740746L;
- public static final AAIObjectPlurals CUSTOMER =
- new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers");
- public static final AAIObjectPlurals GENERIC_VNF =
- new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs");
- public static final AAIObjectPlurals PORT_GROUP =
- new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups");
- public static final AAIObjectPlurals PSERVER =
- new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
- public static final AAIObjectPlurals P_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces");
- public static final AAIObjectPlurals L3_NETWORK =
- new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks");
- public static final AAIObjectPlurals NETWORK_POLICY =
- new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies");
- public static final AAIObjectPlurals VPN_BINDING =
- new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings");
- public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION,
- AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions");
- public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE,
- AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances");
- public static final AAIObjectPlurals OWNING_ENTITY =
- new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities");
- public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP,
- AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups");
- public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE,
- AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones");
- public static final AAIObjectPlurals VF_MODULE =
- new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules");
- public static final AAIObjectPlurals CONFIGURATION =
- new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations");
- public static final AAIObjectPlurals DEFAULT_TENANT =
- new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE
- + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants");
- public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY,
- AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies");
- public static final AAIObjectPlurals LOGICAL_LINK =
- new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links");
- public static final AAIObjectPlurals L_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces");
- public static final AAIObjectPlurals SUB_L_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces");
- public static final AAIObjectPlurals INSTANCE_GROUP =
- new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups");
- public static final AAIObjectPlurals PNF =
- new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs");
- public static final AAIObjectPlurals PROJECT =
- new AAIObjectPlurals(AAIObjectType.PROJECT, AAINamespaceConstants.BUSINESS, "/projects");
- public static final AAIObjectPlurals VSERVER =
- new AAIObjectPlurals(AAIObjectType.VSERVER, AAIObjectType.TENANT.uriTemplate(), "/vservers");
-
private final String uriTemplate;
private final String partialUri;
private final String name;
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
index dae5c62dd3..55a487d675 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
@@ -27,175 +27,30 @@ import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.onap.aai.annotations.Metadata;
-import org.onap.aai.domain.yang.AggregateRoute;
-import org.onap.aai.domain.yang.AllottedResource;
-import org.onap.aai.domain.yang.AvailabilityZone;
-import org.onap.aai.domain.yang.CloudRegion;
-import org.onap.aai.domain.yang.Collection;
-import org.onap.aai.domain.yang.CommunicationServiceProfile;
-import org.onap.aai.domain.yang.Complex;
-import org.onap.aai.domain.yang.Configuration;
-import org.onap.aai.domain.yang.Connector;
-import org.onap.aai.domain.yang.Customer;
-import org.onap.aai.domain.yang.Device;
-import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.aai.domain.yang.ExtAaiNetwork;
-import org.onap.aai.domain.yang.Flavor;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.Image;
-import org.onap.aai.domain.yang.InstanceGroup;
-import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.LInterface;
-import org.onap.aai.domain.yang.LagInterface;
-import org.onap.aai.domain.yang.LineOfBusiness;
-import org.onap.aai.domain.yang.LogicalLink;
-import org.onap.aai.domain.yang.ModelVer;
-import org.onap.aai.domain.yang.NetworkPolicy;
-import org.onap.aai.domain.yang.NetworkTechnology;
-import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.aai.domain.yang.OwningEntity;
-import org.onap.aai.domain.yang.PInterface;
-import org.onap.aai.domain.yang.PhysicalLink;
-import org.onap.aai.domain.yang.Platform;
-import org.onap.aai.domain.yang.Pnf;
-import org.onap.aai.domain.yang.PortGroup;
-import org.onap.aai.domain.yang.Project;
-import org.onap.aai.domain.yang.Pserver;
-import org.onap.aai.domain.yang.RouteTableReference;
-import org.onap.aai.domain.yang.Service;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.ServiceProfile;
-import org.onap.aai.domain.yang.ServiceSubscription;
-import org.onap.aai.domain.yang.SliceProfile;
-import org.onap.aai.domain.yang.SpPartner;
-import org.onap.aai.domain.yang.SriovPf;
-import org.onap.aai.domain.yang.SriovVf;
-import org.onap.aai.domain.yang.Subnet;
-import org.onap.aai.domain.yang.Tenant;
-import org.onap.aai.domain.yang.TunnelXconnect;
-import org.onap.aai.domain.yang.Vce;
-import org.onap.aai.domain.yang.VfModule;
-import org.onap.aai.domain.yang.VlanRange;
-import org.onap.aai.domain.yang.VlanTag;
-import org.onap.aai.domain.yang.Vnfc;
-import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.aai.domain.yang.Vserver;
-import org.onap.aai.domain.yang.Zone;
import org.onap.aaiclient.client.aai.entities.uri.AAIFluentTypeReverseLookup;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
-import org.onap.so.constants.Defaults;
import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import com.google.common.base.CaseFormat;
-public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable {
+/**
+ * Types are accessed through AAIFluentTypeBuilder and should no longer be added as static members
+ *
+ */
+public class AAIObjectType implements AAIObjectBase, AAIObjectName, GraphInventoryObjectType, Serializable {
private static final long serialVersionUID = -2877184776691514600L;
private static Map<String, AAIObjectType> map = new HashMap<>();
- public static final AAIObjectType DEFAULT_CLOUD_REGION = new AAIObjectType(
- AAINamespaceConstants.CLOUD_INFRASTRUCTURE,
- "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}", "default-cloud-region");
- public static final AAIObjectType CUSTOMER = new AAIObjectType(AAINamespaceConstants.BUSINESS, Customer.class);
public static final AAIObjectType GENERIC_QUERY = new AAIObjectType("/search", "/generic-query", "generic-query");
public static final AAIObjectType BULK_PROCESS = new AAIObjectType("/bulkprocess", "", "bulkprocess");
public static final AAIObjectType SINGLE_TRANSACTION =
new AAIObjectType("/bulk/single-transaction", "", "single-transaction");
- public static final AAIObjectType GENERIC_VNF = new AAIObjectType(AAINamespaceConstants.NETWORK, GenericVnf.class);
- public static final AAIObjectType GENERIC_VNFS =
- new AAIObjectType(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnfs");
- public static final AAIObjectType VF_MODULE =
- new AAIObjectType(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class);
- public static final AAIObjectType L3_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, L3Network.class);
- public static final AAIObjectType NETWORK_POLICY =
- new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkPolicy.class);
public static final AAIObjectType NODES_QUERY = new AAIObjectType("/search", "/nodes-query", "nodes-query");
public static final AAIObjectType CUSTOM_QUERY = new AAIObjectType("/query", "", "query");
- public static final AAIObjectType ROUTE_TABLE_REFERENCE =
- new AAIObjectType(AAINamespaceConstants.NETWORK, RouteTableReference.class);
- public static final AAIObjectType DEFAULT_TENANT =
- new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/"
- + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}", "default-tenant");
- public static final AAIObjectType VCE = new AAIObjectType(AAINamespaceConstants.NETWORK, Vce.class);
- public static final AAIObjectType PORT_GROUP = new AAIObjectType(AAIObjectType.VCE.uriTemplate(), PortGroup.class);
- public static final AAIObjectType VPN_BINDING = new AAIObjectType(AAINamespaceConstants.NETWORK, VpnBinding.class);
- public static final AAIObjectType CONFIGURATION =
- new AAIObjectType(AAINamespaceConstants.NETWORK, Configuration.class);
- public static final AAIObjectType PSERVER =
- new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class);
- public static final AAIObjectType SERVICE_SUBSCRIPTION =
- new AAIObjectType(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class);
-
- public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType(
- AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class);
-
- public static final AAIObjectType SERVICE = new AAIObjectType(
- AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class);
- public static final AAIObjectType SERVICE_INSTANCE =
- new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class);
- public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class);
- public static final AAIObjectType LINE_OF_BUSINESS =
- new AAIObjectType(AAINamespaceConstants.BUSINESS, LineOfBusiness.class);
- public static final AAIObjectType PLATFORM = new AAIObjectType(AAINamespaceConstants.BUSINESS, Platform.class);
- public static final AAIObjectType OWNING_ENTITY =
- new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class);
- public static final AAIObjectType ALLOTTED_RESOURCE =
- new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class);
- public static final AAIObjectType ALLOTTED_RESOURCE_ALL =
- new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources");
- public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class);
- public static final AAIObjectType OPERATIONAL_ENVIRONMENT =
- new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class);
- public static final AAIObjectType CLOUD_REGION =
- new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class);
- public static final AAIObjectType TENANT =
- new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class);
- public static final AAIObjectType VOLUME_GROUP =
- new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class);
- public static final AAIObjectType VSERVER = new AAIObjectType(AAIObjectType.TENANT.uriTemplate(), Vserver.class);
- public static final AAIObjectType MODEL_VER = new AAIObjectType(
- AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class);
- public static final AAIObjectType TUNNEL_XCONNECT =
- new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class);
- public static final AAIObjectType P_INTERFACE =
- new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class);
- public static final AAIObjectType SRIOV_PF =
- new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class);
- public static final AAIObjectType LOGICAL_LINK =
- new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class);
- public static final AAIObjectType PHYSICAL_LINK =
- new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class);
- public static final AAIObjectType INSTANCE_GROUP =
- new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class);
- public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class);
- public static final AAIObjectType VNFC = new AAIObjectType(AAINamespaceConstants.NETWORK, Vnfc.class);
- public static final AAIObjectType VLAN_TAG = new AAIObjectType(AAINamespaceConstants.NETWORK, VlanTag.class);
- public static final AAIObjectType COMPLEX =
- new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class);
- public static final AAIObjectType CONNECTOR = new AAIObjectType(AAINamespaceConstants.BUSINESS, Connector.class);
- public static final AAIObjectType NETWORK_TECHNOLOGY =
- new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class);
- public static final AAIObjectType SUBNET = new AAIObjectType(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class);
- public static final AAIObjectType SP_PARTNER = new AAIObjectType(AAINamespaceConstants.BUSINESS, SpPartner.class);
- public static final AAIObjectType DEVICE = new AAIObjectType(AAINamespaceConstants.NETWORK, Device.class);
- public static final AAIObjectType EXT_AAI_NETWORK =
- new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class);
- public static final AAIObjectType AGGREGATE_ROUTE =
- new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
- public static final AAIObjectType L_INTERFACE =
- new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
- public static final AAIObjectType SRIOV_VF =
- new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), SriovVf.class);
- public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(),
- "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
- public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
- public static final AAIObjectType FLAVOR =
- new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
-
- public static final AAIObjectType VLAN_RANGE = new AAIObjectType(CLOUD_REGION.uriTemplate(), VlanRange.class);
public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") {
private static final long serialVersionUID = 9208984071038447607L;
@@ -206,42 +61,9 @@ public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, S
}
};
public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
- public static final AAIObjectType VNFM = new AAIObjectType(
- AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class);
- public static final AAIObjectType VNFM_LIST =
- new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list");
- public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST =
- new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list",
- "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list");
- public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType(
- AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list");
- public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class);
- public static final AAIObjectType AVAILIBILITY_ZONE =
- new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class);
- public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM,
- "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list");
- public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST =
- new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list",
- "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list");
- public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE =
- new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class);
- public static final AAIObjectType SERVICE_PROFILE =
- new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class);
- public static final AAIObjectType SERVICE_PROFILE_ALL =
- new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles");
- public static final AAIObjectType SLICE_PROFILE =
- new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class);
- public static final AAIObjectType SLICE_PROFILE_ALL =
- new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles");
- public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType(
- AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles");
- public static final AAIObjectType QUERY_ALLOTTED_RESOURCE =
- new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance");
-
- public static final AAIObjectType LAG_INTERFACE =
- new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), LagInterface.class);
-
-
+ public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(
+ "/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}",
+ "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
private final String uriTemplate;
private final String parentUri;
@@ -346,8 +168,8 @@ public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, S
@Override
public boolean equals(Object o) {
- if (o instanceof AAIObjectBase) {
- return this.typeName().equals(((AAIObjectBase) o).typeName());
+ if (o instanceof GraphInventoryObjectName) {
+ return this.typeName().equals(((GraphInventoryObjectName) o).typeName());
}
return false;
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
index 0aff965ac0..c31d393b36 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
@@ -20,8 +20,6 @@
package org.onap.aaiclient.client.aai;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -36,9 +34,12 @@ import org.onap.aaiclient.client.aai.entities.CustomQuery;
import org.onap.aaiclient.client.aai.entities.Results;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.Format;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class AAIRestClientImpl implements AAIRestClientI {
@@ -48,7 +49,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
@Override
public List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException {
List<AAIResourceUri> startNodes = new ArrayList<>();
- startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ startNodes.add(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
return this.getListOfPservers(jsonInput);
@@ -70,20 +71,21 @@ public class AAIRestClientImpl implements AAIRestClientI {
public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setInMaint(inMaint);
- new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
+ new AAIResourcesClient()
+ .update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)), genericVnf);
}
@Override
public GenericVnf getVnfByName(String vnfId) {
- return new AAIResourcesClient()
- .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null);
+ return new AAIResourcesClient().get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))).orElse(null);
}
@Override
public Optional<Pnf> getPnfByName(String pnfId) {
- Response response =
- new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
+ Response response = new AAIResourcesClient()
+ .getFullResponse(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)));
if (response.getStatus() != 200) {
return Optional.empty();
} else {
@@ -93,20 +95,22 @@ public class AAIRestClientImpl implements AAIRestClientI {
@Override
public void createPnf(String pnfId, Pnf pnf) {
- new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId),
- Optional.of(pnf));
+ new AAIResourcesClient().createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)), Optional.of(pnf));
}
@Override
public void updatePnf(String pnfId, Pnf pnf) {
- new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf);
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)),
+ pnf);
}
@Override
public Optional<ServiceInstance> getServiceInstanceById(String globalSubscriberId, String serviceType,
String serviceInstanceId) {
- Response response = new AAIResourcesClient().getFullResponse(AAIUriFactory
- .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId));
+ Response response = new AAIResourcesClient().getFullResponse(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)
+ .serviceSubscription(serviceType).serviceInstance(serviceInstanceId)));
return Optional.ofNullable(response.readEntity(ServiceInstance.class));
}
@@ -114,8 +118,9 @@ public class AAIRestClientImpl implements AAIRestClientI {
public void updateServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId,
ServiceInstance serviceInstance) {
try {
- new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- globalSubscriberId, serviceType, serviceInstanceId), serviceInstance);
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)),
+ serviceInstance);
} catch (Throwable ex) {
log.error("Exception happened while updating ServiceInstance, Exception: {}", ex.getLocalizedMessage());
throw new RuntimeException(ex);
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIFluentTypeReverseLookup.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIFluentTypeReverseLookup.java
index bd9f4c713f..95cb1fe7c2 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIFluentTypeReverseLookup.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIFluentTypeReverseLookup.java
@@ -1,5 +1,6 @@
package org.onap.aaiclient.client.aai.entities.uri;
+import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -20,7 +21,7 @@ public class AAIFluentTypeReverseLookup {
(Class<? extends GraphInventoryFluentType.Info>) Class
.forName("org.onap.aaiclient.client.generated.fluentbuilders." + className + "$Info");
- GraphInventoryFluentType.Info type = clazz.newInstance();
+ GraphInventoryFluentType.Info type = clazz.getConstructor().newInstance();
Optional<String> parentTemplate = findParentPath(type, uri);
if (parentTemplate.isPresent()) {
@@ -29,7 +30,8 @@ public class AAIFluentTypeReverseLookup {
// fallback to enum lookup
return AAIObjectType.fromTypeName(name);
}
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | NoSuchMethodException | SecurityException e) {
}
return AAIObjectType.UNKNOWN;
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
index 6bb2cbd471..be49535f3e 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
@@ -21,29 +21,43 @@
package org.onap.aaiclient.client.aai.entities.uri;
import java.net.URI;
+import org.onap.aaiclient.client.aai.AAIObjectName;
import org.onap.aaiclient.client.aai.AAIObjectPlurals;
import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
public class AAIUriFactory {
+
+ public static final AAIFluentTypeReverseLookup reverseLookup = new AAIFluentTypeReverseLookup();
+
/**
* values are filled into the URI template specified in {@link AAIObjectType} in order <br>
- * There are two special lookups performed on certain types when a single value is specified: <br>
- * Service Instance and AllottedResources <br>
- * These can be retrieved without all their required keys but an HTTP call is required to do so
- *
+ *
* @param type
* @param values
* @return
*/
public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
- if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
- return new ServiceInstanceUri(values);
- } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) {
- return new AllottedResourceLookupUri(values);
+ return new AAISimpleUri(type, values);
+ }
+
+ /**
+ * These can be retrieved without all their required keys but an HTTP call is required to do so
+ *
+ * @param type
+ * @param values
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAISingleFragment fragment) {
+
+ if (Types.SERVICE_INSTANCE.typeName().equals(fragment.get().build().typeName())) {
+ return new ServiceInstanceUri(fragment);
+ } else if (Types.ALLOTTED_RESOURCE.typeName().equals(fragment.get().build().typeName())) {
+ return new AllottedResourceLookupUri(fragment);
} else {
- return new AAISimpleUri(type, values);
+ return null;
}
}
@@ -51,13 +65,16 @@ public class AAIUriFactory {
return new AAISimpleUri(uri.build(), uri.values());
}
- public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
+ protected static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
return new NodesSingleUri(type, values);
+ }
+ public static NodesSingleUri createNodesUri(AAISingleFragment fragment) {
+ return new NodesSingleUri(fragment.get().build(), fragment.get().values());
}
- public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
- return new NodesPluralUri(type);
+ public static NodesPluralUri createNodesUri(AAIPluralFragment fragment) {
+ return new NodesPluralUri(fragment.get().build());
}
@@ -68,7 +85,8 @@ public class AAIUriFactory {
* @param uri
* @return
*/
- public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+ public static AAISimpleUri createResourceFromExistingURI(AAIObjectName name, URI uri) {
+ AAIObjectType type = reverseLookup.fromName(name.typeName(), uri.toString());
return new AAISimpleUri(type, uri);
}
@@ -81,20 +99,19 @@ public class AAIUriFactory {
* @param childValues
* @return
*/
- public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
- Object... childValues) {
+ public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAISingleFragment fragment) {
- return new AAISimpleUri(parentUri, childType, childValues);
+ return new AAISimpleUri(parentUri, fragment.get().build(), fragment.get().values());
}
- public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIPluralFragment fragment) {
- return new AAISimplePluralUri(parentUri, childType);
+ return new AAISimplePluralUri(parentUri, fragment.get().build());
}
public static AAISimplePluralUri createResourceUri(AAIFluentPluralType uri) {
- return new AAISimplePluralUri(uri.build());
+ return new AAISimplePluralUri(uri.build(), uri.values());
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java
index 7f51835580..099f717238 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java
@@ -25,22 +25,25 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
public class AllottedResourceLookupUri extends HttpLookupUri {
private static final long serialVersionUID = -9212594383876793188L;
- protected AllottedResourceLookupUri(Object... values) {
- super(AAIObjectType.ALLOTTED_RESOURCE, values);
+ protected AllottedResourceLookupUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue,
+ Object... values) {
+ super(type, builder, cachedValue, values);
}
- protected AllottedResourceLookupUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
- super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values);
+ protected AllottedResourceLookupUri(AAISingleFragment fragment) {
+ super(AAIFluentTypeBuilder.business().customer("").serviceSubscription("").serviceInstance("")
+ .allottedResource("").build(), fragment.get().values());
}
@Override
public AllottedResourceLookupUri clone() {
- return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values);
+ return new AllottedResourceLookupUri(this.aaiType, this.internalURI.clone(), this.getCachedValue(), values);
}
public AAIResourcesClient getResourcesClient() {
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java
index c39eb50dc2..42f52565cd 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java
@@ -45,7 +45,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri {
private transient Optional<String> cachedValue = Optional.empty();
- private final AAIObjectType aaiType;
+ protected final AAIObjectType aaiType;
protected HttpLookupUri(AAIObjectType type, Object... values) {
super(type, values);
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java
index 96eaac5815..366a011b14 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java
@@ -25,22 +25,25 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
public class ServiceInstanceUri extends HttpLookupUri {
private static final long serialVersionUID = 2248914170527514548L;
- protected ServiceInstanceUri(Object... values) {
- super(AAIObjectType.SERVICE_INSTANCE, values);
+ protected ServiceInstanceUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue,
+ Object... values) {
+ super(type, builder, cachedValue, values);
}
- protected ServiceInstanceUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
- super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values);
+ protected ServiceInstanceUri(AAISingleFragment fragment) {
+ super(AAIFluentTypeBuilder.business().customer("").serviceSubscription("").serviceInstance("").build(),
+ fragment.get().values());
}
@Override
public ServiceInstanceUri clone() {
- return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values);
+ return new ServiceInstanceUri(this.aaiType, this.internalURI.clone(), this.getCachedValue(), values);
}
public AAIResourcesClient getResourcesClient() {