From 2181667755c3e831d3c83e7b8e0636f2960ce107 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Mon, 6 Nov 2023 13:59:20 +0200 Subject: [PATCH] initial commit (cherry picked from commit 791898ad94956a559849d044da44ed179c204e38) --- .gitignore | 4 + LICENSE | 201 ++++++++ README.md | 92 +--- pom.xml | 96 ++++ src/license/licenses.properties | 19 + .../java/org/etsi/osl/model/Category.java | 141 ++++++ .../CompositeExperimentOnBoardDescriptor.java | 25 + .../model/CompositeVxFOnBoardDescriptor.java | 25 + .../org/etsi/osl/model/ConstituentVxF.java | 79 +++ .../org/etsi/osl/model/DeployArtifact.java | 150 ++++++ .../etsi/osl/model/DeploymentDescriptor.java | 451 ++++++++++++++++++ .../osl/model/DeploymentDescriptorStatus.java | 43 ++ .../DeploymentDescriptorVxFInstanceInfo.java | 72 +++ .../DeploymentDescriptorVxFPlacement.java | 105 ++++ .../etsi/osl/model/ExperimentMetadata.java | 186 ++++++++ .../model/ExperimentOnBoardDescriptor.java | 87 ++++ .../osl/model/IMANOCommunicationStatus.java | 34 ++ .../org/etsi/osl/model/IMANOprovider.java | 40 ++ .../org/etsi/osl/model/Infrastructure.java | 272 +++++++++++ .../etsi/osl/model/InfrastructureStatus.java | 32 ++ .../java/org/etsi/osl/model/InstalledVxF.java | 133 ++++++ .../etsi/osl/model/InstalledVxFStatus.java | 44 ++ .../java/org/etsi/osl/model/MANOplatform.java | 102 ++++ .../java/org/etsi/osl/model/MANOprovider.java | 265 ++++++++++ .../osl/model/NetworkServiceDescriptor.java | 31 ++ .../org/etsi/osl/model/OnBoardDescriptor.java | 154 ++++++ .../org/etsi/osl/model/OnBoardingStatus.java | 36 ++ .../org/etsi/osl/model/PackagingFormat.java | 39 ++ .../org/etsi/osl/model/PortalProperty.java | 82 ++++ .../java/org/etsi/osl/model/PortalUser.java | 398 ++++++++++++++++ src/main/java/org/etsi/osl/model/Product.java | 366 ++++++++++++++ .../etsi/osl/model/ProductExtensionItem.java | 73 +++ .../org/etsi/osl/model/ScaleDescriptor.java | 91 ++++ .../etsi/osl/model/SubscribedResource.java | 119 +++++ .../java/org/etsi/osl/model/UserRoleType.java | 61 +++ .../java/org/etsi/osl/model/UserSession.java | 58 +++ src/main/java/org/etsi/osl/model/VFImage.java | 387 +++++++++++++++ .../org/etsi/osl/model/ValidationJob.java | 141 ++++++ .../org/etsi/osl/model/ValidationStatus.java | 35 ++ .../java/org/etsi/osl/model/VxFMetadata.java | 208 ++++++++ .../osl/model/VxFOnBoardedDescriptor.java | 92 ++++ .../etsi/osl/model/util/EncryptionUtil.java | 78 +++ 42 files changed, 5056 insertions(+), 91 deletions(-) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 pom.xml create mode 100644 src/license/licenses.properties create mode 100644 src/main/java/org/etsi/osl/model/Category.java create mode 100644 src/main/java/org/etsi/osl/model/CompositeExperimentOnBoardDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/CompositeVxFOnBoardDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/ConstituentVxF.java create mode 100644 src/main/java/org/etsi/osl/model/DeployArtifact.java create mode 100644 src/main/java/org/etsi/osl/model/DeploymentDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/DeploymentDescriptorStatus.java create mode 100644 src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFInstanceInfo.java create mode 100644 src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFPlacement.java create mode 100644 src/main/java/org/etsi/osl/model/ExperimentMetadata.java create mode 100644 src/main/java/org/etsi/osl/model/ExperimentOnBoardDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/IMANOCommunicationStatus.java create mode 100644 src/main/java/org/etsi/osl/model/IMANOprovider.java create mode 100644 src/main/java/org/etsi/osl/model/Infrastructure.java create mode 100644 src/main/java/org/etsi/osl/model/InfrastructureStatus.java create mode 100644 src/main/java/org/etsi/osl/model/InstalledVxF.java create mode 100644 src/main/java/org/etsi/osl/model/InstalledVxFStatus.java create mode 100644 src/main/java/org/etsi/osl/model/MANOplatform.java create mode 100644 src/main/java/org/etsi/osl/model/MANOprovider.java create mode 100644 src/main/java/org/etsi/osl/model/NetworkServiceDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/OnBoardDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/OnBoardingStatus.java create mode 100644 src/main/java/org/etsi/osl/model/PackagingFormat.java create mode 100644 src/main/java/org/etsi/osl/model/PortalProperty.java create mode 100644 src/main/java/org/etsi/osl/model/PortalUser.java create mode 100644 src/main/java/org/etsi/osl/model/Product.java create mode 100644 src/main/java/org/etsi/osl/model/ProductExtensionItem.java create mode 100644 src/main/java/org/etsi/osl/model/ScaleDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/SubscribedResource.java create mode 100644 src/main/java/org/etsi/osl/model/UserRoleType.java create mode 100644 src/main/java/org/etsi/osl/model/UserSession.java create mode 100644 src/main/java/org/etsi/osl/model/VFImage.java create mode 100644 src/main/java/org/etsi/osl/model/ValidationJob.java create mode 100644 src/main/java/org/etsi/osl/model/ValidationStatus.java create mode 100644 src/main/java/org/etsi/osl/model/VxFMetadata.java create mode 100644 src/main/java/org/etsi/osl/model/VxFOnBoardedDescriptor.java create mode 100644 src/main/java/org/etsi/osl/model/util/EncryptionUtil.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5601d3b --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target/ +.project +.classpath +/.settings diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.md b/README.md index 50ebc95..0e0b6eb 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,2 @@ # org.etsi.osl.model - - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://labs.etsi.org/rep/osl/code/org.etsi.osl.model.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://labs.etsi.org/rep/osl/code/org.etsi.osl.model/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +openslice model diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..064a51f --- /dev/null +++ b/pom.xml @@ -0,0 +1,96 @@ + + 4.0.0 + + + org.etsi.osl + org.etsi.osl.main + 1.2.0-SNAPSHOT + ../org.etsi.osl.main + + + org.etsi.osl.model + jar + + org.etsi.osl.model + http://maven.apache.org + + + + UTF-8 + UTF-8 + ${spring-boot-version} + ${spring-cloud-consul-version} + 1.8.0 + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot-version} + pom + import + + + commons-logging + commons-logging + + + + + + org.apache.camel.springboot + camel-spring-boot-dependencies + ${camel.version} + pom + import + + + + + + + + jakarta.persistence + jakarta.persistence-api + + + + com.fasterxml.jackson.core + jackson-databind + + + org.apache.shiro + shiro-core + ${shiro.version} + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + ${java.version} + + + + + + + + + + + + + diff --git a/src/license/licenses.properties b/src/license/licenses.properties new file mode 100644 index 0000000..bfa71f5 --- /dev/null +++ b/src/license/licenses.properties @@ -0,0 +1,19 @@ +### +# ========================LICENSE_START================================= +# org.etsi.osl.model +# %% +# Copyright (C) 2019 openslice.io +# %% +# 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================================== +### diff --git a/src/main/java/org/etsi/osl/model/Category.java b/src/main/java/org/etsi/osl/model/Category.java new file mode 100644 index 0000000..d8f4105 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/Category.java @@ -0,0 +1,141 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@Entity(name = "Category") +@JsonIgnoreProperties(value = { "products" }, ignoreUnknown = true ) +public class Category { + + private static final transient Logger logger = LoggerFactory.getLogger(Category.class.getName()); + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String name=null; + + + + @ManyToMany(cascade = { CascadeType.ALL }) + @JoinTable( + name = "CATEGORY_PRODUCTS", + joinColumns = { @JoinColumn(name = "CAT_ID") }, + inverseJoinColumns = { @JoinColumn(name = "PROD_ID") } + ) + private Set products = new HashSet(); + + + + public Set getProducts() { + return products; + } + + public void setProducts(Set products) { + this.products = products; + } + + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + + public void addProduct(Product product) { + if (!products.contains(product)) { + logger.info("ACTUALLY add into category "+ this.getName()+" product "+product.getId()); + products.add(product); + //product.addCategory(this); + } + } + + + public void removeProduct(Product p) { + if (products.contains(p)) { + products.remove(p); + //p.removeCategory(this); + } + } + + @JsonIgnore + public int getAppscount() { + int c = 0; + for (Product p : products) { + if ( p instanceof ExperimentMetadata) + c++; + } + return c; + } + @JsonIgnore + public int getVxFscount() { + int c = 0; + for (Product p : products) { + if ( p instanceof VxFMetadata) + c++; + } + + return c; + } + + + @JsonIgnore + public int getProductsCount() { + return products.size(); + } + + +} diff --git a/src/main/java/org/etsi/osl/model/CompositeExperimentOnBoardDescriptor.java b/src/main/java/org/etsi/osl/model/CompositeExperimentOnBoardDescriptor.java new file mode 100644 index 0000000..df3db53 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/CompositeExperimentOnBoardDescriptor.java @@ -0,0 +1,25 @@ +package org.etsi.osl.model; + +public class CompositeExperimentOnBoardDescriptor { + private ExperimentOnBoardDescriptor obd; + private String filename; + private byte[] allBytes; + public ExperimentOnBoardDescriptor getObd() { + return obd; + } + public void setObd(ExperimentOnBoardDescriptor obd) { + this.obd = obd; + } + public String getFilename() { + return filename; + } + public void setFilename(String filename) { + this.filename = filename; + } + public byte[] getAllBytes() { + return allBytes; + } + public void setAllBytes(byte[] allBytes) { + this.allBytes = allBytes; + } +} diff --git a/src/main/java/org/etsi/osl/model/CompositeVxFOnBoardDescriptor.java b/src/main/java/org/etsi/osl/model/CompositeVxFOnBoardDescriptor.java new file mode 100644 index 0000000..176c053 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/CompositeVxFOnBoardDescriptor.java @@ -0,0 +1,25 @@ +package org.etsi.osl.model; + +public class CompositeVxFOnBoardDescriptor { + private VxFOnBoardedDescriptor obd; + private String filename; + private byte[] allBytes; + public VxFOnBoardedDescriptor getObd() { + return obd; + } + public void setObd(VxFOnBoardedDescriptor obd) { + this.obd = obd; + } + public String getFilename() { + return filename; + } + public void setFilename(String filename) { + this.filename = filename; + } + public byte[] getAllBytes() { + return allBytes; + } + public void setAllBytes(byte[] allBytes) { + this.allBytes = allBytes; + } +} diff --git a/src/main/java/org/etsi/osl/model/ConstituentVxF.java b/src/main/java/org/etsi/osl/model/ConstituentVxF.java new file mode 100644 index 0000000..d933d41 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ConstituentVxF.java @@ -0,0 +1,79 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToOne; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@Entity(name = "ConstituentVxF") +@JsonIgnoreProperties(value = { "vxfref" }) +public class ConstituentVxF { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String membervnfIndex; + + @Basic() + private String vnfdidRef; + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DETACH } ) + @JoinColumn(name = "vxf_id") + private VxFMetadata vxfref; + + public String getMembervnfIndex() { + return membervnfIndex; + } + + public void setMembervnfIndex(String membervnfIndex) { + this.membervnfIndex = membervnfIndex; + } + + public String getVnfdidRef() { + return vnfdidRef; + } + + public void setVnfdidRef(String vnfdidRef) { + this.vnfdidRef = vnfdidRef; + } + + public VxFMetadata getVxfref() { + return vxfref; + } + + public void setVxfref(VxFMetadata vxfref) { + this.vxfref = vxfref; + } + + + +} diff --git a/src/main/java/org/etsi/osl/model/DeployArtifact.java b/src/main/java/org/etsi/osl/model/DeployArtifact.java new file mode 100644 index 0000000..23a6023 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/DeployArtifact.java @@ -0,0 +1,150 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinTable; +import jakarta.persistence.OneToMany; + + +@Entity(name = "DeployArtifact") +public class DeployArtifact { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String uuid = null; + + @Basic() + private String name = null; + + @Basic() + private String artifactURL = null; + + @Basic() + private String artifactPackageURL = null; + + @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinTable() + private List extensions = new ArrayList(); + + + @Basic() + private InstalledVxFStatus status = InstalledVxFStatus.INIT; + + public InstalledVxFStatus getStatus() { + return status; + } + + public void setStatus(InstalledVxFStatus status) { + this.status = status; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getArtifactURL() { + return artifactURL; + } + + public void setArtifactURL(String artifactURL) { + this.artifactURL = artifactURL; + } + + public String getArtifactPackageURL() { + return artifactPackageURL; + } + + public void setArtifactPackageURL(String artifactPackageURL) { + this.artifactPackageURL = artifactPackageURL; + } + + public List getExtensions() { + return extensions; + } + + public void setExtensions(List extensions) { + this.extensions = extensions; + } + + public void addExtensionItem(ProductExtensionItem i){ + if (!this.extensions.contains(i)){ + if (findProductExtensionItemByName(i.getName())==null ) + this.extensions.add(i); + } + } + + public void removeExtensionItem(ProductExtensionItem i){ + if (this.extensions.contains(i)){ + this.extensions.remove(i); + } + } + + public void addExtensionItem(String name, String value){ + ProductExtensionItem i = new ProductExtensionItem(); + i.setName(name); + i.setValue(value); + this.addExtensionItem(i); + } + + public ProductExtensionItem findProductExtensionItemByName(String name){ + for (ProductExtensionItem p : this.extensions) { + if (p.getName().equals(name)) + return p; + } + return null; + } + + +} diff --git a/src/main/java/org/etsi/osl/model/DeploymentDescriptor.java b/src/main/java/org/etsi/osl/model/DeploymentDescriptor.java new file mode 100644 index 0000000..b2d95dd --- /dev/null +++ b/src/main/java/org/etsi/osl/model/DeploymentDescriptor.java @@ -0,0 +1,451 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.io.Serializable; +import java.time.Instant; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Set; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.ConstraintMode; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.JoinTable; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +/** + * @author ctranoris + * + */ +@Entity(name = "DeploymentDescriptor") +@JsonIgnoreProperties(ignoreUnknown=true, value = { "ExperimentFullDetails" }) +public class DeploymentDescriptor implements Serializable{ + + + /** + * + */ + private static final long serialVersionUID = 2274390183349399598L; + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + + @Basic() + private String uuid = null; + + @Basic() + private String name = null; + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "mentor_id") + private PortalUser mentor = null; + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "infrastructure_for_all_id") + private Infrastructure infrastructureForAll = null; + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "obddescriptor_uuid") + private ExperimentOnBoardDescriptor obddescriptor_uuid = null; + + @Lob + @Column(name = "LDESCRIPTION", columnDefinition = "LONGTEXT") + private String description = null; + + @Lob + @Column(name = "FEEDBACK", columnDefinition = "LONGTEXT") + private String feedback = null; + + @Lob + @Column(name = "INSTANTIATIONCONFIG", columnDefinition = "LONGTEXT") + private String instantiationconfig = null; + + @Basic() + private DeploymentDescriptorStatus status = DeploymentDescriptorStatus.UNDER_REVIEW; + + @Basic() + private Date dateCreated; + + @Basic() + private Date startReqDate; + + @Basic() + private Date endReqDate; + + @Basic() + private Date startDate; + @Basic() + private Date endDate; + + @Basic() + private String instanceId; + + @Basic() + private String nsLcmOpOccId; + + public String getNsLcmOpOccId() { + return nsLcmOpOccId; + } + + public void setNsLcmOpOccId(String nsLcmOpOccId) { + this.nsLcmOpOccId = nsLcmOpOccId; + } + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "experiment_id") + private ExperimentMetadata experiment = null; + +// USE THE FOLLOWING DISABLE FOREIGN KEY RESTRICTION +// @ManyToOne(optional=true) +// @JoinColumn(name="experiment_id", foreignKey = @jakarta.persistence.ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) +// private ExperimentMetadata experiment = null; + + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumn(name = "owner_id") + private PortalUser owner = null; + + @OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true) + private List vxfPlacements = new ArrayList(); + + @OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true) + private Set deploymentDescriptorVxFInstanceInfo; + + public Set getDeploymentDescriptorVxFInstanceInfo() { + return deploymentDescriptorVxFInstanceInfo; + } + + public void setDeploymentDescriptorVxFInstanceInfo( + Set deploymentDescriptorVxFInstanceInfo) { + this.deploymentDescriptorVxFInstanceInfo = deploymentDescriptorVxFInstanceInfo; + } + + @Basic() + private String operationalStatus; + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + @Basic() + private String configStatus; + public String getConfigStatus() { + return configStatus; + } + + public void setConfigStatus(String configStatus) { + this.configStatus = configStatus; + } + + @Lob + @Column(name = "LDETAILEDSTATUS", columnDefinition = "LONGTEXT") + private String detailedStatus; + public String getDetailedStatus() { + return detailedStatus; + } + + public void setDetailedStatus(String detailedStatus) { + this.detailedStatus = detailedStatus; + } + + + @Lob + @Column(name = "LCONSITVNFRIPS", columnDefinition = "LONGTEXT") + private String constituentVnfrIps; + + @Lob + @Column(name = "LNSR", columnDefinition = "LONGTEXT") + private String nsr; + + @Lob + @Column(name = "LNSLCM_DETAILS", columnDefinition = "LONGTEXT") + private String ns_nslcm_details; + + public String getNs_nslcm_details() { + return ns_nslcm_details; + } + + public void setNs_nslcm_details(String ns_nslcm_details) { + this.ns_nslcm_details = ns_nslcm_details; + } + + public String getNsr() { + return nsr; + } + + public void setNsr(String nsr) { + this.nsr = nsr; + } + + public String getConstituentVnfrIps() { + return constituentVnfrIps; + } + + public void setConstituentVnfrIps(String constituentVnfrIps) { + this.constituentVnfrIps = constituentVnfrIps; + } + + public DeploymentDescriptor() { + } + + public DeploymentDescriptor(String uuid, String name) { + super(); + this.name = name; + this.uuid = uuid; + } + + public List getVxfPlacements() { + return vxfPlacements; + } + + public void setVxfPlacements(List vxfPlacements) { + this.vxfPlacements = vxfPlacements; + } + + + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + + public PortalUser getOwner() { + if ( owner!=null ) { + PortalUser p = owner.getSnippedDetails(); + return p; + } + + return null; + } + + public void setOwner(PortalUser owner) { + this.owner = owner; + } + + //@JsonIgnore + public ExperimentMetadata getExperimentFullDetails() { + return experiment; + } + + public ExperimentMetadata getExperiment() { + + if (experiment!=null) { + return experiment.getSnippedDetails(); + } + + return experiment; + } + + public void setExperiment(ExperimentMetadata e) { + this.experiment = e; + } + + public DeploymentDescriptorStatus getStatus() { + return status; + } + + public void setStatus(DeploymentDescriptorStatus status) { + this.status = status; + } + + public Date getStartReqDate() { + return startReqDate; + } + + public void setStartReqDate(Date startReqDate) { + this.startReqDate = startReqDate; + } + + public Date getEndReqDate() { + return endReqDate; + } + + public void setEndReqDate(Date endReqDate) { + this.endReqDate = endReqDate; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFeedback() { + return feedback; + } + + public void setFeedback(String feedback) { + this.feedback = feedback; + } + + + public Date getStartDate() { + return startDate; + } + + + public void setScheduledStartDate() { + + } + + public String getScheduledStartDate() { + if (startDate!=null ) { + Instant instant= startDate.toInstant(); + Instant ins3 = Instant.from( instant.atOffset(ZoneOffset.UTC).withHour(0).withMinute(0).withSecond(0) ); + return ins3.toString(); + } + return null; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setScheduledEndDate() { + + } + public String getScheduledEndDate() { + if (endDate!=null ) { + Instant instant= endDate.toInstant(); + Instant ins3 = Instant.from( instant.atOffset(ZoneOffset.UTC).withHour(23).withMinute(59).withSecond(59) ); + return ins3.toString(); + } + return null; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public PortalUser getMentor() { + return mentor; + } + + public void setMentor(PortalUser mentor) { + this.mentor = mentor; + } + + public Infrastructure getInfrastructureForAll() { + return infrastructureForAll; + } + + public void setInfrastructureForAll(Infrastructure infrastructureForAll) { + this.infrastructureForAll = infrastructureForAll; + } + + public ExperimentOnBoardDescriptor getObddescriptor_uuid() { + return obddescriptor_uuid; + } + + public void setObddescriptor_uuid(ExperimentOnBoardDescriptor obddescriptor_uuid) { + this.obddescriptor_uuid = obddescriptor_uuid; + } + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getInstantiationconfig() { + return instantiationconfig; + } + + public void setInstantiationconfig(String instantiationconfig) { + this.instantiationconfig = instantiationconfig; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + +} diff --git a/src/main/java/org/etsi/osl/model/DeploymentDescriptorStatus.java b/src/main/java/org/etsi/osl/model/DeploymentDescriptorStatus.java new file mode 100644 index 0000000..61e63be --- /dev/null +++ b/src/main/java/org/etsi/osl/model/DeploymentDescriptorStatus.java @@ -0,0 +1,43 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * + */ +public enum DeploymentDescriptorStatus { + + UNDER_REVIEW, + SCHEDULED, + REJECTED, + RUNNING, + TERMINATED, + INSTANTIATING, + FAILED, + TERMINATING, + TERMINATION_FAILED, + COMPLETED, + FAILED_OSM_REMOVED, + DELETION_FAILED +} + diff --git a/src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFInstanceInfo.java b/src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFInstanceInfo.java new file mode 100644 index 0000000..53d7ed1 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFInstanceInfo.java @@ -0,0 +1,72 @@ +package org.etsi.osl.model; + +import java.io.Serializable; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToOne; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author ichatzis + * + */ +@Entity(name = "DeploymentDescriptorVxFInstanceInfo") +public class DeploymentDescriptorVxFInstanceInfo implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 2904593792014246094L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String memberVnfIndexRef = null; + + public String getMemberVnfIndexRef() { + return memberVnfIndexRef; + } + + public void setMemberVnfIndexRef(String memberVnfIndexRef) { + this.memberVnfIndexRef = memberVnfIndexRef; + } + + @Lob + @Column(columnDefinition = "LONGTEXT") + private String vxfInstanceInfo = null; + + public String getVxfInstanceInfo() { + return vxfInstanceInfo; + } + + public void setVxfInstanceInfo(String vxfInstanceInfo) { + this.vxfInstanceInfo = vxfInstanceInfo; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } +} diff --git a/src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFPlacement.java b/src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFPlacement.java new file mode 100644 index 0000000..07a8ad7 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/DeploymentDescriptorVxFPlacement.java @@ -0,0 +1,105 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.io.Serializable; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToOne; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author ctranoris + * + */ +@Entity(name = "DeploymentDescriptorVxFPlacement") +public class DeploymentDescriptorVxFPlacement implements Serializable{ + + + /** + * + */ + private static final long serialVersionUID = 719321004307067543L; + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DETACH } ) + @JoinColumn(name = "constituent_vxf_id") + private ConstituentVxF constituentVxF = null; + + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DETACH } ) + @JoinColumn(name = "infrastructure_id") + private Infrastructure infrastructure = null; + + + public ConstituentVxF getConstituentVxF() { + return constituentVxF; + } + + + public void setConstituentVxF(ConstituentVxF constituentVxF) { + this.constituentVxF = constituentVxF; + } + + + public Infrastructure getInfrastructure() { + return infrastructure; + } + + + public void setInfrastructure(Infrastructure infrastructure) { + this.infrastructure = infrastructure; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } +} diff --git a/src/main/java/org/etsi/osl/model/ExperimentMetadata.java b/src/main/java/org/etsi/osl/model/ExperimentMetadata.java new file mode 100644 index 0000000..bd82b39 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ExperimentMetadata.java @@ -0,0 +1,186 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.OneToMany; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + + +/** + * @author ctranoris + * + */ +@Entity(name = "ExperimentMetadata") +@JsonIgnoreProperties(ignoreUnknown = true) +public class ExperimentMetadata extends Product{ + + + /** + * + */ + private boolean valid; + + + /** + * + */ + @Basic() + private ValidationStatus validationStatus = ValidationStatus.NOT_STARTED; + + /** + * + */ + private PackagingFormat packagingFormat = PackagingFormat.OSMvEIGHT; + + /** + * @return + */ + public PackagingFormat getPackagingFormat() { + return packagingFormat; + } + + /** + * @param packagingFormat + */ + public void setPackagingFormat(PackagingFormat packagingFormat) { + this.packagingFormat = packagingFormat; + } + + + /** + * + */ + @OneToMany( mappedBy ="experiment", cascade = { CascadeType.ALL } , orphanRemoval = true) + private Set experimentOnBoardDescriptors = new HashSet(); + + /** + * USE THE FOLLOWING TO DISABLE FOREIGN KEY RESTRICTION ALONG WITH THE RELATED CAHNGE TO DeploymentDescriptor CLASS + */ + // @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) + // @JoinColumn(name = "experiment", foreignKey = @jakarta.persistence.ForeignKey(name = "none")) + // private Set DeploymentDescriptors = new HashSet(); + // + // public Set getDeploymentDescriptors() { + // return DeploymentDescriptors; + // } + // + // public void setDeploymentDescriptors(Set deploymentDescriptors) { + // DeploymentDescriptors = deploymentDescriptors; + // } + + + /** + * + */ + @OneToMany( cascade = { CascadeType.ALL }, orphanRemoval = true) + @JoinTable() + private List constituentVxF = new ArrayList(); + + + + /** + * @return + */ + public List getConstituentVxF() { + return constituentVxF; + } + + /** + * @param constituentVxF + */ + public void setConstituentVxF(List constituentVxF) { + this.constituentVxF = constituentVxF; + } + + /** + * @return + */ + public boolean isValid() { + return valid; + } + + /** + * @param valid + */ + public void setValid(boolean valid) { + this.valid = valid; + } + + /** + * @return + */ + public Set getExperimentOnBoardDescriptors() { + return experimentOnBoardDescriptors; + } + + /** + * @param e + */ + public void setExperimentOnBoardDescriptors(Set e) { + this.experimentOnBoardDescriptors = e; + } + + /** + * @return + */ + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** + * @param validationStatus + */ + public void setValidationStatus(ValidationStatus validationStatus) { + this.validationStatus = validationStatus; + } + + @JsonIgnore + public ExperimentMetadata getSnippedDetails() { + @JsonIgnoreProperties(value = { "iconsrc", "owner", "dateUpdated", "packageLocation", "longDescription", "version", + "experimentOnBoardDescriptors", "termsOfUse", "dateCreated", "shortDescription", "descriptor", "packagingFormat", + "valid", "categories", "screenshots", "vendor", "published", "extensions", "validationJobs", "descriptorHTML", "validationStatus"} ) + class SnipExperimentMetadata extends ExperimentMetadata{ + } + + SnipExperimentMetadata p = new SnipExperimentMetadata(); + p.setId( this.getId() ); + p.setName( this.getName() ); + p.setConstituentVxF( this.getConstituentVxF() ); + p.setUuid( this.getUuid() ); + + return p; + } + +} diff --git a/src/main/java/org/etsi/osl/model/ExperimentOnBoardDescriptor.java b/src/main/java/org/etsi/osl/model/ExperimentOnBoardDescriptor.java new file mode 100644 index 0000000..a9f2ab1 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ExperimentOnBoardDescriptor.java @@ -0,0 +1,87 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.ManyToOne; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author ctranoris + * maintains information and status of an Experiment (in terms of NSD currently) on which MANO providers is on-boarded + * see https://github.com/5GinFIRE/eu.5ginfire.portal.api/issues/7 + */ +@Entity(name = "ExperimentOnBoardDescriptor") +@JsonIgnoreProperties(value = { "experiment" }) + +public class ExperimentOnBoardDescriptor extends OnBoardDescriptor{ + + @ManyToOne(fetch = FetchType.EAGER ) + @JoinColumn(name = "experiment_id") + private ExperimentMetadata experiment; + + private String experimentMANOProviderID; + + private long tempExperimentID; + + public ExperimentOnBoardDescriptor() { + } + + public ExperimentOnBoardDescriptor(ExperimentMetadata v) { + this.experiment = v; + } + + public ExperimentMetadata getExperiment() { + return experiment; + } + + public void setExperiment(ExperimentMetadata e) { + this.experiment = e; + this.tempExperimentID = e.getId(); + } + + public long getExperimentid() { + if ( experiment != null ) { + return experiment.getId(); + }else { + return this.tempExperimentID; + } + } + + public void setExperimentid(long e) { + this.tempExperimentID = e; + } + + public String getExperimentMANOProviderID() { + return experimentMANOProviderID; + } + + public void setExperimentMANOProviderID(String experimentMANOProviderID) { + this.experimentMANOProviderID = experimentMANOProviderID; + } + +} diff --git a/src/main/java/org/etsi/osl/model/IMANOCommunicationStatus.java b/src/main/java/org/etsi/osl/model/IMANOCommunicationStatus.java new file mode 100644 index 0000000..2dc9f5f --- /dev/null +++ b/src/main/java/org/etsi/osl/model/IMANOCommunicationStatus.java @@ -0,0 +1,34 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +public interface IMANOCommunicationStatus { + + static String getMessage() { + // TODO Auto-generated method stub + return null; + } + + static String getOsmCommunicationStatusUUID() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/main/java/org/etsi/osl/model/IMANOprovider.java b/src/main/java/org/etsi/osl/model/IMANOprovider.java new file mode 100644 index 0000000..857f3c9 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/IMANOprovider.java @@ -0,0 +1,40 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * + * Describes a MANO provider that can be accessed via an API + * + */ +public interface IMANOprovider { + + public String getName(); + + public String getDescription(); + + public MANOplatform getSupportedMANOplatform(); + + public String getApiEndpoint(); + + +} diff --git a/src/main/java/org/etsi/osl/model/Infrastructure.java b/src/main/java/org/etsi/osl/model/Infrastructure.java new file mode 100644 index 0000000..2d58bec --- /dev/null +++ b/src/main/java/org/etsi/osl/model/Infrastructure.java @@ -0,0 +1,272 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Transient; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author ctranoris + * + */ + +@Entity(name = "Infrastructure") +@JsonIgnoreProperties(value = { "supportedImages" }) +public class Infrastructure { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String organization = null; + @Basic() + private String name = null; + @Basic() + private String email = null; + @Basic() + private InfrastructureStatus infrastructureStatus = InfrastructureStatus.UNKNOWN; + + @Basic() + private Date dateCreated; + + @Basic() + private String datacentername = null; + + @Basic() + private String vimid = null; + + @ManyToOne + @JoinColumn(name = "mp_id") + private MANOprovider mp = null; + + @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinTable() + private List supportedImages = new ArrayList<>(); + + + @Transient + private List refSupportedImages = new ArrayList<>(); + + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + public Date getDateCreated() { + return dateCreated; + } + + public String getDatacentername() { + return datacentername; + } + + public void setDatacentername(String datacentername) { + this.datacentername = datacentername; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + public String getVIMid() { + return vimid; + } + + public void setVIMid(String vimid) { + this.vimid = vimid; + } + + public MANOprovider getMp() { + return mp; + } + + public void setMp(MANOprovider mp) { + this.mp = mp; + } + + /** + * @return the supportedImages + */ + public List getSupportedImages() { + return supportedImages; + } + + /** + * @param supportedImages the supportedImages to set + */ + public void setSupportedImages(List supportedImages) { + this.supportedImages = supportedImages; + } + + /** + * @return the refSupportedImages + */ + public List getRefSupportedImages() { + refSupportedImages.clear(); + for (VFImage vfimg : supportedImages) { + RefVFImage ref = new RefVFImage( vfimg.getId(), vfimg.getName()); + refSupportedImages.add( ref ); + } + return refSupportedImages; + } + + /** + * @param refSupportedImages the refSupportedImages to set + */ + public void setRefSupportedImages(List refSupportedImages) { + this.refSupportedImages = refSupportedImages; + } + + /** + * Locally used to report back objects, otherwise the response would be recursive + * @author ctranoris + * + */ + static class RefVFImage { + + /** */ + private long id; + /** */ + private String name; + + public RefVFImage() { + + } + + public RefVFImage(long id2, String name2) { + id = id2; + name = name2; + + } + + /** + * @return the id + */ + public long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(long id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + } + + + public InfrastructureStatus getInfrastructureStatus() { + return infrastructureStatus; + } + + public void setInfrastructureStatus(InfrastructureStatus infrastructureStatus) { + this.infrastructureStatus = infrastructureStatus; + } + + /** + * @param l + * @return + */ + public Object getSupportedImageById(long l) { + for (VFImage refVFImage : supportedImages) { + if ( refVFImage.getId() == l ){ + return refVFImage; + } + } + return null; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } +} diff --git a/src/main/java/org/etsi/osl/model/InfrastructureStatus.java b/src/main/java/org/etsi/osl/model/InfrastructureStatus.java new file mode 100644 index 0000000..ed8af12 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/InfrastructureStatus.java @@ -0,0 +1,32 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ichatzis + * + */ +public enum InfrastructureStatus { + UNKNOWN, + OSM_PRESENT, + OSM_MISSING +} diff --git a/src/main/java/org/etsi/osl/model/InstalledVxF.java b/src/main/java/org/etsi/osl/model/InstalledVxF.java new file mode 100644 index 0000000..237eba1 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/InstalledVxF.java @@ -0,0 +1,133 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.Basic; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + + +/** + * @author ctranoris + * + */ +@Entity(name = "InstalledVxF") +public class InstalledVxF { + + + + @Id + @GeneratedValue( strategy = GenerationType.IDENTITY ) + private long id = 0; + + @Basic() + private String uuid; + @Basic() + private String repoUrl; + @Basic() + private String installedVersion; + @Basic() + private String name; + @Basic() + private InstalledVxFStatus status = InstalledVxFStatus.INIT; + @Basic() + private String packageLocalPath; + @Basic() + private String packageURL; + + public InstalledVxF() { + super(); + } + + public InstalledVxF(String uuid, String repoUrl) { + super(); + this.uuid = uuid; + this.repoUrl = repoUrl; + this.name = "(pending)"; + this.packageURL = "(pending url)"; + } + + + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getRepoUrl() { + return repoUrl; + } + public void setRepoUrl(String repoUrl) { + this.repoUrl = repoUrl; + } + public String getInstalledVersion() { + return installedVersion; + } + public void setInstalledVersion(String installedVersion) { + this.installedVersion = installedVersion; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public InstalledVxFStatus getStatus() { + return status; + } + + public void setStatus(InstalledVxFStatus status) { + this.status = status; + } + + public String getPackageLocalPath() { + return packageLocalPath; + } + + public void setPackageLocalPath(String packageLocalPath) { + this.packageLocalPath = packageLocalPath; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getPackageURL() { + return packageURL; + } + + public void setPackageURL(String packageURL) { + this.packageURL = packageURL; + } + + + +} diff --git a/src/main/java/org/etsi/osl/model/InstalledVxFStatus.java b/src/main/java/org/etsi/osl/model/InstalledVxFStatus.java new file mode 100644 index 0000000..1e16e50 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/InstalledVxFStatus.java @@ -0,0 +1,44 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * + */ +public enum InstalledVxFStatus { + + INIT, + DOWNLOADING, + DOWNLOADED, + INSTALLING, + INSTALLED, + STARTING, + STARTED, + CONFIGURING, + STOPPING, + STOPPED, + UNINSTALLING, + UNINSTALLED, + FAILED + +} diff --git a/src/main/java/org/etsi/osl/model/MANOplatform.java b/src/main/java/org/etsi/osl/model/MANOplatform.java new file mode 100644 index 0000000..8dae74f --- /dev/null +++ b/src/main/java/org/etsi/osl/model/MANOplatform.java @@ -0,0 +1,102 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.Basic; +import jakarta.persistence.Embeddable; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +/** + * @author ctranoris + * + * Metadata for describing a MANO platform in terms of its name, version description etc + * + */ +/** + * @author ctranoris + * + */ +@Entity(name = "MANOplatform") +public class MANOplatform { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String name = null; + + @Basic() + private String version = null; + + + @Basic() + private String description = null; + + + public long getId() { + return id; + } + + + public void setId(long id) { + this.id = id; + } + + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public String getVersion() { + return version; + } + + + public void setVersion(String version) { + this.version = version; + } + + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + + + +} diff --git a/src/main/java/org/etsi/osl/model/MANOprovider.java b/src/main/java/org/etsi/osl/model/MANOprovider.java new file mode 100644 index 0000000..c47d93e --- /dev/null +++ b/src/main/java/org/etsi/osl/model/MANOprovider.java @@ -0,0 +1,265 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * @author ctranoris + * + * Describes a MANO provider that can be accessed via an API + * + */ +/** + * @author ctranoris + * + */ +@Entity(name = "MANOprovider") +public class MANOprovider implements IMANOprovider { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String name = null; + + @Basic() + private String description = null; + + @OneToMany(mappedBy ="mp", fetch = FetchType.EAGER) + private List vims = new ArrayList(); + + + @JsonProperty("vims") + public List getVimsID() { + + List vimsids = new ArrayList<>(); + if(this.vims!=null) + { + for (Infrastructure infrastructure : vims) { + Infrastructure in = new Infrastructure(); + in.setName( infrastructure.getName() ); + in.setId(infrastructure.getId()); + in.setVIMid(infrastructure.getVIMid()); + in.setDatacentername(infrastructure.getDatacentername()); + vimsids.add(in); + } + } + return vimsids; + } + + + public List getVims() { + return vims; + } + + + public void setVims(List vims) { + this.vims = vims; + } + + + @ManyToOne + @JoinColumn(name="MP_ID", nullable=false) + private MANOplatform supportedMANOplatform; + + + @Basic() + private String apiEndpoint = null; + + + /** + * base64-encoding of username:password + */ + @Basic() + private String authorizationBasicHeader = null; + + + /** + * username to connect + */ + @Basic() + private String username = null; + + /** + * password to connect + */ + @Basic() + private String password = null; + + /** + * OSM MANO project to use + */ + @Basic() + private String project = null; + + /** + * password to connect + */ + @Basic() + private Boolean enabledForONBOARDING = null; + @Basic() + private Boolean enabledForSYNC = null; + + + public String getAuthorizationBasicHeader() { + return authorizationBasicHeader; + } + + + public void setAuthorizationBasicHeader(String authorizationBasicHeader) { + this.authorizationBasicHeader = authorizationBasicHeader; + } + + + public String getApiEndpoint() { + return apiEndpoint; + } + + + public void setApiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; + } + + + public long getId() { + return id; + } + + + public void setId(long id) { + this.id = id; + } + + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public MANOplatform getSupportedMANOplatform() { + return supportedMANOplatform; + } + + + public void setSupportedMANOplatform(MANOplatform supportedMANOplatform) { + this.supportedMANOplatform = supportedMANOplatform; + } + + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + + /** + * @return the enabledForONBOARDING + */ + public Boolean getEnabledForONBOARDING() { + return enabledForONBOARDING; + } + /** + * @param enabledForONBOARDING the enabledForONBOARDING to set + */ + public void setEnabledForONBOARDING( Boolean enabledForONBOARDING) { + this.enabledForONBOARDING = enabledForONBOARDING; + } + + /** + * @return the enabledForSYNC + */ + public Boolean getEnabledForSYNC() { + return enabledForSYNC; + } + /** + * @param enabledForSYNC the enabledForSYNC to set + */ + public void setEnabledForSYNC( Boolean enabledForSYNC) { + this.enabledForSYNC = enabledForSYNC; + } + + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + +} diff --git a/src/main/java/org/etsi/osl/model/NetworkServiceDescriptor.java b/src/main/java/org/etsi/osl/model/NetworkServiceDescriptor.java new file mode 100644 index 0000000..c81ee4c --- /dev/null +++ b/src/main/java/org/etsi/osl/model/NetworkServiceDescriptor.java @@ -0,0 +1,31 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 - 2020 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.Entity; + +/** + * @author ctranoris + * + */ +@Entity(name = "NetworkServiceDescriptor") +public class NetworkServiceDescriptor extends ExperimentMetadata { + +} diff --git a/src/main/java/org/etsi/osl/model/OnBoardDescriptor.java b/src/main/java/org/etsi/osl/model/OnBoardDescriptor.java new file mode 100644 index 0000000..3102b12 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/OnBoardDescriptor.java @@ -0,0 +1,154 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.Date; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToOne; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author ctranoris + * maintains information and status of a VNF or NSD on which MANO providers is on-boarded + * see https://github.com/5GinFIRE/eu.5ginfire.portal.api/issues/10 + */ +@Entity(name = "OnBoardDescriptor") +@JsonIgnoreProperties(value = { "vxf" }) + +public class OnBoardDescriptor { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @ManyToOne + @JoinColumns({ @JoinColumn() }) + private MANOprovider obMANOprovider; + + private OnBoardingStatus onBoardingStatus = OnBoardingStatus.UNKNOWN; + + private Date lastOnboarding; + + private String deployId = "(N/A)"; + + @Lob + @Column(name = "LDETAILEDSTATUS", columnDefinition = "LONGTEXT") + private String feedbackMessage; + + @Basic() + @Column(unique=true) + private String uuid = null; + + public OnBoardDescriptor() { + } + + + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public MANOprovider getObMANOprovider() { + return obMANOprovider; + } + + public void setObMANOprovider(MANOprovider obMANOprovider) { + this.obMANOprovider = obMANOprovider; + } + + + public OnBoardingStatus getOnBoardingStatus() { + return onBoardingStatus; + } + + public void setOnBoardingStatus(OnBoardingStatus onBoardingStatus) { + this.onBoardingStatus = onBoardingStatus; + } + + public Date getLastOnboarding() { + return lastOnboarding; + } + + public void setLastOnboarding(Date lastOnboarding) { + this.lastOnboarding = lastOnboarding; + } + + public String getDeployId() { + return deployId; + } + + public void setDeployId(String deployId) { + this.deployId = deployId; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * @return the feedbackMessage + */ + public String getFeedbackMessage() { + return feedbackMessage; + } + + /** + * @param feedbackMessage the feedbackMessage to set + */ + public void setFeedbackMessage(String feedbackMessage) { + this.feedbackMessage = feedbackMessage; + } + + public String toJSON() { + String jsonInString = null; + ObjectMapper mapper = new ObjectMapper(); + try { + jsonInString = mapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } +} diff --git a/src/main/java/org/etsi/osl/model/OnBoardingStatus.java b/src/main/java/org/etsi/osl/model/OnBoardingStatus.java new file mode 100644 index 0000000..a91fd3f --- /dev/null +++ b/src/main/java/org/etsi/osl/model/OnBoardingStatus.java @@ -0,0 +1,36 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * + */ +public enum OnBoardingStatus { + UNKNOWN, + FAILED, + ONBOARDED, + OFFBOARDED, + OFFBOARDING, + ONBOARDING, + OSM_MISSING +} diff --git a/src/main/java/org/etsi/osl/model/PackagingFormat.java b/src/main/java/org/etsi/osl/model/PackagingFormat.java new file mode 100644 index 0000000..28be6fe --- /dev/null +++ b/src/main/java/org/etsi/osl/model/PackagingFormat.java @@ -0,0 +1,39 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * + * DO NOT DELETE THESE even the old ones. THEY AFFECT THE DB relationships + * + */ +public enum PackagingFormat { + OSMvFIVE, + OSMvFSIX, + OSMvSEVEN, + GenericSOL005, + OSMvEIGHT, + OSMvNINE, + OSMvTEN, + OSMvELEVEN, + OSMvTHIRTEEN +} diff --git a/src/main/java/org/etsi/osl/model/PortalProperty.java b/src/main/java/org/etsi/osl/model/PortalProperty.java new file mode 100644 index 0000000..48c1faf --- /dev/null +++ b/src/main/java/org/etsi/osl/model/PortalProperty.java @@ -0,0 +1,82 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.Basic; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +/** + * @author ctranoris + * + */ +@Entity(name = "PortalProperty") +public class PortalProperty { + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + + @Basic() + private String name = null; + + @Basic() + private String value = null; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public PortalProperty() { + + } + + public PortalProperty(String name, String value) { + this.name = name; + this.value = value; + + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } +} diff --git a/src/main/java/org/etsi/osl/model/PortalUser.java b/src/main/java/org/etsi/osl/model/PortalUser.java new file mode 100644 index 0000000..440e8b0 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/PortalUser.java @@ -0,0 +1,398 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinTable; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Transient; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.model.util.EncryptionUtil; + + +/** + * @author ctranoris + * + */ +@Entity(name = "PortalUser") +@JsonIgnoreProperties(value = { "products", "vfimages", "deployments", "subscribedResources" }) +public class PortalUser { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String organization = null; + @Basic() + private String firstname = null; + @Basic() + private String lastname = null; + @Basic() + private String email = null; + @Basic() + private String username = null; + + //we no longer store the password. This is stored to oauth service + @Transient + private String password = null; + + + @Basic() + private Boolean active = false; + @Basic() + private String currentSessionID = null; + @Basic() + private String apikey = null; + + + @Basic() + private Date createdAt; + + + /** + * @return the firstname + */ + public String getFirstname() { + return firstname; + } + + /** + * @param firstname the firstname to set + */ + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + /** + * @return the lastname + */ + public String getLastname() { + return lastname; + } + + /** + * @param lastname the lastname to set + */ + public void setLastname(String lastname) { + this.lastname = lastname; + } + + /** + * + */ + @ElementCollection(targetClass=UserRoleType.class) + @Enumerated(EnumType.STRING) + @Column(name = "role_type") + private List roles = new ArrayList(); + + /** + * + */ + @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH } ) + @JoinTable() + private List products = new ArrayList(); + + + /** + * + */ + @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH } ) + @JoinTable() + private List vfimages = new ArrayList(); + + + public List getRoles() { + return roles; + } + + @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH } ) + @JoinTable() + private Set deployments = new HashSet(); + + @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH } ) + @JoinTable() + private List subscribedResources = new ArrayList(); + + + + + public List getSubscribedResources() { + return subscribedResources; + } + + public void setSubscribedResources(List subscribedResources) { + this.subscribedResources = subscribedResources; + } + + public Set getDeployments() { + return deployments; + } + + public void setDeployments(Set deployments) { + this.deployments = deployments; + } + + public List getProducts() { + return products; + } + + public void setProducts(List products) { + this.products = products; + } + + public void addProduct(Product prod) { + if (!this.products.contains(prod)) { + this.products.add(prod); + prod.setOwner(this); + } + } + + public void removeFromProducts(Product prod) { + if (this.products.contains(prod)) { + this.products.remove(prod); + } + } + + public void clearProducts() { + while (!this.products.isEmpty()) { + removeFromProducts(this.products.iterator().next()); + } + } + + public Product getProductById(long l) { + + for (Iterator iterator = this.products.iterator(); iterator.hasNext();) { + Product prod = (Product) iterator.next(); + if (prod.getId() == l) + return prod; + } + return null; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String newOrganization) { + organization = newOrganization; + } + +// public List getVxFs() { +// return vxfs; +// } + +// public void addVxF(VxFMetadata vxfsValue) { +// if (!vxfs.contains(vxfsValue)) { +// vxfs.add(vxfsValue); +// vxfsValue.setOwner(this); +// } +// } +// +// public void removeFromVxFs(VxFMetadata vxfsValue) { +// if (vxfs.contains(vxfsValue)) { +// vxfs.remove(vxfsValue); +// } +// } +// +// public void clearVxFs() { +// while (!vxfs.isEmpty()) { +// removeFromVxFs(vxfs.iterator().next()); +// } +// } +// +// public void setVxFs(List newVxFs) { +// vxfs = newVxFs; +// } + + public long getId() { + return id; + } + + public void setId(long newId) { + id = newId; + } + + @Override + public String toString() { + return "PortalUser " + " [organization: " + getOrganization() + "]" + " [id: " + getId() + "]"; + } + +// public String getName() { +// return firstname + " " + lastname ; +// } + + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @JsonIgnore + public String getPassword() { + return password; + } + + @JsonProperty + public void setPassword(String password) { + + this.password = password; + } + +// public void setPasswordUnencrypted(String password) { +// this.password = password; +// } + +// public VxFMetadata getVxFById(int vxfid) { +// +// for (Iterator iterator = vxfs.iterator(); iterator.hasNext();) { +// VxFMetadata vxfMetadata = (VxFMetadata) iterator.next(); +// if (vxfMetadata.getId() == vxfid) +// return vxfMetadata; +// } +// return null; +// } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public String getCurrentSessionID() { + return currentSessionID; + } + + public void setCurrentSessionID(String currentSessionID) { + this.currentSessionID = currentSessionID; + } + + public void addRole(UserRoleType role ) { + this.roles.add(role); + } + + public void removeRole(UserRoleType role ) { + this.roles.remove(role); + } + + + + public List getVFImages() { + return vfimages; + } + + public void setVFImages(List products) { + this.vfimages = products; + } + + public void addVFImage( VFImage prod ) { + if (!this.vfimages.contains(prod)) { + this.vfimages.add(prod); + prod.setOwner(this); + } + } + + public void removeFromVFImages( VFImage prod) { + if (this.vfimages.contains(prod)) { + this.vfimages.remove(prod); + } + } + + /** + * @return the apikey + */ + public String getApikey() { + return apikey; + } + + /** + * @param apikey the apikey to set + */ + public void setApikey(String apikey) { + this.apikey = apikey; + } + + + + /** + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * @param createdAt the createdAt to set + */ + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + @JsonIgnore + public PortalUser getSnippedDetails() { + @JsonIgnoreProperties(value = { "products", "vfimages", "deployments", "subscribedResources", "apikey", "roles", "currentSessionID", "active"}) + class SnipPortalUser extends PortalUser{ + } + + SnipPortalUser p = new SnipPortalUser(); + p.setId( this.getId() ); + p.setFirstname( this.getFirstname() ); + p.setLastname( this.getLastname()); + p.setUsername( this.getUsername() ); + p.setOrganization( this.getOrganization() ); + p.setEmail(this.getEmail()); + return p; + } +} diff --git a/src/main/java/org/etsi/osl/model/Product.java b/src/main/java/org/etsi/osl/model/Product.java new file mode 100644 index 0000000..ea58872 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/Product.java @@ -0,0 +1,366 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorColumn; +import jakarta.persistence.DiscriminatorType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.JoinTable; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; + +/** + * @author ctranoris + * + */ +@Entity(name = "Product") +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@DiscriminatorColumn(name = "app_type", discriminatorType = DiscriminatorType.STRING) +public class Product { + + private static final transient Logger logger = LoggerFactory.getLogger(Product.class.getName()); + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @ManyToOne + @JoinColumns({ @JoinColumn() }) + private PortalUser owner = null; + + + @Basic() + @Column(unique = true) + private String uuid = null; + @Basic() + private String name = null; + @Basic() + private String iconsrc = null; + @Basic() + private String shortDescription = null; + + + @Lob + @Column(name = "LDESCRIPTION", columnDefinition = "LONGTEXT") + private String longDescription = null; + @Basic() + private String version = null; + @Basic() + private String packageLocation = null; + + @Basic() + private Date dateCreated; + + @Basic() + private Date dateUpdated; + + @ManyToMany( mappedBy ="products" ) + private Set categories = new HashSet(); + + @OneToMany(cascade = { CascadeType.ALL }) + @JoinTable() + private List extensions = new ArrayList(); + + @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinTable() + private List validationJobs = new ArrayList(); + + + + + @Basic() + @Column(name = "SCREENSPATH", columnDefinition = "LONGTEXT") + private String screenshots= null; //comma separated file paths + + @Basic() + private String vendor = null; + + + @Basic() + private boolean published; + + + @Lob + @Column(name = "TERMS", columnDefinition = "LONGTEXT") + private String termsOfUse; + + + @Lob + @Column(name = "DESCRIPTOR", columnDefinition = "LONGTEXT") + private String descriptor; + + + @Lob + @Column(name = "DESCRIPTORHTML", columnDefinition = "LONGTEXT") + private String descriptorHTML; + + + public String getScreenshots() { + return screenshots; + } + + public void setScreenshots(String screenshots) { + this.screenshots = screenshots; + } + + public List getExtensions() { + return extensions; + } + + public void setExtensions(List extensions) { + this.extensions = extensions; + } + + public Product() { + } + + public Product(String uuid, String name) { + super(); + this.name = name; + this.uuid = uuid; + } + + public PortalUser getOwner() { + if (owner!=null){ + return owner.getSnippedDetails() ; + } else { + return null; + } + } + + public void setOwner(PortalUser newOwner) { + owner = newOwner; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIconsrc() { + return iconsrc; + } + + public void setIconsrc(String iconsrc) { + this.iconsrc = iconsrc; + } + + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public String getLongDescription() { + return longDescription; + } + + public void setLongDescription(String longDescription) { + this.longDescription = longDescription; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getPackageLocation() { + return packageLocation; + } + + public void setPackageLocation(String packageLocation) { + this.packageLocation = packageLocation; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + public Date getDateUpdated() { + return dateUpdated; + } + + public void setDateUpdated(Date dateUpdated) { + this.dateUpdated = dateUpdated; + } + + public Set getCategories() { + return categories; + } + + public void setCategories( Set categories) { + this.categories = categories; + } + + +// public void addCategory(Category category) { +// logger.info("IN Product "+ this.getId()+" category "+category.getId()); +// if (!this.categories.contains(category) ){ +// this.categories.add(category); +// category.addProduct(this); +// } +// } +// +// public void removeCategory(Category category) { +// if (this.categories.contains(category) ){ +// this.categories.remove(category); +// category.removeProduct(this); +// } +// } + + public void addExtensionItem(ProductExtensionItem i){ + if (!this.extensions.contains(i)){ + if (findProductExtensionItemByName(i.getName())==null ) + this.extensions.add(i); + } + } + + public void removeExtensionItem(ProductExtensionItem i){ + if (this.extensions.contains(i)){ + this.extensions.remove(i); + } + } + + public void addExtensionItem(String name, String value){ + ProductExtensionItem i = new ProductExtensionItem(); + i.setName(name); + i.setValue(value); + this.addExtensionItem(i); + } + + public ProductExtensionItem findProductExtensionItemByName(String name){ + for (ProductExtensionItem p : this.extensions) { + if (p.getName().equals(name)) + return p; + } + return null; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + + public boolean isPublished() { + return published; + } + + public void setPublished(boolean published) { + this.published = published; + } + + + public String getTermsOfUse() { + return termsOfUse; + } + + public void setTermsOfUse(String termsOfUse) { + this.termsOfUse = termsOfUse; + } + + public String getDescriptor() { + return descriptor; + } + + public void setDescriptor(String descriptor) { + this.descriptor = descriptor; + } + + public String getDescriptorHTML() { + return descriptorHTML; + } + + public void setDescriptorHTML(String descriptorHTML) { + this.descriptorHTML = descriptorHTML; + } + + /** + * @return the validationJobs + */ + public List getValidationJobs() { + return validationJobs; + } + + /** + * @param validationJobs the validationJobs to set + */ + public void setValidationJobs(List validationJobs) { + this.validationJobs = validationJobs; + } + + + +} diff --git a/src/main/java/org/etsi/osl/model/ProductExtensionItem.java b/src/main/java/org/etsi/osl/model/ProductExtensionItem.java new file mode 100644 index 0000000..9a9d0b0 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ProductExtensionItem.java @@ -0,0 +1,73 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.Basic; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +/** + * @author ctranoris + * + */ +@Entity(name = "ProductExtensionItem") +public class ProductExtensionItem { + + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String name = null; + + @Basic() + private String value = null; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + +} diff --git a/src/main/java/org/etsi/osl/model/ScaleDescriptor.java b/src/main/java/org/etsi/osl/model/ScaleDescriptor.java new file mode 100644 index 0000000..3babd5c --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ScaleDescriptor.java @@ -0,0 +1,91 @@ +package org.etsi.osl.model; + +/** + * @author ctranoris + * + */ +public class ScaleDescriptor { + + private String deploymentRequestID; + private String nsInstanceId; + private String scaleType= "SCALE_VNF"; + private String memberVnfIndex; + private String scalingGroupDescriptor; + private String scaleVnfType ; + /** + * @return the nsInstanceId + */ + public String getNsInstanceId() { + return nsInstanceId; + } + /** + * @param nsInstanceId the nsInstanceId to set + */ + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + /** + * @return the scaleType + */ + public String getScaleType() { + return scaleType; + } + /** + * @param scaleType the scaleType to set + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + /** + * @return the memberVnfIndex + */ + public String getMemberVnfIndex() { + return memberVnfIndex; + } + /** + * @param memberVnfIndex the memberVnfIndex to set + */ + public void setMemberVnfIndex(String memberVnfIndex) { + this.memberVnfIndex = memberVnfIndex; + } + /** + * @return the scalingGroupDescriptor + */ + public String getScalingGroupDescriptor() { + return scalingGroupDescriptor; + } + /** + * @param scalingGroupDescriptor the scalingGroupDescriptor to set + */ + public void setScalingGroupDescriptor(String scalingGroupDescriptor) { + this.scalingGroupDescriptor = scalingGroupDescriptor; + } + /** + * @return the scaleVnfType + */ + public String getScaleVnfType() { + return scaleVnfType; + } + /** + * @param scaleVnfType the scaleVnfType to set + */ + public void setScaleVnfType(String scaleVnfType) { + this.scaleVnfType = scaleVnfType; + } + /** + * @return the deploymentRequestID + */ + public String getDeploymentRequestID() { + return deploymentRequestID; + } + /** + * @param deploymentRequestID the deploymentRequestID to set + */ + public void setDeploymentRequestID(String deploymentRequestID) { + this.deploymentRequestID = deploymentRequestID; + } + + + + +} diff --git a/src/main/java/org/etsi/osl/model/SubscribedResource.java b/src/main/java/org/etsi/osl/model/SubscribedResource.java new file mode 100644 index 0000000..db0e712 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/SubscribedResource.java @@ -0,0 +1,119 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.Date; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.ManyToOne; + + +/** + * @author ctranoris + * + */ +@Entity(name = "SubscribedResource") +public class SubscribedResource { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id = 0; + + + @Basic() + private String uuid = null; + + + @Basic + private String URL = null; + + @Basic + private Boolean active; + + + @Basic + private Date lastUpdate; + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumns({ @JoinColumn() }) + private PortalUser owner = null; + + + public PortalUser getOwner() { + return owner; + } + + public void setOwner(PortalUser owner) { + this.owner = owner; + } + + public int getId() { + return id; + } + + public void setId(int newId) { + id = newId; + } + + + public String getURL() { + return URL; + } + + public void setURL(String uRL) { + URL = uRL; + } + + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public Date getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(Date lastUpdate) { + this.lastUpdate = lastUpdate; + } + +} diff --git a/src/main/java/org/etsi/osl/model/UserRoleType.java b/src/main/java/org/etsi/osl/model/UserRoleType.java new file mode 100644 index 0000000..28d503d --- /dev/null +++ b/src/main/java/org/etsi/osl/model/UserRoleType.java @@ -0,0 +1,61 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * different defined user roles + */ + +public enum UserRoleType { + + ROLE_ADMIN("ROLE_ADMIN"), + ROLE_EXPERIMENTER("ROLE_EXPERIMENTER"), + ROLE_NFV_DEVELOPER("ROLE_NFV_DEVELOPER"), + ROLE_TESTBED_PROVIDER("ROLE_TESTBED_PROVIDER"), + ROLE_MENTOR("ROLE_MENTOR"); + + + + + private String value; + + UserRoleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return this.getValue(); + } + + public static UserRoleType getEnum(String value) { + for(UserRoleType v : values()) + if(v.getValue().equalsIgnoreCase(value)) return v; + throw new IllegalArgumentException(); + } + +} diff --git a/src/main/java/org/etsi/osl/model/UserSession.java b/src/main/java/org/etsi/osl/model/UserSession.java new file mode 100644 index 0000000..aa04fa6 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/UserSession.java @@ -0,0 +1,58 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + + +/** + * @author ctranoris + * + */ +public class UserSession { + + + private String username = null; + private String password = null; + private PortalUser portalUser = null; + + + + public UserSession() { + super(); + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + public PortalUser getPortalUser() { + return portalUser; + } + public void setPortalUser(PortalUser portalUser) { + this.portalUser = portalUser; + } +} diff --git a/src/main/java/org/etsi/osl/model/VFImage.java b/src/main/java/org/etsi/osl/model/VFImage.java new file mode 100644 index 0000000..7ac299a --- /dev/null +++ b/src/main/java/org/etsi/osl/model/VFImage.java @@ -0,0 +1,387 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.JoinTable; +import jakarta.persistence.Lob; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Transient; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author ctranoris + * + */ +@Entity(name = "VFImage") +@JsonIgnoreProperties(value = { "usedByVxFs" }) +public class VFImage { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id = 0; + + @Basic() + private String name = null; + + @Basic() + private String uuid = null; + + @Basic() + private String shortDescription = null; + + @Basic() + private String packageLocation = null; + + + @Basic() + private String publicURL = null; + + @Basic() + private Date dateCreated; + + + @Basic() + private Date dateUpdated; + + @ManyToMany(mappedBy = "vfimagesVDU", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DETACH }) + private List usedByVxFs = new ArrayList<>(); + + @Transient + private Set refVxFs = new HashSet<>(); + + @ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinColumns({ @JoinColumn() }) + private PortalUser owner = null; + + @Basic() + private boolean published; + + @Lob + @Column(name = "TERMS", columnDefinition = "LONGTEXT") + private String termsOfUse; + + @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DETACH }) + @JoinTable() + private List deployedInfrastructures = new ArrayList<>(); + + public VFImage(){ + + } + + + /** + * @return the id + */ + public long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(long id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the uuid + */ + public String getUuid() { + return uuid; + } + + /** + * @param uuid the uuid to set + */ + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * @return the shortDescription + */ + public String getShortDescription() { + return shortDescription; + } + + /** + * @param shortDescription the shortDescription to set + */ + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + /** + * @return the packageLocation + */ + public String getPackageLocation() { + return packageLocation; + } + + /** + * @param packageLocation the packageLocation to set + */ + public void setPackageLocation(String packageLocation) { + this.packageLocation = packageLocation; + } + + /** + * @return the dateCreated + */ + public Date getDateCreated() { + return dateCreated; + } + + /** + * @param dateCreated the dateCreated to set + */ + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + /** + * @return the usedByVxFs + */ + public List getUsedByVxFs() { + return usedByVxFs; + } + + /** + * @param usedByVxFs the usedByVxFs to set + */ + public void setUsedByVxFs(List usedByVxFs) { + this.usedByVxFs = usedByVxFs; + } + + /** + * @return the owner + */ + public PortalUser getOwner() { + return owner; + } + + /** + * @param owner the owner to set + */ + public void setOwner(PortalUser owner) { + this.owner = owner; + } + + /** + * @return the published + */ + public boolean isPublished() { + return published; + } + + /** + * @param published the published to set + */ + public void setPublished(boolean published) { + this.published = published; + } + + /** + * @return the termsOfUse + */ + public String getTermsOfUse() { + return termsOfUse; + } + + /** + * @param termsOfUse the termsOfUse to set + */ + public void setTermsOfUse(String termsOfUse) { + this.termsOfUse = termsOfUse; + } + + /** + * @return the deployedInfrastructures + */ + public List getDeployedInfrastructures() { + return deployedInfrastructures; + } + + /** + * @param deployedInfrastructures the deployedInfrastructures to set + */ + public void setDeployedInfrastructures(List deployedInfrastructures) { + this.deployedInfrastructures = deployedInfrastructures; + } + + + /** + * @return the publicURL + */ + public String getPublicURL() { + return publicURL; + } + + + /** + * @param publicURL the publicURL to set + */ + public void setPublicURL(String publicURL) { + this.publicURL = publicURL; + } + + + /** + * @return the refVxFs + */ + public Set getRefVxFs() { + refVxFs.clear(); + for (VxFMetadata vxf : usedByVxFs) { + RefVxF ref = new RefVxF( vxf.getId(), vxf.getName()); + refVxFs.add( ref ); + } + return refVxFs; + } + + + /** + * @param refVxFs the refVxFs to set + */ + public void setRefVxFs(Set refVxFs) { + this.refVxFs = refVxFs; + } + + + /** + * @return the dateUpdated + */ + public Date getDateUpdated() { + return dateUpdated; + } + + + /** + * @param dateUpdated the dateUpdated to set + */ + public void setDateUpdated(Date dateUpdated) { + this.dateUpdated = dateUpdated; + } + + + + + + /** + * Locally used to report back objects, otherwise the response would be recursive + * @author ctranoris + * + */ + static class RefVxF { + + private long id; + private String name; + + public RefVxF() { + + } + + public RefVxF(long id2, String name2) { + id = id2; + name = name2; + + } + + /** + * @return the id + */ + public long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(long id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + + } + + + /** + * @param id2 + * @return + */ + public Infrastructure getDeployedInfrastructureById(long id2) { + + for (Infrastructure infrastructure : deployedInfrastructures) { + if ( infrastructure.getId() == id2 ){ + return infrastructure; + } + } + return null; + } + + +} diff --git a/src/main/java/org/etsi/osl/model/ValidationJob.java b/src/main/java/org/etsi/osl/model/ValidationJob.java new file mode 100644 index 0000000..074bb65 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ValidationJob.java @@ -0,0 +1,141 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.Date; + +import jakarta.persistence.Basic; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +/** + * @author ctranoris + * + */ +/** + * @author ctranoris + * + */ +@Entity(name = "ValidationJob") +public class ValidationJob { + + /** */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id = 0; + + /** */ + @Basic() + private String jobid = null; + + /** */ + @Basic() + private Date dateCreated; + + /** */ + @Basic() + private int vxfid; + /** */ + @Basic() + private Boolean validationStatus; + /** */ + @Basic() + private String outputLog; + /** + * @return the id + */ + public int getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + /** + * @return the jobid + */ + public String getJobid() { + return jobid; + } + /** + * @param jobid the jobid to set + */ + public void setJobid(String jobid) { + this.jobid = jobid; + } + /** + * @return the dateCreated + */ + public Date getDateCreated() { + return dateCreated; + } + /** + * @param dateCreated the dateCreated to set + */ + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + /** + * @return the vxfid + */ + public int getVxfid() { + return vxfid; + } + /** + * @param vxfid the vxfid to set + */ + public void setVxfid(int vxfid) { + this.vxfid = vxfid; + } + /** + * @return the validationStatus + */ + public Boolean getValidationStatus() { + return validationStatus; + } + /** + * @param validationStatus the validationStatus to set + */ + public void setValidationStatus(Boolean validationStatus) { + this.validationStatus = validationStatus; + } + /** + * @return the outputLog + */ + public String getOutputLog() { + return outputLog; + } + /** + * @param outputLog the outputLog to set + */ + public void setOutputLog(String outputLog) { + this.outputLog = outputLog; + } + + + + +} diff --git a/src/main/java/org/etsi/osl/model/ValidationStatus.java b/src/main/java/org/etsi/osl/model/ValidationStatus.java new file mode 100644 index 0000000..2ccf013 --- /dev/null +++ b/src/main/java/org/etsi/osl/model/ValidationStatus.java @@ -0,0 +1,35 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +/** + * @author ctranoris + * + */ +public enum ValidationStatus { + + NOT_STARTED, + UNDER_REVIEW, + COMPLETED + +} + diff --git a/src/main/java/org/etsi/osl/model/VxFMetadata.java b/src/main/java/org/etsi/osl/model/VxFMetadata.java new file mode 100644 index 0000000..cec044b --- /dev/null +++ b/src/main/java/org/etsi/osl/model/VxFMetadata.java @@ -0,0 +1,208 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import jakarta.persistence.Basic; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; + + +/** + * @author ctranoris + * + */ +@Entity(name = "VxFMetadata") +public class VxFMetadata extends Product{ + + + /** + * + */ + private boolean certified=false; + + /** + * + */ + private String certifiedBy; + + /** + * + */ + @Basic() + private ValidationStatus validationStatus = ValidationStatus.NOT_STARTED; + + /** + * + */ + private PackagingFormat packagingFormat = PackagingFormat.OSMvEIGHT; + + + + /** + * + */ + @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) + @JoinTable( + name = "PRODUCT_MANOPLATFORMS", + joinColumns = { @JoinColumn(name = "PROD_ID") }, + inverseJoinColumns = { @JoinColumn(name = "MANOPLATFORM_ID") } + ) + private Set supportedMANOPlatforms = new HashSet(); + + /** + * + */ + @OneToMany( mappedBy ="vxf", cascade = { CascadeType.ALL } , orphanRemoval = true ) + private List vxfOnBoardedDescriptors = new ArrayList(); + + + + @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DETACH } ) + @JoinTable( + name="VXF_VFIMAGES", + joinColumns = @JoinColumn( name="VXF_ID"), + inverseJoinColumns = @JoinColumn( name="IMAGE_ID") + ) + private Set vfimagesVDU = new HashSet<>(); + + + /** + * @return + */ + public List getVxfOnBoardedDescriptors() { + return vxfOnBoardedDescriptors; + } + + /** + * @param vxfOnBoardedDescriptors + */ + public void setVxfOnBoardedDescriptors(List vxfOnBoardedDescriptors) { + this.vxfOnBoardedDescriptors = vxfOnBoardedDescriptors; + } + + + + /** + * @return + */ + public boolean isCertified() { + return certified; + } + + /** + * @param certified + */ + public void setCertified(boolean certified) { + this.certified = certified; + } + + /** + * @return + */ + public boolean getCertified() { + return this.certified; + } + + + /** + * @return + */ + public String getCertifiedBy() { + return certifiedBy; + } + + /** + * @param certifiedBy + */ + public void setCertifiedBy(String certifiedBy) { + this.certifiedBy = certifiedBy; + } + + /** + * @return + */ + public PackagingFormat getPackagingFormat() { + return packagingFormat; + } + + /** + * @param packagingFormat + */ + public void setPackagingFormat(PackagingFormat packagingFormat) { + this.packagingFormat = packagingFormat; + } + + /** + * @return + */ + public Set getSupportedMANOPlatforms() { + return supportedMANOPlatforms; + } + + /** + * @param supportedMANOPlatforms + */ + public void setSupportedMANOPlatforms(Set supportedMANOPlatforms) { + this.supportedMANOPlatforms = supportedMANOPlatforms; + } + + + /** + * @return + */ + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** + * @param validationStatus + */ + public void setValidationStatus(ValidationStatus validationStatus) { + this.validationStatus = validationStatus; + } + + /** + * @return the vfimagesVDU + */ + public Set getVfimagesVDU() { + return vfimagesVDU; + } + + /** + * @param vfimagesVDU the vfimagesVDU to set + */ + public void setVfimagesVDU(Set vfimagesVDU) { + this.vfimagesVDU = vfimagesVDU; + } + + +} diff --git a/src/main/java/org/etsi/osl/model/VxFOnBoardedDescriptor.java b/src/main/java/org/etsi/osl/model/VxFOnBoardedDescriptor.java new file mode 100644 index 0000000..4b4787f --- /dev/null +++ b/src/main/java/org/etsi/osl/model/VxFOnBoardedDescriptor.java @@ -0,0 +1,92 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author ctranoris + * maintains information and status of a VNF on which MANO providers is on-boarded + * see https://github.com/5GinFIRE/eu.5ginfire.portal.api/issues/10 + */ +@Entity(name = "VxFOnBoardedDescriptor") +@JsonIgnoreProperties(value = { "vxf" }) + +public class VxFOnBoardedDescriptor extends OnBoardDescriptor{ + + + @ManyToOne(fetch = FetchType.EAGER ) + @JoinColumn(name = "vxf_id") + private VxFMetadata vxf; + + + private String vxfMANOProviderID; + + private long tempvxfID; + + public VxFOnBoardedDescriptor() { + } + + public VxFOnBoardedDescriptor(VxFMetadata v) { + this.vxf = v; + } + + + + public VxFMetadata getVxf() { + return vxf; + } + + public void setVxf(VxFMetadata vxf) { + this.vxf = vxf; + this.tempvxfID = vxf.getId(); + } + + + public long getVxfid() { + if ( vxf != null ) { + return vxf.getId(); + }else { + return this.tempvxfID; + } + } + + public void setVxfid(long vxfid) { + this.tempvxfID = vxfid; + } + + public String getVxfMANOProviderID() { + return vxfMANOProviderID; + } + + public void setVxfMANOProviderID(String vxfMANOProviderID) { + this.vxfMANOProviderID = vxfMANOProviderID; + } +} diff --git a/src/main/java/org/etsi/osl/model/util/EncryptionUtil.java b/src/main/java/org/etsi/osl/model/util/EncryptionUtil.java new file mode 100644 index 0000000..3378e0b --- /dev/null +++ b/src/main/java/org/etsi/osl/model/util/EncryptionUtil.java @@ -0,0 +1,78 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.model + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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.etsi.osl.model.util; + + +import org.apache.shiro.crypto.hash.Hash; +import org.apache.shiro.crypto.hash.Md5Hash; + + +/** + * @author ctranoris + * + */ +public class EncryptionUtil { + + //secret key + private static final byte[] key = new byte[]{'d', '3', '2', 't', 'p', 'd', 'M', 'o', 'I', '8', 'x', 'z', 'a', 'P', 'o', 'd'}; + + + /** + * return hash value of string + * + * @param str unhashed string + * @return hash value of string + */ + public static String hash(String str) { + + Hash hash = new Md5Hash(str); + + return hash.toBase64(); + } + + /** + * return encrypt value + * + * @param val unencrypted string + * @return encrypted string + */ + public static String encrypt(String val) { + + String retVal = null; + + return retVal; + } + + /** + * return decrypted value of an encrypted + * + * @param val encrypted string + * @return decrypted string + */ + public static String decrypt(String val) { + String retVal = null; + + return retVal; + } + + +} -- GitLab