diff options
Diffstat (limited to 'controlloop/common/model-impl/sdc')
11 files changed, 597 insertions, 0 deletions
diff --git a/controlloop/common/model-impl/sdc/README.md b/controlloop/common/model-impl/sdc/README.md new file mode 100644 index 000000000..2a17461e5 --- /dev/null +++ b/controlloop/common/model-impl/sdc/README.md @@ -0,0 +1,3 @@ +ECOMP ASDC + + diff --git a/controlloop/common/model-impl/sdc/pom.xml b/controlloop/common/model-impl/sdc/pom.xml new file mode 100644 index 000000000..9a80bc6a4 --- /dev/null +++ b/controlloop/common/model-impl/sdc/pom.xml @@ -0,0 +1,11 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.drools-applications</groupId> + <artifactId>model-impl</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>sdc</artifactId> + +</project> diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java new file mode 100644 index 000000000..99b770475 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * 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.sdc; + +import java.io.Serializable; +import java.util.UUID; + +public class Resource implements Serializable { + + private static final long serialVersionUID = -913729158733348027L; + + public UUID resourceUUID; + public UUID resourceInvariantUUID; + public String resourceName; + public String resourceVersion; + public ResourceType resourceType; + + public Resource() { + + } + + public Resource(Resource resource) { + this.resourceUUID = resource.resourceUUID; + this.resourceInvariantUUID = resource.resourceInvariantUUID; + this.resourceName = resource.resourceName; + this.resourceVersion = resource.resourceVersion; + this.resourceType = resource.resourceType; + } + + public Resource(UUID uuid) { + this.resourceUUID = uuid; + } + + public Resource(String name, ResourceType type) { + this.resourceName = name; + this.resourceType = type; + } + + public Resource(UUID uuid, UUID invariantUUID, String name, String version, ResourceType type) { + this.resourceUUID = uuid; + this.resourceInvariantUUID = invariantUUID; + this.resourceName = name; + this.resourceVersion = version; + this.resourceType = type; + } + + @Override + public String toString() { + return "Resource [resourceUUID=" + resourceUUID + ", resourceInvariantUUID=" + resourceInvariantUUID + + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" + + resourceType + "]"; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode()); + result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); + result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); + result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode()); + result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Resource other = (Resource) obj; + if (resourceInvariantUUID == null) { + if (other.resourceInvariantUUID != null) + return false; + } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID)) + return false; + if (resourceName == null) { + if (other.resourceName != null) + return false; + } else if (!resourceName.equals(other.resourceName)) + return false; + if (resourceType == null) { + if (other.resourceType != null) + return false; + } else if (!resourceType.equals(other.resourceType)) + return false; + if (resourceUUID == null) { + if (other.resourceUUID != null) + return false; + } else if (!resourceUUID.equals(other.resourceUUID)) + return false; + if (resourceVersion == null) { + if (other.resourceVersion != null) + return false; + } else if (!resourceVersion.equals(other.resourceVersion)) + return false; + return true; + } + +} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java new file mode 100644 index 000000000..108163a34 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * 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.sdc; + +import java.io.Serializable; +import java.util.UUID; + +public class ResourceInstance implements Serializable { + private static final long serialVersionUID = -5506162340393802424L; + + public String resourceInstanceName; + public String resourceName; + public UUID resourceInvariantUUID; + public String resourceVersion; + public ResourceType resourceType; + public UUID resourceUUID; + + public ResourceInstance() { + + } + + public ResourceInstance(ResourceInstance instance) { + if (instance == null) { + return; + } + this.resourceInstanceName = instance.resourceInstanceName; + this.resourceName = instance.resourceName; + this.resourceInvariantUUID = instance.resourceInvariantUUID; + this.resourceVersion = instance.resourceVersion; + this.resourceType = instance.resourceType; + this.resourceUUID = instance.resourceUUID; + } + + @Override + public String toString() { + return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName + + ", resourceInvariantUUID=" + resourceInvariantUUID + ", resourceVersion=" + resourceVersion + + ", resourceType=" + resourceType + ", resourceUUID=" + resourceUUID + "]"; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode()); + result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode()); + result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); + result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); + result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode()); + result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ResourceInstance other = (ResourceInstance) obj; + if (resourceInstanceName == null) { + if (other.resourceInstanceName != null) + return false; + } else if (!resourceInstanceName.equals(other.resourceInstanceName)) + return false; + if (resourceInvariantUUID == null) { + if (other.resourceInvariantUUID != null) + return false; + } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID)) + return false; + if (resourceName == null) { + if (other.resourceName != null) + return false; + } else if (!resourceName.equals(other.resourceName)) + return false; + if (resourceType != other.resourceType) + return false; + if (resourceUUID == null) { + if (other.resourceUUID != null) + return false; + } else if (!resourceUUID.equals(other.resourceUUID)) + return false; + if (resourceVersion == null) { + if (other.resourceVersion != null) + return false; + } else if (!resourceVersion.equals(other.resourceVersion)) + return false; + return true; + } + +} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java new file mode 100644 index 000000000..ee2fc89fd --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * 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.sdc; + +public enum ResourceType { + VF("VF"), + VFC("VFC"), + VL("VL"), + CP("CP") + ; + + private String type; + + private ResourceType(String type) { + this.type = type; + } + + public String toString() { + return this.type; + } + +} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java new file mode 100644 index 000000000..4b97168b8 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * 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.sdc; + +import java.io.Serializable; +import java.util.UUID; + +public class Service implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -1249276698549996806L; + + public UUID serviceUUID; + public UUID serviceInvariantUUID; + public String serviceName; + public String serviceVersion; + + public Service() { + + } + + public Service(UUID uuid) { + this.serviceUUID = uuid; + } + + public Service(String name) { + this.serviceName = name; + } + + public Service(UUID uuid, UUID invariantUUID, String name, String version) { + this.serviceUUID = uuid; + this.serviceInvariantUUID = invariantUUID; + this.serviceName = name; + this.serviceVersion = version; + } + + public Service(Service service) { + this.serviceUUID = service.serviceUUID; + this.serviceInvariantUUID = service.serviceInvariantUUID; + this.serviceName = service.serviceName; + this.serviceVersion = service.serviceVersion; + } + + @Override + public String toString() { + return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID + + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode()); + result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); + result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode()); + result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Service other = (Service) obj; + if (serviceInvariantUUID == null) { + if (other.serviceInvariantUUID != null) + return false; + } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) + return false; + if (serviceName == null) { + if (other.serviceName != null) + return false; + } else if (!serviceName.equals(other.serviceName)) + return false; + if (serviceUUID == null) { + if (other.serviceUUID != null) + return false; + } else if (!serviceUUID.equals(other.serviceUUID)) + return false; + if (serviceVersion == null) { + if (other.serviceVersion != null) + return false; + } else if (!serviceVersion.equals(other.serviceVersion)) + return false; + return true; + } + +} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java new file mode 100644 index 000000000..519f88712 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * 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.sdc; + +import java.io.Serializable; +import java.util.UUID; + +public class ServiceInstance implements Serializable { + private static final long serialVersionUID = 6285260780966679625L; + + public UUID personaModelUUID; + public UUID serviceUUID; + public UUID serviceInstanceUUID; + public UUID widgetModelUUID; + public String widgetModelVersion; + public String serviceName; + public String serviceInstanceName; + + public ServiceInstance() { + + } + + public ServiceInstance(ServiceInstance instance) { + if (instance == null) { + return; + } + this.personaModelUUID = instance.personaModelUUID; + this.serviceUUID = instance.serviceUUID; + this.serviceInstanceUUID = instance.serviceInstanceUUID; + this.widgetModelUUID = instance.widgetModelUUID; + this.widgetModelVersion = instance.widgetModelVersion; + this.serviceName = instance.serviceName; + this.serviceInstanceName = instance.serviceInstanceName; + } + + @Override + public String toString() { + return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID + + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID + + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName + + ", serviceInstanceName=" + serviceInstanceName + "]"; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((personaModelUUID == null) ? 0 : personaModelUUID.hashCode()); + result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode()); + result = prime * result + ((serviceInstanceUUID == null) ? 0 : serviceInstanceUUID.hashCode()); + result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); + result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode()); + result = prime * result + ((widgetModelUUID == null) ? 0 : widgetModelUUID.hashCode()); + result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ServiceInstance other = (ServiceInstance) obj; + if (personaModelUUID == null) { + if (other.personaModelUUID != null) + return false; + } else if (!personaModelUUID.equals(other.personaModelUUID)) + return false; + if (serviceInstanceName == null) { + if (other.serviceInstanceName != null) + return false; + } else if (!serviceInstanceName.equals(other.serviceInstanceName)) + return false; + if (serviceInstanceUUID == null) { + if (other.serviceInstanceUUID != null) + return false; + } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) + return false; + if (serviceName == null) { + if (other.serviceName != null) + return false; + } else if (!serviceName.equals(other.serviceName)) + return false; + if (serviceUUID == null) { + if (other.serviceUUID != null) + return false; + } else if (!serviceUUID.equals(other.serviceUUID)) + return false; + if (widgetModelUUID == null) { + if (other.widgetModelUUID != null) + return false; + } else if (!widgetModelUUID.equals(other.widgetModelUUID)) + return false; + if (widgetModelVersion == null) { + if (other.widgetModelVersion != null) + return false; + } else if (!widgetModelVersion.equals(other.widgetModelVersion)) + return false; + return true; + } + +} diff --git a/controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml b/controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml new file mode 100644 index 000000000..6fb1f7cfa --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml @@ -0,0 +1,76 @@ +Service: + type: Object + properties: + serviceUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + serviceInvariantUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + serviceName: + type: string + serviceVersion: + type: string +Resource: + type: Object + properties: + resourceUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + resourceInvariantUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + resourceName: + type: string + resourceVersion: + type: string + resourceType: + type: string + valid_values: + - VF + - VFC + - CP + - VL +ServiceInstance: + type: Object + properties: + personaModelUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + serviceUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + serviceInstanceUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + widgetModelUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + widgetModelVersion: + type: string + serviceName: + type: string + serviceInstanceName: + type: string +ResourceInstance: + type: object + properties: + resourceInstanceName: + type: string + resourceName: + type: string + resourceInvariantUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + resourceVersion: + type: string + resourceType: + type: string + valid_values: + - VF + - VFC + - CP + - VL + resourceUUID: + type: string + pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" diff --git a/controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml b/controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml new file mode 100644 index 000000000..2dda7d705 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml @@ -0,0 +1,3 @@ +Service: + serviceName: trinity +
\ No newline at end of file diff --git a/controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml b/controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml new file mode 100644 index 000000000..c56961ec9 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml @@ -0,0 +1,2 @@ +Service: + serviceName: vSCP
\ No newline at end of file diff --git a/controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml b/controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml new file mode 100644 index 000000000..e63636d39 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml @@ -0,0 +1,2 @@ +Service: + serviceName: vUSP |